0 Members and 1 Guest are viewing this topic.
idante
For instance i wanna make a kamakaze script that if you say bomb you explode after 5 secs and i want the console to say something 5,4,3,2,1 to the person after each second.I cant connect code...HELP PLOX <('-'<)DONT DO IT FOR ME. Just lead me in the right direction :0.
Quote from: kuposrock on December 07, 2008, 10:13:55 pmFor instance i wanna make a kamakaze script that if you say bomb you explode after 5 secs and i want the console to say something 5,4,3,2,1 to the person after each second.I cant connect code...HELP PLOX <('-'<)DONT DO IT FOR ME. Just lead me in the right direction :0.Sorry, it's been done already. And a long time ago, at that.
var Counter: Array [1..32] of Byte;// Runs every second...procedure AppOnIdle(Ticks: Integer);var i: Byte;begin // Go through the array and check what to do... for i := 1 to 32 do begin // Time to blow up? if Counter[i] = 1 then begin // Blow up here... Counter[i] := 0; end; // Just count down? if Counter[i] > 1 then begin Counter[i] := Counter[i] - 1; SayToPlayer(i, IntToStr(Counter[i]) + '...'); end end;end;// So it doesnt cause problems if someone leaves before they blowprocedure OnLeaveGame(ID, Team: Byte; Kicked: Boolean);begin Counter[ID] := 0;end;// If a player does /kaboom and isn't already blowing up...function OnPlayerCommand(ID: Byte; Text: String): Boolean;begin if Text = '/kaboom' then if Counter[ID] = 0 then Counter[ID] := 5;end;
I know its been done but i wanna do it as well. So can some one lead me the right way
function OnPlayerCommand(ID: Byte; Text: String): Boolean;begin if Text = '/kaboom' then begin Writeconsole(ID,'5 seconds 'till explosion',$00FFFF); sleep(1000); Writeconsole(ID,'4',$00FFFF); sleep(1000); Writeconsole(ID,'3',$00FFFF); sleep(1000); Writeconsole(ID,'2',$00FFFF); sleep(1000); Writeconsole(ID,'1',$00FFFF); sleep(1000); Writeconsole(ID,'KABOOM',$00FFFF); //here goes some Createbullet end;end;
sleep function sux, use apponidle, first:create variable, name it timer (or in u'r own way)in activateserver procedure set it to -1in oncommand if text /some_text then set variable 5in apponidle if variable>0 then writeconsole with variable and variable:=variable-1;if variable=0 then createbullet stuff (check my "Bombing Time" script), writeconsole with info and variable:=-1thats allif u need it i can write
shantec's is really easy to understand :0