SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

Thread Tools Display Modes
Old 21/09/2009, 05:54 PM   #1
Huge Clucker
Join Date: Nov 2008
Posts: 318
Reputation: 0
Default Integer - Float

I want to deduce a float to an integer, but PAWN compiler gives me a warning, I can't find the way to do it in the pawn language guide... Any idea?

pawn Code:
new fuel = 100 - CarInfo[car][cFuel]; // cFuel is a Float
new fuelprice = fuel*2; // Warning here

I want fuel to be 0,1,2,3,4,5... or 100 not a decimal number so if cFuel = 45.66 the operation should be 100-45
Coicatak is offline  
Old 21/09/2009, 05:59 PM   #3
brett7's Avatar
Join Date: Nov 2007
Location: samp is #1
Posts: 669
Reputation: 14
Default Re: Integer - Float

do like %.3f

that will round to 3 deciaml places in c it should do the same for pawn
brett7 is offline  
Old 21/09/2009, 07:14 PM   #4
Huge Clucker
Join Date: Nov 2008
Posts: 318
Reputation: 0
Default Re: Integer - Float

Originally Posted by Don Correlli
Coicatak is offline  

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting a Float into an Integer aNdReSk Help Archive 1 24/06/2010 08:25 PM
help | float to integer _V1rTu4L_ Help Archive 6 21/05/2010 08:22 PM
GetArea(&Float:minx,&Float:miny,&Float:maxx,&Float:maxy) pagie1111 Help Archive 1 14/04/2010 10:33 AM
how to round up a float to an integer ? Whizion Help Archive 1 02/03/2010 10:45 PM

All times are GMT. The time now is 05:06 PM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.