SA-MP Forums Archive
[Help] Faction vehicle troubles (2.0) - 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: [Help] Faction vehicle troubles (2.0) (/showthread.php?tid=489252)



[Help] Faction vehicle troubles (2.0) - BornHuman - 21.01.2014

Hi, all. I have a had a long working faction system for a long time and this used to work, but now it doesn't for some reason. Whenver you entered a vehicle, the script would check your faction and if you were not in Faction 1 then it would kick you out of the car. Observe:

Код:
new playerState = GetPlayerState(playerid);

    if(IsPlayerInVehicle(playerid, SFPDC1 && playerState == PLAYER_STATE_DRIVER))
    {
        if(Faction[playerid] != 1)
            return RemovePlayerFromVehicle(playerid);
    }
(Note: I know it should be under OnPlayerStateChange but I haven't had time so keep in mind it is under OnPlayerUpdate)

But it doesn't kick me out. I am not in Faction 1, so idk.

REPing for the answer.


Re: [Help] Faction vehicle troubles (2.0) - [TMS]Legena - 21.01.2014

Try to change this:
Код:
if(Faction[playerid] != 1)
to this:
Код:
if(Faction[playerid] == 1)
I hope it will work now.


Re: [Help] Faction vehicle troubles (2.0) - BornHuman - 21.01.2014

Quote:
Originally Posted by [TMS]Legena
Посмотреть сообщение
Try to change this:
Код:
if(Faction[playerid] != 1)
to this:
Код:
if(Faction[playerid] == 1)
I hope it will work now.
Nope. I can still drive it without being in Faction 1


Re: [Help] Faction vehicle troubles (2.0) - ikey07 - 21.01.2014

print(); to check if it actually remove you, put it under OnPlayerStateChange,and to remove from bikes, freeze player for a sec remove player and unfreeze it.


Re: [Help] Faction vehicle troubles (2.0) - Smally - 21.01.2014

pawn Код:
// Change
if(IsPlayerInVehicle(playerid, SFPDC1 && playerState == PLAYER_STATE_DRIVER))
// To
if(IsPlayerInVehicle(playerid, SFPDC1) && playerState == PLAYER_STATE_DRIVER)
You was closing the IsPlayerInVehicle too late.


Re: [Help] Faction vehicle troubles (2.0) - BornHuman - 21.01.2014

Quote:
Originally Posted by Smally
Посмотреть сообщение
pawn Код:
// Change
if(IsPlayerInVehicle(playerid, SFPDC1 && playerState == PLAYER_STATE_DRIVER))
// To
if(IsPlayerInVehicle(playerid, SFPDC1) && playerState == PLAYER_STATE_DRIVER)
You was closing the IsPlayerInVehicle too late.
Worked. REP+