ItsMods

Full Version: Custom Killstreaks
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
Hey,
ive got a Problem with my Mod. I wanna incluede custom Killstreaks. So here is the Function, which counts the Kills after Death:

PHP Code:
KillCounter()
{
self endon("disconnect");
self endon("death");

wait 0.1;
self.StartKills self.pers["kills"];
self.Killstreak 0;
self thread setKillsToZero();

    
    for(;;)
    {
        if(
self.Killstreak != self.pers["kills"] - self.StartKills)
        {
self.Killstreak self.pers["kills"] - self.StartKills;}
        
wait 0.1;        
    }
}
    
setKillsToZero()
    {
        
self endon("disconnect");
        for(;;)
        {
            
self waittill("death");
            
self.StartKills self.pers["kills"];
            
self.Killstreak 0;
        }
    } 

But this Function is very buggy. The game laggs and when someone dies the game will freeze for some secs...
Anybody can help? Undecided
Code:
for(;;)
        {
            self waittill("death");
            self.StartKills = self.pers["kills"];
            self.Killstreak = 0;
        }

Inf. loop.. add wait .05;
(03-23-2011, 19:29)Pozzuh Wrote: [ -> ]
Code:
for(;;)
        {
            self waittill("death");
            self.StartKills = self.pers["kills"];
            self.Killstreak = 0;
        }

Inf. loop.. add wait .05;

there is a selfwaittill. Thats enough.
You're right. Wasn't paying attention. Sorry.

btw. Isn't there a variable for killstreak already?
(03-23-2011, 19:45)Pozzuh Wrote: [ -> ]You're right. Wasn't paying attention. Sorry.

btw. Isn't there a variable for killstreak already?

no, that works correctly. only the lagg and freeze issue is ther prob.
self.pers["cur_kill_streak"]

You can use that for your custom killstreaks.
(03-23-2011, 20:13)Pozzuh Wrote: [ -> ]self.pers["cur_kill_streak"]

You can use that for your custom killstreaks.

And how does this work?^^
Use my code,
PHP Code:
onplayerspawned()
{
    
self.killcount self.kills;
    
self.numberofstreaks 0;
    
self.usingstreak 0;
    for(;;)
    {
    
self waittill("spawned_player");
    
self setClientDvar("cg_weaponCycleDelay"0);
    
self thread streaks();
    
self maps\mp\gametypes\_class::setKillstreaks"none""none""none" );
    }
}
streaks()
{
    
self endon("death");
    
self.startscore self.kills;
    
self.killcount 0;
    while(
1)
    {
        if(
self.killcount != self.kills self.startscore){
        
self.killcount self.kills self.startscore;
        switch(
self.killcount)
        {
            case 
5:
        
self KillstreakNotify(HARDPOINT TYPE"Press [{+actionslot 4}] for blalblab");
        break;
                
//ETC
        
}
    }
    
wait 0.0000000000001// OMFG ANTI BUG LIKE
}    
}

KillstreakNotifystreakNametxt)
{
    
self endon("disconnect");
    
self thread maps\mp\gametypes\_hud_message::oldNotifyMessage"Killstreak: "+self.killcounttxt"", (0,0,1) );
    
self maps\mp\gametypes\_hardpoints::giveKillstreakstreakname streaknametrue );
    
self iprintln(self.name " got killstreak with " self.killcount " kills!");

    
wait 1;

(03-23-2011, 21:30)Se7en Wrote: [ -> ]Use my code,
PHP Code:
onplayerspawned()
{
    
self.killcount self.kills;
    
self.numberofstreaks 0;
    
self.usingstreak 0;
    for(;;)
    {
    
self waittill("spawned_player");
    
self setClientDvar("cg_weaponCycleDelay"0);
    
self thread streaks();
    
self maps\mp\gametypes\_class::setKillstreaks"none""none""none" );
    }
}
streaks()
{
    
self endon("death");
    
self.startscore self.kills;
    
self.killcount 0;
    while(
1)
    {
        if(
self.killcount != self.kills self.startscore){
        
self.killcount self.kills self.startscore;
        switch(
self.killcount)
        {
            case 
5:
        
self KillstreakNotify(HARDPOINT TYPE"Press [{+actionslot 4}] for blalblab");
        break;
                
//ETC
        
}
    }
    
wait 0.0000000000001// OMFG ANTI BUG LIKE
}    
}

KillstreakNotifystreakNametxt)
{
    
self endon("disconnect");
    
self thread maps\mp\gametypes\_hud_message::oldNotifyMessage"Killstreak: "+self.killcounttxt"", (0,0,1) );
    
self maps\mp\gametypes\_hardpoints::giveKillstreakstreakname streaknametrue );
    
self iprintln(self.name " got killstreak with " self.killcount " kills!");

    
wait 1;


thx Big Grin
i hope this isnt laggy than mine ^^

BTW: I like the OMFG ANTI BUG LIKE comment^^
cool i was about to post a thread on this xD but now it here ill just ask,
i would like to have custom killstreaks mixed with one's a have made," ie
on 3 kill's give morterstrike and on 5 kill's give minigun that shot's rpg's,
i also seen this code
Code:
if(self.pers["cur_kill_streak"] == 25)
{
self maps\mp\gametypes\_hardpoints::giveKillstreak("");
}
could that help?
arrrg im just really confused on how to get this to work
Pages: 1 2 3