OnPlayerEnterVehicle bug
#1

Hi,
This code doesn't work. (except IsACopCar and IsTruckerCar) Does it have any problem?
PHP код:
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)
    {
        if(
IsACopCar(vehicleid))
        {
            if(!
IsACop(playerid))
            {
                
displayCenterHUDInfo(playerid,  "You are not a member of the~n~~b~LSPD/FBI/SAST~w~."8); //display for 8 seconds
                
PlayerPlaySound(playerid10580.00.00.0);
                
ClearAnimations(playerid);
            }
        }
        else if(
IsTruckerCar(vehicleid))
        {
            if(
PlayerInfo[playerid][pJob] != 18)
            {
                
displayCenterHUDInfo(playerid,  "You are not a~n~~r~Trucker Driver~w~."8); //display for 8 seconds
                
PlayerPlaySound(playerid10580.00.00.0);
                
ClearAnimations(playerid);
            }
            else
               {
                
CP[playerid] = CHECKPOINT_TRUCKERLOAD;
                
SetPlayerCheckpoint(playerid,1037.4570,-1105.8281,23.9771,4);
            }
        }
        else if(
IsADLTCar(vehicleid))
        {
            if(
IsPlayerGivingDTest[playerid] == 0)
            {
                
displayCenterHUDInfo(playerid,  "Shoma hazineye Test ra pardakht nakardid!"8); //display for 8 seconds
                
PlayerPlaySound(playerid10580.00.00.0);
                
ClearAnimations(playerid);
            }
            else
            {
                
CP[playerid] = CHECKPOINT_DLTSTART;
                
SetPlayerCheckpoint(playerid,1700.4584,-1589.6927,13.3699,4);
            }
        }
        else if(
IsANGCar(vehicleid))
        {
            if(!
IsANG(playerid))
            {
                
displayCenterHUDInfo(playerid,  "You are not a member of the~n~~g~National Guard~w~."8); //display for 8 seconds
                
PlayerPlaySound(playerid10580.00.00.0);
                
ClearAnimations(playerid);
            }
        }
        else if(
IsAFBICar(vehicleid))
        {
            if(!
IsAFBI(playerid))
            {
                   
displayCenterHUDInfo(playerid,  "You are not a member of the~n~~b~FBI~w~."8); //display for 8 seconds
                
PlayerPlaySound(playerid10580.00.00.0);
                
ClearAnimations(playerid);
            }
        }
        else if(
IsATaxiCar(vehicleid) || IsABus(vehicleid))
        {
            if(
PlayerInfo[playerid][pMember] != 10 && PlayerInfo[playerid][pJob] != 14)
            {
                
displayCenterHUDInfo(playerid,  "You are not a~n~~y~Taxi Driver~w~."8); //display for 8 seconds
                
PlayerPlaySound(playerid10580.00.00.0);
                
GetPlayerPos(playeridxyz);
                
SetPlayerPos(playeridxyz);
            }
        }
        else if(
IsANewsCar(vehicleid))
        {
            if(
PlayerInfo[playerid][pMember] != && !IsAnAgent(playerid))
            {
                
displayCenterHUDInfo(playerid,  "You are not a member of the~n~~b~News Agency~w~."8); //display for 8 seconds
                
PlayerPlaySound(playerid10580.00.00.0);
                
GetPlayerPos(playeridxyz);
                
SetPlayerPos(playeridxyz);
            }
        }
        else if(
IsAnAmbulance(vehicleid))
        {
            if(
PlayerInfo[playerid][pMember] != && !IsAnAgent(playerid))
            {
                   
displayCenterHUDInfo(playerid,  "You are not a member of the~n~~r~LSMFD~w~."8); //display for 8 seconds
                
PlayerPlaySound(playerid10580.00.00.0);
                
GetPlayerPos(playeridxyz);
                
SetPlayerPos(playeridxyz);
            }
        }
        else if(
IsAVipCar(vehicleid))
        {
            if(
IsABronzeCar(vehicleid) && PlayerInfo[playerid][pDonateRank] <= 0)
            {
                   
displayCenterHUDInfo(playerid,  "~w~You are not a~n~~y~Bronze ~p~VIP~w~."8); //display for 8 seconds
                
PlayerPlaySound(playerid10580.00.00.0);
                
GetPlayerPos(playeridxyz);
                
SetPlayerPos(playeridxyz);
            }
            if(
IsASilverCar(vehicleid) && PlayerInfo[playerid][pDonateRank] <= 1)
             {
                
displayCenterHUDInfo(playerid,  "~w~You are not a ~b~~h~~h~~h~Silver ~p~VIP~w~."8); //display for 8 seconds
                
PlayerPlaySound(playerid10580.00.00.0);
                
GetPlayerPos(playeridxyz);
                
SetPlayerPos(playeridxyz);
            }
            if(
IsAGoldCar(vehicleid) && PlayerInfo[playerid][pDonateRank] <= 2)
            {
                      
displayCenterHUDInfo(playerid,  "~w~You are not a~n~~y~Gold ~p~VIP~w~."8); //display for 8 seconds
                
PlayerPlaySound(playerid10580.00.00.0);
                
GetPlayerPos(playeridxyz);
                
SetPlayerPos(playeridxyz);
            }
        }
        else if(
RapidResKitActive[playerid] == 1)
        {
            if(!
ispassenger || ispassenger)
            {
                
SendClientMessage(playeridCOLOR_GREY"You can't enter a vehicle while using a rapid response kit, '/droprrk' in order to drop it.");
                
PlayerPlaySound(playerid10580.00.00.0);
                
GetPlayerPos(playeridxyz);
                
SetPlayerPos(playeridxyz);
            }
        }
        for(new 
04i++)
        {
            if(
FacInfo[6][fCars][i] == vehicleid)
            {
                if(!
IsASenate(playerid) && !IsAnAgent(playerid))
                {
                    
displayCenterHUDInfo(playerid,  "You are not a member of the~n~~r~Senate~w~."8); //display for 8 seconds
                    
PlayerPlaySound(playerid10580.00.00.0);
                    
GetPlayerPos(playeridxyz);
                    
SetPlayerPos(playeridxyz);
                }
            }
        }
    }
      new 
Model GetVehicleModel(vehicleid);
    if(
Model == 427 && !ispassenger)
    {
        
GetPlayerArmour(playeridStoreArmour[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;

Reply
#2

Can you provide us some more details about functions you use in that callback, such as IsTruckerCar and so...
From this peace of code i can't see where is the problem.
Try with adding debug messages under every if statement so you can see where is you script failing...
Reply
#3

Ah yes, It's about two different type of working/not working CAR functions :
IsACopCar (Working) :
PHP код:
stock IsACopCar(vehicleid)
{
    for(new 
ii<33i++)
    {
        if(
vehicleid == PoliceVeh[i]) return 1;
    }
    return 
0;

IsANGCar (Not Working) :
PHP код:
stock IsANGCar(vehicleid)
{
    for(new 
ii<65i++)
    {
        if(
vehicleid == NGVeh[i]) return 1;
    }
    return 
0;

And about player's Membership , There's not any problem.
And also about Array sizes , There's not any problem again ... (As I said on Skype)
Reply
#4

Age old problem with godfather edits because it relies completely on assumptions. Basically, if you add vehicles anywhere but at the end of the list, your gamemode will royally screw up.
Reply
#5

So what I have to do @Vince?
Reply
#6

It's so weired to me.
This code looks works properly but it's not ...
and also I don't know why it works for just Trucker and Cop cars ...
Reply
#7

Someone please answer!
Reply
#8

It seems no one can't help ...
Anybody else?
Reply
#9

Nobody gives a fuck because you are just using a downloaded script. Scripting help is for people who know how to script and have a problem not for people to fix downloaded gamemodes ask the person who released the gamemode to help you.
Reply
#10

If I knew who released this shit ...
And also , If you don't know something about how to fix it, Please get out and stop spamming and let helpers breath to think how to fix it. Ok buddy?
EDIT : I'm not that bad in scripting.
If It was a normal problem, You're right. But just check my code! This shit's strange!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)