SA-MP Forums Archive
RemovePlayerFromVehicle function don't work? - 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: RemovePlayerFromVehicle function don't work? (/showthread.php?tid=372140)



RemovePlayerFromVehicle function don't work? - Vvolk - 25.08.2012

Hello sa-mp.com visiters! I started my own server and some players reported me about a bug in server. Then they don't work in job, they can drive this work cars and they don't get this message: SendClientMessage(playerid,0xFF0000FF,"This car only for police!");//Explained below.... And other players said that they can't do this. I think there is something wrong with function RemovePlayerFromVehicle(playerid); There is my code:

Код:
		if(JobVehicle[Job1][vehicleid])
		{
			if(Info[playerid][Job] == JOB1_JOB)
			{
				if(GetPlayerSkin(playerid) == JOB1_SKIN)
				{
					//There is some functions...
				}
				else
				{
					SendClientMessage(playerid,0xFF0000FF,"You have to wear police uniform!");
					RemovePlayerFromVehicle(playerid);
				}
			}
			else
			{
				SendClientMessage(playerid,0xFF0000FF,"This car only for police!");
				RemovePlayerFromVehicle(playerid);
			}
		}
This code under callback OnPlayerStateChange. Where can be problem?


Re: RemovePlayerFromVehicle function don't work? - Vince - 25.08.2012

Does not work in OnPlayerEnterVehicle because the player isn't in the vehicle yet. Use OnPlayerStateChange.


Re: RemovePlayerFromVehicle function don't work? - Vvolk - 25.08.2012

I use It in OnPlayerStateChange.


Re: RemovePlayerFromVehicle function don't work? - clarencecuzz - 25.08.2012

What are you using?
Код:
if(newstate == PLAYER_STATE_DRIVER)
??


Re: RemovePlayerFromVehicle function don't work? - Vvolk - 25.08.2012

Yes.


AW: RemovePlayerFromVehicle function don't work? - [Y]P90 - 25.08.2012

You could just put:
Код:
if(Info[playerid][Job] != JOB1_JOB) return //Eject and Message here.
And you would be saving a line there