SA-MP Forums Archive
Why it doesn't remove him? - 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: Why it doesn't remove him? (/showthread.php?tid=471947)



Why it doesn't remove him? - Tagathron - 26.10.2013

Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
	if (newstate==PLAYER_STATE_DRIVER)
	{
	    new vehID=GetPlayerVehicleID(playerid);
	    if (vehID==420)
	    {
	        RemovePlayerFromVehicle(playerid);
	        SendClientMessage(playerid, COLOUR_GRAY, "You must be a taxi driver to use this car.");
	    }
	}

	return 1;
}
It doesn't remove the player from the car when he enters a taxi vehicle.


Re: Why it doesn't remove him? - Jerm - 26.10.2013

Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
	if (newstate==PLAYER_STATE_DRIVER)
	{
	    new vehID=GetPlayerVehicleID(playerid);
	    new vehModel=GetVehicleModel(vehID);
	    if (vehModel==420)
	    {
	        RemovePlayerFromVehicle(playerid);
	        SendClientMessage(playerid, COLOUR_GRAY, "You must be a taxi driver to use this car.");
	    }
	}

	return 1;
}



Re: Why it doesn't remove him? - Tagathron - 26.10.2013

Thank you,i didn't know about GetVehicleModel() function at all,i thought GetPlayerVehicleID() does the thing that
GetVehicleModel() is doing.


Re: Why it doesn't remove him? - Jerm - 26.10.2013

no biggie you still need GetPlayerVehicleId in order to check the correct vehicle Model ID.

BTW: If you don't add anything else to "if (vehModel==420)" then even the cab drivers wont be able to enter