SA-MP Forums Archive
Min and Max price for every Vehicle - 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: Min and Max price for every Vehicle (/showthread.php?tid=659878)



Min and Max price for every Vehicle - GospodinX - 19.10.2018

Hi guys,

I need help to make Minium and Max price for which player can sell vehicle to other player.I don't know what is best way to store ModelID,minimum Price,and Max price.

1) If price is < minimum ; set : minimum price
2) If price is > max ; set : max price
3) If price is between min and max; set: selected price

Thank you


Re: Min and Max price for every Vehicle - Beckett - 19.10.2018

You need to identify a min/max price for each vehicle, and compare the input price with the min/max.


Re: Min and Max price for every Vehicle - GospodinX - 19.10.2018

Yes,I know.But my question is how to store it?


Re: Min and Max price for every Vehicle - Calisthenics - 19.10.2018

https://sampwiki.blast.hk/wiki/Clamp


Re: Min and Max price for every Vehicle - GospodinX - 19.10.2018

Quote:
Originally Posted by Calisthenics
View Post
I understand it.But my question is : How to store min and max price?

How that I insert max and min price for INfernus(411) and then check it?


Re: Min and Max price for every Vehicle - Lokii - 19.10.2018

PHP Code:
#include <a_samp>
#include <zcmd>
static car_prices[][] =
{
    {
100000/*min*/200000/*max*/}, {300000/*min*/400000/*max*/}, {1200000/*min*/1500000/*max*/}
};
CMD:cprice(playeridparams[])
{
    new 
str[60];
    
format(strsizeof(str), "car id: %d, min price: $%d, max price: $%d"strval(params), car_prices[strval(params)-400][0/*min*/], car_prices[strval(params)-400][1/*max*/]);
    
SendClientMessage(playerid, -1str);
    return 
1;
}
CMD:setprice(playeridparams[])
{
    
vehicle_price clamp(strval(params), car_prices[vehicle_model-400][0/*min*/], car_prices[vehicle_model-400][1/*min*/]);
    return 
1;




Re: Min and Max price for every Vehicle - GospodinX - 19.10.2018

Thank you Lokii