Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
killstreaks mod bug on S&Deee
#1
HI

i use the killstreaks mod (attached)
but its has bug on search and destroy:
The Killstreak Count Resets To 0 when round changed?!! Sad

how can fix this problem??


.rar   CustomStreaks.rar (Size: 31.74 KB / Downloads: 28)
Reply

#2
is it very hard realy?
Reply

#3
This was posted on alteriwnet forums by @banz , I just copied and pasted his info, Tongue

Code:
Hey,

i figured out a way to save variables in round-based gamemodes like SnD, so they wont get reset on round end. Well, i already used that method in promodv3.1 and feel like posting how to to do it now . ;)

As you might know, normally variables get "reset" when the round ends in SnD (Sab), even if you define them somewhere on init() or onplayerconnect()
e.g.:

You define some variables on onplayerconnect() or onplayerspawned() (above the for(;;) loop) of some .gsc file:

Code: Select all
    onPlayerConnect()
    {
    for(;;)
    {
    level waittill( "connected", player );

    if(!isDefined( player.roundsplayed )) //this wont help :p
    player.roundsplayed = 0; //to count the rounds the player played

    player thread onPlayerSpawned();
    }
    }



or

Code: Select all
    onPlayerSpawned()
    {
    self endon("disconnect");

    if(!isDefined( self.roundsplayed )) //this wont help :P
    self.roundsplayed = 0; //to count the rounds the self played

    for(;;)
    {
    self waittill("spawned_player");
    self thread countRounds();
    }
    }



and you make a function countRounds() to count the times you spawned (rounds played) and displays it after you spawned, so you can see if its counted correctly.


Code: Select all
    countRounds()
    {
    self endon("disconnect");
    self endon("death");

    self.roundsplayed++;

    while( !gameFlag( "prematch_done" ) )
    wait .05;

    for (i=0; i < 4; i++)
    {
    self iPrintLnBold("^7Rounds Played ^1" +self.roundsplayed);
    wait 1.5;
    }
    }



You will see that that self.roundsplayed (player.roundsplayed) will get reset to 0 every time a round ends.
Even if you put a if( !isDefined (player.roundsplayed ) ) infront.
Every time you spawn "Rounds Played 1" will be displayed.

Well, the solution to avoid the resetting is quite simple:
You define the variable at the same place naming it:

Code: Select all
    if ( !isDefined( player.pers["roundsPlayed"] ) )
    player.pers["roundsPlayed"] = 0;



Working code:

Spoiler: Toggle

    Code: Select all
        onPlayerConnect()
        {
        for(;;)
        {
        level waittill( "connected", player );


        if ( !isDefined( player.pers["roundsPlayed"] ) )
        player.pers["roundsPlayed"] = 0;

        player thread onPlayerSpawned();
        }
        }

        onPlayerSpawned()
        {
        self endon("disconnect");

        for(;;)
        {
        self waittill("spawned_player");
        self thread countRounds();
        }
        }

        countRounds()
        {
        self endon("disconnect");
        self endon("death");

        self.pers["roundsPlayed"]++;


        while( !gameFlag( "prematch_done" ) )
        wait .05;

        for (i=0; i < 4; i++)
        {
        self iPrintLnBold("^7Rounds Played ^1" +self.pers["roundsPlayed"]);
        wait 1.5;
        }
        }



So if you want to define a player.variable you have to define it like this:

Code: Select all
    if ( !isDefined( player.pers["variablename"] ) )
    player.pers["variablename"] = 0;



(same goes for arrays)

Spoiler: Toggle

    Code: Select all
        if ( !isDefined( player.pers["arrayname"] ) )
        player.pers["arrayname"] = [];



and put it onplayerconnect()

If you want to define a self.variable the same way

Code: Select all
    if ( !isDefined( self.pers["variablename"] ) )
    self.pers["variablename"] = 0;



and put it onplayerspawned().
You may also search for self.pers or players.pers variables in the "stock" .gsc files an put yours below...
(There are some in _playerlogic.gsc and _rank.gsc for example.)
This will also work in costum .gsc files, at least if you call them properly. ;)
Reply

#4
and how do this with self.money that your money won't reset?
Black Ops Mods:

RPG(rocket launcher) mod
Get the Specials

Old aliasses:

eliteCVDelite
CVD

Reply

#5
Put player.money on connect.
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
Big Grin Killstreaks HUD list Puffiamo 9 9,918 06-18-2013, 18:42
Last Post: RaZ
  [Release] Call of Duty Modern Warfare 3 - Airdrops & Killstreaks d0h! 8 11,728 04-03-2013, 06:54
Last Post: USCR
  [Release] Predator Killstreaks Puffiamo 13 14,053 10-28-2012, 15:51
Last Post: Arteq
  Moab and killstreaks Jabbavacca 4 4,554 10-27-2012, 23:40
Last Post: korsika
  Promod Plugin + !Perks/Killstreaks/Killcam On-Off slash2909 2 3,210 03-20-2012, 22:18
Last Post: kris
  MW2 Killstreaks source codes Metro-Police#45 7 13,971 01-23-2012, 02:25
Last Post: ScHmIdTy56789
Brick [Release] Killstreak needed for stock killstreaks banz 4 3,614 01-21-2012, 19:27
Last Post: Arteq
  [Solved]give killstreaks ddaavvee 4 2,925 09-17-2011, 08:54
Last Post: ddaavvee
  Killstreaks in GunGame Dountill 18 9,108 09-06-2011, 16:12
Last Post: Tomsen1410
  [News] Modern Warfare 3 MW3 Menu Killstreaks Accessories and more d0h! 17 9,024 09-04-2011, 20:55
Last Post: Lemon

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.