CMD:buylevel(playerid,params[]) { new string[30]; if(IsPlayerConnected(playerid) == 1) { new points[248]; new nxtlevel = Player[playerid][pLevel]+1; new expamount = nxtlevel*levelexp; if(Player[playerid][pExp] < expamount) { format(points,sizeof(points)," You need [%d] Exp Points in order to level up, You currently have [%d]",expamount,Player[playerid][pExp]); // Format, This is pretty obvious. SendClientMessage(playerid,0xFFFFFFC8,points); return 1; } else { Player[playerid][pExp] = 0; Player[playerid][pLevel]++; format(string,sizeof(string),"~g~Your now level:[%d]",Player[playerid][pLevel]); GameTextForPlayer(playerid,string,6000,1); SavePlayer(playerid); return 1; } } return 1; }
forward ScoreUpdate(); public ScoreUpdate() { new Score; new name[MAX_PLAYER_NAME]; //new string[256]; for(new i=0; i<MAX_PLAYERS; i++) { if (IsPlayerConnected(i)) { GetPlayerName(i, name, sizeof(name)); Score = Player[i][pLevel]; SetPlayerScore(i, Score); if (Score > ScoreOld) { ScoreOld = Score; } } } }
stock SavePlayer(playerid) { new query[356], EncryptedPass[130]; WP_Hash(EncryptedPass, sizeof(EncryptedPass), Player[playerid][pPassword]); GetPlayerPos(playerid, Player[playerid][pPosition][0], Player[playerid][pPosition][1], Player[playerid][pPosition][2]); format(query, sizeof(query), "UPDATE accounts SET pName = '%s', pPassword = '%s', pAdminLevel = %d, pPlayerPos = '%f %f %f', pSkin=%d, pMoney = %d, pVip = %d, pMuted = %d, pWarnings = %d, pWarningReasons = '%s|%s|%s', pLevel = %d, pExp = %d WHERE pid = %d", GetName(playerid), Player[playerid][pPassword], Player[playerid][pAdminLevel], Player[playerid][pPosition][0], Player[playerid][pPosition][1], Player[playerid][pPosition][0], Player[playerid][pSkin], Player[playerid][pMoney], Player[playerid][pvStatus], Player[playerid][pMuted], Player[playerid][pWarnings], Player[playerid][pWarningReason1], Player[playerid][pWarningReason2], Player[playerid][pWarningReason3], Player[playerid][pLevel], Player[playerid][pExp], Player[playerid][pID]); mysql_query(query); printf(query); printf("Player ID %d (%s) has been saved", playerid, GetName(playerid)); }
Player[playerid][pLevel]++;
Player[playerid][pLevel] += 1;
new query[356];
new query[1024];
Код:
forward ScoreUpdate(); public ScoreUpdate() { new Score; new name[MAX_PLAYER_NAME]; //new string[256]; for(new i=0; i<MAX_PLAYERS; i++) { if (IsPlayerConnected(i)) { GetPlayerName(i, name, sizeof(name)); Score = Player[i][pLevel]; SetPlayerScore(i, Score); if (Score > ScoreOld) { ScoreOld = Score; } } } } |
Okay, change :
PHP код:
PHP код:
|