05.04.2017, 21:59
i have a save script when player leaves but unfortunately it doesnt work..
i deposit money on bank before leaving so my money decreases right before i leave it saves my USER[playerid][BANK] variable but it doesnt save my money so its like i deposit all money and do a /q and login again get money from bank and also get money from mysql too.. my money on mysql doesnt change. same code is under /saveme when i do /saveme it saves actual money on mysql
my code for OnPlayerDisconnect:
i deposit money on bank before leaving so my money decreases right before i leave it saves my USER[playerid][BANK] variable but it doesnt save my money so its like i deposit all money and do a /q and login again get money from bank and also get money from mysql too.. my money on mysql doesnt change. same code is under /saveme when i do /saveme it saves actual money on mysql
my code for OnPlayerDisconnect:
Код:
public OnPlayerDisconnect(playerid, reason){ GetPlayerPos(playerid,USER[playerid][POS_X],USER[playerid][POS_Y],USER[playerid][POS_Z]); GetPlayerFacingAngle(playerid, USER[playerid][ANGLE]); USER[playerid][MONEY] = GetPlayerMoney(playerid); new query[256]; mysql_format(mysql, query, sizeof(query), "UPDATE `userlog_info` SET `ADMIN`=%d,`MONEY`=%d,`KILLS`=%d,`DEATHS`=%d,`SKIN`=%d,`POS_X`=%f,`POS_Y`=%f,`POS_Z`=%f WHERE `ID`=%d", USER[playerid][ADMIN], USER[playerid][MONEY], USER[playerid][KILLS], USER[playerid][DEATHS], USER[playerid][SKIN], USER[playerid][POS_X], USER[playerid][POS_Y], USER[playerid][POS_Z], USER[playerid][ID]); mysql_query(mysql, query); mysql_format(mysql, query, sizeof(query), "UPDATE `userlog_info` SET `ANGLE`=%f,`HP`=%f,`AM`=%f, `EXP`=%d, `LEVEL`=%d,`SAVINGS`=%d, `BANK`=%d, `PHONE`=%d, `DONOR`=%d WHERE `ID`=%d", USER[playerid][ANGLE], USER[playerid][HP], USER[playerid][AM], USER[playerid][EXP], USER[playerid][LEVEL], USER[playerid][SAVINGS], USER[playerid][BANK], USER[playerid][PHONE], USER[playerid][DONOR], USER[playerid][ID]); mysql_query(mysql, query); return 1; }