question/help
#5

Create an array for the player:
PHP код:
#define MAX_PLAYER_OWNED_VEHICLES 2 // edit to how much vehicles a player can own
#define DIALOG_PLAYER_VEHICLES 587 // change it if it collides
// global:
new Player_OwnedVehicles[MAX_PLAYER_OWNED_VEHICLES][MAX_PLAYERS];
// OnPlayerConnect:
for (new i!= MAX_PLAYER_OWNED_VEHICLES; ++i)
{
    
Player_OwnedVehicles[i][playerid] = INVALID_VEHICLE_ID;
}
// When creating the vehicle:
new boolfull true;
for (new 
i!= MAX_PLAYER_OWNED_VEHICLES; ++i)
{
    if (
GetVehicleModel(Player_OwnedVehicles[i][playerid])) continue; // vehicle exists
    
Player_OwnedVehicles[i][playerid] = CreateVehicle(...); // modify it
    
full false;
}
if (
full) return SendClientMessage(playerid, -1"No more slots available");
// when you want to show the vehicles:
new veh_string[50]; // if you increase the slots, make sure the string is enough
for (new i!= MAX_PLAYER_OWNED_VEHICLES; ++i)
{
    if (!
GetVehicleModel(Player_OwnedVehicles[i][playerid])) continue;
    
format(veh_stringsizeof (veh_string), "%s%i) Vehicle ID: %i & Model ID: %i\n"veh_string1Player_OwnedVehicles[i][playerid], GetVehicleModel(Player_OwnedVehicles[i][playerid]));
}
ShowPlayerDialog(playeridDIALOG_PLAYER_VEHICLESDIALOG_STYLE_MSGBOX"Owned Vehicles"veh_string"Close"""); 
Reply


Messages In This Thread
question/help - by Rabea - 05.05.2015, 08:23
Re: question/help - by denNorske - 05.05.2015, 10:14
Re: question/help - by Rabea - 05.05.2015, 10:46
Re: question/help - by denNorske - 05.05.2015, 11:01
Re: question/help - by Konstantinos - 05.05.2015, 11:02
Re: question/help - by Rabea - 05.05.2015, 11:15

Forum Jump:


Users browsing this thread: 3 Guest(s)