problem with the mysql admin - 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: problem with the mysql admin (
/showthread.php?tid=650834)
problem with the mysql admin -
wallen - 07.03.2018
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(Database, query, sizeof(query), "UPDATE `players` SET `ADMIN` = '%i' WHERE `players`.`ID` = %i", pInfo[playerid][Admin], pInfo[playerid][ID]);
pInfo[playerid][Admin] = 4;
SendClientMessage(playerid, -1 , "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.
Re: problem with the mysql admin -
Sew_Sumi - 07.03.2018
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.
Re: problem with the mysql admin -
rfr - 07.03.2018
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.
Re: problem with the mysql admin -
wallen - 07.03.2018
Yeah,il'll try to figure it out once ill get back to pc
Re: problem with the mysql admin -
Sew_Sumi - 07.03.2018
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.