0 Members and 1 Guest are viewing this topic.
...var blah:boolean;begin... blah:=true; break; //don't want anything to be done from this temporary change *do this* blah:=false;... if blah = true do this *this will not be done because of break?*end;
hmmm... am I right to believe that "break;" stops a script from working with something?could it be used like so:Code: [Select]...var blah:boolean;begin... blah:=true; break; //don't want anything to be done from this temporary change *do this* blah:=false;... if blah = true do this *this will not be done because of break?*end;
function OnCommand(ID: Byte; Text: string): boolean;begin If text = '/test' then begin PlaceBot('Poncho',GetPlayerStat(ID,'Team'),GetPlayerStat(ID,'X')+21,GetPlayerStat(ID,'Y')); PlaceBot('Poncho',GetPlayerStat(ID,'Team'),GetPlayerStat(ID,'X')+10,GetPlayerStat(ID,'Y')+18); PlaceBot('Poncho',GetPlayerStat(ID,'Team'),GetPlayerStat(ID,'X')-10,GetPlayerStat(ID,'Y')+18); PlaceBot('Poncho',GetPlayerStat(ID,'Team'),GetPlayerStat(ID,'X')+10,GetPlayerStat(ID,'Y')-18); PlaceBot('Poncho',GetPlayerStat(ID,'Team'),GetPlayerStat(ID,'X')-10,GetPlayerStat(ID,'Y')-18); PlaceBot('Poncho',GetPlayerStat(ID,'Team'),GetPlayerStat(ID,'X')-21,GetPlayerStat(ID,'Y')); sleep(60000); Command('/kick Poncho'); end; Result := false;end;
I edited the script a little, since there are too many ponchos when you type /test 3-4 timesIt kicks all of them after a minuteCode: [Select]function OnCommand(ID: Byte; Text: string): boolean;begin If text = '/test' then begin PlaceBot('Poncho',GetPlayerStat(ID,'Team'),GetPlayerStat(ID,'X')+21,GetPlayerStat(ID,'Y')); PlaceBot('Poncho',GetPlayerStat(ID,'Team'),GetPlayerStat(ID,'X')+10,GetPlayerStat(ID,'Y')+18); PlaceBot('Poncho',GetPlayerStat(ID,'Team'),GetPlayerStat(ID,'X')-10,GetPlayerStat(ID,'Y')+18); PlaceBot('Poncho',GetPlayerStat(ID,'Team'),GetPlayerStat(ID,'X')+10,GetPlayerStat(ID,'Y')-18); PlaceBot('Poncho',GetPlayerStat(ID,'Team'),GetPlayerStat(ID,'X')-10,GetPlayerStat(ID,'Y')-18); PlaceBot('Poncho',GetPlayerStat(ID,'Team'),GetPlayerStat(ID,'X')-21,GetPlayerStat(ID,'Y')); sleep(60000); Command('/kick Poncho'); end; Result := false;end;Thats all
Your code will freeze up the server sense OnCommand is not threaded.
Quote from: DorkeyDear on November 11, 2007, 09:13:59 amYour code will freeze up the server sense OnCommand is not threaded.I know and I like it that way! Since people can't spawn 20 packs of Ponchos at the same time... The only thing that bothers me is that if one person spawns Ponchos and after 15 seconds another person spawns Ponchos, then after 5 seconds both packs will be kicked... Any ideas how to solve this? Avarax?
varbots : array[1..6] of byte;beginbots[1] := PlaceBot('Poncho',GetPlayerStat(ID,'Team'),GetPlayerStat(ID,'X')+21,GetPlayerStat(ID,'Y'));bots[2] := PlaceBot('Poncho',GetPlayerStat(ID,'Team'),GetPlayerStat(ID,'X')+10,GetPlayerStat(ID,'Y')+18);bots[3] := PlaceBot('Poncho',GetPlayerStat(ID,'Team'),GetPlayerStat(ID,'X')-10,GetPlayerStat(ID,'Y')+18);bots[4] := PlaceBot('Poncho',GetPlayerStat(ID,'Team'),GetPlayerStat(ID,'X')+10,GetPlayerStat(ID,'Y')-18);bots[5] := PlaceBot('Poncho',GetPlayerStat(ID,'Team'),GetPlayerStat(ID,'X')-10,GetPlayerStat(ID,'Y')-18);bots[6] := PlaceBot('Poncho',GetPlayerStat(ID,'Team'),GetPlayerStat(ID,'X')-21,GetPlayerStat(ID,'Y'));end;
:Ei'd like to take a look at this but..."Not FoundThe requested document was not found."if some1 has that code plz send it somewhere :>
[offtopic]I've noticed that many (if not all) Avarax's "Ready Made" scripts have been removed from notepaste :SWell, luckily at least few guys here, at soldatforums, has them all. Point of this stupid post was nothing, and my intention wasn't to insult anyone. If you however feel insulted, please, tell it to hand. Hand will listen you [/offtopic]
function PlaceBot(botname: string; team: byte; X,Y: single): byte;var i,n,tempType: byte; spawn: array of byte; tempX,tempY: single;begin SetArrayLength(spawn,0); n:=0; for i:=1 to 254 do If GetSpawnStat(i,'Active') = true then If GetSpawnStat(i,'Style') = team then begin n:=n + 1; SetArrayLength(spawn,n); spawn[n-1]:=i; SetSpawnStat(i,'Active',false); end; for i:=1 to 254 do If GetSpawnStat(i,'Active') = false then begin SetSpawnStat(i,'Active',true); tempType:=GetSpawnStat(i,'Style'); tempX:=GetSpawnStat(i,'X'); tempY:=GetSpawnStat(i,'Y'); SetSpawnStat(i,'Style',team); SetSpawnStat(i,'X',X); SetSpawnStat(i,'Y',Y); break; end; result:=Command('/addbot' + inttostr(team) + ' ' + botname); SetSpawnStat(i,'Active',false); SetSpawnStat(i,'Style',tempType); SetSpawnStat(i,'X',tempX); SetSpawnStat(i,'Y',tempY); If n > 0 then for i:=0 to n-1 do SetSpawnStat(spawn[i],'Active',true);end;