Official Soldat Forums
Server Talk => Scripting Discussions and Help => Topic started by: 1221995 on October 14, 2007, 08:01:27 pm
-
What it does is make it so u dont kill urself, teh server kills u. Im making this cause i hav a no suicide script, but it make /kill not work. Tihs makes it so someone else kill u. Whats wrong with it? Does it do what it supposed to?
function OnCommand(ID:Byte;Text:string):boolean;
begin
If GetPiece(LowerCase(Text), ' ', 0) = '/kill' then begin
DoDamage (ID,4000);
end;
Plz respond ASAP.
Thanks,
1221995
-
function OnPlayerCommand(ID: Byte; Text: string):boolean;
var
Temp: array[1..5] of string; //now you have an easy 5 "Temp" variables :)
begin
Result:=false;
Temp[1]:=GetPiece(LowerCase(Text), ' ', 0);
if Temp[1] = '/kill' then begin
Result:=true; //ignores command...
DoDamage(ID,4444); //actually, 150 is a "Perfect kill" in DoDamage, but 4000 makes sure...
//-----Optional-----
DrawText(ID,' ',50,$ffff2020,.24,40,240);
DrawText(ID,'Killed by The Guardians.',125,$ffff2020,.24,40,240);
//I think that's the right scale and position for "Killed By" drawtexts, I am not sure...
end;
end;
I think that works, I can't test it now, I'm at school... I hope it helps...
-
It makes it say "sytax error"... I like the guardians thing tho... Wat does that syntax error mean/ why does it happen? :P
-
".24" should be "0.24"
-
oh, my bad :P sometimes you get used to forgetting the 0
-
uh... Klled by the guardians is too big for screen, it shows killed by the gua....
I dont know y, but it doesnt actually kill him. it just says the guardians thing... :p?
-
You have to retrieve the ID from Text, and you are using the ID of whoever sends the comand. So you should replace the DoDamage with
DoDamage(StrToInt(GetPiece(Text, ' ', 1)), 4444);
-
yeah, I only did it for person killing self
for Admin killing person, you need OnCommand instead of OnPlayerCommand...
-
I dont think it works because the trigger is /kill which is already a default command? looking at the first post it seems like that is exactly what he needs.
-
alrite.. i am cofuzzled :P Can someone put the FINISHED SCRIPT on this thred please? thanks.
-
function OnPlayerCommand(ID: Byte; Text: string):boolean;
var
Temp: array[1..5] of string; //now you have an easy 5 "Temp" variables :)
begin
Result:=false;
Temp[1]:=GetPiece(LowerCase(Text), ' ', 0);
if Temp[1] = '/suicide' then begin
Result:=true; //ignores command...
DoDamage(ID,4444); //actually, 150 is a "Perfect kill" in DoDamage, but 4000 makes sure...
//-----Optional-----
DrawText(0,IDToName(ID),50,$ffff2020,.24,40,240);
DrawText(0,'Killed by The Guardians.',125,$ffff2020,.24,40,240);
//I think that's the right scale and position for "Killed By" drawtexts, I am not sure...
end;
end;
sth like this should work i think. Drawtext(0 writes the text to all players that the player using /suicide was killed by the gaurdians.
-
nice, but instead of .24 it should be 0.24 or it gives a syntax error ::)
-
oh ye :P lol