AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Please tell me one basic thing (https://forums.alliedmods.net/showthread.php?t=230069)

ezio_auditore 11-19-2013 07:27

Please tell me one basic thing
 
My plugin shows the Kills Per Minute Rate of a player....


for this, a simple calculation is to be done.

PHP Code:

public info(id){
new 
userTime
    userTime 
get_user_time(id)
    
    new 
frags 
    frags 
get_user_frags(id)

    new 
deaths
    
deaths get_user_deaths(id)
    
    new 
kpm
    kpm 
deaths/frags*userTime
    
    set_hudmessage
(25500, -1.00.01)    
    
show_hudmessage(id"You killed %i , Died %i times and playing form %i seconds^n[KPM RATE : %i]",frags,deaths,userTimekpm)


what is the mistake the "kpm =.........Time" line??

YamiKaitou 11-19-2013 08:02

Re: Please tell me one basic thing
 
userTime is in Seconds, not Minutes. Plus, your calculation is incorrect, KPM = Kills / Minutes

ezio_auditore 11-19-2013 09:04

Re: Please tell me one basic thing
 
Quote:

Originally Posted by YamiKaitou (Post 2062782)
userTime is in Seconds, not Minutes. Plus, your calculation is incorrect, KPM = Kills / Minutes

the function info never gets called....
what's the mistake

YamiKaitou 11-19-2013 09:08

Re: Please tell me one basic thing
 
Are you even calling the function? We can't help you there as you don't provide all of the code

ezio_auditore 11-19-2013 09:18

Re: Please tell me one basic thing
 
Quote:

Originally Posted by YamiKaitou (Post 2062816)
Are you even calling the function? We can't help you there as you don't provide all of the code


well...
if i provide the whole code and you correct it then i post it in new plugin submission, a moderator post will appear saying plugin originally posted by you....
i know how to call a function..
i typed register_clcmd("say /kpm","info")

YamiKaitou 11-19-2013 09:22

Re: Please tell me one basic thing
 
We cannot assist you if we don't see more of the code

ezio_auditore 11-19-2013 09:36

Re: Please tell me one basic thing
 
Quote:

Originally Posted by YamiKaitou (Post 2062823)
We cannot assist you if we don't see more of the code

PHP Code:

 #include <amxmodx>
 #include <amxmisc>
public plugin_init() {
register_plugin("Kills per minute""1.0""AssAssIN_IMpossible")
register_clcmd("say /info","info")
 }
public 
info(id){
new 
userTime
    userTime 
get_user_time(id)
    
    new 
frags 
    frags 
get_user_frags(id)
    new 
deaths
    
deaths get_user_deaths(id)
    
    new 
kpm
    kpm 
deaths/frags*userTime
    
    set_hudmessage
(25500, -1.00.01)    
    
show_hudmessage(id"You killed %i , Died %i times and playing form %i seconds^n[KPM RATE : %i]",frags,deaths,userTimekpm)



fysiks 11-19-2013 23:45

Re: Please tell me one basic thing
 
Everything looks fine to me except that your calculation of KPM is completely wrong and also the y-position of your HUD message is questionable. I'm not even sure you will be able to see it with that value. Test it with the default, -1, for both x- and y-position (assuming you are not able to see the message).

ezio_auditore 11-20-2013 07:32

Re: Please tell me one basic thing
 
Quote:

Originally Posted by fysiks (Post 2063078)
Everything looks fine to me except that your calculation of KPM is completely wrong and also the y-position of your HUD message is questionable. I'm not even sure you will be able to see it with that value. Test it with the default, -1, for both x- and y-position (assuming you are not able to see the message).

when i type debug after the plugin name in plugins.ini, it says something is wrong with line 30 (divisions)

YamiKaitou 11-20-2013 07:46

Re: Please tell me one basic thing
 
Quote:

Originally Posted by ezio_auditore (Post 2063171)
when i type debug after the plugin name in plugins.ini, it says something is wrong with line 30 (divisions)

Do you have the exact error? Have you tried using the correct formula?


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

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