03.01.2017, 00:16
Hello, i'm sitting with one script for 3 hours and still dont understand whats wrong.
Problem:
Creating XP/Level system with mysql, working perfectly! BUT! not saving level number.
i have created tables: pLEVEL, pEXP, MAXEXP. SAVING just MAXEXP but not pEXP and pLEVEL.
look at saving script:
But i added that when player level up i give 1000 money, and then in "pLEVEL" and "pinigai"(money) dublicating, money just have to save into "pinigai" but not in "pLEVEL".
code where i puted money give:
Anyone?

Problem:
Creating XP/Level system with mysql, working perfectly! BUT! not saving level number.
i have created tables: pLEVEL, pEXP, MAXEXP. SAVING just MAXEXP but not pEXP and pLEVEL.
look at saving script:
Код:
stock MySQL_Save(playerid) { if( online[playerid] ) { new Float: pos[3], // 0,1,2 - pozicija; Query[3000]; printf("Iрsaugoma. [%s]", GetPlayerNameEx(playerid)); GetPlayerPos(playerid,pos[0],pos[1],pos[2]); format( Query,sizeof( Query ),"UPDATE `zaidejai` SET x = '%f', y = '%f', z = '%f' WHERE vardas = '%s'",\ pos[0], pos[1], pos[2], GetPlayerNameEx( playerid )); mysql_query( Query ); playerData[playerid][pSkin] = GetPlayerSkin(playerid); playerData[playerid][pPinigai] = GetPlayerMoney(playerid); playerData[playerid][pPatirtis] = GetPlayerScore(playerid); format( Query, sizeof(Query),"UPDATE `zaidejai` SET skin = '%i', pinigai = '%i', patirtis = '%i', lang = '%i', pLEVEL = '%i', EXP = '%i', MAXEXP = '%i' WHERE vardas = '%s'",\ playerData[playerid][pSkin], playerData[playerid][pPinigai], playerData[playerid][pPatirtis], playerData[playerid][lang], playerData[playerid][level], playerData[playerid][pEXP], playerData[playerid][pMaxEXP], GetPlayerNameEx(playerid)); mysql_query( Query ); new Float:HP, Float:ARM; GetPlayerArmour(playerid, ARM); GetPlayerHealth(playerid, HP); format(Query, sizeof(Query), "UPDATE `zaidejai` SET hp = '%f', armour = '%f' WHERE vardas = '%s'",\ HP,ARM, GetPlayerNameEx(playerid)); mysql_query(Query);
code where i puted money give:
Код:
forward CheckLevel(playerid); public CheckLevel(playerid) { if(playerData[playerid][pEXP] >= playerData[playerid][pMaxEXP])//This will make the player level +1 after the EXP = MAXEXP { playerData[playerid][level] ++;//The Player Level will +1 after the EXP = MAXEXP playerData[playerid][pMaxEXP] += 500;//After Player Level Up the max EXP will +520 playerData[playerid][pEXP] -= playerData[playerid][pMaxEXP]; //playerData[playerid][pMaxEXP] += 500;//After Player Level Up the max EXP will +520 //playerData[playerid][level] ++;//The Player Level will +1 after the EXP = MAXEXP //playerData[playerid][pEXP] -= playerData[playerid][pMaxEXP]; //The EXP after level up will back to 0 SendClientMessage(playerid,-1,"{FF0000}[LEVEL]{00FFD5}Congratulation!! You've Level Up, for the reward you got {00FF3C}1000$ !");//You can change 1000$ to what you want for the player level up reward. GivePlayerMoney(playerid, 1000);//This the reward you can change same like at the SendClientMessage } return 1; }