Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <cstrike>
new bool:hasNinja[33]=false
public plugin_init()
{
register_plugin("Ninja Mode","0.1","smallwimpyboy")
register_cvar("amx_ninjaon", "1")
register_clcmd("say /ninja","ninja")
register_clcmd("say_team /ninja","ninja")
register_clcmd("say /ninjaoff","ninjaoff")
register_clcmd("say_team /ninjaoff","ninjaoff")
register_event("CurWeapon","CurWeapon","be")
register_logevent("round_start",2,"0=World triggered","1=Round_Start")
}
public client_connect(id)
{
hasNinja[id] = false
}
public ninja(id,level,cid)
{
if(hasNinja[id])
{
client_print (id,print_chat,"[AMXX] You are already a Ninja.")
return PLUGIN_CONTINUE
}
set_user_health(id,355)
set_user_armor(id,355)
set_user_rendering(id,kRenderFxGlowShell,0,0,0,kRenderTransAlpha,50)
client_print (id,print_chat,"[AMXX] You are now a Ninja, you have increased health and armor, as well as stealth.")
set_user_gravity(id,0.4)
set_user_footsteps(id,1)
hasNinja[id] = true
return PLUGIN_CONTINUE
}
public ninjaoff(id)
{
set_user_health (id,100)
set_user_armor (id,0)
set_user_rendering(id,kRenderFxGlowShell,0,0,0,kRenderTransAlpha, 255)
client_print (id,print_chat,"[AMXX] Your Ninja powers have worn off, you are now normal.")
set_user_gravity (id,1.0)
set_user_footsteps (id,0)
hasNinja[id]=false
}
public round_start() {
for( i=1; i < get_maxplayers() i++ ) { //Everything seems to be coming from here.
if( !is_user_connected(i) ) continue
if( hasNinja[i] == true ) {
set_user_health (id,100)
set_user_armor (id,0)
set_user_rendering(id,kRenderFxGlowShell,0,0,0,kRenderTransAlpha, 255)
client_print (id,print_chat,"[AMXX] Your Ninja powers have worn off, you are now normal.")
set_user_gravity (id,1.0)
set_user_footsteps (id,0)
hasNinja[id]=false
}
}
}
public CurWeapon(id)
{
if(hasNinja[id]==true)
{
client_cmd(id,"weapon_knife")
}
return PLUGIN_HANDLED
}