SA-MP Forums Archive
Rcon admin. - 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: Rcon admin. (/showthread.php?tid=545289)



Rcon admin. - mkmk - 07.11.2014

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;
}



Re: Rcon admin. - Glossy42O - 07.11.2014

https://sampwiki.blast.hk/wiki/IsPlayerAdmin


Re: Rcon admin. - mkmk - 07.11.2014

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


Re: Rcon admin. - Glossy42O - 07.11.2014

Код:
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;
}



Re: Rcon admin. - 0x41726d79 - 07.11.2014

you could be more explicit?


Re: Rcon admin. - Glossy42O - 07.11.2014

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


Re: Rcon admin. - 0x41726d79 - 07.11.2014

Already only RCON Admins can use it.