CarOwner
#2

Automatically assuming that carOwner is a foreign key of some kind of player/account table in your database. Upon spawning the vehicle you also load the owner information.
Код:
format(query, sizeof(query), "SELECT PlayerName FROM playerTable WHERE ID=%i", CarData[id][carOwner]);
mysql_tquery(connection, query, "OnPlayerLoadForVehicles", "i", CarData[id][carOwner]);
Creating the function:
Код:
forward OnPlayerLoadForVehicles(vID);
public OnPlayerLoadForVehicles(vID)
{
     new rows = cache_get_row_count(connection);
     if (rows == 1)
    {
           cache_get_field_content(0, "PlayerName", CarData[vID][carOwnerName]); //select first row (0) and take out whatever is stated in it  and place it into the enum
    }
    return 1;
}
Add carOwnerName as a string into your CarData enum (carOwnerName[MAX_PLAYER_NAME]). Note, this is only a template of an example and not the actual answer, you cannot just copy-paste this expecting it will work.
Reply


Messages In This Thread
CarOwner - by MineiriinHo - 03.11.2016, 03:02
Re: CarOwner - by Hansrutger - 03.11.2016, 03:52
Re: CarOwner - by Vince - 03.11.2016, 08:33

Forum Jump:


Users browsing this thread: 1 Guest(s)