Hello, my players have reported that their cars are not spawning when they type /spawn, I then did some testing on localhost and confirmed myself. During development of the vehicle system in the script it worked fine. :/ Somethings up here.
pawn Код:
CMD:spawn(playerid, params[])
{
new vehicle;
if(sscanf(params, "d", vehicle))
{
SendClientMessage(playerid, COLOR_WHITE, "{33CCFF}Correct Usage{FFFFFF}: /spawn [Vehicle(1-3)]");
return 1;
}
if(vehicle == 1)
{
if(PlayerInfo[playerid][pCarkey] == MAX_SCRIPT_CARS)
{
SendClientMessage(playerid,COLOR_LIGHTRED,"* You do not have a vehicle slot 1.");
return 1;
}
if(VehicleInfo[PlayerInfo[playerid][pCarkey]][vImpounded]==1)
{
SendClientMessage(playerid,COLOR_LIGHTRED,"* Your car is impounded, Go to the PD and pay your fine!");
return 1;
}
if(VehicleInfo[PlayerInfo[playerid][pCarkey]][vOwned] == 0)
{
SendClientMessage(playerid,COLOR_LIGHTRED,"* This vehicle has had it's Owned value placed at 0, meaning you can't own it anymore.");
return PlayerInfo[playerid][pCarkey] = MAX_SCRIPT_CARS;
}
if(ForwardOwnCar(1,playerid)) { SendClientMessage(playerid,COLOR_GREY,"You already have a vehicle spawned, Please /park it"); return 1; }
else if(ForwardOwnCar(2,playerid)) { SendClientMessage(playerid,COLOR_GREY,"You already have a vehicle spawned, Please /park it"); return 1; }
else if(ForwardOwnCar(3,playerid)) { SendClientMessage(playerid,COLOR_GREY,"You already have a vehicle spawned, Please /park it"); return 1; }
else
{
new key = PlayerInfo[playerid][pCarkey];
new carid;
carid = AddStaticVehicleEx(VehicleInfo[key][vModel],VehicleInfo[key][vLocationX],VehicleInfo[key][vLocationY],VehicleInfo[key][vLocationZ]+1.0,VehicleInfo[key][vLocationR],VehicleInfo[key][vColour][0],VehicleInfo[key][vColour][1],60000);
if(IsValidVehicle(carid))
{
VehicleInfo[key][vSpawned] = 1;
VehSpawned[carid] = 1;
VehicleOwned[carid] = key;
LoadMods(carid,key);
SetVehicleNumberPlate(carid, VehicleInfo[key][vPlate]);
SetVehicleToRespawn(carid);
if(VehicleInfo[key][vFuel] > 0)
{
VehicleFuel[carid] = VehicleInfo[key][vFuel];
}
else
{
VehicleFuel[carid] = 100;
}
GameTextForPlayer(playerid, "~w~Vehicle ~g~Spawned", 5000, 1);
}
else SendClientMessage(playerid,COLOR_LIGHTRED,"* The vehicle didn't spawn for some reason.");
}
}
else if(vehicle == 2)
{
if(PlayerInfo[playerid][pCarkey2] == MAX_SCRIPT_CARS)
{
SendClientMessage(playerid,COLOR_LIGHTRED,"* You do not have a vehicle slot 2.");
return 1;
}
if(VehicleInfo[PlayerInfo[playerid][pCarkey2]][vImpounded]==1)
{
SendClientMessage(playerid,COLOR_LIGHTRED,"* Your car is impounded, Go to the PD and pay your fine!");
return 1;
}
if(VehicleInfo[PlayerInfo[playerid][pCarkey2]][vOwned] == 0)
{
SendClientMessage(playerid,COLOR_LIGHTRED,"* This vehicle has had it's Owned value placed at 0, meaning you can't own it anymore.");
return PlayerInfo[playerid][pCarkey2] = MAX_SCRIPT_CARS;
}
if(ForwardOwnCar(1,playerid)) { SendClientMessage(playerid,COLOR_GREY,"You already have a vehicle spawned, Please /park it"); return 1; }
else if(ForwardOwnCar(2,playerid)) { SendClientMessage(playerid,COLOR_GREY,"You already have a vehicle spawned, Please /park it"); return 1; }
else if(ForwardOwnCar(3,playerid)) { SendClientMessage(playerid,COLOR_GREY,"You already have a vehicle spawned, Please /park it"); return 1; }
else
{
new key = PlayerInfo[playerid][pCarkey2];
VehicleInfo[key][vSpawned] = 1;
new carid;
carid = AddStaticVehicleEx(VehicleInfo[key][vModel],VehicleInfo[key][vLocationX],VehicleInfo[key][vLocationY],VehicleInfo[key][vLocationZ]+1.0,VehicleInfo[key][vLocationR],VehicleInfo[key][vColour][0],VehicleInfo[key][vColour][1],60000);
if(IsValidVehicle(carid))
{
VehSpawned[carid] = 1;
VehicleOwned[carid] = key;
LoadMods(carid,key);
SetVehicleNumberPlate(carid, VehicleInfo[key][vPlate]);
SetVehicleToRespawn(carid);
if(VehicleInfo[key][vFuel] > 0)
{
VehicleFuel[carid] = VehicleInfo[key][vFuel];
}
else
{
VehicleFuel[carid] = 100;
}
GameTextForPlayer(playerid, "~w~Vehicle ~g~Spawned", 5000, 1);
}
else SendClientMessage(playerid,COLOR_LIGHTRED,"* The vehicle didn't spawn for some reason.");
}
}
else if(vehicle == 3)
{
if(PlayerInfo[playerid][pCarkey3] == MAX_SCRIPT_CARS)
{
SendClientMessage(playerid,COLOR_LIGHTRED,"* You do not have a vehicle slot 3.");
return 1;
}
if(VehicleInfo[PlayerInfo[playerid][pCarkey3]][vImpounded]==1)
{
SendClientMessage(playerid,COLOR_LIGHTRED,"* Your car is impounded, Go to the PD and pay your fine!");
return 1;
}
if(VehicleInfo[PlayerInfo[playerid][pCarkey3]][vOwned] == 0)
{
SendClientMessage(playerid,COLOR_LIGHTRED,"* This vehicle has had it's Owned value placed at 0, meaning you can't own it anymore.");
return PlayerInfo[playerid][pCarkey3] = MAX_SCRIPT_CARS;
}
if(ForwardOwnCar(1,playerid)) { SendClientMessage(playerid,COLOR_GREY,"You already have a vehicle spawned, Please /park it"); return 1; }
else if(ForwardOwnCar(2,playerid)) { SendClientMessage(playerid,COLOR_GREY,"You already have a vehicle spawned, Please /park it"); return 1; }
else if(ForwardOwnCar(3,playerid)) { SendClientMessage(playerid,COLOR_GREY,"You already have a vehicle spawned, Please /park it"); return 1; }
else
{
new key = PlayerInfo[playerid][pCarkey3];
VehicleInfo[key][vSpawned] = 1;
new carid;
carid = AddStaticVehicleEx(VehicleInfo[key][vModel],VehicleInfo[key][vLocationX],VehicleInfo[key][vLocationY],VehicleInfo[key][vLocationZ]+1.0,VehicleInfo[key][vLocationR],VehicleInfo[key][vColour][0],VehicleInfo[key][vColour][1],60000);
if(IsValidVehicle(carid))
{
VehSpawned[carid] = 1;
VehicleOwned[carid] = key;
LoadMods(carid,key);
SetVehicleNumberPlate(carid, VehicleInfo[key][vPlate]);
SetVehicleToRespawn(carid);
if(VehicleInfo[key][vFuel] > 0)
{
VehicleFuel[carid] = VehicleInfo[key][vFuel];
}
else
{
VehicleFuel[carid] = 100;
}
GameTextForPlayer(playerid, "~w~Vehicle ~g~Spawned", 5000, 1);
}
else SendClientMessage(playerid,COLOR_LIGHTRED,"* The vehicle didn't spawn for some reason.");
}
}
else if(vehicle == 4)
{
if(PlayerInfo[playerid][pCarkey4] == MAX_SCRIPT_CARS)
{
SendClientMessage(playerid,COLOR_LIGHTRED,"* You do not have a vehicle slot 3.");
return 1;
}
if(VehicleInfo[PlayerInfo[playerid][pCarkey4]][vImpounded]==1)
{
SendClientMessage(playerid,COLOR_LIGHTRED,"* Your car is impounded, Go to the PD and pay your fine!");
return 1;
}
if(VehicleInfo[PlayerInfo[playerid][pCarkey4]][vOwned] == 0)
{
SendClientMessage(playerid,COLOR_LIGHTRED,"* This vehicle has had it's Owned value placed at 0, meaning you can't own it anymore.");
return PlayerInfo[playerid][pCarkey4] = MAX_SCRIPT_CARS;
}
if(ForwardOwnCar(1,playerid)) { SendClientMessage(playerid,COLOR_GREY,"You already have a vehicle spawned, Please /park it"); return 1; }
else if(ForwardOwnCar(2,playerid)) { SendClientMessage(playerid,COLOR_GREY,"You already have a vehicle spawned, Please /park it"); return 1; }
else if(ForwardOwnCar(3,playerid)) { SendClientMessage(playerid,COLOR_GREY,"You already have a vehicle spawned, Please /park it"); return 1; }
else
{
new key = PlayerInfo[playerid][pCarkey4];
VehicleInfo[key][vSpawned] = 1;
new carid;
carid = AddStaticVehicleEx(VehicleInfo[key][vModel],VehicleInfo[key][vLocationX],VehicleInfo[key][vLocationY],VehicleInfo[key][vLocationZ]+1.0,VehicleInfo[key][vLocationR],VehicleInfo[key][vColour][0],VehicleInfo[key][vColour][1],60000);
if(IsValidVehicle(carid))
{
VehSpawned[carid] = 1;
VehicleOwned[carid] = key;
LoadMods(carid,key);
SetVehicleNumberPlate(carid, VehicleInfo[key][vPlate]);
SetVehicleToRespawn(carid);
if(VehicleInfo[key][vFuel] > 0)
{
VehicleFuel[carid] = VehicleInfo[key][vFuel];
}
else
{
VehicleFuel[carid] = 100;
}
GameTextForPlayer(playerid, "~w~Vehicle ~g~Spawned", 5000, 1);
}
else SendClientMessage(playerid,COLOR_LIGHTRED,"* The vehicle didn't spawn for some reason.");
}
}
return 1;
}