17.09.2018, 08:44
When a player registers, isn't their inventory supposed to be empty? Insert a row only when an item is given to the said player.
If the server gives a few items to the player upon registration, you need to know their user ID but this does not mean a SELECT query!
If the server gives a few items to the player upon registration, you need to know their user ID but this does not mean a SELECT query!
pawn Код:
mysql_format(..., "INSERT INTO users ...", ...);
mysql_tquery(..., "OnPlayerRegister", "d", playerid);
pawn Код:
forward OnPlayerRegister(playerid);
public OnPlayerRegister(playerid)
{
// store the user_id in a global array to use for reference
// for this example, I will use a local variable
new new_userid = cache_insert_id();
// pass new_userid in the mysql_format below
mysql_format(..., "INSERT INTO inventory ...", ...);
mysql_tquery(...);
}

