SA-MP Forums Archive
Vehicle Spawner 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 Spawner problem (/showthread.php?tid=381475)



Vehicle Spawner problem - tommzy09 - 29.09.2012

Hey Guys, Beginning Scripter here, I've been fooling around with the base game mode Rivershell and
just been adding stuff onto it.

I'm having trouble with my car spawning command.

-When I spawn a Vehicle, it spawns on top of me.

I want to make it so that when I Spawn a Vehicle, I spawn inside of it as the Driver.

here is my snippet of code
i would really appreciate if someone could help me with this, also i use ZCMD.

Код:
CMD:v(playerid, params[])
{
	if (PlayerInfo[playerid][pAdmin] >= 2)
	{

		new
			iVehicle,
			iColors[2];

		if(sscanf(params, "iii", iVehicle, iColors[0], iColors[1]))
		{
			SendClientMessage(playerid, COLOR_PURPLE, "USAGE: /v [Car ID] [Colour 1] [Colour 2]");
		}
		else if(!(400 <= iVehicle <= 611))
		{
			SendClientMessage(playerid, COLOR_PURPLE, "No Such Vehicle Model (400 - 611)");
		}
		else if(!(0 <= iColors[0] <= 255 && 0 <= iColors[1] <= 255))
		{
			SendClientMessage(playerid, COLOR_PURPLE, "No Such Colour (0 - 255)");
		}

		new
            Float: fVehPos[4];
            
		GetPlayerPos(playerid, fVehPos[0], fVehPos[1], fVehPos[2]);
		GetPlayerFacingAngle(playerid, fVehPos[3]);
		CreateVehicle(iVehicle, fVehPos[0], fVehPos[1], fVehPos[2]+0.2, fVehPos[3], iColors[0], iColors[1], -1);
		return SendClientMessage(playerid, COLOR_PURPLE, "Your Vehicle Has Spawned!");
	}
	return 1;
}



Re: Vehicle Spawner problem - [HK]Ryder[AN] - 29.09.2012

Use PutPlayerInVehicle


Re: Vehicle Spawner problem - tommzy09 - 29.09.2012

I did, I used it right after CreateVehicle and it still spawns the car on top of me.