What's wrong with this code? - 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: What's wrong with this code? (
/showthread.php?tid=512331)
What's wrong with this code? -
NoahF - 10.05.2014
Ok, what's wrong with this code?
PHP код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new vehicleid = GetVehicleModel(vehicleid);
if(vehicleid) == 487)
{
if(isPilot[playerid] == 1)
{
if(newstate == 2)
{
PutPlayerInVehicle(playerid, vehicleid, 0);
}
else
{
SendClientMessage(playerid, COLOR_RED, "You must be the Pilot class to fly helicopters.");
RemovePlayerFromVehicle(playerid);
}
}
return 1;
}
Re: What's wrong with this code? -
Matess - 10.05.2014
Maybe because you are removing the player from vehicle when he is still only entering vehicle? Try it with TogglePlayerControlable
Re: What's wrong with this code? -
NoahF - 10.05.2014
Edited the original post^^
Re: What's wrong with this code? -
Konstantinos - 10.05.2014
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if (newstate == PLAYER_STATE_DRIVER)
{
if (GetVehicleModel(GetVehiclePlayerID(playerid)) == 487)
{
if (!isPilot[playerid])
{
SendClientMessage(playerid, COLOR_RED, "You must be the Pilot class to fly helicopters.");
RemovePlayerFromVehicle(playerid);
}
}
}
return 1;
}
Re: What's wrong with this code? -
NoahF - 10.05.2014
That works perfectly. Thank you guys!!