Admin system
#1

Hi, I have a few questions regarding creating a custom admin system.
First of all, how would I be able to create a rcon command which will be used to promote and demote admins?
And my other question is if I need to use a specific thing or do I just assign their admin rank in the mySQL database and then in game a variable will store whether the player is an admin or not and if he is it will also list his admin rank? Basically all of that system is just a single boolean that says if player X is an admin or not, and whenever player X tries to use a restricted command, the server will check this boolean variable and if it returns true, it will check for his rank, if rank is higher or equals to the required rank, command will execute, if rank is lower, command will return 1.
Is that how it works or should I do something else?
Reply
#2

Hey. I'll try to answer.
Код:
First of all, how would I be able to create a rcon command which will be used to promote and demote admins?
You use IsPlayerAdmin(playerid), which allow only player connected with RCON to use your commande.
PHP код:
if(IsPlayerAdmin(playerid)) 
For your second question, I recommende to you to create a variable with different level, not with a boolean.
THere is an example because my english is pretty bad:
PHP код:
#define     PLAYER    0
#define     MODO     1
#define     GMODO     2
#define     ADMIN     3
CMD:goto(playeridparams[])
{
    if(
pAccount[playerid][pAdmin] < ADMIN) return 1;
// pAdmin is a integer which is storing admin lvl of the player even if the player is not an admin.
    
new target;
    if(
sscanf(params"u"target)) return SCM(playeridLBLUE"/goto [playerid/name]");
    if(!
IsPlayerConnected(target)) 
        return 
ErrorMsg(playerid"This player isn't connected.");
    new 
Float:x,
        
Float:y,
        
Float:z;
    
GetPlayerPos(targetxyz);
    
SetPlayerPos(playeridx+1y+1z);
    
SetPlayerInterior(playeridGetPlayerInterior(target));
    
SetPlayerVirtualWorld(playeridGetPlayerVirtualWorld(target));
    return 
1;

Reply
#3

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
Hey. I'll try to answer.
Код:
First of all, how would I be able to create a rcon command which will be used to promote and demote admins?
You use IsPlayerAdmin(playerid), which allow only player connected with RCON to use your commande.
PHP код:
if(IsPlayerAdmin(playerid)) 
For your second question, I recommende to you to create a variable with different level, not with a boolean.
THere is an example because my english is pretty bad:
PHP код:
#define     PLAYER    0
#define     MODO     1
#define     GMODO     2
#define     ADMIN     3
CMD:goto(playeridparams[])
{
    if(
pAccount[playerid][pAdmin] < ADMIN) return 1;
// pAdmin is a integer which is storing admin lvl of the player even if the player is not an admin.
    
new target;
    if(
sscanf(params"u"target)) return SCM(playeridLBLUE"/goto [playerid/name]");
    if(!
IsPlayerConnected(target)) 
        return 
ErrorMsg(playerid"This player isn't connected.");
    new 
Float:x,
        
Float:y,
        
Float:z;
    
GetPlayerPos(targetxyz);
    
SetPlayerPos(playeridx+1y+1z);
    
SetPlayerInterior(playeridGetPlayerInterior(target));
    
SetPlayerVirtualWorld(playeridGetPlayerVirtualWorld(target));
    return 
1;

Thank you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)