[HELP] class help - 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: [HELP] class help (
/showthread.php?tid=563060)
[HELP] class help -
usamahifi - 13.02.2015
hey guys can u help me a bit? i have a problem in class
every one can drive special vehicles like hunter, rhino, and sea sparrow
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new vehicleid = GetPlayerVehicleID(playerid);//variable to get vehicle ids
if(GetVehicleModel(vehicleid) == 425 && gPlayerClass[playerid] == ASSAULT && gPlayerClass[playerid] == SNIPER && gPlayerClass[playerid] == MEDIC && gPlayerClass[playerid] == ENGINEER && gPlayerClass[playerid] == SPY && gPlayerClass[playerid] == SPECIAL_FORCE)//if player is pilot then he can drive
{
SendClientMessage(playerid, COLOR_RED, "You Need to be an Airforce 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) == 520 && gPlayerClass[playerid] == ASSAULT && gPlayerClass[playerid] == SNIPER && gPlayerClass[playerid] == MEDIC && gPlayerClass[playerid] == ENGINEER && gPlayerClass[playerid] == SPY && gPlayerClass[playerid] == SPECIAL_FORCE)//if player is pilot then he can drive
{
SendClientMessage(playerid, COLOR_RED, "You Need to be an Airforce 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) == 432 && gPlayerClass[playerid] == ASSAULT && gPlayerClass[playerid] == SNIPER && gPlayerClass[playerid] == MEDIC && gPlayerClass[playerid] == AIRFORCE && gPlayerClass[playerid] == SPY && gPlayerClass[playerid] == SPECIAL_FORCE)//if player is Soldier then he can drive
{
SendClientMessage(playerid, COLOR_RED, "You Need to be an Engineer 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) == 447 && gPlayerClass[playerid] == ASSAULT && gPlayerClass[playerid] == SNIPER && gPlayerClass[playerid] == MEDIC && gPlayerClass[playerid] == ENGINEER && gPlayerClass[playerid] == SPY && gPlayerClass[playerid] == SPECIAL_FORCE)//if player is pilot then he can drive
{
SendClientMessage(playerid, COLOR_RED, "You Need to be an Airforce to fly Sea Sparrow");
RemovePlayerFromVehicle(playerid);//get u off from the sea sparrow
}
return 1;
}
can u help me?
Re: [HELP] class help -
MBilal - 13.02.2015
You see this line in every if statement u using &&
gPlayerClass[playerid] == ASSAULT && gPlayerClass[playerid] == SNIPER && gPlayerClass[playerid] == MEDIC && gPlayerClass[playerid] == ENGINEER && gPlayerClass[playerid] == SPY && gPlayerClass[playerid] == SPECIAL_FORCE
That mean player should be in all class to use that vehicle...
you need to change it to..
just do like this
if(GetVehicleModel(vehicleid) == 425 && gPlayerClass[playerid] == here add class name which u want.)
like this
if(GetVehicleModel(vehicleid) == 425 && gPlayerClass[playerid] == ASSAULT) that mean only assault class can use that vehicle .
Re: [HELP] class help -
usamahifi - 13.02.2015
ooh ok im going to try it
Re: [HELP] class help -
usamahifi - 13.02.2015
THANKS bro it work " +REP " for help