Help with /kill command ! - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help with /kill command ! (
/showthread.php?tid=203301)
Help with /kill command ! -
Yaszine - 26.12.2010
Hi everyone,
I've made this simple command:
pawn Код:
if(strcmp(cmdtext,"/kill",true)==0)
{
if(DM[playerid] == 1)
{
SendClientMessage(playerid, RED, "ERROR: You're in DM.");
return 0;
}
if(AFK[playerid] == 1)
{
SendClientMessage(playerid, RED, "ERROR: You're AFK.");
return 0;
}
SetPlayerHealth(playerid,0.0);
return 1;
}
But, if I'm in DM or AFK I can use /kill without any problems !
I hope you will help me
Re: Help with /kill command ! -
Tutrix - 26.12.2010
Try this:
pawn Код:
if(strcmp(cmd, "/kill" true) == 0)
{
if(DM[playerid] == 1)
{
SendClientMessage(playerid, COLOR_RED, " ERROR: This command cannot be used inside the DM area!");
return 1;
}
if(AFK[playerid] == 1)
{
SendClientMessage(playerid, COLOR_RED, " ERROR: You cant use this command while being AFK!");
return 1;
}
else
{
SetPlayerHealth(playerid, 0);
return 1;
}
}
Let me know if it works or not.
Re: Help with /kill command ! -
JaTochNietDan - 26.12.2010
Well, are you sure there isn't another /kill command somewhere in any of the scripts running on the server? Are you also sure that those variables are actually set to one for the playerid when they are actually in a DM or AFK?
Also you could do with slightly cleaner code plus indentation:
pawn Код:
if(strcmp(cmdtext,"/kill",true) == 0)
{
if(DM[playerid] == 1) return SendClientMessage(playerid, RED, "ERROR: You're in DM.");
if(AFK[playerid] == 1) return SendClientMessage(playerid, RED, "ERROR: You're AFK.");
SetPlayerHealth(playerid,0.0);
return 1;
}
Anyway you're going to have to check those things I mentioned. As the command should work as intended the way it is, assuming everything else in the script is up to scratch.
Re : Re: Help with /kill command ! -
Yaszine - 26.12.2010
My code works, also your one works, I've found the /kill cmd in admin FS
Thanks very Much