SA-MP Forums Archive
Help with simple cmd - 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)
+--- Thread: Help with simple cmd (/showthread.php?tid=612577)



Help with simple cmd - FrAnKiN1 - 19.07.2016

When i write /kill its working fine but showing this:
SERVER:Unknown Command

Код:
CMD:kill(playerid,params[]) 
{   
SetPlayerHealth(playerid, 0.0);
SendClientMessage(playerid, C_RED, "You have killed yourself");
return 0;
}



Re: Help with simple cmd - K0P - 19.07.2016

Код:
CMD:kill(playerid,params[]) 
{   
SetPlayerHealth(playerid, 0.0);
SendClientMessage(playerid, C_RED, "You have killed yourself");
return 1;
}
Changes:
- Changed "return 0;" to "return 1;" so it will know that the command is successfully executed and the servfer will not detect it as unknown command because in you "OnPlayerCommandPrompt" the "!success" is called when the command is not successfully executed and the message "Unknown command" is shown.


Re: Help with simple cmd - FrAnKiN1 - 19.07.2016

Quote:
Originally Posted by K0P
Посмотреть сообщение
Код:
CMD:kill(playerid,params[]) 
{   
SetPlayerHealth(playerid, 0.0);
SendClientMessage(playerid, C_RED, "You have killed yourself");
return 1;
}
Changes:
- Changed "return 0;" to "return 1;" so it will know that the command is successfully executed and the servfer will not detect it as unknown command because in you "OnPlayerCommandPrompt" the "!success" is called when the command is not successfully executed and the message "Unknown command" is shown.
Thanks worked fine now.