Rcon admin.
#1

How would I make this command only usable by a rcon admin? Using it at the moment just gives me the message "You are not an admin!"

pawn Код:
CMD:createfaction(playerid, params[])
{
    new id, number, string[100];
    if(IsPlayerAdmin(playerid))
    {
        if(sscanf(params, "ui", id, number)) return SendClientMessage(playerid, -1, " USAGE: /createfaction [playerid] [Faction-Slot]");
        if(FacInfo[number][fOwned]) return SendClientMessage(playerid, -1, "Faction slot ID is already taken!");
        if(number == 0) return SendClientMessage(playerid, COLOR_GREY, "That faction number is invalid - Slots: 1-20.");
        if(PlayerInfo[playerid][pOwner])
        FacInfo[number][fMembers]++;
        FacInfo[number][DAccess] = 0;
        FacInfo[number][GovAccess] = 0;
        FacInfo[number][NewsAccess] = 0;
        PlayerInfo[id][pFacLeader] = 1;
        PlayerInfo[id][pFacRank] = 10;
        PlayerInfo[id][pFac] = number;
        format(string, sizeof(string), "Admin %s has given you leadership of faction id %d. (/fhelp)", GetName(playerid), number);
        SendClientMessage(id, -1, string);
        format(string, sizeof(string), "You have given %s leadership of faction id %d.", GetName(id), number);
        SendClientMessage(playerid, -1, string);
    }
    else
    {
        SendClientMessage(playerid, -1, "You are not an admin!");
        return 1;
    }
    return 1;
}
Reply
#2

https://sampwiki.blast.hk/wiki/IsPlayerAdmin
Reply
#3

Quote:
Originally Posted by Stuun
Посмотреть сообщение
I did that and still got the same thing, I know about IsPlayerAdmin.
Reply
#4

Код:
CMD:createfaction(playerid, params[])
{
    new id, number, string[100];
    if(!IsPlayerAdmin(playerid))
    {
        if(sscanf(params, "ui", id, number)) return SendClientMessage(playerid, -1, " USAGE: /createfaction [playerid] [Faction-Slot]");
        if(FacInfo[number][fOwned]) return SendClientMessage(playerid, -1, "Faction slot ID is already taken!");
        if(number == 0) return SendClientMessage(playerid, COLOR_GREY, "That faction number is invalid - Slots: 1-20.");
        if(PlayerInfo[playerid][pOwner])
        FacInfo[number][fMembers]++;
        FacInfo[number][DAccess] = 0;
        FacInfo[number][GovAccess] = 0;
        FacInfo[number][NewsAccess] = 0;
        PlayerInfo[id][pFacLeader] = 1;
        PlayerInfo[id][pFacRank] = 10;
        PlayerInfo[id][pFac] = number;
        format(string, sizeof(string), "Admin %s has given you leadership of faction id %d. (/fhelp)", GetName(playerid), number);
        SendClientMessage(id, -1, string);
        format(string, sizeof(string), "You have given %s leadership of faction id %d.", GetName(id), number);
        SendClientMessage(playerid, -1, string);
    }
    else
    {
        SendClientMessage(playerid, -1, "You are not an admin!");
        return 1;
    }
    return 1;
}
Reply
#5

you could be more explicit?
Reply
#6

Quote:
Originally Posted by 0x41726d79
Посмотреть сообщение
you could be more explicit?
He meant how to make that command that only RCON admins can use it.
Reply
#7

Already only RCON Admins can use it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)