18.04.2015, 14:52
(
Last edited by Alpay0098; 30/05/2015 at 01:47 PM.
)
Hi, I don't know what's problem but it seems that normal players can drive and get in some faction-restricted vehicles.
So , I put all these codes here. Please check them out and if you can , reply. thanks.
OnPlayerEnterVehicle Code :
* I've deleted some codes (Other Factions Codes)
IsACop Code :
IsACopCar Code :
* There's too many cars that defined like this : (FacInfo[1] ; 1 Is LSPD)
FacInfo[1][fCars][1] = CreateVehicle ...
And also it's about 2 month that I'm dealing with this problem.
So , I put all these codes here. Please check them out and if you can , reply. thanks.
OnPlayerEnterVehicle Code :
PHP Code:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
new Float:x, Float:y, Float:z;
if(GetPlayerSurfingVehicleID(playerid) == vehicleid)
{
new Float:hp;
GetPlayerHealth(playerid,hp);
GetPlayerPos(playerid, x, y, z);
if(!PlayerInfo[playerid][pMask]) format(string, sizeof(string), "* %s slipped off the top of the vehicle and fell.", PlayerRPName(playerid));
else format(string, sizeof(string), "* Gharibe slipped off the top of the vehicle and fell.");
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SetPlayerPos(playerid, x+3, y+3, z+1);
SetPlayerHealth(playerid,hp-3);
PlayerPlaySound(playerid, 1130, 0.0, 0.0, 0.0);
LoopingAnim(playerid,"PED","BIKE_fallR",4.0,0,1,1,1,0);
}
if(!ispassenger)
{
else if(IsACopCar(vehicleid))
{
if(!IsACop(playerid))
{
displayCenterHUDInfo(playerid, "You are not a member of the~n~~b~LSPD/FBI/SAST~w~.", 8);
PlayerPlaySound(playerid, 1058, 0.0, 0.0, 0.0);
ClearAnimations(playerid);
}
}
else if(PlayerTied[playerid] != 0) { ClearAnimations(playerid); }
else if(PlayerCuffed[playerid] != 0) { ClearAnimations(playerid); }
else if(PlayerFrozen[playerid] != 0) { ClearAnimations(playerid); }
else if(RapidResKitActive[playerid] != 0) { ClearAnimations(playerid); }
else if(PlayerJustDied[playerid] != 0) { ClearAnimations(playerid); }
return 1;
}
IsACop Code :
PHP Code:
stock IsACop(playerid)
{
if(IsPlayerConnected(playerid))
{
new leader = PlayerInfo[playerid][pLeader];
new member = PlayerInfo[playerid][pMember];
if(member==1 || member==2 || member==3)
{
return 1;
}
else if(leader==1 || leader==2 || leader==3)
{
return 1;
}
else if(IsAnAgent(playerid))
{
return 1;
}
}
return 0;
}
PHP Code:
stock IsACopCar(vehicleid)
{
for(new i; i<50; i++)
{
if(vehicleid == FacInfo[1][fCars][i])return 1;
}
return 0;
}
FacInfo[1][fCars][1] = CreateVehicle ...
I'll +Rep for the best answer.
And also it's about 2 month that I'm dealing with this problem.