29.04.2016, 20:27
Guys a few questions, since im moving from old R7 to these now.
Can i use orm_addvar like that? Will it try to access invalid memory and fuck up my server?
Is it possible to create my own query, and still be able to use ORM?
And now just use ORM in the OnVehicleLoading public? (If i can, than example is more than welcome)
[EDIT] Dont mind second question, just found answer myself.
If someone is interested here is example from wiki:
pawn Код:
stock pName(playerid)
{
new PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME);
return PlayerName;
}
orm_addvar_string(playerid, pName(playerid), MAX_PLAYER_NAME, "UserName");
Is it possible to create my own query, and still be able to use ORM?
pawn Код:
mysql_tquery(mysqlThread, "SELECT * FROM `Vehicles`", "OnVehicleLoading");
[EDIT] Dont mind second question, just found answer myself.
If someone is interested here is example from wiki:
pawn Код:
new query[128];
format(query, sizeof(query), "SELECT * FROM `players` WHERE `id` = '%d'", Player[playerid][ID]);
mysql_tquery(MySQL, query, "OnStuffSelected", "d", playerid);
public OnStuffSelected(playerid)
{
orm_apply_cache(Player[playerid][ORM_ID], 0);
printf("Player %s has %d Money and is on PosX with %f.", Player[playerid][Name], Player[playerid][Money], Player[playerid][PosX]);
return 1;
}