SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 07/11/2014, 04:18 PM   #1
mkmk
Big Clucker
 
Join Date: Mar 2014
Posts: 170
Reputation: 3
Default Rcon admin.

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 Code:
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;
}
mkmk is offline   Reply With Quote
Old 07/11/2014, 04:27 PM   #2
Glossy42O
High-roller
 
Join Date: Oct 2014
Location: in my house
Posts: 1,733
Reputation: 231
Default Re: Rcon admin.

http://wiki.sa-mp.com/wiki/IsPlayerAdmin
Glossy42O is offline   Reply With Quote
Old 07/11/2014, 04:28 PM   #3
mkmk
Big Clucker
 
Join Date: Mar 2014
Posts: 170
Reputation: 3
Default Re: Rcon admin.

Quote:
Originally Posted by Stuun View Post
I did that and still got the same thing, I know about IsPlayerAdmin.
mkmk is offline   Reply With Quote
Old 07/11/2014, 04:31 PM   #4
Glossy42O
High-roller
 
Join Date: Oct 2014
Location: in my house
Posts: 1,733
Reputation: 231
Default Re: Rcon admin.

Code:
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;
}
Glossy42O is offline   Reply With Quote
Old 07/11/2014, 04:34 PM   #5
0x41726d79
Big Clucker
 
0x41726d79's Avatar
 
Join Date: Jul 2013
Location: Piatra Neamt, Romania
Posts: 74
Reputation: 2
Default Re: Rcon admin.

you could be more explicit?
__________________
0x41726d79 is offline   Reply With Quote
Old 07/11/2014, 04:35 PM   #6
Glossy42O
High-roller
 
Join Date: Oct 2014
Location: in my house
Posts: 1,733
Reputation: 231
Default Re: Rcon admin.

Quote:
Originally Posted by 0x41726d79 View Post
you could be more explicit?
He meant how to make that command that only RCON admins can use it.
Glossy42O is offline   Reply With Quote
Old 07/11/2014, 04:41 PM   #7
0x41726d79
Big Clucker
 
0x41726d79's Avatar
 
Join Date: Jul 2013
Location: Piatra Neamt, Romania
Posts: 74
Reputation: 2
Default Re: Rcon admin.

Already only RCON Admins can use it.
__________________
0x41726d79 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
RCON admin kalanerik99 Scripting Help 24 21/12/2013 01:32 AM
Replace RCON admin with regular admin hellfirehound Scripting Help 3 25/01/2013 04:51 PM
Rcon admin grantism Scripting Help 4 17/10/2011 10:52 AM
i need car only rcon or admin can use matdav Help Archive 10 30/11/2009 10:21 PM


All times are GMT. The time now is 10:30 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.