Issue..
#1

Hey, on my gamemode when a player registers he gets level 3 admin/vip ( I think it sets the stats of the last person who was logged on as that ID. and also my auto repair doesn't repair anyone except id 0?
1st Issue
PHP код:
public OnPlayerDisconnect(playeridreason)
{
    new 
INI:File INI_Open(UserPath(playerid));
    
INI_SetTag(File,"data");
    
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
    
INI_WriteInt(File,"Health",PlayerInfo[playerid][pHealth]);
    
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
    
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
    
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
    
INI_WriteInt(File,"Score",PlayerInfo[playerid][pScore]);
    
INI_WriteInt(File,"VIP",PlayerInfo[playerid][pVIP]);
    
INI_WriteInt(File,"Banned",PlayerInfo[playerid][pBanned]);
    
INI_Close(File);
    return 
1;
Register Dialogs
        
case DIALOG_REGISTER:
        {
            if (!
response) return Kick(playerid);
            if(
response)
            {
                if(!
strlen(inputtext)) return ShowPlayerDialog(playeridDIALOG_REGISTERDIALOG_STYLE_INPUT""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
                new 
INI:File INI_Open(UserPath(playerid));
                
INI_SetTag(File,"data");
                
INI_WriteInt(File,"Password",udb_hash(inputtext));
                
INI_WriteInt(File,"Cash",0);
                
INI_WriteInt(File,"Admin",0);
                
INI_WriteInt(File,"Kills",0);
                
INI_WriteInt(File,"Deaths",0);
                
INI_WriteInt(File,"Score",0);
                
INI_WriteInt(File,"Admin",0);
                
INI_WriteInt(File,"VIP",0);
                
INI_Close(File);
                
SetSpawnInfo(playerid001958.331343.1215.36269.15000000);
                
//SpawnPlayer(playerid)
            
}
        }

Reply
#2

Make sure when the player disconnects all his data is reset
Set to 0
Reply
#3

Can you explain a little better? OnPlayerDisconnect gets their data they have then saves it on disconnect so it can be loaded when the reconnect. if I set their stats to 0 then when they connect their stats would be 0.
Reply
#4

Reset all variables AFTER you've saved them ... <_<

You can use this:
pawn Код:
#define SetEnum(%0,%1,%3) for(new _iD;_iD<_:%1;++_iD) %0[%1:_iD] = _:%3

//Usage:
SetEnum(PlayerInfo[playerid], pInfo, 0);
Reply
#5

Heh, thanks Vince, going to test it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)