|
Senior Member
Join Date: Sep 2020
Location: France
|
05-17-2021
, 13:35
Re: Money Every 5 Minutes
|
#20
|
Quote:
Originally Posted by Celena Luna
[Global Timer]
Spoiler
PHP Code:
/* Sublime AMXX Editor v2.2 */
#include <amxmodx>
#include <cstrike>
#define PLUGIN "Give Money per 5 minues"
#define VERSION "1.0"
#define AUTHOR "Celena Luna"
#define TASK_GETMONEY 546213
//EDIT AMOUNT OF MONEY U WANT TO GIVE HERE
#define GIVE_AMOUNT 1000
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
set_task(60.0*5.0, "Give_Money", TASK_GETMONEY, _, _, "b")
}
public Give_Money()
{
static PlayerList[32], PlayerNum; PlayerNum = 0
static id
static CsTeams:iTeam;
get_players(PlayerList, PlayerNum, "h")
for(new i=0; i<PlayerNum;i++)
{
id = PlayerList[i];
iTeam = cs_get_user_team(id)
if(iTeam == CS_TEAM_SPECTATOR || iTeam == CS_TEAM_UNASSIGNED)
continue
cs_set_user_money(id, min(cs_get_user_money(id) + GIVE_AMOUNT, 16000))
}
}
[Unique Timer]
Spoiler
PHP Code:
/* Sublime AMXX Editor v2.2 */
#include <amxmodx>
#include <cstrike>
#define PLUGIN "Give Money per 5 minues"
#define VERSION "1.0"
#define AUTHOR "Celena Luna"
#define TASK_GETMONEY 546213
//EDIT AMOUNT OF MONEY U WANT TO GIVE HERE
#define GIVE_AMOUNT 1000
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
}
public client_putinserver(id)
{
set_task(60.0*5.0, "Give_Money", id+TASK_GETMONEY, _, _, "b")
}
public client_disconnect(id) remove_task(id+TASK_GETMONEY)
public Give_Money(taskid)
{
new id = taskid -TASK_GETMONEY;
static CsTeams:iTeam;
if(iTeam == CS_TEAM_SPECTATOR || iTeam == CS_TEAM_UNASSIGNED)
return
cs_set_user_money(id, min(cs_get_user_money(id) + GIVE_AMOUNT, 16000))
}
I edited based on my post
P/S: Please reply if it work or not
@Bugsy: Sorry, I got infected by Dias's style who usually check the negative condition.
Though, I would use positive condition if the positive condition is less than negative
|
With unique timer, we don't get the money.
__________________
CS:CZ > CS 1.6
|
|
|
|