02.08.2014, 14:45
Yo,
I have scripted a system where the players money saves when they disconnect and the player gets it back when he next logs in. The problem starts when he connects.
When a player connects instead of giving him the actual amount, It gives him double. For example I had 3000 and I quit then re-joined and it gave me back 6000. I have checked the script just incase I set it twice anywhere else, But nope.
Hope you guys can help me out![Smiley](images/smilies/smile.png)
Everything saves but when its loading it doubles it then hands it out.
I have scripted a system where the players money saves when they disconnect and the player gets it back when he next logs in. The problem starts when he connects.
When a player connects instead of giving him the actual amount, It gives him double. For example I had 3000 and I quit then re-joined and it gave me back 6000. I have checked the script just incase I set it twice anywhere else, But nope.
Hope you guys can help me out
![Smiley](images/smilies/smile.png)
Код:
public OnPlayerConnect(playerid) { LoadCharacter(playerid); return 1; }
Код:
stock LoadCharacter(playerid) { if(INI_Open(GetUser(playerid))) { PlayerInfo[playerid][Money] = INI_ReadInt("Money"); PlayerInfo[playerid][Score] = INI_ReadInt("Score"); PlayerInfo[playerid][Administrator] = INI_ReadInt("Administrator"); PlayerInfo[playerid][AdminLevel] = INI_ReadInt("AdminLevel"); PlayerInfo[playerid][Health] = INI_ReadFloat("Health"); PlayerInfo[playerid][Armour] = INI_ReadFloat("Armour"); PlayerInfo[playerid][Skin] = INI_ReadInt("Skin"); PlayerInfo[playerid][TutorialCompleted] = INI_ReadInt("TutorialCompleted"); PlayerInfo[playerid][pX] = INI_ReadFloat("pX"); PlayerInfo[playerid][pY] = INI_ReadFloat("pY"); PlayerInfo[playerid][pZ] = INI_ReadFloat("pZ"); INI_Save(); INI_Close(); } return 1; }