SA-MP Forums Archive
Vehicle problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Vehicle problem (/showthread.php?tid=525175)



Vehicle problem - cnoopers - 10.07.2014

Compiled without errors or warnings, but theres no vehicle.
Код:
	new playersvw;
	playersvw = GetPlayerVirtualWorld(playerid);
	SetVehicleVirtualWorld(tutbike, playersvw);
	tutbike = CreateVehicle(481, 2256.7861,-1263.1980,23.4870,273.2590, 3, 3, -1);
	GetVehicleParamsEx(tutbike, iEngine, iLights, iAlarm, iDoors, iBonnet, iBoot, iObjective);
	SetVehicleParamsEx(tutbike, iEngine, iLights, iAlarm, 1, iBonnet, iBoot, iObjective);
	SetPlayerVirtualWorld(playerid, playerid + 1);



Re: Vehicle problem - AMouldyLemon - 10.07.2014

What do you want the code to do?


Re: Vehicle problem - Konstantinos - 10.07.2014

You need first to create the vehicle and then set the vehicle's virtual world (so you need to set and then get the player's virtual world or store it in a variable).


Re: Vehicle problem - Threshold - 10.07.2014

Also, by adding '1' to the player's virtual world, the player won't see the vehicle anyway because they will be in a different virtual world to the vehicle itself.

I'm not sure what the use of this code is for, but I'm going to have to make assumptions here.
pawn Код:
tutbike = CreateVehicle(481, 2256.7861, -1263.1980, 23.4870, 273.2590, 3, 3, -1);
    SetVehicleVirtualWorld(tutbike, GetPlayerVirtualWorld(playerid));
    GetVehicleParamsEx(tutbike, iEngine, iLights, iAlarm, iDoors, iBonnet, iBoot, iObjective);
    SetVehicleParamsEx(tutbike, iEngine, iLights, iAlarm, 1, iBonnet, iBoot, iObjective);
I'm also not sure whether the vehicle is meant to be created at "2256.7861, -1263.1980, 23.4870" or at the player's position. I'm sure that's something that you're capable of working out for yourself though.

Helpful Functions:
https://sampwiki.blast.hk/wiki/GetPlayerPos
https://sampwiki.blast.hk/wiki/CreateVehicle


Re: Vehicle problem - Konstantinos - 10.07.2014

If I understood correctly, he wants to set each player in their own virtual world (alone without other players) and so are their vehicles.

pawn Код:
new playersvw = playerid + 1;
SetPlayerVirtualWorld(playerid, playersvw);
tutbike = CreateVehicle(481, 2256.7861,-1263.1980,23.4870,273.2590, 3, 3, -1);
SetVehicleVirtualWorld(tutbike, playersvw);
GetVehicleParamsEx(tutbike, iEngine, iLights, iAlarm, iDoors, iBonnet, iBoot, iObjective);
SetVehicleParamsEx(tutbike, iEngine, iLights, iAlarm, 1, iBonnet, iBoot, iObjective);