Raised This Month: $ Target: $400
 0% 

Teammates not updating


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
sekac
Senior Member
Join Date: Nov 2016
Old 06-08-2018 , 14:27   Teammates not updating
Reply With Quote #1

I have this code for showing teammates money but when someone switches teams it doesn't update...

PHP Code:
#include <amxmodx>
#include <cstrike>
#include <hamsandwich>

#define NAME "show teammate's money"
#define VERSION "1.3.1"
#define AUTHOR "K.K.Lv"

new g_max_playersg_sync_creat_listsyncObjectg_pFreezeTimefreezetime

new bool:g_teammate[33]

public 
plugin_init()
{
    
register_plugin(NAMEVERSIONAUTHOR)
    
    
register_event("HLTV""FreezeTimeStart""a""1=0""2=0")
    
    
register_event("StatusValue""set_team""be""1=1")
    
    
register_event("StatusValue""EventStatusValue""be""1=2""2!0")
    
    
RegisterHam(Ham_Spawn"player""player_spawn"1)
    
    
g_max_players get_maxplayers()
    
g_pFreezeTime get_cvar_pointer("mp_freezetime")
    
    
syncObject CreateHudSyncObj()
}

public 
plugin_precache() g_sync_creat_list CreateHudSyncObj()

public 
player_spawn(client) if(freezetimeset_task(1.0"show_money"client, .flags="a", .repeat=get_pcvar_num(g_pFreezeTime))

public 
show_money(client)
{
    if(!
is_user_alive(client) || !is_user_connected(client)) return
    
    static 
message[1024]
    static 
name[32]
    
    new 
moneyidlen
    
    
for (id 1id <= g_max_playersid++)
    {
        if (
id != client && is_user_connected(id) && cs_get_user_team(id) == cs_get_user_team(client))
        {
            
money cs_get_user_money(id)
            
get_user_name(idname31)
            
len += format(message[len], charsmax(message) - len"%-22.22s$%d^n"namemoney)
        }
    }
    
set_hudmessage(10020000.050.3500.021.00.10.22)
    
ShowSyncHudMsg(clientg_sync_creat_listmessage)
}

public 
FreezeTimeStart() {
    
freezetime true
    
if(task_exists(9778)) remove_task(9778)
    
set_task(get_pcvar_float(g_pFreezeTime), "freezetime_ended"9778)
}

public 
freezetime_ended() {
    
freezetime false
    remove_task
(9778)
}

public 
set_team(idg_teammate[id] = bool:(read_data(2) == 1)

public 
EventStatusValue(id)
{
    if(
is_user_connected(id) && !is_user_bot(id)) 
    {
        new 
targetName[32], targetid read_data(2)
        
get_user_name(targetidtargetName31)   
        new 
playerTeam get_user_team(id), targetTeam get_user_team(targetid), money cs_get_user_money(targetid)
        
        if (
playerTeam == targetTeam
        {
            
set_hudmessage(255255255, -1.00.4210.010.90.010.01, -1)
            
ShowSyncHudMsg(idsyncObject"%s : $%d"targetNamemoney)
        }
    }
    return 
PLUGIN_CONTINUE

sekac is offline
 


Thread Tools
Display Modes

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 04:34.


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