25.09.2009, 16:37
Код:
public OnPlayerUpdate(playerid) { if(IsPlayerConnected(playerid)) { if(gPlayerLogged[playerid]) { new string3[32]; new pname3[MAX_PLAYER_NAME]; GetPlayerName(playerid, pname3, sizeof(pname3)); format(string3, sizeof(string3), "%s.ini", pname3); new File: pFile = fopen(string3, io_write); if (pFile) { new var[32]; format(var, 32, "%s\n", PlayerInfo[playerid][pPassword]);fwrite(pFile, var); fclose(pFile); new File: hFile = fopen(string3, io_append); PlayerInfo[playerid][pCash] = GetPlayerMoney(playerid); format(var, 32, "Rank=%d\n",PlayerInfo[playerid][pRank]);fwrite(hFile, var); format(var, 32, "Exp=%d\n",PlayerInfo[playerid][pExp]);fwrite(hFile, var); format(var, 32, "Kills=%d\n",PlayerInfo[playerid][pKills]);fwrite(hFile, var); format(var, 32, "Deaths=%d\n",PlayerInfo[playerid][pDeaths]);fwrite(hFile, var); format(var, 32, "Admin=%d\n",PlayerInfo[playerid][pAdmin]);fwrite(hFile, var); format(var, 32, "Premium=%d\n",PlayerInfo[playerid][pPremium]);fwrite(hFile, var); format(var, 32, "pG=%d\n",PlayerInfo[playerid][pSaw]);fwrite(hFile, var); format(var, 32, "Money=%d\n",PlayerInfo[playerid][pCash]);fwrite(hFile, var); format(var, 32, "Police=%d\n",PlayerInfo[playerid][pPolice]);fwrite(hFile, var); format(var, 32, "Marine=%d\n",PlayerInfo[playerid][pMarine]);fwrite(hFile, var); format(var, 32, "Nemesis=%d\n",PlayerInfo[playerid][pNemesis]);fwrite(hFile, var); format(var, 32, "FBI=%d\n",PlayerInfo[playerid][pFBI]);fwrite(hFile, var); format(var, 32, "Muted=%d\n",PlayerInfo[playerid][pMuted]);fwrite(hFile, var); format(var, 32, "Locked=%d\n",PlayerInfo[playerid][pLocked]);fwrite(hFile, var); format(var, 32, "Local=%d\n",PlayerInfo[playerid][pLocal]);fwrite(hFile, var); format(var, 32, "Team=%d\n",PlayerInfo[playerid][pTeam]);fwrite(hFile, var); fclose(hFile); } new string[50]; new nxtlevel = PlayerInfo[playerid][pRank]+1; new costlevel = nxtlevel*rankcost;//1000 for testing purposes if (PlayerInfo[playerid][pExp] >= costlevel) { PlayerInfo[playerid][pRank]++; format(string, sizeof(string), "~g~Ranked Up~n~~w~You Are Now Rank %d", nxtlevel); PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0); PlayerPlayMusic(playerid); GivePlayerMoney(playerid, 10000); new rank = PlayerInfo[playerid][pRank]; SetPlayerScore(playerid, rank); } } } return 1; }