Mensajes: 385
Temas: 132
Registro en: May 2018
Reputación:
1
12/06/2019, 03:10 PM
(Última modificación: 13/06/2019, 03:42 AM por Forever123 . Edited 2 times in total.)
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 i = 1 ; i <= iMaxPlayers ; i ++) { if(! is_user_connected ( i ) || get_user_team ( i ) != team ) { continue } get_user_name ( i , name , 31 ) format ( hud , charsmax ( hud ), "%s%s - $%i^n" , hud , name , get_member ( i , m_iAccount )) } for(new i = 1 ; i <= iMaxPlayers ; i ++) { if(! is_user_connected ( i ) || get_user_team ( i ) != team ) { continue } set_hudmessage ( 0 , 255 , 0 , 0.6 , 0.15 , 0 , 1.0 , 1.1 , 0.1 , 0.2 , 1 ) show_hudmessage ( i , team == 1 ? "Terrorista:" : "Anti-Terrorista:" ) set_hudmessage ( 255 , 255 , 255 , 0.6 , 0.18 , 0 , 1.0 , 1.1 , 0.1 , 0.2 , 2 ) show_hudmessage ( i , hud ) } }
Mensajes: 3,077
Temas: 33
Registro en: May 2017
Reputación:
34
12/06/2019, 05:18 PM
(Última modificación: 12/06/2019, 05:39 PM por Valentina. . Edited 2 times in total.)
Toma te hice esto.
Sí no lo puedes adaptar a tus necesidades avisas por aquí y lo hago por ti...
Saludos.
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_iMaxPlayers [ 1 char ]; public plugin_init ( ) { /* Register Plugin & Cvars */ register_plugin ( PLUGIN_NAME , PLUGIN_VERSION , PLUGIN_AUTHOR ); register_cvar ( PLUGIN_CVAR , PLUGIN_VERSION , FCVAR_SERVER | FCVAR_SPONLY ); /* Client-related Stuff */ register_clcmd ( "say /money" , "ClientCommand_ViewTeamMoney" ); /* Hamsandwichs */ RegisterHam ( Ham_Spawn , "player" , "Ham_PlayerSpawn_Post" , true ); g_iMaxPlayers { 0 } = get_maxplayers ( ); } /* Client-related Stuff */ public ClientCommand_ViewTeamMoney ( const id ) { if( ! IsUserConnected ( id ) ) return PLUGIN_HANDLED ; GetTeamMoney ( id ); return PLUGIN_HANDLED ; } /* Hamsandwichs */ public Ham_PlayerSpawn_Post ( id ) { if( ! is_user_alive ( id ) ) return HAM_IGNORED ; GetTeamMoney ( id ); return HAM_IGNORED ; } /* Stocks & Private functions */ stock AddDot ( iNumber ) { /* - Stock by LuKKs ( Thanks ) - */ new szResult [ 15 ], i , c ; static szString [ 15 ], iLen ; for( iLen = num_to_str ( iNumber , szString , 14 ); i < iLen ; i ++ ) { i && ( iLen - i ) % 3 == 0 && ( szResult [ c ++ ] = '.' ); szResult [ c ++ ] = szString [ i ]; } return szResult ; } stock ClientPrintColor ( const id , const szInput [ ], any :... ) { static szMessage [ 192 ], iLen ; if( ! iLen ) iLen = formatex ( szMessage , 191 , CHAT_PREFIX ); vformat ( szMessage [ iLen ], 191 - iLen , szInput , 3 ); replace_all ( szMessage , 190 , "!g" , "^4" ); replace_all ( szMessage , 190 , "!y" , "^1" ); replace_all ( szMessage , 190 , "!t" , "^3" ); message_begin ( ( id ) ? MSG_ONE_UNRELIABLE : MSG_BROADCAST , get_user_msgid ( "SayText" ), _ , id ); write_byte ( ( id ) ? id : MAX_PLAYERS + 1 ); write_string ( szMessage ); message_end ( ); return 1 ; } GetTeamMoney ( const id ) { new iPlayers [ MAX_PLAYERS ], szTeam [ 13 ], iNum = 0 , iMoney = 0 ; get_user_team ( id , szTeam , charsmax ( szTeam ) ); get_players ( iPlayers , iNum , "aeh" , szTeam ); if( iNum > 0 ) { for( new i = 0 ; i < iNum ; ++ i ) iMoney += cs_get_user_money ( iPlayers [ i ] ); ClientPrintColor ( id , "Total ^3money^1 in your team:^4 $%s^1." , AddDot ( iMoney ) ); } }
Mensajes: 385
Temas: 132
Registro en: May 2018
Reputación:
1
(12/06/2019, 05:18 PM) Chema escribió: Toma te hice esto.
Sí no lo puedes adaptar a tus necesidades avisas por aquí y lo hago por ti...
Saludos.
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_iMaxPlayers [ 1 char ]; public plugin_init ( ) { /* Register Plugin & Cvars */ register_plugin ( PLUGIN_NAME , PLUGIN_VERSION , PLUGIN_AUTHOR ); register_cvar ( PLUGIN_CVAR , PLUGIN_VERSION , FCVAR_SERVER | FCVAR_SPONLY ); /* Client-related Stuff */ register_clcmd ( "say /money" , "ClientCommand_ViewTeamMoney" ); /* Hamsandwichs */ RegisterHam ( Ham_Spawn , "player" , "Ham_PlayerSpawn_Post" , true ); g_iMaxPlayers { 0 } = get_maxplayers ( ); } /* Client-related Stuff */ public ClientCommand_ViewTeamMoney ( const id ) { if( ! IsUserConnected ( id ) ) return PLUGIN_HANDLED ; GetTeamMoney ( id ); return PLUGIN_HANDLED ; } /* Hamsandwichs */ public Ham_PlayerSpawn_Post ( id ) { if( ! is_user_alive ( id ) ) return HAM_IGNORED ; GetTeamMoney ( id ); return HAM_IGNORED ; } /* Stocks & Private functions */ stock AddDot ( iNumber ) { /* - Stock by LuKKs ( Thanks ) - */ new szResult [ 15 ], i , c ; static szString [ 15 ], iLen ; for( iLen = num_to_str ( iNumber , szString , 14 ); i < iLen ; i ++ ) { i && ( iLen - i ) % 3 == 0 && ( szResult [ c ++ ] = '.' ); szResult [ c ++ ] = szString [ i ]; } return szResult ; } stock ClientPrintColor ( const id , const szInput [ ], any :... ) { static szMessage [ 192 ], iLen ; if( ! iLen ) iLen = formatex ( szMessage , 191 , CHAT_PREFIX ); vformat ( szMessage [ iLen ], 191 - iLen , szInput , 3 ); replace_all ( szMessage , 190 , "!g" , "^4" ); replace_all ( szMessage , 190 , "!y" , "^1" ); replace_all ( szMessage , 190 , "!t" , "^3" ); message_begin ( ( id ) ? MSG_ONE_UNRELIABLE : MSG_BROADCAST , get_user_msgid ( "SayText" ), _ , id ); write_byte ( ( id ) ? id : MAX_PLAYERS + 1 ); write_string ( szMessage ); message_end ( ); return 1 ; } GetTeamMoney ( const id ) { new iPlayers [ MAX_PLAYERS ], szTeam [ 13 ], iNum = 0 , iMoney = 0 ; get_user_team ( id , szTeam , charsmax ( szTeam ) ); get_players ( iPlayers , iNum , "aeh" , szTeam ); if( iNum > 0 ) { for( new i = 0 ; i < iNum ; ++ i ) iMoney += cs_get_user_money ( iPlayers [ i ] ); ClientPrintColor ( id , "Total ^3money^1 in your team:^4 $%s^1." , AddDot ( iMoney ) ); } }
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
Mensajes: 3,077
Temas: 33
Registro en: May 2017
Reputación:
34
12/06/2019, 08:34 PM
(Última modificación: 12/06/2019, 08:34 PM por Valentina. . Edited 1 time in total.)
Al menos hubieras intentado algo, para algo está el foro. Así aprendemos todos juntos!
Saludos.
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 i = 1 ; i <= iMaxPlayers ; i ++) { if(! is_user_connected ( i ) || get_user_team ( i ) != team ) { continue } get_user_name ( i , name , 31 ) format ( hud , charsmax ( hud ), "%s%s - $%i^nTotal Money: %s" , hud , name , get_member ( i , m_iAccount ), GetTeamMoney ( id ) ) } for(new i = 1 ; i <= iMaxPlayers ; i ++) { if(! is_user_connected ( i ) || get_user_team ( i ) != team ) { continue } set_hudmessage ( 0 , 255 , 0 , 0.6 , 0.15 , 0 , 1.0 , 1.1 , 0.1 , 0.2 , 1 ) show_hudmessage ( i , team == 1 ? "Terrorista:" : "Anti-Terrorista:" ) set_hudmessage ( 255 , 255 , 255 , 0.6 , 0.18 , 0 , 1.0 , 1.1 , 0.1 , 0.2 , 2 ) show_hudmessage ( i , hud ) } } stock AddDot ( iNumber ) { /* - Stock by LuKKs ( Thanks ) - */ new szResult [ 15 ], i , c ; static szString [ 15 ], iLen ; for( iLen = num_to_str ( iNumber , szString , 14 ); i < iLen ; i ++ ) { i && ( iLen - i ) % 3 == 0 && ( szResult [ c ++ ] = '.' ); szResult [ c ++ ] = szString [ i ]; } return szResult ; } GetTeamMoney ( const id ) { new iPlayers [ MAX_PLAYERS ], szTeam [ 13 ], szBuffer [ 10 ], iNum = 0 , iMoney = 0 ; get_user_team ( id , szTeam , charsmax ( szTeam ) ); get_players ( iPlayers , iNum , "aeh" , szTeam ); if( iNum > 0 ) { for( new i = 0 ; i < iNum ; ++ i ) iMoney += cs_get_user_money ( iPlayers [ i ] ); format ( szBuffer , 9 , "$%s" , AddDot ( iMoney ) ); } return szBuffer ; }
Mensajes: 385
Temas: 132
Registro en: May 2018
Reputación:
1
(12/06/2019, 08:34 PM) Chema escribió: Al menos hubieras intentado algo, para algo está el foro. Así aprendemos todos juntos!
Saludos.
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 i = 1 ; i <= iMaxPlayers ; i ++) { if(! is_user_connected ( i ) || get_user_team ( i ) != team ) { continue } get_user_name ( i , name , 31 ) format ( hud , charsmax ( hud ), "%s%s - $%i^nTotal Money: %s" , hud , name , get_member ( i , m_iAccount ), GetTeamMoney ( id ) ) } for(new i = 1 ; i <= iMaxPlayers ; i ++) { if(! is_user_connected ( i ) || get_user_team ( i ) != team ) { continue } set_hudmessage ( 0 , 255 , 0 , 0.6 , 0.15 , 0 , 1.0 , 1.1 , 0.1 , 0.2 , 1 ) show_hudmessage ( i , team == 1 ? "Terrorista:" : "Anti-Terrorista:" ) set_hudmessage ( 255 , 255 , 255 , 0.6 , 0.18 , 0 , 1.0 , 1.1 , 0.1 , 0.2 , 2 ) show_hudmessage ( i , hud ) } } stock AddDot ( iNumber ) { /* - Stock by LuKKs ( Thanks ) - */ new szResult [ 15 ], i , c ; static szString [ 15 ], iLen ; for( iLen = num_to_str ( iNumber , szString , 14 ); i < iLen ; i ++ ) { i && ( iLen - i ) % 3 == 0 && ( szResult [ c ++ ] = '.' ); szResult [ c ++ ] = szString [ i ]; } return szResult ; } GetTeamMoney ( const id ) { new iPlayers [ MAX_PLAYERS ], szTeam [ 13 ], szBuffer [ 10 ], iNum = 0 , iMoney = 0 ; get_user_team ( id , szTeam , charsmax ( szTeam ) ); get_players ( iPlayers , iNum , "aeh" , szTeam ); if( iNum > 0 ) { for( new i = 0 ; i < iNum ; ++ i ) iMoney += cs_get_user_money ( iPlayers [ i ] ); format ( szBuffer , 9 , "$%s" , AddDot ( iMoney ) ); } return szBuffer ; }
si funciona grax pero como le quito ese . que sale
Mensajes: 3,077
Temas: 33
Registro en: May 2017
Reputación:
34
En el FORMAT , quita el AddDot y deja solo iMoney .
Saludos.
Mensajes: 385
Temas: 132
Registro en: May 2018
Reputación:
1
(13/06/2019, 03:29 AM) Chema escribió: En el FORMAT , quita el AddDot y deja solo iMoney .
Saludos.
no sale el dinero sale dos simbolos de dolar
Archivos adjuntos
Miniatura(s)
Mensajes: 3,077
Temas: 33
Registro en: May 2017
Reputación:
34
13/06/2019, 03:37 AM
(Última modificación: 13/06/2019, 03:38 AM por Valentina. . Edited 1 time in total.)
Cambia el %s por un %i dentro del FORMAT .
Saludos.
Mensajes: 385
Temas: 132
Registro en: May 2018
Reputación:
1
(13/06/2019, 03:37 AM) Chema escribió: Cambia el %s por un %i dentro del FORMAT .
Saludos.
ya muchisimas gracias
Mensajes: 3,077
Temas: 33
Registro en: May 2017
Reputación:
34
Por nada, sí puedes edita el título del tema y agregale [SOLUCIONADO]
Saludos.