Raised This Month: $ Target: $400
 0% 

Please tell me one basic thing


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
devWaleed
Member
Join Date: Apr 2013
Location: Karachi, Pakistan
Old 11-20-2013 , 09:12   Re: Please tell me one basic thing
Reply With Quote #1

If this is line 30:
PHP Code:
kpm deaths/frags*userTime 
If frags = 0 then frags x userTime = 0 and dividingg by 0 is inifinity which is not possible and thus your error.

If get_user_time(id) returns the time spent by user playing since he joined the server then your calculation should be something like this.

PHP Code:
    new frags get_user_frags(id);
    new 
userTime get_user_time(id) / 60// Time returned is in seconds, convert to minutes.
    
    
new KPM    frags userTime 

Last edited by devWaleed; 11-20-2013 at 09:22.
devWaleed is offline
Send a message via Skype™ to devWaleed
ezio_auditore
Senior Member
Join Date: May 2013
Old 11-20-2013 , 09:52   Re: Please tell me one basic thing
Reply With Quote #2

Quote:
Originally Posted by YamiKaitou View Post
Do you have the exact error? Have you tried using the correct formula?
Quote:
Originally Posted by devWaleed View Post
If this is line 30:
PHP Code:
kpm deaths/frags*userTime 
If frags = 0 then frags x userTime = 0 and dividingg by 0 is inifinity which is not possible and thus your error.

If get_user_time(id) returns the time spent by user playing since he joined the server then your calculation should be something like this.

PHP Code:
    new frags get_user_frags(id);
    new 
userTime get_user_time(id) / 60// Time returned is in seconds, convert to minutes.
 
    
new KPM    frags userTime 
exactly...
now can you please get the plugin working
__________________
ezio_auditore is offline
Send a message via Skype™ to ezio_auditore
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 11-20-2013 , 09:58   Re: Please tell me one basic thing
Reply With Quote #3

Quote:
Originally Posted by ezio_auditore View Post
exactly...
now can you please get the plugin working
Have you tried what we have been telling you yet?
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
ezio_auditore
Senior Member
Join Date: May 2013
Old 11-20-2013 , 10:00   Re: Please tell me one basic thing
Reply With Quote #4

Quote:
Originally Posted by YamiKaitou View Post
Have you tried what we have been telling you yet?

yeah....
but plugin still doesn't work
__________________
ezio_auditore is offline
Send a message via Skype™ to ezio_auditore
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-20-2013 , 23:25   Re: Please tell me one basic thing
Reply With Quote #5

Quote:
Originally Posted by ezio_auditore View Post
yeah....
but plugin still doesn't work
If you have tried what you have been told then post that new code. Also, you need to post the full errors that you get AFTER you have done what you have been told.
__________________
fysiks is online now
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 11-21-2013 , 00:33   Re: Please tell me one basic thing
Reply With Quote #6

Your formula should look like this:
Code:
kpm = floatround( float( frags ) / ( float( userTime ) / 60 ) );

If you don't want to see ridiculous numbers in your first minute of play, then you can also throw in something like this:
Code:
if( userTime < 60 )         kpm = frags;

I also recommend that you set flag to 1 in get_user_time() to be fair.
hornet is offline
ezio_auditore
Senior Member
Join Date: May 2013
Old 11-21-2013 , 01:53   Re: Please tell me one basic thing
Reply With Quote #7

Quote:
Originally Posted by hornet View Post
Your formula should look like this:

Code:
kpm = floatround( float( frags ) / ( float( userTime ) / 60 ) );



If you don't want to see ridiculous numbers in your first minute of play, then you can also throw in something like this:

Code:
if( userTime < 60 )</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;kpm = frags;</p><p>



I also recommend that you set flag to 1 in get_user_time() to be fair.

and the winner with the best reply is hornet
__________________
ezio_auditore is offline
Send a message via Skype™ to ezio_auditore
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 23:22.


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