View Single Post
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-14-2021 , 23:57   Re: Money Every 5 Minutes
Reply With Quote #6

@Celena Luna - You do not need to check is_user_connected() on players returned by get_players() as it only returns connected players. And you want to avoid calling the same native more than once when it's guaranteed to return the same value, in this case your two cs_get_user_team() calls are redundant. You should store the value in a variable and use that in your conditions, or do it as I have below. And this is more of a style thing, but IMO there's no sense in checking negative conditions to return or continue, just execute the applicable code when the condition is met, as I have below.

PHP Code:
//Global timer
if ( CS_TEAM_T <= cs_get_user_teamPlayerList] ) <= CS_TEAM_CT )
    
cs_set_user_money(PlayerList[i], cs_get_user_money(PlayerList[i]) + GIVE_AMOUNT)

//Unique timer
if ( CS_TEAM_T <= cs_get_user_teamid ) <= CS_TEAM_CT )
    
cs_set_user_money(idcs_get_user_money(id) + GIVE_AMOUNT
__________________

Last edited by Bugsy; 04-14-2021 at 23:59.
Bugsy is offline