Problem with license thing - 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: Problem with license thing (
/showthread.php?tid=401854)
Problem with license thing -
bensmart469 - 24.12.2012
I have made my own pilot license script, but the problem is, that it is bugged. (before you ask the code that i put under onplayerentervehicle is below) The thing that is bugged is that it allows the person to enter the plane even if the person doesn't have a license. Anyone know how to fix this?
Code:
PHP код:
//under onplayerentervehicle
if(IsAPlane(vehicleid))
{
if(PlayerInfo[playerid][pPilotLic] < 1)
{
new Float:pos[3];
GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
SendClientMessage(playerid, COLOR_ORANGE, "You cannot use this vehicle.");
}
}
Re: Problem with license thing -
Vince - 24.12.2012
Use ClearAnimations() instead of Get/SetPlayerPos. Or use the OnPlayerStateChange callback.
Re: Problem with license thing -
bensmart469 - 24.12.2012
Still nothing
Re: Problem with license thing -
Mike_Peterson - 24.12.2012
Just a guess but,
replace
pawn Код:
SendClientMessage(playerid, COLOR_ORANGE, "You cannot use this vehicle.");
with
pawn Код:
return SendClientMessage(playerid, COLOR_ORANGE, "You cannot use this vehicle.");
Re: Problem with license thing -
bensmart469 - 24.12.2012
Did that, still got nothing
(didn't even receive the message)
Re: Problem with license thing -
Mike_Peterson - 24.12.2012
Well, I read this thread:
https://sampforum.blast.hk/showthread.php?tid=362499&page=2
It's better if you kick him out of the vehicle once his state changed to driver.
Re: Problem with license thing -
SKAzini - 24.12.2012
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
new vehicle = GetVehicleModel(GetPlayerVehicleID(playerid));
if(IsAPlane(vehicle))
{
if(PlayerInfo[playerid][pPilotLic] < 1)
{
new Float:pos[3];
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_ORANGE, "You cannot use this vehicle.");
}
}
}
return 1;
}
Re: Problem with license thing -
bensmart469 - 24.12.2012
Didn't work
Re: Problem with license thing -
bensmart469 - 24.12.2012
Never mind, added a bit of extra code, now it works, please lock this