equals to or less than or what? -
xXitsgodzillaXx - 10.07.2013
Okay so Im having two problems my first one is, any class can enter the "Pilot" restricted vehicles such as the rustler, Sea Sparrow, ect.
so to combat that im using this:
pawn Код:
if(GetVehicleModel(vehicleid) == 447 && GetPlayerScore(playerid) < 919 && gLoadout[playerid] == CLASS_PILOT)
{
SendClientMessage(playerid, COLOR_ERROR, "You need at least a Colonel rank to ride a Sea Sparrow! Use /rank to see your rank.");
SendClientMessage(playerid, COLOR_ERROR, "You also need to be a pilot to drive this vehicle, use /kill and select the 'pilot' class");
RemovePlayerFromVehicle(playerid);
}
now when that line says
pawn Код:
gLoadout[playerid] == CLASS_PILOT)
anyone can enter the plane as long as they have a high enough score. Question: how can I make it to the point to where only pilots can enter.
problem 2: for some reason this rank system I downloaded I giving players 1 rank higher than they are supposed to be This is the code:
pawn Код:
forward GetPlayerRankInfo(playerid);
public GetPlayerRankInfo(playerid)
{
new string[250];
if(GetPlayerScore(playerid) <= 0)
{
SendClientMessage(playerid, COLOR_WHITE, "Your Rank Is Trainee");
format(string, sizeof(string),"Name:%s [Your score is:%d]",pName, GetPlayerScore(playerid));
SendClientMessage(playerid, COLOR_WHITE, string);
}
else if(GetPlayerScore(playerid) <= 10)
{
SendClientMessage(playerid, COLOR_WHITE, "Your Rank Is Private");
format(string, sizeof(string),"Name:%s [Your score is:%d]",pName, GetPlayerScore(playerid));
SendClientMessage(playerid, COLOR_WHITE, string);
}
else if(GetPlayerScore(playerid) <= 100)
{
SendClientMessage(playerid, COLOR_WHITE, "Your Rank Is Corporal");
format(string, sizeof(string),"Name:%s [Your score is: %d]",pName, GetPlayerScore(playerid));
SendClientMessage(playerid, COLOR_WHITE, string);
}
else if(GetPlayerScore(playerid) <= 250)
{
SendClientMessage(playerid, COLOR_WHITE, "Your Rank Is Sergeant");
format(string, sizeof(string),"Name:%s [Your score is: %d]",pName, GetPlayerScore(playerid));
SendClientMessage(playerid, COLOR_WHITE, string);
}
else if(GetPlayerScore(playerid) <= 400)
{
SendClientMessage(playerid, COLOR_WHITE, "Your Rank Is Captain");
format(string, sizeof(string),"Name:%s [Your score is: %d]",pName, GetPlayerScore(playerid));
SendClientMessage(playerid, COLOR_WHITE, string);
}
else if(GetPlayerScore(playerid) <= 650)
{
SendClientMessage(playerid, COLOR_WHITE, "Your Rank Is Major");
format(string, sizeof(string),"Name:%s [Your score is: %d]",pName, GetPlayerScore(playerid));
SendClientMessage(playerid, COLOR_WHITE, string);
}
else if(GetPlayerScore(playerid) <= 920)
{
SendClientMessage(playerid, COLOR_WHITE, "Your Rank Is Colonel");
format(string, sizeof(string),"Name:%s [Your score is: %d]",pName, GetPlayerScore(playerid));
SendClientMessage(playerid, COLOR_WHITE, string);
}
else if(GetPlayerScore(playerid) <= 1150)
{
SendClientMessage(playerid, COLOR_WHITE, "Your Rank Is Lieutenant Colonel");
format(string, sizeof(string),"Name:%s [Your score is: %d]",pName, GetPlayerScore(playerid));
SendClientMessage(playerid, COLOR_WHITE, string);
}
else if(GetPlayerScore(playerid) <= 1500)
{
SendClientMessage(playerid, COLOR_WHITE, "Your Rank Is Lieutenant General");
format(string, sizeof(string),"Name:%s [Your score is: %d]",pName, GetPlayerScore(playerid));
SendClientMessage(playerid, COLOR_WHITE, string);
}
else if(GetPlayerScore(playerid) <= 2000)
{
SendClientMessage(playerid, COLOR_WHITE, "Your Rank Is Major General");
format(string, sizeof(string),"Name:%s [Your score is: %d]",pName, GetPlayerScore(playerid));
SendClientMessage(playerid, COLOR_WHITE, string);
}
else if(GetPlayerScore(playerid) <= 2700)
{
SendClientMessage(playerid, COLOR_WHITE, "Your Rank Is General");
format(string, sizeof(string),"Name:%s [Your score is: %d]",pName, GetPlayerScore(playerid));
SendClientMessage(playerid, COLOR_WHITE, string);
}
else if(GetPlayerScore(playerid) <= 3000)
{
SendClientMessage(playerid, COLOR_WHITE, "Your Rank Is General Of The Army");
format(string, sizeof(string),"Name:%s [Your score is: %d]",pName, GetPlayerScore(playerid));
SendClientMessage(playerid, COLOR_WHITE, string);
}
return 1;
}
now the "<=" mean equal too or greater than correct? and how would I make it display their correct rank! Help would be greatly appriciated.
Re: equals to or less than or what? -
Misiur - 10.07.2013
1. GetVehicleModel(vehicleid) == 447 && GetPlayerScore(playerid) < 919 && gLoadout[playerid] == CLASS_PILOT
This will be true only when vehicle model number is 447
and score is less than 919
and the player class is pilot. A little weird that you remove pilot from airplane, huh? You want to remove player if he isn't a pilot, or he is a pilot but hasn't high enough score.
pawn Код:
if(GetVehicleModel(vehicleid) == 447 && (gLoadout[playerid] != CLASS_PILOT || GetPlayerScore(playerid) < 919))
Now if the vehicle is a plane, we check if the player isn't pilot, or he is a pilot and has too low score.
2.
pawn Код:
GetPlayerScore(playerid) <= X
Condition is met when the score is less than or equal X.
Re: equals to or less than or what? -
IceBilizard - 10.07.2013
"<=" = equal to or less then
">=" = equal to or greater then
Re: equals to or less than or what? -
xXitsgodzillaXx - 10.07.2013
Okay so players with any class can still enter the vehicle.
[EDIT]: Sorry I forgot to change the vehicle models.