cmd not working - 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: cmd not working (
/showthread.php?tid=334531)
cmd not working -
Matthewaj - 15.04.2012
Code:
http://pastebin.com/BiWRixpz
OKay, my problem is that when I enter the proper fields out it still keeps saying "Correct usage: /sethealth <playerid> <0-100>"
I tried to troubleshoot through this problem but I cannot figure it out.
Re: cmd not working -
Nuke547 - 15.04.2012
first of all, in sscanf, you should use something else other then playerid... Its already defined in CMD:cmd(playerid, params[]). You never did:
Re: cmd not working -
NeTuddMeg - 15.04.2012
Код:
#include <a_samp>
#include <sscanf2>
#include <zcmd>
new health, otherid;
public OnFilterScriptInit() return 1;
CMD:sethealth(playerid, params[])
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xff0000FF, "You are not an admin.");
if(sscanf(params,"ui", otherid, health)) return SendClientMessage(playerid, 0xffffffFF, "Correct usage: /sethealth <playerid> <0-100>");
if(!IsPlayerConnected(otherid)) return SendClientMessage(playerid, 0xFFFFFFF,"That player is not connected to the server");
SetPlayerHealth(playerid, health);
return 1;
}