SA-MP Forums Archive
Price in negative amount 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: Price in negative amount help (/showthread.php?tid=561532)



Price in negative amount help - danish007 - 03.02.2015

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"


Re: Price in negative amount help - CalvinC - 03.02.2015

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;



Re: Price in negative amount help - danish007 - 03.02.2015

thanks +rep