Reducing number by 20%?
#1

Код:
new price=HouseInfo[houseid][hPrice]*0.8;
I get

warning 213: tag mismatch

Also it gives me ridiculous number (1178161... and so on)
HouseInfo[houseid][hPrice] is equal 14900
Reply
#2

hPrice need to be float if you want to do multiplication with decimal numbers...
Reply
#3

Quote:
Originally Posted by Dusan01
Посмотреть сообщение
hPrice need to be float if you want to do multiplication with decimal numbers...
Ok, so if it isn't how do I reduce it by 20%?
Reply
#4

hPrice has to be a Float:.
Then, you can take this row:
PHP код:
new price=HouseInfo[houseid][hPrice]*0.8
Reply
#5

basic math bro...

Код:
new price=HouseInfo[houseid][hPrice]*0.8;
new on‌eprecent=HouseInfo[houseid][hPrice]*0.8/100;
new twozerop = oneprecent*20;
new finalprice = price - twozerop;
price reduced by 20% is: finalprice
Reply
#6

PHP код:
new price=floatround(HouseInfo[houseid][hPrice]*0.8); 
Reply
#7

Storing a float variable into a non float variable won't work and obviously will give you the error that you have.

pawn Код:
new Float:price = ( HouseInfo[houseid][hPrice] * 0.8 );
This way it will remain float and you don't have to use floatround either..
Reply
#8

Quote:
Originally Posted by Dusan01
Посмотреть сообщение
basic math bro...

Код:
new price=HouseInfo[houseid][hPrice]*0.8;
new on‌eprecent=HouseInfo[houseid][hPrice]*0.8/100;
new twozerop = oneprecent*20;
new finalprice = price - twozerop;
price reduced by 20% is: finalprice
Quote:
Originally Posted by Cypress
Посмотреть сообщение
Storing a float variable into a non float variable won't work and obviously will give you the error that you have.

pawn Код:
new Float:price = ( HouseInfo[houseid][hPrice] * 0.8 );
This way it will remain float and you don't have to use floatround either..
Doesn't work also I get "warning 213: tag mismatch"

Quote:
Originally Posted by AbyssMorgan
Посмотреть сообщение
PHP код:
new price=floatround(HouseInfo[houseid][hPrice]*0.8); 
thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)