forward OnPlayerSpawnVehicle(playerid, parked);
public OnPlayerSpawnVehicle(playerid, parked)
{
if(!cache_get_row_count(connectionID))
{
SendClientMessage(playerid, COLOR_GREY, "The slot specified contains no valid vehicle which you can spawn.");
}
else
{
for(new i = 0; i < MAX_VEHICLES; i ++)
{
if(IsValidVehicle(i) && VehicleInfo[i][vID] == cache_get_field_content_int(0, "id"))
{
return SendClientMessage(playerid, COLOR_GREY, "This vehicle is spawned already. /findcar to track it.");
}
}
if(GetSpawnedVehicles(playerid) >= MAX_SPAWNED_VEHICLES)
{
return SendClientMessageEx(playerid, COLOR_GREY, "You can't have more than %i vehicles spawned at a time.", MAX_SPAWNED_VEHICLES);
}
new
modelid = cache_get_field_content_int(0, "modelid"),
Float:x = cache_get_field_content_float(0, "pos_x"),
Float:y = cache_get_field_content_float(0, "pos_y"),
Float:z = cache_get_field_content_float(0, "pos_z"),
Float:a = cache_get_field_content_float(0, "pos_a"),
color1 = cache_get_field_content_int(0, "color1"),
color2 = cache_get_field_content_int(0, "color2"),
vehicleid;
vehicleid = CreateVehicle(modelid, x, y, z, a, color1, color2, -1);
if(vehicleid != INVALID_VEHICLE_ID)
{
ResetVehicle(vehicleid);
cache_get_field_content(0, "owner", VehicleInfo[vehicleid][vOwner], connectionID, MAX_PLAYER_NAME);
cache_get_field_content(0, "plate", VehicleInfo[vehicleid][vPlate], connectionID, 32);
VehicleInfo[vehicleid][vID] = cache_get_field_content_int(0, "id");
VehicleInfo[vehicleid][vOwnerID] = cache_get_field_content_int(0, "ownerid");
VehicleInfo[vehicleid][vPrice] = cache_get_field_content_int(0, "price");
VehicleInfo[vehicleid][vTickets] = cache_get_field_content_int(0, "tickets");
VehicleInfo[vehicleid][vLocked] = cache_get_field_content_int(0, "locked");
VehicleInfo[vehicleid][vHealth] = cache_get_field_content_float(0, "health");
VehicleInfo[vehicleid][vPaintjob] = cache_get_field_content_int(0, "paintjob");
VehicleInfo[vehicleid][vInterior] = cache_get_field_content_int(0, "interior");
VehicleInfo[vehicleid][vWorld] = cache_get_field_content_int(0, "world");
VehicleInfo[vehicleid][vNeon] = cache_get_field_content_int(0, "neon");
VehicleInfo[vehicleid][vNeonEnabled] = cache_get_field_content_int(0, "neonenabled");
VehicleInfo[vehicleid][vTrunk] = cache_get_field_content_int(0, "trunk");
VehicleInfo[vehicleid][vMods][0] = cache_get_field_content_int(0, "mod_1");
VehicleInfo[vehicleid][vMods][1] = cache_get_field_content_int(0, "mod_2");
VehicleInfo[vehicleid][vMods][2] = cache_get_field_content_int(0, "mod_3");
VehicleInfo[vehicleid][vMods][3] = cache_get_field_content_int(0, "mod_4");
VehicleInfo[vehicleid][vMods][4] = cache_get_field_content_int(0, "mod_5");
VehicleInfo[vehicleid][vMods][5] = cache_get_field_content_int(0, "mod_6");
VehicleInfo[vehicleid][vMods][6] = cache_get_field_content_int(0, "mod_7");
VehicleInfo[vehicleid][vMods][7] = cache_get_field_content_int(0, "mod_8");
VehicleInfo[vehicleid][vMods][8] = cache_get_field_content_int(0, "mod_9");
VehicleInfo[vehicleid][vMods][9] = cache_get_field_content_int(0, "mod_10");
VehicleInfo[vehicleid][vMods][10] = cache_get_field_content_int(0, "mod_11");
VehicleInfo[vehicleid][vMods][11] = cache_get_field_content_int(0, "mod_12");
VehicleInfo[vehicleid][vMods][12] = cache_get_field_content_int(0, "mod_13");
VehicleInfo[vehicleid][vMods][13] = cache_get_field_content_int(0, "mod_14");
VehicleInfo[vehicleid][vCash] = cache_get_field_content_int(0, "cash");
VehicleInfo[vehicleid][vMaterials] = cache_get_field_content_int(0, "materials");
VehicleInfo[vehicleid][vWeed] = cache_get_field_content_int(0, "weed");
VehicleInfo[vehicleid][vCocaine] = cache_get_field_content_int(0, "cocaine");
VehicleInfo[vehicleid][vMeth] = cache_get_field_content_int(0, "meth");
VehicleInfo[vehicleid][vPainkillers] = cache_get_field_content_int(0, "painkillers");
VehicleInfo[vehicleid][vWeapons][0] = cache_get_field_content_int(0, "weapon_1");
VehicleInfo[vehicleid][vWeapons][1] = cache_get_field_content_int(0, "weapon_2");
VehicleInfo[vehicleid][vWeapons][2] = cache_get_field_content_int(0, "weapon_3");
VehicleInfo[vehicleid][vHPAmmo] = cache_get_field_content_int(0, "hpammo");
VehicleInfo[vehicleid][vPoisonAmmo] = cache_get_field_content_int(0, "poisonammo");
VehicleInfo[vehicleid][vFMJAmmo] = cache_get_field_content_int(0, "fmjammo");
VehicleInfo[vehicleid][vGang] = -1;
VehicleInfo[vehicleid][vFactionType] = FACTION_NONE;
VehicleInfo[vehicleid][vJob] = JOB_NONE;
VehicleInfo[vehicleid][vRespawnDelay] = -1;
VehicleInfo[vehicleid][vModel] = modelid;
VehicleInfo[vehicleid][vPosX] = x;
VehicleInfo[vehicleid][vPosY] = y;
VehicleInfo[vehicleid][vPosZ] = z;
VehicleInfo[vehicleid][vPosA] = a;
VehicleInfo[vehicleid][vColor1] = color1;
VehicleInfo[vehicleid][vColor2] = color2;
VehicleInfo[vehicleid][vObjects][0] = INVALID_OBJECT_ID;
VehicleInfo[vehicleid][vObjects][1] = INVALID_OBJECT_ID;
VehicleInfo[vehicleid][vTimer] = -1;
vehicleFuel[vehicleid] = cache_get_field_content_int(0, "fuel");
adminVehicle{vehicleid} = false;
ReloadVehicle(vehicleid);
if(!parked)
{
SendClientMessageEx(playerid, COLOR_AQUA, "You have spawned your {FF6347}%s{33CCFF} which is located in {F7A763}%s{33CCFF}. /findcar to track it.", GetVehicleName(vehicleid), GetVehicleZoneName(vehicleid));
}
}
}
return 1;
}