[Help] Faction vehicle troubles (2.0)
#1

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.
Reply
#2

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

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
Reply
#4

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.
Reply
#5

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.
Reply
#6

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+
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)