18.12.2013, 21:27
hi- I'm currently using OnPlayerenterVehicle, but this check I have, isn't working.
It's set so if you're on aduty, it will let you in. But no matter what, if you're not in the faction, you can still enter it.
Can't understand why.
GetVehFaction code:
IsFactionVehicle code:
Код:
if(IsFactionVehicle(vehicleid) && PlayerInfo[playerid][pFac] != GetVehFaction(vehicleid)) { new car[128]; if(AdminDuty[playerid] == 1) return 1; if(CarPerm[playerid] == 1) return 1; new Float:pos[3]; GetPlayerPos(playerid, pos[0], pos[1], pos[2]); SetPlayerPos(playerid, pos[0], pos[1], pos[2]); format(car,sizeof(car),"You can't enter this vehicle. (%s Vehicle)", FacInfo[GetVehFaction(vehicleid)][facDep]); SendClientMessage(playerid, COLOR_WHITE, car); }
Can't understand why.
GetVehFaction code:
Код:
stock GetVehFaction(vehicleid) { new faction; for(new i=0; i<MAX_FCARS; i++) { for(new f=0; f<MAX_FACTIONS; f++) { if(vehicleid == FacInfo[f][fCars][i]) return 1; { faction = f; } } } return faction; }
Код:
stock IsFactionVehicle(vehicleid) { for(new i=0; i<MAX_FCARS; i++) { for(new f=0; f<MAX_FACTIONS; f++) { if(vehicleid == FacInfo[f][fCars][i]) return 1; if(f == 0) return 0; } } return 0; }