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?