AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help in this code. (https://forums.alliedmods.net/showthread.php?t=174413)

kramesa 12-19-2011 20:56

Help in this code.
 
PHP Code:

#include <amxmodx>
#include <cstrike>

new Name[32]
new 
g_MsgSay  

public plugin_init()
{
    
register_plugin("RoundStart Money""1.2""krm")
    
    
register_event("HLTV""RoundStart_Money""a""1=0""2=0"
    
    
g_MsgSay get_user_msgid "SayText" )  
}

public 
RoundStart_Money()
{
    new 
iPlayers[32], iNum
    get_players
(iPlayersiNum"ch")
    
    for(new 
iiNumi++)
    {
        
get_user_name(iPlayers[i], Name31)
        
        if(
cs_get_user_team(iPlayers[i]) == CS_TEAM_CT)
        {
            
print_colored(iPlayers[i], "!n(Counter-Terrorist)!t %s!n :  $%i"Namecs_get_user_money(iPlayers[i]))
        }
        
        if(
cs_get_user_team(iPlayers[i]) == CS_TEAM_T)
        {
            
print_colored(iPlayers[i], "!n(Terrorist)!t %s!n :  $%i"Namecs_get_user_money(iPlayers[i]))
        }
    }
}

stock print_colored ( const index, const input [ ], const any:... )
{
    new 
players 32 ]
    new 
count
    
new message 191 ]
    new 
i
    
    count 
1
    
    vformat 
message190input)
    
    
replace_all message190"!n""^1" )
    
replace_all message190"!t""^3" )
    
replace_all message190"!g""^4" )
    
    if ( 
index )
    {
        
players ] = index
    
}
    
    else
    {
        
get_players playerscount"ch" )
    }
    
    for ( 
0count++ )
    {
        if ( 
is_user_connected players ] ) )
        {
            
message_begin MSG_ONE_UNRELIABLEg_MsgSay_players ] )
            
write_byte players ] )
            
write_string message )
            
message_end ( )
        }
    }


I need the money to show her entire team, but, is not working. Can anyone help me?

Thx

ConnorMcLeod 12-19-2011 22:05

Re: Help in this code.
 
Why don't let the game do that for you ?

PHP Code:

    register_event("HLTV""Event_HLTV_New_Round""a""1=0""2=0")
}

public 
Event_HLTV_New_Round()
{
    
set_task(0.1"ShowMoney")
}

public 
ShowMoney()
{
    new 
iPlayers[32], iNumszSaid[8]
    
get_players(iPlayersiNum"ah")
    for(--
iNumiNum>=0iNum--)
    {
        
id iPlayers[iNum]
        
formatex(szSaidcharsmax(szSaid), "$ %d"cs_get_user_money(id))
        
engclient_cmd(id"say_team"szSaid)
    }



kramesa 12-19-2011 22:16

Re: Help in this code.
 
Thanks, works perfectly.


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

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