OnPlayerEnterVehicle help - 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: OnPlayerEnterVehicle help (
/showthread.php?tid=475181)
OnPlayerEnterVehicle help -
EthanMason - 11.11.2013
Hello guys, i made a job script ..it has been compiled successfuly but one problem is !
Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if (GetVehicleModel(GetPlayerVehicleID(playerid)) == 448)
{
if ((Pizzajob) == 1)
{
SendClientMessage(playerid,0xF5FF00FF, "[JOBHELP]:Use /deliverpizza to start your job");
}
else if ((Pizzajob) == 0)
{
RemovePlayerFromVehicle(playerid);
}
}
}
When Pizzajob = 1 i recieve the message but when Pizzajob = 0 the play won't be ejected :/
Re: OnPlayerEnterVehicle help -
Konstantinos - 11.11.2013
OnPlayerEnterVehicle is called when a player
starts to enter a vehicle, so the player is not in yet. Use OnPlayerStateChange instead.
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
if (GetVehicleModel(GetPlayerVehicleID(playerid)) == 448)
{
if (Pizzajob == 1) SendClientMessage(playerid,0xF5FF00FF, "[JOBHELP]:Use /deliverpizza to start your job");
else if (Pizzajob == 0) RemovePlayerFromVehicle(playerid);
}
}
return 1;
}
Re: OnPlayerEnterVehicle help -
CJay9209 - 12.11.2013
or you could simply use the code you have there and change the check to use vehicleid instead - also remove the brackets around Pizzajob:
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if (GetVehicleModel(vehicleid) == 448) {
if ((Pizzajob) == 1) {
SendClientMessage(playerid,0xF5FF00FF, "[JOBHELP]: Use /deliverpizza to start your job");
}
else {
new Float:pos[3];
GetPlayerPos(playerid,pos[0],pos[1],pos[2]);
SetPlayerPos(playerid,pos[0],pos[1],pos[2]);
SendClientMessage(playerid,0xF5FF00FF, "[JOBHELP]: Prevented from entering Vehicle. You are not currently employed in Pizza Delivery");
}
}
}
this code simply stops the person from entering completely