Admin system - 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: Admin system (
/showthread.php?tid=617503)
Admin system -
EtayJ - 22.09.2016
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?
Re: Admin system -
Dayrion - 22.09.2016
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(playerid, params[])
{
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(playerid, LBLUE, "/goto [playerid/name]");
if(!IsPlayerConnected(target))
return ErrorMsg(playerid, "This player isn't connected.");
new Float:x,
Float:y,
Float:z;
GetPlayerPos(target, x, y, z);
SetPlayerPos(playerid, x+1, y+1, z);
SetPlayerInterior(playerid, GetPlayerInterior(target));
SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(target));
return 1;
}
Re: Admin system -
EtayJ - 22.09.2016
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(playerid, params[])
{
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(playerid, LBLUE, "/goto [playerid/name]");
if(!IsPlayerConnected(target))
return ErrorMsg(playerid, "This player isn't connected.");
new Float:x,
Float:y,
Float:z;
GetPlayerPos(target, x, y, z);
SetPlayerPos(playerid, x+1, y+1, z);
SetPlayerInterior(playerid, GetPlayerInterior(target));
SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(target));
return 1;
}
|
Thank you