sumar el dinero de todo el equipo resuelto
#1
buenas, me pueden ayudar a poner al lado del hud anti-terroristas y terroritas la suma de todo el dinero q tiene los jugadores que cada lado osea sumar el dinero de todos los terroristas y ponerlo al lado del hud y a si con en el de anti terroristas y cuando los terroristas o los anti terroristas vallan gastando dinero en el hud valla bajando tambien

Código PHP:
public pfn_show_money(tid) {
    
update_team_money(1)
    
update_team_money(2)
}
update_team_money(team) {
    new 
hud[256], name[32]
    for(new 
<= iMaxPlayers i++) {
        if(!
is_user_connected(i) || get_user_team(i) != team) {
            continue
        }
        
get_user_name(iname31)
        
format(hudcharsmax(hud), "%s%s - $%i^n"hudnameget_member(im_iAccount))
    }

    for(new 
<= iMaxPlayers i++) {
        if(!
is_user_connected(i) || get_user_team(i) != team) {
            continue
        }
        
set_hudmessage(025500.60.1501.01.10.10.21)
        
show_hudmessage(iteam == "Terrorista:" "Anti-Terrorista:")

        
set_hudmessage(2552552550.60.1801.01.10.10.22)
        
show_hudmessage(ihud)
    }

Responder
#2
Toma te hice esto. Lengua

Sí no lo puedes adaptar a tus necesidades avisas por aquí y lo hago por ti...

Saludos. Crab


Código PHP:
/*
    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - NOMBRE: MIX: Total Team Money                     -
    - AUTOR: Chema - [ www.facebook.com/CSPlayerChema ] -
    - VERSIÓN: 1.1 Beta                                 -
    - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/

#include < amxmodx >
#include < cstrike >
#include < hamsandwich >

#pragma semicolon 1

#if AMXX_VERSION_NUM < 183

    #define client_disconected client_disconnect
    #define print_team_default 0
    #define MAX_PLAYERS 32
#endif

/* GLOBAL STUFF */
#define IsUserConnected(%1) ( 1 <= %1 <= g_iMaxPlayers{0} && is_user_connected( %1 ) )

new const PLUGIN_NAME[ ] = "MIX: Total Team Money";
new const 
PLUGIN_VERSION[ ] = "1.1b";
new const 
PLUGIN_AUTHOR[ ] = "Chema";
new const 
PLUGIN_CVAR[ ] = "ttm_version";

new const 
CHAT_PREFIX[ ] = "^3[SG]^1 ";

new 
g_iMaxPlayers1 char ];

public 
plugin_init( ) {

    
/* Register Plugin & Cvars */
    
register_pluginPLUGIN_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR );

    
register_cvarPLUGIN_CVARPLUGIN_VERSIONFCVAR_SERVER|FCVAR_SPONLY );

    
/* Client-related Stuff */
    
register_clcmd"say /money""ClientCommand_ViewTeamMoney" );

    
/* Hamsandwichs */
    
RegisterHamHam_Spawn"player""Ham_PlayerSpawn_Post"true );

    
g_iMaxPlayers{0} = get_maxplayers( );
}

/* Client-related Stuff */
public ClientCommand_ViewTeamMoney( const id ) {

    if( !
IsUserConnectedid ) )
        return 
PLUGIN_HANDLED;

    
GetTeamMoneyid );
    return 
PLUGIN_HANDLED;
}

/* Hamsandwichs */
public Ham_PlayerSpawn_Postid ) {

    if( !
is_user_aliveid ) )
        return 
HAM_IGNORED;

    
GetTeamMoneyid );
    return 
HAM_IGNORED;
}

/* Stocks & Private functions */
stock AddDotiNumber ) {

    
/* - Stock by LuKKs ( Thanks ) - */
    
new szResult15 ], ic;
    static 
szString15 ], iLen;

    for( 
iLen num_to_striNumberszString14 ); iLeni++ ) {

        
&& ( iLen ) % == && ( szResultc++ ] = '.' );
        
szResultc++ ] = szString];
    }

    return 
szResult;
}

stock ClientPrintColor( const id, const szInput[ ], any:... ) {

    static 
szMessage192 ], iLen;

    if( !
iLen )
        
iLen formatexszMessage191CHAT_PREFIX );
    
    
vformatszMessageiLen ], 191 iLenszInput);
    
    
replace_allszMessage190"!g""^4" );
    
replace_allszMessage190"!y""^1" );
    
replace_allszMessage190"!t""^3" );

    
message_begin( ( id ) ? MSG_ONE_UNRELIABLE MSG_BROADCASTget_user_msgid"SayText" ), _id );
    
write_byte( ( id ) ? id MAX_PLAYERS );
    
write_stringszMessage );
    
message_end( );
    
    return 
1;
}

GetTeamMoney( const id ) {

    new 
iPlayersMAX_PLAYERS ], szTeam13 ], iNum 0iMoney 0;
    
    
get_user_teamidszTeamcharsmaxszTeam ) );
    
get_playersiPlayersiNum"aeh"szTeam );
    
    if( 
iNum ) {

        for( new 
0iNum; ++
            
iMoney += cs_get_user_moneyiPlayers] );

        
ClientPrintColorid"Total ^3money^1 in your team:^4 $%s^1."AddDotiMoney ) );
    }

Responder
#3
(12/06/2019, 05:18 PM)Chema escribió: Toma te hice esto. Lengua

Sí no lo puedes adaptar a tus necesidades avisas por aquí y lo hago por ti...

Saludos. Crab


Código PHP:
/*
    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - NOMBRE: MIX: Total Team Money                     -
    - AUTOR: Chema - [ www.facebook.com/CSPlayerChema ] -
    - VERSIÓN: 1.1 Beta                                 -
    - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/

#include < amxmodx >
#include < cstrike >
#include < hamsandwich >

#pragma semicolon 1

#if AMXX_VERSION_NUM < 183

    #define client_disconected client_disconnect
    #define print_team_default 0
    #define MAX_PLAYERS 32
#endif

/* GLOBAL STUFF */
#define IsUserConnected(%1) ( 1 <= %1 <= g_iMaxPlayers{0} && is_user_connected( %1 ) )

new const PLUGIN_NAME[ ] = "MIX: Total Team Money";
new const 
PLUGIN_VERSION[ ] = "1.1b";
new const 
PLUGIN_AUTHOR[ ] = "Chema";
new const 
PLUGIN_CVAR[ ] = "ttm_version";

new const 
CHAT_PREFIX[ ] = "^3[SG]^1 ";

new 
g_iMaxPlayers1 char ];

public 
plugin_init( ) {

    
/* Register Plugin & Cvars */
    
register_pluginPLUGIN_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR );

    
register_cvarPLUGIN_CVARPLUGIN_VERSIONFCVAR_SERVER|FCVAR_SPONLY );

    
/* Client-related Stuff */
    
register_clcmd"say /money""ClientCommand_ViewTeamMoney" );

    
/* Hamsandwichs */
    
RegisterHamHam_Spawn"player""Ham_PlayerSpawn_Post"true );

    
g_iMaxPlayers{0} = get_maxplayers( );
}

/* Client-related Stuff */
public ClientCommand_ViewTeamMoney( const id ) {

    if( !
IsUserConnectedid ) )
        return 
PLUGIN_HANDLED;

    
GetTeamMoneyid );
    return 
PLUGIN_HANDLED;
}

/* Hamsandwichs */
public Ham_PlayerSpawn_Postid ) {

    if( !
is_user_aliveid ) )
        return 
HAM_IGNORED;

    
GetTeamMoneyid );
    return 
HAM_IGNORED;
}

/* Stocks & Private functions */
stock AddDotiNumber ) {

    
/* - Stock by LuKKs ( Thanks ) - */
    
new szResult15 ], ic;
    static 
szString15 ], iLen;

    for( 
iLen num_to_striNumberszString14 ); iLeni++ ) {

        
&& ( iLen ) % == && ( szResultc++ ] = '.' );
        
szResultc++ ] = szString];
    }

    return 
szResult;
}

stock ClientPrintColor( const id, const szInput[ ], any:... ) {

    static 
szMessage192 ], iLen;

    if( !
iLen )
        
iLen formatexszMessage191CHAT_PREFIX );
    
    
vformatszMessageiLen ], 191 iLenszInput);
    
    
replace_allszMessage190"!g""^4" );
    
replace_allszMessage190"!y""^1" );
    
replace_allszMessage190"!t""^3" );

    
message_begin( ( id ) ? MSG_ONE_UNRELIABLE MSG_BROADCASTget_user_msgid"SayText" ), _id );
    
write_byte( ( id ) ? id MAX_PLAYERS );
    
write_stringszMessage );
    
message_end( );
    
    return 
1;
}

GetTeamMoney( const id ) {

    new 
iPlayersMAX_PLAYERS ], szTeam13 ], iNum 0iMoney 0;
    
    
get_user_teamidszTeamcharsmaxszTeam ) );
    
get_playersiPlayersiNum"aeh"szTeam );
    
    if( 
iNum ) {

        for( new 
0iNum; ++
            
iMoney += cs_get_user_moneyiPlayers] );

        
ClientPrintColorid"Total ^3money^1 in your team:^4 $%s^1."AddDotiMoney ) );
    }


no se como adaptarlo para hacerlo con hud y q salga en el freezetime me puedes ayudar a si como lo q publique pero mostrando lo que pedi porfa
Responder
#4
Al menos hubieras intentado algo, para algo está el foro. Así aprendemos todos juntos! Lengua

Saludos. Crab


Código PHP:
public pfn_show_money(tid) {
    
update_team_money(1)
    
update_team_money(2)
}
update_team_money(team) {
    new 
hud[256], name[32]
    for(new 
<= iMaxPlayers i++) {
        if(!
is_user_connected(i) || get_user_team(i) != team) {
            continue
        }
        
get_user_name(iname31)
        
format(hudcharsmax(hud), "%s%s - $%i^nTotal Money: %s"hudnameget_member(im_iAccount), GetTeamMoneyid ) )
    }

    for(new 
<= iMaxPlayers i++) {
        if(!
is_user_connected(i) || get_user_team(i) != team) {
            continue
        }
        
set_hudmessage(025500.60.1501.01.10.10.21)
        
show_hudmessage(iteam == "Terrorista:" "Anti-Terrorista:")

        
set_hudmessage(2552552550.60.1801.01.10.10.22)
        
show_hudmessage(ihud)
    }
}

stock AddDotiNumber ) {

    
/* - Stock by LuKKs ( Thanks ) - */
    
new szResult15 ], ic;
    static 
szString15 ], iLen;

    for( 
iLen num_to_striNumberszString14 ); iLeni++ ) {

        
&& ( iLen ) % == && ( szResultc++ ] = '.' );
        
szResultc++ ] = szString];
    }

    return 
szResult;
}

GetTeamMoney( const id ) {

    new 
iPlayersMAX_PLAYERS ], szTeam13 ], szBuffer10 ], iNum 0iMoney 0;
    
    
get_user_teamidszTeamcharsmaxszTeam ) );
    
get_playersiPlayersiNum"aeh"szTeam );
    
    if( 
iNum ) {

        for( new 
0iNum; ++
            
iMoney += cs_get_user_moneyiPlayers] );

        
formatszBuffer9"$%s"AddDotiMoney ) );
    }

    return 
szBuffer;

Responder
#5
(12/06/2019, 08:34 PM)Chema escribió: Al menos hubieras intentado algo, para algo está el foro. Así aprendemos todos juntos! Lengua

Saludos. Crab


Código PHP:
public pfn_show_money(tid) {
    
update_team_money(1)
    
update_team_money(2)
}
update_team_money(team) {
    new 
hud[256], name[32]
    for(new 
<= iMaxPlayers i++) {
        if(!
is_user_connected(i) || get_user_team(i) != team) {
            continue
        }
        
get_user_name(iname31)
        
format(hudcharsmax(hud), "%s%s - $%i^nTotal Money: %s"hudnameget_member(im_iAccount), GetTeamMoneyid ) )
    }

    for(new 
<= iMaxPlayers i++) {
        if(!
is_user_connected(i) || get_user_team(i) != team) {
            continue
        }
        
set_hudmessage(025500.60.1501.01.10.10.21)
        
show_hudmessage(iteam == "Terrorista:" "Anti-Terrorista:")

        
set_hudmessage(2552552550.60.1801.01.10.10.22)
        
show_hudmessage(ihud)
    }
}

stock AddDotiNumber ) {

    
/* - Stock by LuKKs ( Thanks ) - */
    
new szResult15 ], ic;
    static 
szString15 ], iLen;

    for( 
iLen num_to_striNumberszString14 ); iLeni++ ) {

        
&& ( iLen ) % == && ( szResultc++ ] = '.' );
        
szResultc++ ] = szString];
    }

    return 
szResult;
}

GetTeamMoney( const id ) {

    new 
iPlayersMAX_PLAYERS ], szTeam13 ], szBuffer10 ], iNum 0iMoney 0;
    
    
get_user_teamidszTeamcharsmaxszTeam ) );
    
get_playersiPlayersiNum"aeh"szTeam );
    
    if( 
iNum ) {

        for( new 
0iNum; ++
            
iMoney += cs_get_user_moneyiPlayers] );

        
formatszBuffer9"$%s"AddDotiMoney ) );
    }

    return 
szBuffer;


si funciona grax pero como le quito ese . que sale
Responder
#6
En el FORMAT, quita el AddDot y deja solo iMoney.

Saludos. Crab
Responder
#7
(13/06/2019, 03:29 AM)Chema escribió: En el FORMAT, quita el AddDot y deja solo iMoney.

Saludos. Crab

no sale el dinero sale dos simbolos de dolar


Archivos adjuntos Miniatura(s)
   
Responder
#8
Cambia el %s por un %i dentro del FORMAT.

Saludos. Crab
Responder
#9
(13/06/2019, 03:37 AM)Chema escribió: Cambia el %s por un %i dentro del FORMAT.

Saludos. Crab

ya muchisimas gracias
Responder
#10
Por nada, sí puedes edita el título del tema y agregale [SOLUCIONADO]

Saludos. Crab
Responder


Salto de foro:


Usuarios navegando en este tema: 1 invitado(s)