26.02.2017, 20:06
I don't know if I understood you, but you want to create player vehicles (player login in server and create his vehicle)?
If yes, you'll request to DB the data of his vehicle (model, color, paintjob, ...), assign the data to its id in vehicleVariables array and create the vehicle
Every time a player join, you create the vehicle, every time the player leaves the server, you destroy it and erase the data in vehicleVariables array.
Example:
If yes, you'll request to DB the data of his vehicle (model, color, paintjob, ...), assign the data to its id in vehicleVariables array and create the vehicle
Every time a player join, you create the vehicle, every time the player leaves the server, you destroy it and erase the data in vehicleVariables array.
Example:
PHP код:
public OnPlayerConnect(playerid)
{
new vID = INVALID_VEHICLE_ID;
//Loop all vehicles to get the free slot (Maybe it isn't the best method to do that)
for(new i=0; i>MAX_VEHICLES; i++)
{
if(!IsValidVehicle(i))
{
//This slot is free
vID = i;
break;
}
}
//This means that we have a free slot and we can create a vehicle.
if(vID != INVALID_VEHICLE_ID)
{
//Request data from DB, assign to vID slot in vehicleVariables array and create the vehicle.
}
return 1;
}