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

Run Statistics


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
myusername
Senior Member
Join Date: Aug 2012
Old 01-05-2014 , 10:11   Run Statistics
Reply With Quote #1

Hi, i need run statistics like in this zombie escape mode. I want to use it in Deathrun server. I've tried to get some code from zombie escape but not working.

Help me.

Here is what ive got so far...
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta>
#include <hamsandwich>
#include <cstrike>
#include <fun>

#define OFFICIAL_LANG LANG_PLAYER

enum
{
    
RANK_NONE 0,
    
RANK_FIRST,
    
RANK_SECOND,
    
RANK_THIRD
}

enum
{
    
TEAM_T 1,
    
TEAM_CT 2
}

new 
g_WinText[7][64]
new 
Float:delay_hud[33]
new 
g_escape_point[33]
new 
g_MaxPlayersscore_hudstat_hud
new g_escape_rank[4]
new 
g_team_score[6]

public 
plugin_init()
{    
    
register_dictionary("zombie_escape.txt")
    
RegisterHam(Ham_Spawn"player""fw_Spawn_Post"1)
    
    
g_MaxPlayers get_maxplayers()    
    
    
format(g_WinText[TEAM_T], 63"Escape Fail")
    
format(g_WinText[TEAM_CT], 63"Escape Success")        
    
    
score_hud CreateHudSyncObj(2)
}

public 
client_putinserver(id)
{
    
g_escape_point[id] = 0
}

public 
get_stat()
{
    static 
highestcurrent
    highest 
current 0
    
    
// Rank First
    
for(new 0g_MaxPlayersi++)
    {
        if(!
is_user_connected(i))
            continue
        if(!
is_user_alive(i))
            continue
        if(
cs_get_user_team(i) == CS_TEAM_T)
            continue
            
        if(
g_escape_point[i] > highest)
        {
            
current i
            highest 
g_escape_point[i]
        }
    }
    
g_escape_rank[RANK_FIRST] = current
    
    
// Rank Second
    
highest current 0    
    
for(new 0g_MaxPlayersi++)
    {
        if(!
is_user_connected(i))
            continue
        if(!
is_user_alive(i))
            continue
        if(
cs_get_user_team(i) == CS_TEAM_T)
            continue            
        if(
g_escape_rank[RANK_FIRST] == i)
            continue
            
        if(
g_escape_point[i] > highest)
        {
            
current i
            highest 
g_escape_point[i]
        }
    }
    
g_escape_rank[RANK_SECOND] = current        
    
    
// Rank Third
    
highest current 0    
    
for(new 0g_MaxPlayersi++)
    {
        if(!
is_user_connected(i))
            continue
        if(!
is_user_alive(i))
            continue
        if(
cs_get_user_team(i) == CS_TEAM_T)
            continue            
        if(
g_escape_rank[RANK_FIRST] == || g_escape_rank[RANK_SECOND] == i)
            continue
            
        if(
g_escape_point[i] > highest)
        {
            
current i
            highest 
g_escape_point[i]
        }
    }
    
g_escape_rank[RANK_THIRD] = current    
}

public 
client_PostThink(id)
{
    if(!
is_user_connected(id))
        return
    if(
get_gametime() - 1.0 delay_hud[id])
    {
        
// Show Score
        
set_hudmessage(255255255, -1.00.002.02.0)
        
ShowSyncHudMsg(idscore_hud"%L"OFFICIAL_LANG"HUD_SCORE"g_team_score[TEAM_T], g_team_score[TEAM_CT])
        
        
// Add Point for Who is Running Fast
        
if(cs_get_user_team(id) == CS_TEAM_CT)
        {
            static 
Float:Velocity[3], Speed
            
            pev
(idpev_velocityVelocity)
            
Speed floatround(vector_length(Velocity))
            
            switch(
Speed)
            {
                case 
210..229g_escape_point[id] += 1
                
case 230..249g_escape_point[id] += 2
                
case 250..300g_escape_point[id] += 3
            
}
        }
        
        
// Show Stat
        
show_stat(id)
        
delay_hud[id] = get_gametime()
    }
}

public 
show_stat(id)
{
    
get_stat()
    new 
temp_string_first[64], temp_string_second[64], temp_string_third[64], curidPlayer_Name[64], none[32]
    
    
formatex(nonesizeof(none), "%L"OFFICIAL_LANG"RANK_NONE")
    
    
// Rank First
    
curid g_escape_rank[RANK_FIRST]
    if(
is_user_alive(curid) && cs_get_user_team(curid) == CS_TEAM_CT && g_escape_point[curid] != 0)
    {
        
get_user_name(curidPlayer_Namesizeof(Player_Name))
        
formatex(temp_string_firstsizeof(temp_string_first), "%L"OFFICIAL_LANG"RANK_FIRST"Player_Name)
    } else {
        
get_user_name(curidPlayer_Namesizeof(Player_Name))
        
formatex(temp_string_firstsizeof(temp_string_first), "%L"OFFICIAL_LANG"RANK_FIRST"none)    
    }
    
    
// Rank Second
    
curid g_escape_rank[RANK_SECOND]
    if(
is_user_alive(curid) && cs_get_user_team(curid) == CS_TEAM_CT && g_escape_point[curid] != 0)
    {
        
get_user_name(curidPlayer_Namesizeof(Player_Name))
        
formatex(temp_string_secondsizeof(temp_string_second), "%L"OFFICIAL_LANG"RANK_SECOND"Player_Name)
    } else {
        
get_user_name(curidPlayer_Namesizeof(Player_Name))
        
formatex(temp_string_secondsizeof(temp_string_second), "%L"OFFICIAL_LANG"RANK_SECOND"none)    
    }
    
    
// Rank Third
    
curid g_escape_rank[RANK_THIRD]
    if(
is_user_alive(curid) && cs_get_user_team(curid) == CS_TEAM_CT && g_escape_point[curid] != 0)
    {
        
get_user_name(curidPlayer_Namesizeof(Player_Name))
        
formatex(temp_string_thirdsizeof(temp_string_third), "%L"OFFICIAL_LANG"RANK_THIRD"Player_Name)
    } else {
        
get_user_name(curidPlayer_Namesizeof(Player_Name))
        
formatex(temp_string_thirdsizeof(temp_string_third), "%L"OFFICIAL_LANG"RANK_THIRD"none)    
    }    

    
set_hudmessage(025500.050.3002.02.0)
    
ShowSyncHudMsg(idstat_hud"%L^n%s^n%s^n%s"OFFICIAL_LANG"RANK_INFO"temp_string_firsttemp_string_secondtemp_string_third)    
}

public 
fw_Spawn_Post(id)
{
    if(!
is_user_connected(id))
        return 
HAM_IGNORED
    
    g_escape_point
[id] = 0
    
    
return HAM_HANDLED

Gives me this error
PHP Code:
L 01/05/2014 23:01:01HudSyncObject -1 is invalid
L 01
/05/2014 23:01:01: [AMXXDisplaying debug trace (plugin "Statistics.amxx")
L 01/05/2014 23:01:01: [AMXXRun time error 10native error (native "ShowSyncHudMsg")
L 01/05/2014 23:01:01: [AMXX]    [0RunStatistics.sma::show_stat (line 190)
L 01/05/2014 23:01:01: [AMXX]    [1RunStatistics.sma::client_PostThink (line 144
__________________
Rest in piece.

Last edited by myusername; 01-05-2014 at 10:15.
myusername is offline
Old 01-18-2014, 11:23
myusername
This message has been deleted by YamiKaitou. Reason: wait 14 days before you bump
myusername
Senior Member
Join Date: Aug 2012
Old 01-28-2014 , 08:50   Re: Run Statistics
Reply With Quote #2

to YamiKaitou: Ive bumped after 14 days :<

Bring
Up
My
Post
__________________
Rest in piece.
myusername is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 01-28-2014 , 09:09   Re: Run Statistics
Reply With Quote #3

Quote:
Originally Posted by myusername View Post
to YamiKaitou: Ive bumped after 14 days :<
Showed 13 on my screen


But, your issue is because stat_hud is not a valid HudSyncObj
__________________
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
myusername
Senior Member
Join Date: Aug 2012
Old 01-29-2014 , 07:28   Re: Run Statistics
Reply With Quote #4

Quote:
Originally Posted by YamiKaitou View Post
Showed 13 on my screen

But, your issue is because stat_hud is not a valid HudSyncObj
I see in my timezone( +8 ) its 14.

Can you show me example? Its really hard to fix for me.
__________________
Rest in piece.

Last edited by myusername; 01-29-2014 at 07:28.
myusername is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 01-30-2014 , 10:39   Re: Run Statistics
Reply With Quote #5

Quote:
Originally Posted by myusername View Post
Can you show me example? Its really hard to fix for me.
Your example is already in your code, look at score_hud
__________________
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
myusername
Senior Member
Join Date: Aug 2012
Old 01-31-2014 , 07:18   Re: Run Statistics
Reply With Quote #6

Oh i see thank you. Solved.
__________________
Rest in piece.
myusername 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 07:20.


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