27.09.2018, 10:07
What you have done wrong is this:
new superadmin;
The line above you used, this isn't a player but a global one.
So it should be this:
new superadmin[MAX_PLAYERS];
So this would be a correct check:
About your login:
superadmin=1; sets only one var while in this case we want to use superadmin[playerid]=1;
Also don't forget to empty the it on connect or disconnect otherwise when ID5 admin leaves, the next ID5 is still admin.
superadmin[playerid]=0;
new superadmin;
The line above you used, this isn't a player but a global one.
So it should be this:
new superadmin[MAX_PLAYERS];
So this would be a correct check:
PHP код:
stock IsPlayerSuperAdmin(playerid)
{
if(superadmin[playerid]==1){
return 1;
}
return 0;
}
PHP код:
CMD:login(playerid, params[]){
new password;
if(sscanf(params, "i",password))return SendClientMessage(playerid, 0x33AA33AA, "USAGE: /login [PASSWORD]");
if(password != blablabla) return SendClientMessage(playerid, 0x33AA33AA, "Wrong Password.");
superadmin=1;
SendClientMessage(playerid, 0x33AA33AA, "You have logged in.");
return 1;
}
Also don't forget to empty the it on connect or disconnect otherwise when ID5 admin leaves, the next ID5 is still admin.
superadmin[playerid]=0;