[URGENT] Players becoming Admins & VIPs!
#1

Solved.
Reply
#2

Properly reset the variables in OnPlayerConnect and/or OnPlayerDisconnect.
Reply
#3

Quote:
Originally Posted by Vince
Посмотреть сообщение
Properly reset the variables in OnPlayerConnect and/or OnPlayerDisconnect.
I do not reset PlayerInfo[playerid][Admin] and PlayerInfo[playerid][VIP] on OnPlayerConnect because I load their data from the INI file. If I reset them, they'll probably not have the player's admin level?
Reply
#4

I had the same problem reset their info on top of your loading system OnPlayerConnect

and that will fix it
Reply
#5

When a player connects, set all of their variables as 0 before you load the INI file.

Example..

pawn Код:
public OnPlayerConnect(playerid)
{
    PlayerInfo[playerid][pAdmin] = 0;
    PlayerInfo[playerid][pVIP] = 0;

    //Then load your file.
    INI_ParseFile(UserPath(...


    return 1;
}
Reply
#6

here is the code Fixed
PHP код:
if (dialogid == REGISTER)
    {
        if (!
response) return Kick(playerid);
        if (
response)
        {
            if (!
strlen(inputtext))
            {
                
ShowPlayerDialog(playeridREGISTERDIALOG_STYLE_PASSWORD""TELEPORTBLUE">> Account Register"""WHITE"Please enter a password below to register.""Register""Quit");
                return 
1;
            }
            new 
hashpass[129], date[20], yearmonthdaystr[200];
            new    
random_color = ( 16777216 random256 ) ) + ( 65536 random256 ) ) + ( 256 random256 ) ) + 255;
            
WP_Hash(hashpasssizeof(hashpass), inputtext);
            
getdate(yearmonthday);
            
format(datesizeof(date), "%d/%d/%d"daymonthyear);
            new 
INI:File INI_Open(UserPath(playerid));
            
INI_SetTag(File"Player's Data");
            
INI_WriteString(File"Password"hashpass);
            
INI_WriteString(File"Registered_On"date);
            
INI_WriteInt(File,"Admin"0);
            
INI_WriteInt(File,"VIP"0);
            
INI_WriteInt(File,"Cash"0);
            
INI_WriteInt(File,"Score"0);
            
INI_WriteInt(File,"Kills"0);
            
INI_WriteInt(File,"Deaths"0);
            
INI_WriteInt(File"Hours"0);
            
INI_WriteInt(File"Minutes"0);
            
INI_Close(File);
            
gTotalRegisters++;
            
GivePlayerMoney(playerid5000);
            
PlayerInfo[playerid][Hours] = 0;
            
PlayerInfo[playerid][Minutes] = 0;
           
PlayerInfo[playerid][Admin]=0;
          
PlayerInfo[playerid][VIP]=0;
        
PlayerInfo[playerid][Kills]=0;
          
PlayerInfo[playerid]Deaths]=0;
            
SendClientMessage(playeridCOLOR_PINK"- RegServ - Your account has been successfully registered.");
            
SpawnPlayer(playerid);
            
format(strsizeof(str), "- RegServ - {%06x}%s(%d) {2BD9F8}has registered, making the server have total {008FFB}%d {2BD9F8}players registered."random_color >>> 8GetName(playerid), playeridgTotalRegisters);
            
SetPlayerColor(playeridrandom_color);
            
SendClientMessageToAll(0x2BD9F8FFstr);
            new 
INI:FILE_SERVER_STATS INI_Open(ServerStats);
            
INI_SetTag(FILE_SERVER_STATS"Server_Statistics");
            
INI_WriteInt(FILE_SERVER_STATS"Total_Registered_Users"gTotalRegisters);
            
INI_Close(FILE_SERVER_STATS);
            
PlayerInfo[playerid][Spawned] = 1;
            
PlayerInfo[playerid][LoggedIn] = 1;
            return 
1;
        }
    } 
Reply
#7

Thanks!!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)