SA-MP Forums Archive
help - 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 (/showthread.php?tid=587523)



help - ahameed4755 - 31.08.2015

im making a godmode but i get 1 error

Код:
#define FILTERSCRIPT
#include a_samp
#include zcmd

CMD:ihealth(playerid,params[])
{
if(IsPlayerAdmin(playerid))
SetPlayerHealth(playerid,99999.99);
SetPlayerArmour(playerid,99999.99);
SendClientMessage(playerid,0xC2A2DAAA,"infinite health is activated");
}
else
SendClientMessage(playerid,0xC2A2DAAA,"You Need To be rcon admin");
}
Код:
infinitehealth.pwn(12) : error 010: invalid function or declaration
whats the problem?


Re: help - Karan007 - 31.08.2015

Код:
CMD:ihealth(playerid,params[])
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xC2A2DAAA, "You need to be an RCON admin!");
SetPlayerHealth(playerid,99999.99);
SetPlayerArmour(playerid,99999.99);
SendClientMessage(playerid,0xC2A2DAAA,"infinite health is activated");
}
Try this!

EXPLANATION CODE:-

Well, you should have added another "}" when you put else, but here's another method of doing so. ^
I changed "else" to "return".

if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xC2A2DAAA, "You need to be an RCON admin!");

This line means "If the player is not admin, the server will return the following message". [Note:- This symbol "!" means if not].


Re: help - ahameed4755 - 31.08.2015

thanks +rep