Optimized a bit cause you shouln't get tha cvar pointer twice in the same function.
Also added a taskID, not needed at the moment but you need to do another task it will.
Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#define PLUGIN "Round Survival Money"
#define VERSION "1.0"
#define AUTHOR "X-Script"
#define TASKID 978645
new roundsurvival, roundreward
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_logevent("round_end", 2, "0=World triggered", "1=Round_End")
register_logevent("new_round", 2, "0=World triggered", "1=Round_Start")
roundsurvival = register_cvar("amx_survivemode", "1")
roundreward = register_cvar("amx_survivecash", "3000")
}
public new_round()
{
if (!get_pcvar_num(roundsurvival))
return PLUGIN_HANDLED
client_print(0, print_chat, "[AMXX] ROUND STARTED: Survive this round and win an additional $%i!", get_pcvar_num(roundreward))
return PLUGIN_HANDLED
}
public round_end()
{
if (!get_pcvar_num(roundsurvival))
return PLUGIN_HANDLED
new players[32], totalplayers, player
get_players(players, totalplayers)
for (new i = 0; i < totalplayers; i++) {
player = players[i]
if (is_user_alive(player)) {
new money_to_give = get_pcvar_num(roundreward)
cs_set_user_money(player, cs_get_user_money(player) + money_to_give)
client_print(player, print_chat, "[AMXX] ROUND ENDED: You survived and have been awarded $%i!", money_to_give)
set_user_rendering(player, kRenderFxGlowShell, 255, 255, 255, kRenderNormal, 0)
set_task(8.0, "glow_off", player+TASKID)
}
else
client_print(player, print_chat, "[AMXX] ROUND ENDED: You did not survive this round. No award for you. Better luck next time!")
}
return PLUGIN_HANDLED
}
public glow_off(id)
{
id -= TASKID
set_user_rendering(id)
}