Access problem - 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: Access problem (
/showthread.php?tid=521001)
Access problem -
Dziugsas - 21.06.2014
Hello sa-mpers!
Im having a trouble here.
Im 5 level admin and it still says that this command is only for admins or VIP's.
pawn Код:
CMD:heal(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] == 0 || PlayerInfo[playerid][pVip] == 0) return SendClientMessage(playerid,COL_RED,"This command is only for administrators or VIP's!");
new targetid,string[50],pName[MAX_PLAYER_NAME],aName[MAX_PLAYER_NAME];
GetPlayerName(playerid, aName, sizeof(aName));
GetPlayerName(targetid, pName, sizeof(pName));
if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COL_RED, ""TCRED"USAGE:"TCADMINGREEN" /heal [PlayerID or Name]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COL_RED, ""TCADMINGREEN"Player is not connected!");
format(string,sizeof(string),"You have healed "TCRED"%s",pName);
SendClientMessage(playerid,COL_VIP,string);
format(string,sizeof(string),"You have been healed by"TCRED"%s",aName);
SendClientMessage(targetid,COL_VIP,string);
SetPlayerHealth(targetid,100);
return 1;
}
whats wrong?
Re: Access problem -
Konstantinos - 21.06.2014
pawn Код:
if(!PlayerInfo[playerid][pAdmin] && !PlayerInfo[playerid][pVip]) return SendClientMessage(playerid,COL_RED,"This command is only for administrators or VIP's!");
Re: Access problem -
Cena44 - 21.06.2014
pawn Код:
if(PlayerInfo[playerid][pAdmin] && PlayerInfo[playerid][pVip]) return SendClientMessage(playerid,COL_RED,"This command is only for administrators or VIP's!");
You just made the command check if the player is an admin/vip and then deny their access if the return is positive, you should do the opposite.
pawn Код:
if(!PlayerInfo[playerid][pAdmin] && !PlayerInfo[playerid][pVip]) return SendClientMessage(playerid,COL_RED,"This command is only for administrators or VIP's!");