SA-MP Forums Archive
[HELP] Faction Cars - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] Faction Cars (/showthread.php?tid=188395)



[HELP] Faction Cars - Fredden1993 - 07.11.2010

This script used to work like a charm until I did something wrong and now it blocks you from entering 'any' vehicle, even vehicles spawned by the debug script.

Please have a look if you find something...

pawn Код:
enum FactionCars
{
    fc1,
    fc2,
    fc3,
    fc4,
    fc5,
}
new FactionCar[FactionCars];

//-------------------------------------------------------------------------------------------
FactionCar[fc1] = AddStaticVehicleEx(598,2285.9214,2430.8110,3.0213,359.5193,0,1,3600); // Police Cruiser
//-------------------------------------------------------------------------------------------
FactionCar[fc2] = AddStaticVehicleEx(598,-210.7925,999.8816,19.4111,89.8037,0,1,3600); // Sheriff Cruiser
//-------------------------------------------------------------------------------------------
FactionCar[fc3] = AddStaticVehicleEx(598,2558.0076,2790.7627,10.5636,180.7760,1,1,3600); // Prison Cruiser
FactionCar[fc4] = AddStaticVehicleEx(431,2511.4521,2785.7664,10.9246,153.1390,1,1,3600); // Prison Bus
FactionCar[fc5] = AddStaticVehicleEx(497,2617.4951,2720.3389,36.7155,310.2184,1,1,3600); //Prison Helicopter
//-------------------------------------------------------------------------------------------

//I get kicked out pf this vehicles when trying to enter them...
AddStaticVehicleEx(577,1597.3873,1564.5188,10.7354,193.9565,1,1,3600); // Airplane
AddStaticVehicleEx(577,1552.0261,1537.2712,10.7419,256.2767,1,1,3600); // Airplane
AddStaticVehicleEx(577,1560.9110,1482.9185,10.7431,307.4450,1,1,3600); // Airplane

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == 2)
    {
        new CarCheck = GetPlayerVehicleID(playerid);

        if(CarCheck == FactionCar[fc1])
        {
            if(PlayerInfo[playerid][pTeam] != 1 && PlayerInfo[playerid][pLeader] != 1)
            {
                SendClientMessage(playerid, COLOR_WHITE,"You are not allowed to enter this vehicle. (Faction-Vehicle)");
                RemovePlayerFromVehicle(playerid);
                return 1;
            }
            else
            {
                return 1;
            }
        }
        else if(CarCheck == FactionCar[fc2])
        {
            if(PlayerInfo[playerid][pTeam] != 2 && PlayerInfo[playerid][pLeader] != 2)
            {
                SendClientMessage(playerid, COLOR_WHITE,"You are not allowed to enter this vehicle. (Faction-Vehicle)");
                RemovePlayerFromVehicle(playerid);
                return 1;
            }
            else
            {
                return 1;
            }
        }
        else if(CarCheck == FactionCar[fc3] || FactionCar[fc4] || FactionCar[fc5])
        {
            if(PlayerInfo[playerid][pTeam] != 3 && PlayerInfo[playerid][pLeader] != 3)
            {
                SendClientMessage(playerid, COLOR_WHITE,"You are not allowed to enter this vehicle. (Faction-Vehicle)");
                RemovePlayerFromVehicle(playerid);
                return 1;
            }
            else
            {
                return 1;
            }
        }
        return 1;
    }
    return 1;
}



Re: [HELP] Faction Cars - gr56 - 07.11.2010

pawn Код:
else if(CarCheck == FactionCar[fc3] || FactionCar[fc4] || FactionCar[fc5])
change it to
pawn Код:
else if(CarCheck == FactionCar[fc3] || CarCheck == FactionCar[fc4] || CarCheck == FactionCar[fc5])



Re: [HELP] Faction Cars - Fredden1993 - 07.11.2010

Quote:
Originally Posted by gr56
Посмотреть сообщение
pawn Код:
else if(CarCheck == FactionCar[fc3] || FactionCar[fc4] || FactionCar[fc5])
change it to
pawn Код:
else if(CarCheck == FactionCar[fc3] || CarCheck == FactionCar[fc4] || CarCheck == FactionCar[fc5])
Thanks, have a good one!