Vehicle problem
#1

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);
Reply
#2

What do you want the code to do?
Reply
#3

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).
Reply
#4

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
Reply
#5

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);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)