Spawning vehicles with command makes the game stuck... -
Mr.Anonymous - 12.10.2014
Okay so no matter which game mode I use, my custom one or Grandlarc, spawning any vehicles with a command and trying to drive it makes my game stuck. I thought there was a problem in my custom game mode which gave me this problem but then I tried it with grandlarc and it's still there. All I did was added the
/veh command and when the vehicle spawned, I sat in it and tried to drive with the arrow keys. The car drove like 1 inch and then the game got stuck. I tried this with different game modes and filterscripts but no solution found.
The only thing works is the vehicles already spawned (set in game mode). I can drive them but not the vehicles spawned by command. Here's my command:
Код:
// VEHICLE COMMAND
CMD:veh(playerid, params[])
{
new veh, color1, color2;
if (!sscanf(params, "iii", veh, color1,color2))
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x,y,z);
AddStaticVehicle(veh, x,y,z,0,color1, color2);
}
else SendClientMessage(playerid, 0xfff, "[Usage]: /veh [carid] [Color 1] [Color 2]");
return 1;
}
Any solution is greatly appreciated.
Re: Spawning vehicles with command makes the game stuck... -
Beckett - 12.10.2014
Because you should use CreateVehicle not AddStaticVehicle.
Re: Spawning vehicles with command makes the game stuck... -
DavidBilla - 12.10.2014
It's a static vehicle, means it can only be added under ongamemodeinit
If you want to spawn vehicles with command CreateVehicle is the only and best choice
Re: Spawning vehicles with command makes the game stuck... -
Mr.Anonymous - 12.10.2014
Quote:
Originally Posted by DaniceMcHarley
Because you should use CreateVehicle not AddStaticVehicle.
|
Quote:
Originally Posted by DavidBilla
It's a static vehicle, means it can only be added under ongamemodeinit
If you want to spawn vehicles with command CreateVehicle is the only and best choice
|
Same thing happens again. Car spawns, but when I enter it and try to drive, the game gets stuck.
Re: Spawning vehicles with command makes the game stuck... -
DavidBilla - 12.10.2014
Can you show your create vehicle code?
Re: Spawning vehicles with command makes the game stuck... -
Mr.Anonymous - 12.10.2014
Quote:
Originally Posted by DavidBilla
Can you show your create vehicle code?
|
I changed the command actually. But still doesn't works.
Код:
// VEHICLE COMMAND
CMD:veh(playerid, params[])
{
if(!strlen(params)) return SendClientMessage(playerid, red, "Error. Usage: /veh [modelid]");
if(strval(params) > 611 || strval(params) < 400) return SendClientMessage(playerid, red, "Error. Models are between 400 and 611.");
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
PutPlayerInVehicle(playerid, CreateVehicle(strval(params), x, y, z, 0.0, -1, -1, -1), 0);
return 1;
}
Re: Spawning vehicles with command makes the game stuck... -
Dampyr - 12.10.2014
Try using sscanf:
Код:
CMD:veh(playerid, params[])
{
new modelid;
if(sscanf(params, "i", modelid)) return SendClientMessage(playerid, red, "Error. Usage: /veh [modelid]");
if(modelid > 611 || modelid < 400) return SendClientMessage(playerid, red, "Error. Models are between 400 and 611.");
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
new playervehicle = CreateVehicle(modelid, x, y, z, 0.0, -1, -1, -1);
PutPlayerInVehicle(playerid, playervehicle, 0);
return 1;
}
Re: Spawning vehicles with command makes the game stuck... -
Mr.Anonymous - 12.10.2014
Quote:
Originally Posted by Dampyr
Try using sscanf
|
Not working. I don't think it's related to sscanf or something. I mean, the car is on, I can see the smoke, I can hear the sound of the car, but the game is just stuck. Any other help?