20.11.2016, 19:18
I start today working on my MYSQL Mode and everything is great but there is one problem with saving IG variables
loading is ok,and at register create Nick,password... in tables if something i write it will be load in game like this 5000$ http://prntscr.com/d9pg7y for first acc,but if for example i give Admin level 6 me in game, it can not preserve in the database..This is structure of "accounts" http://prntscr.com/d9phpl .
And this is script which i using for save in DB,probably something in script isn't good because i just started with MySQL:
And this is one cmd for giving admin:
loading is ok,and at register create Nick,password... in tables if something i write it will be load in game like this 5000$ http://prntscr.com/d9pg7y for first acc,but if for example i give Admin level 6 me in game, it can not preserve in the database..This is structure of "accounts" http://prntscr.com/d9phpl .
And this is script which i using for save in DB,probably something in script isn't good because i just started with MySQL:
Quote:
stock SavePlayer(playerid) { new query[200], pname[24]; //Creates the variables GetPlayerName(playerid, pname, 24); //Gets the players name. format(query, sizeof(query), "UPDATE 'accounts' SET 'Money' = %d, 'Admin' = %d, 'GM' = %d, 'AdminKod' = %d, 'GMKod' = %d, 'VIP' = %d, 'PosX' = %f, 'PosY' = %f, 'PosZ' = %f, 'PosA' = %f WHERE ID = '%d'", PlayerInfo[playerid][NovacDzep], PlayerInfo[playerid][Admin], PlayerInfo[playerid][GM], PlayerInfo[playerid][AdminKod], PlayerInfo[playerid][GMKod], PlayerInfo[playerid][Vip], PlayerInfo[playerid][posX], PlayerInfo[playerid][posY], PlayerInfo[playerid][posZ], PlayerInfo[playerid][posA], PlayerInfo[playerid][ID]); mysql_tquery(mysql, query, "", ""); return 1; } |
Quote:
CMD:makeadmin(playerid, params[]) { if(UlogovanProvera[playerid] == 0) return Ulogovan(playerid); if(PlayerInfo[playerid][Admin] == 6 || IsPlayerAdmin(playerid)) { new id, level; if(sscanf(params, "ud", id, level)) return SCM(playerid, -1, ""ORANGE"[SA:RP]:"BELA"/makeadmin [ID/Ime] [Level (1-6)]"); if(!IsPlayerConnected(id)) return SCM(playerid, -1,""CRVENA"[SA:RP]:"BELA"Pogresan ID!"); if(level < 0 || level > 6) return SCM(playerid, -1, ""CRVENA"[SA:RP]:"BELA"Admin Level ne moze biti manji od 0 i veci od 6!"); if(PlayerInfo[id][GM] >= 1) return SCM(playerid,-1,""CRVENA"[SA:RP]:"BELA"Nemozete postaviti administratora igracu koji je gamemaster.Prvo mu skinite gamemastera"CRVENA"(/makegm)"); if(level >= 1) { new randomkod = 1000 + random(8999), kod[30]; format(kod, 7, "%d", randomkod); PlayerInfo[id][Admin] = level; PlayerInfo[id][AdminKod] = kod; SCMF(playerid,-1,""ORANGE"[SA:RP]:"BELA"Postavili ste administratora igracu %s te ste mu postavili level %d",GetName(id),level); SCM(id,-1,""ORANGE"[SA:RP]:"BELA"CESTITKE!! "); SCMF(id,-1,""ORANGE"[SA:RP]:"BELA"Cestitamo postavljeni ste za administratora od strane "ORANGE"%s"BELA".Vas admin level je "ORANGE"%d"BELA".",GetName(playerid),level); SCMF(id,-1,""ORANGE"[SA:RP]:"BELA"Vas pinkod je: "ORANGE"%s"BELA".",PlayerInfo[playerid][AdminKod]); SavePlayer(id); } else if(level == 0) { SCMF(id,-1,""ORANGE"[SA:RP]:"BELA"Administrator "ZUTA"%s"BELA" vam je skinuo administratora!!",GetName(playerid)); SCMF(id,-1,""ORANGE"[SA:RP]:"BELA"Ukoliko neznate razlog skidanja obratite nam se na "ZUTA"%s",WEB_ADRESA); PlayerInfo[id][Admin] = 0; PlayerInfo[id][AdminKod] = 0; } } else { Ovlasteni(playerid); } return 1; } |