Raised This Month: $51 Target: $400
 12% 

Why sum calculator can't be this simple


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Moody92
Veteran Member
Join Date: May 2011
Location: Oman
Old 06-10-2013 , 08:18   Why sum calculator can't be this simple
Reply With Quote #1

PHP Code:
#include < amxmodx > 

public plugin_init() 


    
register_clcmd("say""Host_Say"0); 
    
register_clcmd("say_team""Host_Say"1); 


Float:sum(Float:oneFloat:two)
{
   new 
Float:sum one two
 
   
return sum
}

public 
Host_Say(id

    new 
Float:a
    
new Float:b
    
new Float:sum
    
    
if( equali("%s + %s"ab))
    { 
        
client_print(idprint_chat"The result is %s"sum); 
        return 
PLUGIN_CONTINUE
    }

My brain is damaged, tried to do whatever to make it simple.. It's not possible ?!
By the way I made it float so it can accept decimal numbers.

I saw calculator plugin.. Just messed with my brain more

Last edited by Moody92; 06-10-2013 at 08:22.
Moody92 is offline
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 06-10-2013 , 11:40   Re: Why sum calculator can't be this simple
Reply With Quote #2

PHP Code:
client_print(idprint_chat"The result is %f", (a+b)) 
PHP Code:
if( == something 

Last edited by .Dare Devil.; 06-10-2013 at 11:41.
.Dare Devil. is offline
akcaliberg
Senior Member
Join Date: Nov 2011
Location: Istanbul
Old 06-10-2013 , 12:42   Re: Why sum calculator can't be this simple
Reply With Quote #3

It's not that so hard ? You just need to convert strings to floats. And then simply use "+"
akcaliberg is offline
Moody92
Veteran Member
Join Date: May 2011
Location: Oman
Old 06-10-2013 , 12:46   Re: Why sum calculator can't be this simple
Reply With Quote #4

Quote:
Originally Posted by .Dare Devil. View Post
PHP Code:
client_print(idprint_chat"The result is %f", (a+b)) 
PHP Code:
if( == something 
Ops..

Thanks.. I won't post such a matter again :S

Last edited by Moody92; 06-10-2013 at 12:46.
Moody92 is offline
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 06-10-2013 , 15:07   Re: Why sum calculator can't be this simple
Reply With Quote #5

Quote:
Originally Posted by Moody92 View Post
Ops..

Thanks.. I won't post such a matter again :S
Its nothing bad about asking right?
Feel free to post things...
.Dare Devil. is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-10-2013 , 22:57   Re: Why sum calculator can't be this simple
Reply With Quote #6

This has been done on this forum before.
__________________
fysiks is offline
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 15:40.


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