17.12.2009, 23:00
Hi,
i will save PlayerInfo[playerid][pDrugs]
in MYSQL.
This is my Code to save & login.
Login:
And Save on Disconecct
I will save my stats in on line .
an example:
savemysql_stats(FIELDNAME,PlayerInfo[playerid][pDrugs];
savemysql_stats(FIELDNAME,PlayerInfo[playerid][pMoney];
And on login:
loadmysql_stats(FIELD,Name,PlayerInfo[playerid][pMoney];
loadmysql_stats(FIELD,Name,PlayerInfo[playerid][pDrugs];
should somehow be so.
I would be very grateful for that.
i will save PlayerInfo[playerid][pDrugs]
in MYSQL.
This is my Code to save & login.
Login:
Код:
LoginPlayer(playerid,pass[]) { new pName[MAX_PLAYER_NAME], query[256]; GetPlayerName(playerid,pName,sizeof(pName)); MySQLCheck(); mysql_real_escape_string(pName,pName); mysql_real_escape_string(pass,pass); format(query,sizeof(query),"SELECT Money FROM `"TABLENAME"` WHERE Username = '%s' AND Password = md5('%s') LIMIT 1",pName,pass); mysql_query(query,LOGIN_THREAD_ID); LOGIN_PLAYER_ID = playerid; return 1; }
And Save on Disconecct
Код:
public OnPlayerDisconnect(playerid,reason) { if(pLogtimer[playerid] != 0) KillTimer(pLogtimer[playerid]); new query[300], pName[MAX_PLAYER_NAME]; GetPlayerName(playerid,pName,sizeof(pName)); if(LoggedIn[playerid]) { new Float:arm; GetPlayerArmour(playerid,arm); format(query,sizeof(query),"UPDATE `"TABLENAME"` SET `Money`='%d'WHERE (`Username` = '%s')",GetPlayerMoney(playerid),pName); mysql_query(query); } return 1; }
an example:
savemysql_stats(FIELDNAME,PlayerInfo[playerid][pDrugs];
savemysql_stats(FIELDNAME,PlayerInfo[playerid][pMoney];
And on login:
loadmysql_stats(FIELD,Name,PlayerInfo[playerid][pMoney];
loadmysql_stats(FIELD,Name,PlayerInfo[playerid][pDrugs];
should somehow be so.
I would be very grateful for that.