0 Members and 1 Guest are viewing this topic.
procedure KillObject(ObjID: Integer): integer;
varF, P, Z, V, C: string;
((Killer = IT) = false)
I'm ont sure but I don't think that you can get every 3 bonusses at once. So I thin that this is problem.
The global declarations of upg and rade are unnecessary as you only use them in OnPlayerCommand. Same goes for F, P, Z, V, C.
and what does ThreadFunc do?
and how do I spawn an item and save the byte for killing it if needed?
and it STILL doesn't work
nvm, I made it work, except, the timers don't work and it automatically spawns all of the bonuses, help!
procedure Monkey(ID: byte; Text: string);begin WriteLn(GetPlayerStat(ID,'IP') + ' is a ' + Text); Sleep(1000); WriteLn('Don''t you dare lie to me!');end;procedure OnFlagGrab(ID, TeamFlag: byte;GrabbedInBase: boolean);begin ThreadFunc([ID,'freak'],'Monkey');end;
varIT: Byte;FirstKill, PowerUP, NewIT: boolean;pause, UP: integer;procedure OnMapChange(NewMap: string);begin//-----Reset vars-----FirstKill:=false;IT:=0;pause:=0;PowerUP:=false;NewIT:=false;end;procedure OnPlayerKill(Killer, Victim: byte; Weapon: string);begin//-----First IT-----if (FirstKill = false) then begin if (Killer <> Victim) then begin NewIT:=true; pause:=1; FirstKill:=true; IT:=Victim; WriteConsole(0,GetPlayerStat(IT,'Name')+' is it! Run away!',RGB(192,192,64)); DrawText(0,GetPlayerStat(IT,'Name')+' is now it!',2500,RGB(192,64,64),0.20,40,240); PowerUP:=true; end;end;//-----New IT-----if (Firstkill = true) and (IT > 0) then begin if (IT > 0) and (Victim <> IT) and (Killer = IT) then begin IT:=Victim; pause:=1; NewIT:=true; WriteConsole(0,GetPlayerStat(IT,'Name')+' is it! Run away!',RGB(192,192,64)); DrawText(0,GetPlayerStat(IT,'Name')+' is now it!',2500,RGB(192,64,64),0.20,40,240); if (NewIT = true) then begin PowerUP:=true; if (pause = 0) then begin NewIT:=false; end; end; end;//-----Power Up!----- if (PowerUP = true) and (NewIT = true) then begin DrawText(IT,'You are now it.',2500,RGB(192,64,64),0.25,40,240); SayToPlayer(IT,'You are now it. Please choose your "it" powerup'); SayToPlayer(IT,'/upgrade flame, /upgrade pred, /upgrade zerk, /upgrade vest, or /upgrade clust'); end;//-----Extra Points!----- if (Victim = IT) and (Killer <> IT) and (pause = 0) then begin NewIT:=false; SayToPlayer(Killer,'You get 2 extra points for killing "it"'); SetScore(Killer,GetPlayerStat(Killer,'Kills') + 2); end;end;end;function OnPlayerCommand(ID:Byte;Text:string):boolean;begin result:=false;//-----Upgrade----- if GetPiece(LowerCase(Text), ' ', 0) = '/upgrade' then begin if (ID = IT) then begin//-----flame----- if (GetPiece((Text), ' ', 1) = 'flame') and (PowerUP = true) then begin UP:=18; PowerUP:=false; end;//-----pred----- if (GetPiece((Text), ' ', 1) = 'pred') and (PowerUP = true) then begin UP:=20; PowerUP:=false; end;//-----zerk----- if (GetPiece((Text), ' ', 1) = 'zerk') and (PowerUP = true) then begin UP:=21; PowerUP:=false; end;//-----vest----- if (GetPiece((Text), ' ', 1) = 'vest') and (PowerUP = true) then begin UP:=19; PowerUP:=false; end;//-----clust----- if (GetPiece((Text), ' ', 1) = 'clust') and (PowerUP = true) then begin UP:=22; PowerUP:=false; end; end; end;end;procedure AppOnIdle(Ticks:integer);var Time: integer; Spawn: boolean;begin Time:=0;if (Time = 0) then begin Spawn:=true;end;if (Time > 0) then begin Time:=Time-1; Spawn:=false;end;if (pause > 0) then begin pause:=pause-1;end;if (IT > 0) and (PowerUP = false) then begin//-----flame----- if (UP = 18) and (Time = 0) then begin if (Spawn = true) then begin Time:=120; SpawnObject(GetPlayerStat(IT,'x'),GetPlayerStat(IT,'y'),18); end; end;//-----pred----- if (UP = 20) and (Time = 0) then begin if (Spawn = true) then begin Time:=26; SpawnObject(GetPlayerStat(IT,'x'),GetPlayerStat(IT,'y'),20); end; end;//-----zerk----- if (UP = 21) and (Time = 0) then begin if (Spawn = true) then begin Time:=16; SpawnObject(GetPlayerStat(IT,'x'),GetPlayerStat(IT,'y'),21); end; end;//-----vest----- if (UP = 19) and (GetPlayerStat(IT,'Vest') < 100) then begin SpawnObject(GetPlayerStat(IT,'x'),GetPlayerStat(IT,'y'),19); end;//-----clust----- if (UP = 22) and (GetPlayerStat(IT,'Grenades') = 0) then begin SpawnObject(GetPlayerStat(IT,'x'),GetPlayerStat(IT,'y'),22); end;end;end;
Declare some integer variable (as a global one, not just inside AppOnIdle), set it to whatever you want, and count it down every AppOnIdle -- and voilĂ , you got yourself a timer right there.