AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   Money Every 5 Minutes (https://forums.alliedmods.net/showthread.php?t=331843)

Ace67 04-09-2021 20:04

Money Every 5 Minutes
 
Hello, im currently searching a plugin for get money all 5 minutes ex:
You get money for every 5 minutes played.

SHIFT0 04-09-2021 20:15

Re: Money Every 5 Minutes
 
Look like u sharing every 1hour man, you can't wait ?

Ace67 04-10-2021 15:25

Re: Money Every 5 Minutes
 
Quote:

Originally Posted by SHIFT0 (Post 2743610)
Look like u sharing every 1hour man, you can't wait ?

?

Celena Luna 04-14-2021 00:55

Re: Money Every 5 Minutes
 
[Global Timer]
- Everyone get money every 5 minutes
Spoiler


[Unique Timer]
- The player have to stay in server for 5 minutes to get money.
- Disconnect = reset timer
Spoiler


P/S: Please reply if it work or not

Ace67 04-14-2021 13:38

Re: Money Every 5 Minutes
 
Thanks works :D

Bugsy 04-15-2021 00:57

Re: Money Every 5 Minutes
 
@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


Celena Luna 04-15-2021 04:11

Re: Money Every 5 Minutes
 
Quote:

Originally Posted by Bugsy (Post 2744099)
@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.

I was wrote in hurry so I forget about these.

Ace67 04-15-2021 11:52

Re: Money Every 5 Minutes
 
Edited

Ace67 04-18-2021 01:17

Re: Money Every 5 Minutes
 
Quote:

Originally Posted by Celena Luna (Post 2744114)
I was wrote in hurry so I forget about these.

Sup, can you edit for max money 16k ?

Bugsy 04-18-2021 01:20

Re: Money Every 5 Minutes
 
Replace:

cs_get_user_money(id) + GIVE_AMOUNT
with
min( cs_get_user_money(id) + GIVE_AMOUNT , 16000 )

And

cs_get_user_money(PlayerList[i]) + GIVE_AMOUNT
with
min( cs_get_user_money(PlayerList[i]) + GIVE_AMOUNT , 16000 )


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

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