Access problem
#1

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?
Reply
#2

pawn Код:
if(!PlayerInfo[playerid][pAdmin] && !PlayerInfo[playerid][pVip]) return SendClientMessage(playerid,COL_RED,"This command is only for administrators or VIP's!");
Reply
#3

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!");
Reply


Forum Jump:


Users browsing this thread: