AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [Solved] Getting the planted / defused stats (https://forums.alliedmods.net/showthread.php?t=193047)

dark_style 08-16-2012 02:14

[Solved] Getting the planted / defused stats
 
Hello,

How can I get the planted or defused stats ( planted / defused times ) of certain user ? If I use global variable which I increase on the planted / defused events, it will return the total times... ? :?

I figured it out how, but I have one question:

PHP Code:

#include <amxmodx>

new g_iUserPlants33 ]
new 
g_iTotalPlants 0

public plugin_init()
{
    
register_plugin"Test""1.0""Tonev" )
    
    
register_logevent"Event_Bomb_Planted"3"2=Planted_The_Bomb" )
    
    
register_clcmd"say /userplants""ClientCommand_User_Times" )
    
register_clcmd"say /totalplants""ClientCommand_Total_Times" )
}

public 
Event_Bomb_Planted()
{
    new 
id get_loguser_index()
    
g_iUserPlantsid ]++
    
    
g_iTotalPlants++
}

public 
ClientCommand_User_Timesid )
{
    
client_printidprint_chat"You have planted the bomb %d times!"g_iUserPlantsid ] )
}

public 
ClientCommand_Total_Timesid )
{
    
client_printidprint_chat"The bomb has been planted %d times!"g_iTotalPlants )
}
    
get_loguser_index() 
{
    new 
loguser[80], name[32]
    
read_logargv(0loguser79)
    
parse_loguser(logusername31)
 
    return 
get_user_index(name)


Should I decrease loguser from 80 to 32 or what's the best num for it, thanks in advance.

ConnorMcLeod 08-16-2012 02:39

Re: [Solved] Getting the planted / defused stats
 
use csx module and get_user_?stats, that module already stores what you need.

dark_style 08-16-2012 02:48

Re: [Solved] Getting the planted / defused stats
 
Thanks, I will take a look at it. :)


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

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