Quote:
Originally Posted by vernz
Hi, so for some reason I can't create any vehicle using CreateVehicle, it just doesn't show up in game, the model id is valid and I don't have any vehicle in my server so I didn't reach the l;imit...
Example : CreateVehicle(520, 182.3132,-193.0358,1.4343,189.8180, -1,-1, 60);
Under OnGameModeInit, like it should be and yeah it doesn't create the vehicle in game, any idea why ?
|
Hm.. I think
CreateVehicle is the wrong way to do that.
Try to use
PHP код:
AddStaticVehicle(modelid, x, y, z, angle, color1, color2)
Example:
PHP код:
AddStaticVehicle(411,- 1989.0293, 271.0905, 34.9027, 86.9787, -1, -1); // Infernus - Wang Car - SF - Spawning with randoms colors
And if you want to create a spawning command,
CreateVehicle is a good thing.
Example :
PHP код:
CMD:v(playerid, params[])
{
new Float:x, Float:y, Float:z, Float:Angle, vehID, string[150];
if(GetPlayerInterior(playerid) > 0) return SendClientMessage(playerid, red, "[SYSTEM] "rougeUC"You are in an interior !"); // If the player is in an interior, return an error message
if(GetPlayerVirtualWorld(playerid)> 0)return SendClientMessage(playerid, red, "[SYSTEM] "rougeUC"You cannot spawn vehcle in this virtualworld."); // If the player is in an virtual world other than the default virtual world (world 0), return an error message
if(sscanf(params,"i", vehID)) return SendClientMessage(playerid, X11_LIGHT_BLUE_1, "/v [vehicle_id] [400-611]"); // If the player type /v without parameter
if(611<vehID || vehID<400) return SendClientMessage(playerid, red, rougeUF"[SYSTEM] "rougeUC"Invalid ID! [400-611]"); // If the ID typed is behind 400 or upper than 611
if(IsPlayerInAnyVehicle(playerid)) { RemovePlayerFromVehicle(playerid); } // Remove player if he is already in an vehicle
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, Angle); // Stocking different values for spawning the vehicle
vehID = CreateVehicle(vehID, x, y, z, Angle, -1, -1, 600); // Spawning the vehicle at the player's coordinates - Stocking the vehicle's ID in vehID
PutPlayerInVehicle(playerid, vehID, 0); // Put the player in the vehicle as the driver
format(string, sizeof(string), "Vehicle Spawned ! (ID : %i)", GetVehicleModel(vehID)); // Send a message with model of the vehicle (not the ID)
SendClientMessage(playerid, marronc, string);
return 1;
}
NB: I tried to translate this command in English. Please, don't care about orthography mistakes.