09.01.2014, 16:10
Hi guys, I decided to learn how to use the orm system which this MySQL plugin has. I read the tutorial provided by AndreT and still couldn't get how to save player data.
I took the following code from the example scripts (by Pain123/maddinat0r), you can find them on the plugin page:
So it doesn't save the money, either score or whatever else. I was told that the plugin creates the queries for me and I just need to use orm_update and orm_save like this:
I still find using cache much easier than orm. If someone can explain me how to save the player data I will be really thankful.
I took the following code from the example scripts (by Pain123/maddinat0r), you can find them on the plugin page:
pawn Код:
enum E_PLAYERS
{
ORM:ORM_ID,
ID,
Name[MAX_PLAYER_NAME],
Password[129],
Money
};
new Player[MAX_PLAYERS][E_PLAYERS];
public OnPlayerDisconnect(playerid,reason)
{
MysqlRaceCheck[playerid]++;
if(Player[playerid][IsLoggedIn] && Player[playerid][ID] > 0)
orm_save(Player[playerid][ORM_ID]); //if Player[playerid][ID] has a valid value, orm_save sends an UPDATE query, else an INSERT query
return 1;
}
pawn Код:
orm_update(playerid, pInfo[playerid][ID];