A timer problem
#1

Hello everyone, Well I have been rattling my brain for the past day trying to fix the save skin function... I have finally managed to get it to Save Skins of each individual player but if the server restarts or the user crashes it doesnt update too well... So I thought well if I make a timer for every second or so to get each players skin, money, adminlevel etc and then write it to the file... If they crash it will just put them back to what ever the timer last saved.. Problem is its just setting myself to CJ and all my money is set to 0... I log in on a new account works fine but if I re-log it sets the skin to CJ and money to 0..
Heres my timer code.

pawn Код:
public SavePlayer()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
    if(IsPlayerOnline(i))
    {
    PlayerInfo[i][AdminLevel] = dini_Int(File, "AdminLevel");
    PlayerInfo[i][VIP] = dini_Int(File, "VIP");
    PlayerInfo[i][PlayerCash] = dini_Int(File, "PlayerMoney");
    PlayerInfo[i][Skin] = dini_Int(File, "Skin");
    PlayerInfo[i][Rank] = dini_Int(File, "Rank");
    dini_IntSet(File, "PlayerMoney", PlayerInfo[i][PlayerCash] = GetPlayerMoney(i));
    dini_IntSet(File, "AdminLevel", PlayerInfo[i][AdminLevel]);
    dini_IntSet(File, "Rank", PlayerInfo[i][Rank] = GetPlayerScore(i));
    dini_IntSet(File, "VIP", PlayerInfo[i][VIP]);
    dini_IntSet(File, "Skin", PlayerInfo[i][Skin] = GetPlayerSkin(i));
    }
    else if(!IsPlayerOnline(i))
    {
    return 0;
    }
}
return 1;
}
Reply


Messages In This Thread
A timer problem - by LiamM - 31.05.2011, 11:26
Re: A timer problem - by (SF)Noobanatior - 31.05.2011, 11:42
Re: A timer problem - by LiamM - 31.05.2011, 14:21
Re: A timer problem - by LiamM - 31.05.2011, 22:20
Re: A timer problem - by futuretrucker - 31.05.2011, 22:34
Re: A timer problem - by LiamM - 01.06.2011, 09:47

Forum Jump:


Users browsing this thread: 1 Guest(s)