OnPlayerEnterVehicle
#1

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 :
PHP Code:
public OnPlayerEnterVehicle(playeridvehicleidispassenger)
{
    new 
Float:xFloat:yFloat:z;
    if(
GetPlayerSurfingVehicleID(playerid) == vehicleid)
    {
        new 
Float:hp;
        
GetPlayerHealth(playerid,hp);
           
GetPlayerPos(playeridxyz);
        if(!
PlayerInfo[playerid][pMask]) format(stringsizeof(string), "* %s slipped off the top of the vehicle and fell."PlayerRPName(playerid));
        else 
format(stringsizeof(string), "* Gharibe slipped off the top of the vehicle and fell.");
        
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        
SetPlayerPos(playeridx+3y+3z+1);
        
SetPlayerHealth(playerid,hp-3);
        
PlayerPlaySound(playerid11300.00.00.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(playerid10580.00.00.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;

* I've deleted some codes (Other Factions Codes)
IsACop Code :
PHP Code:
stock IsACop(playerid)
{
    if(
IsPlayerConnected(playerid))
    {
        new 
leader PlayerInfo[playerid][pLeader];
        new 
member PlayerInfo[playerid][pMember];
        if(
member==|| member==|| member==3)
        {
            return 
1;
        }
        else if(
leader==|| leader==|| leader==3)
        {
            return 
1;
        }
        else if(
IsAnAgent(playerid))
        {
            return 
1;
        }
    }
    return 
0;

IsACopCar Code :
PHP Code:
stock IsACopCar(vehicleid)
{
    for(new 
ii<50i++)
    {
        if(
vehicleid == FacInfo[1][fCars][i])return 1;
    }
    return 
0;

* There's too many cars that defined like this : (FacInfo[1] ; 1 Is LSPD)
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.
Reply


Messages In This Thread
OnPlayerEnterVehicle - by Alpay0098 - 18.04.2015, 14:52
Re: OnPlayerEnterVehicle - by Fel486 - 18.04.2015, 15:11
Re: OnPlayerEnterVehicle - by fuckingcruse - 18.04.2015, 15:22
Re: OnPlayerEnterVehicle - by Alpay0098 - 19.04.2015, 14:14
Re: OnPlayerEnterVehicle - by fuckingcruse - 19.04.2015, 14:30
Re: OnPlayerEnterVehicle - by Alpay0098 - 19.04.2015, 14:51
Re: OnPlayerEnterVehicle - by fuckingcruse - 19.04.2015, 14:52
Re: OnPlayerEnterVehicle - by Threshold - 19.04.2015, 15:01
Re: OnPlayerEnterVehicle - by Alpay0098 - 19.04.2015, 15:13
Re: OnPlayerEnterVehicle - by Threshold - 19.04.2015, 15:21

Forum Jump:


Users browsing this thread: 5 Guest(s)