23.11.2014, 20:56
Quote:
in addition to clearing the variables on OnPlayerDisconnect(..) you should also make the register part write a set of default values into the database.
Perhaps, do something like this: "INSERT INTO `table` (level, name, money, etc..) VALUES (0, name, 0, etc..)" .. where you directly write level as 0 and all other values/integers as 0. Then you will make sure to avoid the incorrect values, at least when registering. |
pawn Код:
stock MySQL_Register(playerid, passwordstring[])
{
new query[300], pname[24], IP[16];
GetPlayerName(playerid, pname, 24);
GetPlayerIp(playerid, IP, 16);
format(query, sizeof(query), "INSERT INTO playerdata (user, password, pAdmin, pWarns, pScore, pMoney, IP, pSeconds, pMinutes, pHours, pKills, pDeaths, pRegister, pVip) VALUES('%s', SHA1('%s'), 0, 0, 0, 0, '%s', 0, 0, 0, 0, 0, NOW(), 0)", pname, passwordstring, IP);
pInfo[playerid][pAdmin] = 0; // just added
mysql_query(query);
SendClientMessage(playerid, INFO, ">> You have sucesfully registered a new account!");
Logged[playerid] = 1;
return 1;
}