07.01.2017, 00:18
Here the OnPlayerDisconnect code,
And here is the code of the create table Accounts which is giving me the mysql errors above^,
I don't know how to set it so please tell me if you know about it..
Код:
public OnPlayerDisconnect(playerid, reason) { PlayersOnline--; //StealingA69Prot[playerid] = 0; //prototype //++++++++++++++++++++SQL+++++++++++++++++ if(Logged[playerid] == 1 && buggy[playerid] == 0) { //If the player disconnects before registering, //we want to make sure it doesn't try update //so we check if the player is logged in. PlayerInfo[playerid][Level] = TempAdmin[playerid]; new score = GetPlayerScore(playerid); //Gets players score new money = GetPlayerMoney(playerid); //Gets players money new query[200], pname[24]; //Creates the variables GetPlayerName(playerid, pname, 24); //Gets the players name. new h, m, s; TotalGameTime(playerid, h, m, s); format(query, sizeof(query), "UPDATE Accounts SET Score=%d, Cash=%d WHERE Name='%s'", score, money, pname); mysql_query(connection, query); format(query, sizeof(query), "UPDATE Accounts SET Level=%d, Coins=%d, Kills=%d, Deaths=%d, Vip=%d, Kicks=%d, Bans=%d, Jails=%d, license=%d WHERE Name='%s'", PlayerInfo[playerid][Level], PlayerInfo[playerid][Helper], PlayerInfo[playerid][Kills], PlayerInfo[playerid][Deaths], PlayerInfo[playerid][dRank], h, m, s, License[playerid], pname); mysql_query(connection, query); //No need to store a result for a update string }
Код:
mysql_query(connection, "CREATE TABLE IF NOT EXISTS Accounts(Name VARCHAR(24), password VARCHAR(40), IP VARCHAR(16), Cash INT(20), Score INT(30), Level INT(10), Kills INT(20), Deaths INT(20), viplevel INT(10))");