CMD:refill(playerid, params[])
{
new Float:v=100.0;
v-=CarFuel[GetPlayerVehicleID(playerid)];
v/=100.0;
v*=BusinessInfo[23][bFee];
if(GetPlayerMoney(playerid) >= floatround(v))
{
format( fillstring, sizeof(fillstring), "You payed {FFFFFF}%d"ORANGESV"$ to refill your car's fuel.", floatround(v));
BusinessInfo[23][bMoney] += floatround(v);
GivePlayerTheMoney(playerid, - floatround(v));
SCM(playerid, ORANGES, fillstring);
foreach(Player, i)
{
if(GetPlayerVehicleID(i) == GetPlayerVehicleID(playerid))
{
KillTimer(CarTimer[playerid]);
TogglePlayerControllable(i, 0);
FillTimer[playerid] = SetTimerEx("Fill", 250, false, "i", i);
}
}
}
else SCM(playerid, COLOR_DGREY, "You don't have enough money.");
return 1;
}
if(GetPlayerMoney(playerid) >= 100)// this means < is greater and = this is equal and it will check if floatround money is greater then getplayermoney or equal to floatroundthen it will send that message
{
//it will check for money if he have 100 or above then account will be performed
}
else
{
// here if player money is below then 100 it will send message you dont have enough money
}
Hello! Why does it returns me ingame the "You don't have enough money message", even if I do have enough money?
PHP код:
|
CMD:refill(playerid, params[])
{
new car = GetPlayerVehicleID(playerid);
if(car)
{
new Float:v = (((100.0 - ((0.0 <= CarFuel[car] <= 100.0) ? (CarFuel[car]) : (100.0))) / 100.0) * BusinessInfo[23][bFee]), round = floatround(v);
if(GetPlayerMoney(playerid) < round) return SCM(playerid, COLOR_DGREY, "You don't have enough money.");
new fstr[70];
format(fstr, sizeof(fstr), "You paid {FFFFFF}%d"ORANGESV"$ to refill your car's fuel.", round);
BusinessInfo[23][bMoney] += round;
GivePlayerTheMoney(playerid, -round);
SCM(playerid, ORANGES, fstr);
KillTimer(CarTimer[playerid]);
FillTimer[playerid] = SetTimerEx("Fill", 250, false, "i", playerid);
foreach(Player, i)
{
if(GetPlayerVehicleID(i) == car)
TogglePlayerControllable(i, 0);
}
}
//else SCM(playerid, COLOR_DGREY, "You are not in a vehicle.");
return 1;
}
FillTimer[playerid] = SetTimerEx("Fill", 250, false, "i", playerid);