SA-MP Forums Archive
How to - 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)
+--- Thread: How to (/showthread.php?tid=454842)



How to - semaj - 30.07.2013

I have this for my factions but it only checks if you in one faction, how would i get it to check more than one faction for more than one vehicle type like (LSFDVehicles) witch wold be faction 2?

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    for(new i = 0; i < 31; i++) //Loop.  It counts to 11
    { //Open Bracket
        if(vehicleid == LSPDVehicles[i]) //If the vehicleid is an LSPD vehicle
        { //Open Bracket
            if(PlayerInfo[playerid][Faction] != 1) //If the player is not in faction 1 (LSPD, in this case)
            { //Open Bracket
                ClearAnimations(playerid); //Clears their animation, preventing them from entering the vehicle.
                SendClientMessage(playerid, -1, "You don`t have the keys for this car."); //Sends a message to the player that he cannot enter it.
            } //Closed Bracket
        } //Closed Bracket
    } //Closed Bracket
    return 1; //Return a value
}



Re: How to - Kutter - 30.07.2013

SAMP Wiki:

Quote:
Originally Posted by Wiki SAMP
if (a == 5 || b != 3)
{
print("Will be printed");
}



Re: How to - semaj - 30.07.2013

i dont understand that


Re: How to - semaj - 31.07.2013

can any one help?


Re: How to - Facerafter - 31.07.2013

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    for(new i = 0; i < 31; i++) //Loop.  It counts to 11
    { //Open Bracket
        if(vehicleid == LSPDVehicles[i]) //If the vehicleid is an LSPD vehicle
        { //Open Bracket
            if(PlayerInfo[playerid][Faction] != 1) //If the player is not in faction 1 (LSPD, in this case)
            { //Open Bracket
                ClearAnimations(playerid); //Clears their animation, preventing them from entering the vehicle.
                SendClientMessage(playerid, -1, "You don`t have the keys for this car."); //Sends a message to the player that he cannot enter it.
            } //Closed Bracket
        }
        if(vehicleid == LSFDVehicles[i])
        {
            if(PlayerInfo[playerid][Faction] != 2)
            {
                ClearAnimations(playerid);
                SendClientMessage(playerid, -1, "You don`t have the keys for this car.");
            }
        }
    } //Closed Bracket
    return 1; //Return a value
}