Raised This Month: $ Target: $400
 0% 

Float to int ???


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Nobody1985
Member
Join Date: Mar 2007
Old 04-02-2010 , 12:51   Float to int ???
Reply With Quote #1

Hello all

At first sorry for my bad english.
I have translated this text with the google translator

I hope you can help me further.

Quote:

GetObjectProperty ent (1, szProperty1);
new Float: = tempm str_to_float (szProperty1);
Quote:

if (cs_get_user_money (id) == 16000)
(
return PLUGIN_HANDLED;
)
else
(
cs_set_user_money (id, cs_get_user_money (id) + tempm);
)
The problem is with "tempm" I do not know any way I can pass that value to cs_set_user_money () ...

Get this as the error message.

HTML Code:
Warning: Tag mismatch on line ....
So I know it works if it is not a float ...
However, essential in this case.

I hope you now understand my problem

I want to achieve something in this kind
Quote:
GetObjectProperty ent (1, szProperty1);
new Float: = tempm str_to_float (szProperty1);

new test = 0;
bla bla bla
new temp = test + tempm;
bla bla bla
cs_set_user_money (id, cs_get_user_money (id) + temp);
I hope I could describe my lie a little and now i hope for help

Greeting
Nobody
Nobody1985 is offline
joropito
AlliedModders Donor
Join Date: Mar 2009
Location: pfnAddToFullPack
Old 04-02-2010 , 12:54   Re: Float to int ???
Reply With Quote #2

To convert float to int use floatround

http://www.amxmodx.org/funcwiki.php?go=func&id=73

Are you sure it's for HL1 and not SourceMod?
__________________

Divide et vinces
approved plugins | steam account

I don't accept PM for support. Just ask on forums.
If you're looking for private work, PM me.
joropito is offline
Send a message via MSN to joropito
Mxnn
Veteran Member
Join Date: Aug 2009
Location: AT MY HOME
Old 04-02-2010 , 17:51   Re: Float to int ???
Reply With Quote #3

You can do this too:
PHP Code:
new FloatFloatNum 5.5
new IntNum FloatNum

IntNum will be 5 
Mxnn is offline
Nobody1985
Member
Join Date: Mar 2007
Old 04-03-2010 , 11:15   Re: Float to int ???
Reply With Quote #4

Hmm. sometimes it is easier than you'd expect it

So this has come to the work as I wanted it. Many thanks for the help

PHP Code:
GetObjectProperty(ent1szProperty1);
new 
Float:temp str_to_float(szProperty1);

new 
IntTemp floatround(Float:temp); 
Nobody1985 is offline
Old 04-03-2010, 11:17
wrecked_
This message has been deleted by Exolent[jNr]. Reason: Stop flooding.
Old 04-03-2010, 11:35
joropito
This message has been deleted by Exolent[jNr]. Reason: Stop flooding.
Old 04-03-2010, 11:48
wrecked_
This message has been deleted by Exolent[jNr]. Reason: Stop flooding.
Old 04-03-2010, 12:06
joropito
This message has been deleted by Exolent[jNr]. Reason: Stop flooding.
Reply



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

Forum Jump


All times are GMT -4. The time now is 22:11.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode