SA-MP Forums Archive
How i can make the only soldier class, who able drive rhino? - 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 i can make the only soldier class, who able drive rhino? (/showthread.php?tid=457579)



How i can make the only soldier class, who able drive rhino? - qazwsx - 12.08.2013

Hey guys, i need help here...
So the points, i want just only soldier class who will able to drive rhino.

So here is my codes:
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(GetVehicleModel(vehicleid) == 432 &&  gPlayerClass[playerid] == SNIPER && gPlayerClass[playerid] == PILOT)
    {
        SendClientMessage(playerid, COLOR_BRIGHTRED, "You need to be soldier to able drive rhino tank");
        RemovePlayerFromVehicle(playerid);
    }
    return 1;
}
Below are my codes.
When i tested it, and tried to get in to rhino, the player is keeping stay inside the rhino, and doesnt send any error message?

Anyone can help me please?


Re: How i can make the only soldier class, who able drive rhino? - RowdyrideR - 12.08.2013

Use

Quote:

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(GetVehicleModel(vehicleid) == 432 && gPlayerClass[playerid] == SNIPER || gPlayerClass[playerid] == PILOT)
{
SendClientMessage(playerid, COLOR_BRIGHTRED, "You need to be soldier to able drive rhino tank");
RemovePlayerFromVehicle(playerid);
}
return 1;
}

or just

Quote:

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(GetVehicleModel(vehicleid) == 432 && gPlayerClass[playerid] != SOLDIER)
{
SendClientMessage(playerid, COLOR_BRIGHTRED, "You need to be soldier to able drive rhino tank");
RemovePlayerFromVehicle(playerid);
}
return 1;
}




Re: How i can make the only soldier class, who able drive rhino? - dEcooR - 12.08.2013

Try it maybe it helps you.

Код:
#define SNIPER 0
#define PILOT 1
#define SOLDIER 2

public OnPlayerRequestClass(playerid,classid)
{
       if(classid == x || classid == x)
       {
              gPlayerClass[playerid] = SOLDIER;
       }
       return 1;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(GetVehicleModel(vehicleid) == 432 && gPlayerClass[playerid] == SOLDIER) SendClientMessage(playerid, COLOR_BRIGHTRED, "Ok,enjoy your car!");
    else
    {
           SendClientMessage(playerid, COLOR_BRIGHTRED, "You need to be soldier to able drive rhino tank");
           RemovePlayerFromVehicle(playerid);
           return 1;
    }
    return 1;
}



Re: How i can make the only soldier class, who able drive rhino? - qazwsx - 12.08.2013

Quote:
Originally Posted by RowdyrideR
Посмотреть сообщение
Use



or just
Still not working :/


Re: How i can make the only soldier class, who able drive rhino? - Raza2013 - 12.08.2013

I Know Bro You Are Using COD-WAW

Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(GetVehicleModel(vehicleid) == 432 && gPlayerClass[playerid] == Assault) SendClientMessage(playerid, COLOR_BRIGHTRED, "Blam Blam Blam!!
    else
    {
           SendClientMessage(playerid, red, "ERROR: You need to be soldier to able drive rhino tank");
           RemovePlayerFromVehicle(playerid);
           return 1;
    }
    return 1;
}



Re: How i can make the only soldier class, who able drive rhino? - qazwsx - 12.08.2013

Still not working :/


Re: How i can make the only soldier class, who able drive rhino? - NinjahZ - 12.08.2013

Use on playerstatechange if new state == driver etc and just add your code there cause its only going to show with your code if you are trying to enter the passenger seat :P


Re: How i can make the only soldier class, who able drive rhino? - NinjahZ - 12.08.2013

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    new vehicleid = GetPlayerVehicleID(playerid);//variable to get vehicle ids
    if(GetVehicleModel(vehicleid) == 425 && gPlayerClass[playerid] == SOLDIER && gPlayerClass[playerid] == SNIPER && gPlayerClass[playerid] == ENGINEER && gPlayerClass[playerid] == JETTROOPER && gPlayerClass[playerid] == SPY)//if player is pilot then he can drive
    {
        SendClientMessage(playerid, COLOR_RED, "You Need to  be a Pilot to fly Hunter");//messages goes to the player that he can't drive the hunter
        RemovePlayerFromVehicle(playerid);//get u off from the hunter
    }

    if(GetVehicleModel(vehicleid) == 425 && gPlayerClass[playerid] == SOLDIER && gPlayerClass[playerid] == SNIPER && gPlayerClass[playerid] == ENGINEER && gPlayerClass[playerid] == JETTROOPER && gPlayerClass[playerid] == SPY)//if player is pilot then he can drive
    {
        SendClientMessage(playerid, COLOR_RED, "You Need to  be a Pilot to fly Hydra");//messages goes to the player that he can't drive the hydra
        RemovePlayerFromVehicle(playerid);//get u off from the hydra
    }

    if(GetVehicleModel(vehicleid) == 425 && gPlayerClass[playerid] == PILOT && gPlayerClass[playerid] == SNIPER && gPlayerClass[playerid] == ENGINEER && gPlayerClass[playerid] == JETTROOPER && gPlayerClass[playerid] == SPY)//if player is Soldier then he can drive
    {
        SendClientMessage(playerid, COLOR_RED, "You Need to  be a Soldier to drive Tank");//messages goes to the player that he can't drive the tank or rhino
        RemovePlayerFromVehicle(playerid);//get u off from the tank or rhino
    }

    if(GetVehicleModel(vehicleid) == 425 && gPlayerClass[playerid] == SOLDIER && gPlayerClass[playerid] == SNIPER && gPlayerClass[playerid] == ENGINEER && gPlayerClass[playerid] == JETTROOPER && gPlayerClass[playerid] == SPY)//if player is pilot then he can drive
    {
        SendClientMessage(playerid, COLOR_RED, "You Need to  be a Pilot to fly Sea Sparrow");/messages goes to the player that he can't drive the tank or sea sparrow
        RemovePlayerFromVehicle(playerid);//get u off from the sea sparrow
    }
}