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 ? |
AddStaticVehicle(modelid, x, y, z, angle, color1, color2)
AddStaticVehicle(411,- 1989.0293, 271.0905, 34.9027, 86.9787, -1, -1); // Infernus - Wang Car - SF - Spawning with randoms colors
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;
}
public OnGameModeInit()
{
//==========================================================================
// -- > Loads
//==========================================================================
mysql = mysql_connect(SQL_HOST, SQL_USER, SQL_DB, SQL_PASS);
mysql_log(LOG_ALL);
if(mysql_errno(mysql) == 0)
{
mysql_log(LOG_ERROR | LOG_WARNING | LOG_DEBUG);
printf("------------------------------------------------------------------------------");
printf("[MYSQL]: Connection to `%s`@'%s' succesful!", SQL_DB, SQL_HOST);
printf("------------------------------------------------------------------------------");
}
else
{
printf("------------------------------------------------------------------------------");
printf("[MYSQL]: ERROR: Connection to `%s`@'%s' failed!", SQL_DB, SQL_HOST);
printf("------------------------------------------------------------------------------");
}
mysql_tquery(mysql, "SELECT * FROM `Icons` ORDER BY SQLID ASC", "LoadIcons");
//mysql_tquery(mysql, "SELECT * FROM `vehicles`", "Car_Load", "");
CreateVehicle(520, 182.3132,-193.0358,1.4343,189.8180, -1,-1, 60); // bike 1
DisableInteriorEnterExits();
DisableNameTagLOS();
ShowPlayerMarkers(PLAYER_MARKERS_MODE_OFF);
EnableStuntBonusForAll(0);
ShowNameTags(0);
for(new i = 0; i < MAX_PLAYERS; i++)
{
InfoBox[i] = TextDrawCreate(323.000030, 363.377899, "Testing");
TextDrawLetterSize(InfoBox[i], 0.309000, 1.417481);
TextDrawTextSize(InfoBox[i], -114.333312, 300.325866);
TextDrawAlignment(InfoBox[i], 2);
TextDrawColor(InfoBox[i], -1);
TextDrawUseBox(InfoBox[i], true);
TextDrawBoxColor(InfoBox[i], 51);
TextDrawSetShadow(InfoBox[i], 0);
TextDrawSetOutline(InfoBox[i], -1);
TextDrawBackgroundColor(InfoBox[i], 255);
TextDrawFont(InfoBox[i], 1);
TextDrawSetProportional(InfoBox[i], 1);
}
return 1;
}