Price in negative amount help
#1

pawn Код:
if (PlayerInfo[playerid][pTeam] != TEAM_LAW)
                {
                    new vehicleid = GetPlayerVehicleID(playerid);

                    new Float:FullHealth,Health,Damage,MarketValue;
                    GetVehicleHealth(vehicleid, FullHealth);
                    format(string, sizeof(string), "%d",floatround(FullHealth)/10);
                    Health = strval(string);
                    Damage = 100 - Health;
                   
                    MarketValue = CarInfo[vehicleid][cValue] - Damage * 100;

                    format(string, sizeof(string), "~w~PRESS THE ~y~2 ~w~KEY TO SELL YOUR~n~VEHICLE FOR ~w~$%i",MarketValue);
                    GameTextForPlayer(playerid,string,5000,3);

                    format(string, sizeof(string), "Press The SUB-MISSION KEY To Sell Your Vehicle. Current Damage: %d Percent. Value: $%i", Damage, MarketValue);
                    SendClientMessage(playerid, COLOR_SERVER_HELP_MSG, string);
                }
i've checkpoint when player enter in checkpoint it shows car sell price but when i make damages in vehicles it goes to negative amount i want to make like minimun vehicle sell price "5000"
Reply
#2

Use an "if" to check if it's below 5000, then set MarketValue to 5000, else, set it to the normal.
pawn Код:
if(CarInfo[vehicleid][cValue] - Damage * 100 < 5000) MarketValue = 5000;
else MarketValue = CarInfo[vehicleid][cValue] - Damage * 100;
Reply
#3

thanks +rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)