Car error
#1

trying to forbid players that are not in the faction to enter a car, and its not working.

Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_PASSENGER)
    {
        new v = GetPlayerVehicleID(playerid);
        
        if(VehPD(v) && PI[playerid][Member] != 1 && PI[playerid][Leader] != 1)
        {
			SCM(playerid, GREY, "You don't have the keys");
			RemovePlayerFromVehicle(playerid);
		}
  		else if(VehNSA(v) && PI[playerid][Member] != 2 && PI[playerid][Leader] != 2)
        {
			SCM(playerid, GREY, "You don't have the keys");
			RemovePlayerFromVehicle(playerid);
		}
	}
	return 1;
}
Reply
#2

Why dont use OnPlayerEnterVehicle ?
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(!ispassenger)
    {
        if(VehPD(vehicleid) && PI[playerid][Member] != 1 && PI[playerid][Leader] != 1)
        {
            SCM(playerid, GREY, "You don't have the keys");
            RemovePlayerFromVehicle(playerid);
        }
        else if(VehNSA(vehicleid) && PI[playerid][Member] != 2 && PI[playerid][Leader] != 2)
        {
            SCM(playerid, GREY, "You don't have the keys");
            RemovePlayerFromVehicle(playerid);
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: