Code:
public event_player_spawn(id) {
if ( gHasSuperPower[id] && is_user_alive(id) && shModActive() ) {
set_task(0.1, "item_longjump", id)
}
Code:
/* Superhero plugin for crumbl13
*
* CVARS:
* crumb13_level - Default 0
********************************/
#include <amxmodx>
#include <fun>
#include <superheromod>
#define MAX_PLAYERS 32
new bool:g_restart_attempt[MAX_PLAYERS + 1]
new bool:g_hasLongJump[33]
new gHeroName[]="Epic Crumbl3"
new bool:gHasSuperPower[SH_MAXSLOTS+1]
public plugin_init() {
register_plugin("SUPERHERO Epic Crumb13", "1.1", "");
register_cvar("crumb13_level", "0"); //Set to 0 default :)
shCreateHero(gHeroName, "Hero Power List", "constant half-life super-jump", false, "Super_level"); //superheromod.inc: stock shCreateHero(heroName[], heroPower[], heroHelp[], bool:requiresKeyEvents, heroLevel[])
register_srvcmd("Super_init", "Super_init");
shRegHeroInit(gHeroName, "Super_init");
register_event("ResetHUD", "event_hud_reset", "be")
register_clcmd("fullupdate", "clcmd_fullupdate")
register_event("DeathMsg", "death", "a")
register_event("TextMsg", "event_restart_attempt", "a", "2=#Game_will_restart_in")
}
//------------------------------------------------------------------------------------------------------------
public client_connect(id) {
g_hasLongJump[id] = false
return PLUGIN_HANDLED
}
//------------------------------------------------------------------------------------------------------------
public client_disconnect(id) {
g_hasLongJump[id] = false
return PLUGIN_HANDLED
}
//------------------------------------------------------------------------------------------------------------
public death() {
new id = read_data(2)
g_hasLongJump[id] = false
}
//------------------------------------------------------------------------------------------------------------
public Super_init() {
new temp[6];
read_argv(1,temp,5);
new id = str_to_num(temp);
read_argv(2,temp,5);
new hasPowers = str_to_num(temp);
gHasSuperPower[id] = (hasPowers != 0);
}
//------------------------------------------------------------------------------------------------------------
public clcmd_fullupdate() {
return PLUGIN_HANDLED_MAIN
}
//------------------------------------------------------------------------------------------------------------
public event_restart_attempt() {
new players[32], num
get_players(players, num, "a")
for (new i; i < num; ++i)
g_restart_attempt[players[i]] = true
}
//------------------------------------------------------------------------------------------------------------
public event_hud_reset(id) {
if (g_restart_attempt[id]) {
g_restart_attempt[id] = false
return
}
event_player_spawn(id)
}
//------------------------------------------------------------------------------------------------------------
public event_player_spawn(id) {
if ( gHasSuperPower[id] && is_user_alive(id) && shModActive() ) {
set_task(0.1, "item_longjump", id)
}
}
//------------------------------------------------------------------------------------------------------------
public item_longjump(id) {
g_hasLongJump[id] = true
give_item(id, "item_longjump")
return PLUGIN_CONTINUE;
}
//------------------------------------------------------------------------------------------------------------