What is wrong with my comand?[Y_commands] - 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: What is wrong with my comand?[Y_commands] (
/showthread.php?tid=594830)
What is wrong with my comand?[Y_commands] -
Zoepie - 23.11.2015
pawn Код:
YCMD:makeadmin(playerid, params[],help)
{
if(IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"You must be admin");
if(isnull(params))
{
SendClientMessage(playerid,-1,"USAGE: /makeadmin playerid level");
SendClientMessage(playerid,-1,"Function: Player will be an Admin");
}
if(!sscanf(params , "ui", params[0],params[1]))
{
new string [60];
PlayerInfo[params[0]][AdminLevel] = params[1];
format(string,sizeof(string),"You are now an administrator level %d",params[1]);
SendClientMessage(params[0],-1,string);
}
if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid,-1," That player is not connected");
if(params[1] > 5) return SendClientMessage(playerid,-1,"Maximum level is 5");
return true;
}
Re: What is wrong with my comand?[Y_commands] -
nogh445 - 24.11.2015
Change this:
pawn Код:
if(IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"You must be admin");
to this:
pawn Код:
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"You must be admin");
The ! checks if the player isn't an admin, if he isn't it will send him the message, if he is it will grant the command.
IsPlayerAdmin(playerid) = Admin
!IsPlayerAdmin(playerid) = Not Admin