problem with the mysql admin
#1

Well i made a little system that when you log in rcon you get level 4.

PHP код:
    if(success)
    {
        foreach(new 
playerid Player){
         if(
pInfo[playerid][Level] != 4// to check if the player DOESN'T has the level 4.
        
{
            new 
query[256], str[150];
            
mysql_format(Databasequerysizeof(query), "UPDATE `players` SET `ADMIN` = '%i' WHERE `players`.`ID` = %i"pInfo[playerid][Admin], pInfo[playerid][ID]);
            
pInfo[playerid][Admin] = 4;
            
SendClientMessage(playerid, -"You logged in throught rcon and got automatically level 4 admin.");
            
            if(
pInfo[playerid][Admin] > 4)
               
format(str,sizeof(str), "{0066ff}(admin) %s has logged as server management (rcon)."PlayerName[playerid]);
             
SendMessageToAdmins(str);}
        }
    } 
But when i get admin level 4 on name "test2" then i create another account named "test3" i still got the admin from the old account.
Reply
#2

Then you aren't clearing the admin level on player disconnect. And because you reconnect to the same ID, you get that left over admin level.
Reply
#3

did you reset the enum or variable because the server for example thinks you're still id 0 all the time unless you reset all vars on disconnect so it doesnt read old data

temporary solution for this is

OnPlayerDisconnect(playerid)
{
pInfo[playerid][Admin] = 0;
return 1;
}


for means for all users with the playerid = playerid (e.g. 0), it will reset it to 0 so if another player comes on with playerid of 0, their admin level will be 0 since the previous player (with id) disconnected and the server set it to 0.
Reply
#4

Yeah,il'll try to figure it out once ill get back to pc
Reply
#5

Quote:
Originally Posted by rfr
Посмотреть сообщение
temporary solution for this is

OnPlayerDisconnect(playerid)
{
pInfo[playerid][Admin] = 0;
return 1;
}
That is THE solution... Variables don't magically clear themselves.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)