SA-MP Forums Archive
Force player into car - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Force player into car (/showthread.php?tid=112625)



Force player into car - kylebrown - 09.12.2009

Whats the code to force the player into a car?
i need for my spawn car command
the car spwans from the player at X:0 Y:10 Z:=playeridZ

thanks


Re: Force player into car - lolumadd - 09.12.2009

pawn Код:
PutPlayerInVehicle(vehicleid, playerid, seatid);
0 is driver
1 is front passenger
2 & 3 are the back two seats (if available)


Re: Force player into car - kylebrown - 09.12.2009

thanks

just one more qustion how whould i put this in to this
Код:
	if(strcmp(cmd, "/yadayada", true) == 0) {
 	new Float:x, Float:y, Float:z;
	GetPlayerPos(playerid, x, y, z);
	CreateVehicle(520, x, y, z, 82.2873, 0, 1, 60);

  	return 1;
	}



Re: Force player into car - lolumadd - 09.12.2009

Quote:
Originally Posted by kylebrown
thanks

just one more qustion how whould i put this in to this
Код:
	if(strcmp(cmd, "/yadayada", true) == 0) {
 	new Float:x, Float:y, Float:z, vehicle;
	GetPlayerPos(playerid, x, y, z);
	vehicle = CreateVehicle(520, x, y, z, 82.2873, 0, 1, 60);
PutPlayerInVehicle(vehicle, playerid, 0);
  	return 1;
	}



Re: Force player into car - kylebrown - 09.12.2009

Thanks
need that code

EDIT: its not working, it just spwans the hydra on my head!
Код:
	if(strcmp(cmd, "/Hydra", true) == 0) {
 		new Float:x, Float:y, Float:z, vehicle;
		GetPlayerPos(playerid, x, y, z);
		vehicle = CreateVehicle(520, x, y, z, 82.2873, 0, 1, 60);
		PutPlayerInVehicle(vehicle, playerid, 0);
	return 1;
	}



Re: Force player into car - Zeromanster - 09.12.2009

Try this:

pawn Код:
if(strcmp(cmd, "/Hydra", true) == 0)
{
  new Float:x, Float:y, Float:z, vehicle;
  GetPlayerPos(playerid, x, y, z);
  PutPlayerInVehicle(playerid,CreateVehicle(520, x, y, z, 82.2873, 0, 1, 60),0);
  return 1;
}



Re: Force player into car - Daren_Jacobson - 09.12.2009

Quote:
Originally Posted by lolumadd [cod5server.tk
]
pawn Код:
PutPlayerInVehicle(vehicleid, playerid, seatid);
0 is driver
1 is front passenger
2 & 3 are the back two seats (if available)
4 is the next available seat.


Re: Force player into car - kylebrown - 09.12.2009

thanks and it work! yay

How do you stop the hydra from respawning? without useing
Код:
public OnPlayerExitVehicle
     new currentveh;
     currentveh = GetPlayerVehicleID(playerid);
     DestroyVehicle(currentveh);



Re: Force player into car - kylebrown - 09.12.2009

bumpz, please need help



Re: Force player into car - miokie - 09.12.2009

Quote:
Originally Posted by kylebrown
thanks and it work! yay

How do you stop the hydra from respawning? without useing
Код:
public OnPlayerExitVehicle
     new currentveh;
     currentveh = GetPlayerVehicleID(playerid);
     DestroyVehicle(currentveh);
Use OnVehicleDeath? Store the vehicleid when you create it and when it dies Destroy it.