AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How can i return the whole team money value ? (https://forums.alliedmods.net/showthread.php?t=292892)

Craxor 01-17-2017 04:14

How can i return the whole team money value ?
 
I'm trying to make a stock to return the whole team money, idk why is not currentyl working ..

Idk what methot should i add, however here's the code:
PHP Code:

#include <amxmodx>
#include <cstrike>

new iTeMoney;

public 
plugin_init( )
{
    
register_clcmd"say /test""test" );
}


public 
testid )
{
    
client_printid print_chat "Tero team total money: %i, your money: %i"cs_temoney_team( ) , cs_get_user_moneyid ) );
}

stock cs_temoney_team(  )
{
    new 
tePlayers[32] , iteNum;    

    
get_playerstePlayers iteNum "e" "1" );

    for( new 
iteNum i++ )
    {
        
iTeMoney += cs_get_user_moneytePlayers] );
    }
    return 
iTeMoney;



jimaway 01-17-2017 04:45

Re: How can i return the whole team money value ?
 
get_players( tePlayers , iteNum , "e" , "TERRORIST" );

Craxor 01-17-2017 06:16

Re: How can i return the whole team money value ?
 
silly mistake, sorry :(

EFFx 01-17-2017 13:14

Re: How can i return the whole team money value ?
 
And you don't need a global variable.

Craxor 01-17-2017 16:24

Re: How can i return the whole team money value ?
 
Quote:

Originally Posted by EFFx (Post 2487424)
And you don't need a global variable.

thanks sir :) it was just an example of something similar with the same method, the actual stock it's much complex and bigger and do different things, i was not understand why is not working because i made tons like that, i forgot that only in AMXMOD is working with "1" or "2" not also in amxmodx :P , my mistake.

edon1337 01-17-2017 16:36

Re: How can i return the whole team money value ?
 
Or This..
PHP Code:

#include <amxmodx> 
#include <cstrike> 

#define IsValidPlayer(%1) ( 1 <= %1 <= g_maxplayers )

new g_maxplayers;

public 
plugin_init( ) 

    
register_clcmd"say /test""test" ); 
    
    
g_maxplayers get_maxplayers()


public 
testid 

    
client_printid print_chat "Tero team total money: %i, your money: %i"cs_temoney_team( ) , cs_get_user_moneyid ) ); 


stock cs_temoney_team(  ) 

    static 
iTeMoney
    
    for ( new 
i<= g_maxplayersi++ ) {
        
        if(
IsValidPlayer) && is_user_alive) && cs_get_user_team) == CS_TEAM_T) {
            
            
iTeMoney += cs_get_user_money);     
            
        }
    }
    return 
iTeMoney



EFFx 01-17-2017 16:40

Re: How can i return the whole team money value ?
 
No edon, you shouldn't use a loop for pickup players indexes.

edon1337 01-17-2017 16:44

Re: How can i return the whole team money value ?
 
Won't that work ?

OciXCrom 01-17-2017 16:45

Re: How can i return the whole team money value ?
 
It's not a correct way to do it.

EFFx 01-17-2017 16:54

Re: How can i return the whole team money value ?
 
You should use get_players(), there's so many requestions about it, you can search on google for learn.


All times are GMT -4. The time now is 21:01.

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