23.05.2014, 11:41
Create an enum
Under OnPlayerDisconnect
Under OnPlayerConnect
Код:
enum pInfo { pLevel, pCash } new PlayerInfo[MAX_PLAYERS][pInfo];
Код:
CMD:levelbonus(playerid,params[]) { if(PlayerInfo[playerid][pLevel]==3) { SendClientMessage(playerid,-1,"You already have Level 3 and 1,000,000$"); return 1; } else { PlayerInfo[playerid][pLevel]=3; GivePlayerMoney(playerid,1000000); PlayerInfo[playerid][pCash]=GetPlayerMoney(playerid); } return 1; }
Код:
public OnPlayerDisconnect(playerid, reason) { new INI:File = INI_Open(UserPath(playerid)); INI_SetTag(File,"data"); INI_WriteInt(File,"Cash",PlayerInfo[playerid][pCash]); INI_WriteInt(File,"Level",PlayerInfo[playerid][pLevel]); INI_Close(File); return 1; }
Код:
GivePlayerMoney(playerid,PlayerInfo[playerid][pCash]);