Help With KILLSTREAK'S: variable true Please assist :)
#1
Exclamation 
hey guys ive got this killstreak code and it work's but has a very BiG bug,let me explane, the code is watching cur_kill_streak and running a function if cur_kill_streak == xx kill's is true the issue is when "ie" 5 kill's is true the function will spam untill 6 kill's, it stop's because there's not a cur_kill_streak for it so varible isnt true anymore i understand that much but how can i make it Stop once the function has ran once(stop the spaming) I have attached my code and some pic's
Code:
CountKillstreak() { self endon("disconnect"); self endon("death"); for(;;) { killstreak = self.pers["cur_kill_streak"]; switch(killstreak) { case 3: self thread killstreak1(); break; case 5: self thread killstreak2(); break; case 7: self thread killstreak3(); break; case 10: self thread killstreak4(); break; case 15: self thread killstreak5(); break; } wait .05; } } Killstreak1() { for(i=1;i>0;i--) { self iPrintlnBold( "You are on a 3 killstreak!" ); AllClientsPrint( self.name + " is on a 3 killstreak!" ); } } Killstreak2() { for(i=1;i>0;i--) { self iPrintlnBold( "You are on a 5 killstreak!" ); AllClientsPrint( self.name + " is on a 5 killstreak!" ); } } Killstreak3() { for(i=1;i>0;i--) { self iPrintlnBold( "You are on a 7 killstreak!" ); AllClientsPrint( self.name + " is on a 7 killstreak!" ); } } Killstreak4() { for(i=1;i>0;i--) { self iPrintlnBold( "You are on a 10 killstreak!" ); AllClientsPrint( self.name + " is on a 10 killstreak!" ); } } Killstreak5() { for(i=1;i>0;i--) { self iPrintlnBold( "You are on a 15 killstreak!" ); AllClientsPrint( self.name + " is on a 15 killstreak!" ); } } HUDestroy(hudElem) { self waittill("death"); hudElem destroy(); hudElem delete(); }
Edit: photobuckt not working atm photos are attached

+rep if you can help xD


Attached Files Image(s)
       
Reply

#2
maybe go after it says the killstreaks
Code:
wait 0.1 AllClientsPrint = "";
Reply

#3
ok tryied that but same thing happen's
i add it like this
Code:
Killstreak5() { for(i=1;i>0;i--) { self iPrintlnBold( "You are on a 15 killstreak!" ); wait 0.1; AllClientsPrint( self.name + " is on a 15 killstreak!" ); } }
Reply

#4
Tip, after the mod wrote the killstreak, try to save it.

For example:
if done=1, don't run the code below
<writecode>
<save number 1 to: done=1;

and if you die, al done's get reset to 0.

What you get is that it only runs 1 time after the mod wrote the killstreak in the left corner.
Reply

#5
yes,yesyes that sounds like just what i need Smile but i dont quite yet know how to code it ,could you maybe please point me in the right direction im alittle lost ,i am a quick learner though so thanks heaps for helping and bear with me Smile
Reply

#6
Code:
CountKillstreak() { self endon("disconnect"); self endon("death"); for(;;) { killstreak = self.pers["cur_kill_streak"]; switch(killstreak) { case 3: self thread killstreak1(); break; case 5: self thread killstreak2(); break; case 7: self thread killstreak3(); break; case 10: self thread killstreak4(); break; case 15: self thread killstreak5(); break; } wait .05; } } Killstreak1() { for(i=1;i>0;i--) { if(done == 0) { self iPrintlnBold( "You are on a 3 killstreak!" ); AllClientsPrint( self.name + " is on a 3 killstreak!" ); done++; } } } Killstreak2() { for(i=1;i>0;i--) { if(done == 0) { self iPrintlnBold( "You are on a 5 killstreak!" ); AllClientsPrint( self.name + " is on a 5 killstreak!" ); done++; } } } Killstreak3() { for(i=1;i>0;i--) { if(done == 0) { self iPrintlnBold( "You are on a 7 killstreak!" ); AllClientsPrint( self.name + " is on a 7 killstreak!" ); done++; } } } Killstreak4() { for(i=1;i>0;i--) { if(done == 0) { self iPrintlnBold( "You are on a 10 killstreak!" ); AllClientsPrint( self.name + " is on a 10 killstreak!" ); done++; } } } Killstreak5() { for(i=1;i>0;i--) { if(done == 0) { self iPrintlnBold( "You are on a 15 killstreak!" ); AllClientsPrint( self.name + " is on a 15 killstreak!" ); done++; } } } HUDestroy(hudElem) { self waittill("death"); hudElem destroy(); hudElem delete(); }

then put this @ onplayerspawned
Code:
done = 0;
(08-10-2011, 12:58)Pozzuh Wrote:
Se7en Wrote:Stealed, from cod4 mod ...
look who's talking

[Release] Old School Mod v2.2
[Release] Scroll menu

Reply

#7
OMG so close lol uninitialised varible 'done' im not doing something right but ill keep trying
Reply

#8
(04-05-2011, 09:22)rotceh_dnih Wrote: OMG so close lol uninitialised varible 'done' im not doing something right but ill keep trying

onplayerspawned:
Code:
self.done1 = 0; self.done2 = 0; self.done3 = 0; self.done4 = 0; self.done5 = 0;

rest:
Code:
CountKillstreak() { self endon("disconnect"); self endon("death"); for(;;) { killstreak = self.pers["cur_kill_streak"]; switch(killstreak) { case 3: self thread killstreak1(); break; case 5: self thread killstreak2(); break; case 7: self thread killstreak3(); break; case 10: self thread killstreak4(); break; case 15: self thread killstreak5(); break; } wait .05; } } Killstreak1() { for(i=1;i>0;i--) { if(self.done1 == 0) { self iPrintlnBold( "You are on a 3 killstreak!" ); AllClientsPrint( self.name + " is on a 3 killstreak!" ); self.done1++; } } } Killstreak2() { for(i=1;i>0;i--) { if(self.done2 == 0) { self iPrintlnBold( "You are on a 5 killstreak!" ); AllClientsPrint( self.name + " is on a 5 killstreak!" ); self.done2++; } } } Killstreak3() { for(i=1;i>0;i--) { if(self.done3 == 0) { self iPrintlnBold( "You are on a 7 killstreak!" ); AllClientsPrint( self.name + " is on a 7 killstreak!" ); self.done3++; } } } Killstreak4() { for(i=1;i>0;i--) { if(self.done4 == 0) { self iPrintlnBold( "You are on a 10 killstreak!" ); AllClientsPrint( self.name + " is on a 10 killstreak!" ); self.done4++; } } } Killstreak5() { for(i=1;i>0;i--) { if(self.done5 == 0) { self iPrintlnBold( "You are on a 15 killstreak!" ); AllClientsPrint( self.name + " is on a 15 killstreak!" ); self.done5++; } } } HUDestroy(hudElem) { self waittill("death"); hudElem destroy(); hudElem delete(); }

Yes i know, thats very messy but well i have no other ideas :p
(08-10-2011, 12:58)Pozzuh Wrote:
Se7en Wrote:Stealed, from cod4 mod ...
look who's talking

[Release] Old School Mod v2.2
[Release] Scroll menu

Reply

#9
OMG THANK YOU SOOO MUCH MAN YOU THE BEST +1 FOR YOU
Reply

#10
Its much easier. U dont need so much variables Wink
Here:

PHP Code:
CountKillstreak() { self endon("disconnect"); self endon("death"); self.startscore = self.pers["kills"]; self.killcount = 0; for(;;) { if(self.killcount != self.pers["kills"] - self.startscore) {self.killcount = self.pers["kills"] - self.startscore; switch(killstreak) { case 3: self thread killstreak1(); break; case 5: self thread killstreak2(); break; case 7: self thread killstreak3(); break; case 10: self thread killstreak4(); break; case 15: self thread killstreak5(); break; } } wait .05; } }
no the message will ony appear if you're on a next streak.
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  Duration killstreak The Tronuo 2 3,918 07-12-2013, 18:33
Last Post: The Tronuo
  Preview Tank Killstreak Yamato 16 13,986 05-27-2013, 14:47
Last Post: Yamato
  @Azumikkel true identity Arteq 3 4,023 02-24-2013, 13:57
Last Post: 99IRock
  [GSC] All Weapon/Camo/Perk/Killstreak Names DEREKTROTTER 33 32,618 01-30-2013, 15:26
Last Post: 99IRock
  [Request] Give KillStreak yuri8597 1 3,382 10-29-2012, 01:31
Last Post: DidUknowiPwn
  [Request] weapon/killstreak giver jari333 2 3,730 10-17-2012, 18:56
Last Post: OzonE
  Help is this way true raminr63 1 3,052 10-17-2012, 07:38
Last Post: zxz0O0
  Killstreak On/Off codehelp RaZ 13 9,927 06-20-2012, 09:47
Last Post: RaZ
  [Tutorial] Killstreak list Yamato 0 3,256 06-08-2012, 12:25
Last Post: Yamato
  So old but so true Arteq 7 5,502 05-29-2012, 19:34
Last Post: Arteq

Forum Jump:


Users browsing this thread:
2 Guest(s)

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