Vehicles set only for required scores.. -
Huxley - 30.04.2012
OK, I have been scripting and fixing this thing for 2 hours+ but it ain't working yet. So here's the script...
pawn Код:
new USAHunter, USASparrow, USARhino1, USARhino2, USAHydra1, USAHydra2;
public OnGameModeInIt()
{
USAHunter = AddStaticVehicleEx(425,-165.60000610,2654.19995117,66.00000000,90.00000000,-1,-1,15); //Hunter
USARhino1 = AddStaticVehicleEx(432,-171.00000000,2695.10009766,63.20000076,90.00000000,-1,-1,15); //Rhino
USARhino2 = AddStaticVehicleEx(432,-171.10000610,2681.10009766,63.20000076,90.00000000,-1,-1,15); //Rhino
USASparrow = AddStaticVehicleEx(447,-165.30000305,2668.50000000,65.09999847,90.00000000,-1,-1,15); //Seasparrow
USAHydra1 = AddStaticVehicleEx(520,-302.00000000,2628.39990234,63.70000076,270.00000000,-1,-1,15); //Hydra
USAHydra2 = AddStaticVehicleEx(520,-301.89999390,2638.39990234,63.70000076,270.00000000,-1,-1,15); //Hydra
return 1;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
new vID = GetVehicleModel(GetPlayerVehicleID(playerid));
if(vID == USAHunter && vID == USAHydra1 && vID == USAHydra2)
{
if(GetPlayerKills(playerid) < 750)
{
SendClientMessage(playerid,COLOR_ERROR,"You need to be Command Master Sergeant to fly Hunter/Hydra.");
SendClientMessage(playerid,COLOR_WHITE,"Check /ranks for more info.");
RemovePlayerFromVehicle(playerid);
return 1;
}
else if(GetPlayerKills(playerid) >= 750)
{
SendClientMessage(playerid,COLOR_ROYALBLUE,"Good luck in killing your enemies!");
return 1;
}
else if(vID == USARhino1 && vID == USARhino2 && vID == USASparrow)
{
if(GetPlayerKills(playerid) < 250)
{
SendClientMessage(playerid,COLOR_ERROR,"You need to be Corporal to drive Rhino (tank)/fly Sea Sparrow.");
SendClientMessage(playerid,COLOR_WHITE,"Check /ranks for more info.");
RemovePlayerFromVehicle(playerid);
return 1;
}
else if(GetPlayerKills(playerid) >= 250)
{
SendClientMessage(playerid,COLOR_ROYALBLUE,"Good luck in killing your enemies!");
return 1;
}
}
return 1;
}
return 1;
}
Any solutions for this? :S
Re: Vehicles set only for required scores.. -
antonio112 - 30.04.2012
You shouldn't be checking the vehicle MODEL ... but ID. Try this:
pawn Код:
new vID = GetPlayerVehicleID(playerid);
if(vID == USAHunter || vID == USAHydra1 || vID == USAHydra2)
And also, instead of "&&" change to "||", given the fact you're checking something, which can't be true at the same two times.
&& = AND
|| = OR
So, you're checking if ID is equal to USAHunter or USAHydra1 or USAHydra2. It can't be the same three IDs at the same time.
Re: Vehicles set only for required scores.. -
Huxley - 30.04.2012
Still not working, because I registered another account in my server, 0 kills, 0 scores, 0 deaths, purely new, I entered all mentioned vehicles and I still can ride them...
Re: Vehicles set only for required scores.. -
antonio112 - 30.04.2012
Oh yea, you can't use "RemovePlayerFromVehicle" function under the OnPlayerEnterVehicle. Why? Well, OnPlayerEnterVehicle is called when the player presses RETURN or F button to enter the vehicle, while RemovePlayerVehicle can be used only on players who are already in the vehicle. Try using "ClearAnimations(playerid)" function, so:
pawn Код:
// instead of RemovePlayerFromVehicle, use
ClearAnimations(playerid);
Hope I helped.
Or, if you still want to use the RemovePlayerFromVehicle function, you can use
OnPlayerStateChange callback. But that would mean changing your whole script.
Re: Vehicles set only for required scores.. -
Huxley - 01.05.2012
Alright, I solved it. Thanks for the assist!