Raised This Month: $ Target: $400
 0% 

Error log


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bladell
Senior Member
Join Date: Jun 2012
Old 11-05-2013 , 14:22   Error log
Reply With Quote #1

Code:
L 11/05/2013 - 20:54:26: [FUN] Invalid player 1
L 11/05/2013 - 20:54:26: [AMXX] Displaying debug trace (plugin "sh_protoman.amxx")
L 11/05/2013 - 20:54:26: [AMXX] Run time error 10: native error (native "set_user_health")
L 11/05/2013 - 20:54:26: [AMXX]    [0] superheromod.inc::sh_add_hp (line 703)
L 11/05/2013 - 20:54:26: [AMXX]    [1] superheromod.inc::shAddHPs (line 1150)
L 11/05/2013 - 20:54:26: [AMXX]    [2] sh_protoman.sma::proto_damage (line 139)
L 11/05/2013 - 20:54:45: [FUN] Invalid player 4
L 11/05/2013 - 20:54:45: [AMXX] Displaying debug trace (plugin "sh_colossus.amxx")
L 11/05/2013 - 20:54:45: [AMXX] Run time error 10: native error (native "get_user_godmode")
L 11/05/2013 - 20:54:45: [AMXX]    [0] sh_colossus.sma::colossus_endgodmode (line 172)
L 11/05/2013 - 20:54:45: [AMXX]    [1] sh_colossus.sma::colossus_init (line 83)
PHP Code:
#include <amxmodx>
#include <fun>
#include <superheromod>

// colossus!

// CVARS
/*

//Colossus
colossus_level 0
colossus_armor 500
colossus_gravity 5.35
colossus_speed 100
colossus_cooldown 30    //# of seconds before colossus can godmode Again
colossus_godtime 5    //# of seconds colossus has in godmode mode.

*/


// VARIABLES
new gHeroName[] = "Colossus"
new bool:g_hascolossusPower[SH_MAXSLOTS+1]
new 
g_colossusTimer[SH_MAXSLOTS+1]
new 
g_colossusSound[] = "ambience/alien_zonerator.wav"
//----------------------------------------------------------------------------------------------
public plugin_init()
{
    
// Plugin Info
    
register_plugin("SUPERHERO Colossus","1.0","Vectren & AssKicR")

    
register_cvar("colossus_level""0")
    
register_cvar("colossus_armor""500")
    
register_cvar("colossus_gravity""5.35")
    
register_cvar("colossus_speed""100")
    
register_cvar("colossus_cooldown""30")
    
register_cvar("colossus_godtime""5")


    
// FIRE THE EVENT TO CREATE THIS SUPERHERO!
    
shCreateHero(gHeroName"Iron Body""Godmode in X sek on keydown"true"colossus_level")

    
// REGISTER EVENTS THIS HERO WILL RESPOND TO! (AND SERVER COMMANDS)
    
register_event("ResetHUD","newRound","b")

    
// KEY DOWN
    
register_srvcmd("colossus_kd""colossus_kd")
    
shRegKeyDown(gHeroName"colossus_kd")

    
// INIT
    
register_srvcmd("colossus_init""colossus_init")
    
shRegHeroInit(gHeroName"colossus_init")

    
// LOOP
    
set_task(1.0,"colossus_loop",0,"",0,"b"//forever loop

    //Let server know about his cvars
    
shSetMaxArmor(gHeroName"colossus_armor")
    
shSetMinGravity(gHeroName"colossus_gravity")
    
shSetMaxSpeed(gHeroName"colossus_speed""[0]")

}
//----------------------------------------------------------------------------------------------
public plugin_precache()
{
    
precache_sound(g_colossusSound)
}
//----------------------------------------------------------------------------------------------
public colossus_init()
{
    new 
temp[128]
    
// First Argument is an id
    
read_argv(1,temp,5)
    new 
id=str_to_num(temp)

    
// 2nd Argument is 0 or 1 depending on whether the id has iron man powers
    
read_argv(2,temp,5)
    new 
hasPowers=str_to_num(temp)

    
// REMOVE the powers if he is not colossus...
    
if ( !hasPowers )
    {
        
colossus_endgodmode(id)
        
g_colossusTimer[id]=0
        shRemGravityPower
(id)
        
shRemArmorPower(id)
        
shRemSpeedPower(id)
    }

    
g_hascolossusPower[id]=(hasPowers!=0)

}
//----------------------------------------------------------------------------------------------
public newRound(id)
{
    
gPlayerUltimateUsed[id]=false
    
return PLUGIN_HANDLED
}
//----------------------------------------------------------------------------------------------
// RESPOND TO KEYDOWN
public colossus_kd()
{
    new 
temp[6]

    
// First Argument is an id with colossus Powers!
    
read_argv(1,temp,5)
    new 
id=str_to_num(temp)

    if ( !
is_user_alive(id) ) return PLUGIN_HANDLED

    
// Let them know they already used their ultimate if they have
    
if ( gPlayerUltimateUsed[id] )
    {
        
playSoundDenySelect(id)
        return 
PLUGIN_HANDLED
    
}

    
// Make sure they're not in the middle of GOD already
    
if ( g_colossusTimer[id]>) return PLUGIN_HANDLED

    g_colossusTimer
[id]=get_cvar_num("colossus_godtime")+1
    set_user_godmode
(id,1)
    
ultimateTimer(idget_cvar_num("colossus_cooldown") * 1.0)

    
// colossus Messsage
    
new message[128]
    
format(message127"Entered colossus Mode" )
    
set_hudmessage(255,0,0,-1.0,0.3,0,0.25,1.0,0.0,0.0,4)
    
show_hudmessage(idmessage)
    
emit_sound(id,CHAN_STATICg_colossusSound0.1ATTN_NORM0PITCH_LOW)

    return 
PLUGIN_HANDLED
}
//----------------------------------------------------------------------------------------------
public stopSound(id)
{
    
emit_sound(id,CHAN_STATICg_colossusSound0.1ATTN_NORMSND_STOPPITCH_LOW)
}
//----------------------------------------------------------------------------------------------
public colossus_loop()
{
    for ( new 
id=1id<=SH_MAXSLOTSid++ )
    {
        if ( 
g_hascolossusPower[id] && is_user_alive(id)  )
        {
            if ( 
g_colossusTimer[id]>)
            {
                
g_colossusTimer[id]--
                new 
message[128]
                
format(message127"%d seconds left of Colossus Mode"g_colossusTimer[id] )
                
set_user_rendering(id,kRenderFxGlowShell,0,0,255,10,50)
                
set_hudmessage(255,0,0,-1.0,0.3,0,1.0,1.0,0.0,0.0,4)
                
show_hudmessageidmessage)
            }
            else
            {
                if ( 
g_colossusTimer[id] == )
                {
                    
g_colossusTimer[id]--
                    
colossus_endgodmode(id)
                    
stopSound(id)
                }
            }
        }
    }
}
//----------------------------------------------------------------------------------------------
public colossus_endgodmode(id)
{
    
stopSound(id)
    
g_colossusTimer[id]=0
    
if ( get_user_godmode(id) == 1)
    {
        
// Turn off GODMODE
        
set_user_godmode(id,0)
        
set_user_rendering(id,kRenderFxGlowShell,0,0,0,kRenderNormal,255)
    }
}
//---------------------------------------------------------------------------------------------- 
PHP Code:
#include <amxmod> 
#include <amxmisc> 
#include <xtrafun>
#include <superheromod>

// Protoman - Proto Shield blocks all projectiles while not moving, shooting, or zooming for x seconds

// CVARS
// protoman_level    - what level must they be for Protoman's powers?
// proto_delay    - how long after shooting does the shield kick in?
// VARIABLES
new gHeroName[]="Protoman"
new gHasProtoPower[SH_MAXSLOTS+1]
new 
gProtoShield
new gProtoId
//----------------------------------------------------------------------------------------------
public plugin_init()
{
  
// Plugin Info
  
register_plugin("SUPERHERO Protoman","1.0","useless")
 
  
// FIRE THE EVENT TO CREATE THIS SUPERHERO!
  
register_cvar("protoman_level""3")
  
register_cvar("protoman_delay""1.0")

  
shCreateHero(gHeroName"Proto Shield""Autoblock all projectiles when not moving, shooting, or zooming for x seconds"false"protoman_level" )
  
  
// REGISTER EVENTS THIS HERO WILL RESPOND TO! (AND SERVER COMMANDS)
  
register_event("ResetHUD","newRound","b")
  
register_event("Damage""proto_damage""b""2!0")
  
// INIT
  
register_srvcmd("protoman_init""protoman_init")
  
shRegHeroInit(gHeroName"protoman_init")

  
// CHECK SOME BUTTONS
  
set_task(1.0,"check_attack",0,"",0,"b"
  
set_task(1.0,"check_two_buttons",0,"",0,"b"
  
set_task(1.0,"check_move_buttons",0,"",0,"b"
}
//----------------------------------------------------------------------------------------------
public protoman_init()
{
  new 
temp[128]
  
// First Argument is an id
  
read_argv(1,temp,5)
  new 
id=str_to_num(temp)
  
gProtoId=id
  
// 2nd Argument is 0 or 1 depending on whether the id has proto
  
read_argv(2,temp,5)
  new 
hasPowers=str_to_num(temp)
  
gHasProtoPower[id]=(hasPowers!=0

    
// Got to remove the powers if he is not Protoman
  
if ( !hasPowers ){
    
uninvis(id)
  }
    
//Give Powers to the Protoman
  
if ( hasPowers )
    
invis(id)
}

public 
newRound(id)
{
  if ( 
is_user_alive(id) && gHasProtoPower[id]) {
  
invis(id)
  }
}

public 
invis(id) {
    if (
gPlayerUltimateUsed[id]==false) {
    
gProtoShield=1
    
}    
}

public 
uninvis(id) {
    
gProtoShield=0
}

public 
check_attack() { 
  
  for(new 
id 1id <= get_maxplayers(); ++id) { 
    if (
is_user_alive(id)) { 
      if ((
get_user_button(id)&IN_ATTACK) && gHasProtoPower[id]) { 
        
ultimateTimer(gProtoIdFloat:get_cvar_float("protoman_delay"))
        
uninvis(id
      }
      else if (!(
get_user_button(id)&IN_ATTACK) && gHasProtoPower[id]) { 
            
invis(id
      }
    }
  }
  return 
PLUGIN_CONTINUE 


public 
check_two_buttons() { 
  
  for(new 
id 1id <= get_maxplayers(); ++id) { 
    if (
is_user_alive(id)) { 
      if ((
get_user_button(id)&IN_USE) && gHasProtoPower[id]) { 
        
uninvis(id
      }
      if ((
get_user_button(id)&IN_ATTACK2) && gHasProtoPower[id]) { 
        
uninvis(id
      }
    }
  }
  return 
PLUGIN_CONTINUE 


public 
check_move_buttons() { 
  for(new 
id 1id <= get_maxplayers(); ++id) { 
    if (
is_user_alive(id)) { 
      if ((
get_user_button(id)&IN_BACK) && gHasProtoPower[id]) { 
        
uninvis(id
      }
      if ((
get_user_button(id)&IN_MOVELEFT) && gHasProtoPower[id]) { 
        
uninvis(id
      }
      if ((
get_user_button(id)&IN_MOVERIGHT) && gHasProtoPower[id]) { 
        
uninvis(id
      }
      if ((
get_user_button(id)&IN_FORWARD) && gHasProtoPower[id]) { 
        
uninvis(id
      }
      if ((
get_user_button(id)&IN_RUN) && gHasProtoPower[id]) { 
        
uninvis(id
      }
      }
  }
  return 
PLUGIN_CONTINUE 
}

public 
proto_damage() {
    new 
id=gProtoId
    
if (gProtoShield==1) {
        new 
damage read_data(2//This reads the damage done to ID 
        
new weaponbodypart get_user_attacker(id,weapon,bodypart)
        if (
weapon!=CSW_KNIFE) {
            
shAddHPs(id, (damage), 100)//Nullify damage
        
}
    }

PHP Code:
// SuperHero Main Include File
// Version 1.2.0

#if defined _shero_included
  #endinput
#endif
#define _shero_included

#pragma reqlib "SuperHero Core"
#if !defined AMXMODX_NOAUTOLOAD
  #pragma loadlib "SuperHero Core"
#endif

//Default includes used for shero
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <fun>
#include <csx>
#include <cstrike>
#include <superheroconst>

#if defined SH_BACKCOMPAT
  #include <engine>
#endif

//----------------------------------------------------------------------------------------------
// IMPORTANT FUNCTIONS - WHAT EVENTS CAN THE SUPERHEROES REGISTER FOR?
//----------------------------------------------------------------------------------------------


/**************************
 *        FORWARDS        *
 **************************/

/**
 * Called when a hero is added or dropped.
 * See superheroconst.inc for mode types.
 *
 * @param id            The index of the client.
 * @param heroID        The index of the hero.
 * @param mode            The heroID is being added or dropped.
 * @noreturn
 */
forward sh_hero_init(idheroIDmode);

/**
 * Called when a +/-power is executed.
 * See superheroconst.inc for key types.
 *
 * @param id            The index of the client.
 * @param heroID        The index of the hero.
 * @param key            The heroID power key function, key down or key up.
 * @noreturn
 */
forward sh_hero_key(idheroIDkey);

/**
 * Called post player spawn.
 *
 * @param id            The index of the client.
 * @param bool:newRound        True if client spawned because of a new round, else false.
 * @noreturn
 */
forward sh_client_spawn(idbool:newRound);

/**
 * Called whenever a client dies.
 * Death from sh_extra_damage will send correct info into this forward.
 *
 * @param victim        The index of the victim.
 * @param attacker        The index of the attacker.
 * @param headshot        Equals 1 if death is by a headshot else 0.
 * @param wpnDescription    Name of the weapon that killed the victim.
 * @noreturn
 */
forward sh_client_death(victimattackerheadshot, const wpnDescription[]);

/**
 * Called every new round (start of freezetime).
 *
 * @noreturn
 */
forward sh_round_new();

/**
 * Called at the approximate time that a round is started.
 * (0.1 seconds after the end of freezetime).
 *
 * @noreturn
 */
forward sh_round_start();

/**
 * Called at the end of every round (and on sv_restart).
 *
 * @noreturn
 */
forward sh_round_end();


/**************************
 *        NATIVES         *
 **************************/

/**
 * Whether or not there is a game in progress.
 * In round is between end of freezetime and end of round.
 *
 * @return        True if game is in round, false otherwise.
 */
native bool:sh_is_inround();

/**
 * Returns current freezetime status (new round to round start).
 * Freezetime is between the start and end mp_freezetime time.
 *
 * @return        True if game is in freezetime, false otherwise.
 */
native bool:sh_is_freezetime();

/**
 * Returns server's max level.
 *
 * @note        The earliest this is guaranteed to be accurate is during plugin_cfg(). It needs
 *                the max level to be properly set or it will return 0.
 *
 * @return        The max number of levels of the server.
 */
native sh_get_num_lvls();

/**
 * Gets the XP required for the level.
 *
 * @param level        The level number to check.
 * @return        The XP needed for the level, else -1 if not a valid level.
 */
native sh_get_lvl_xp(level);

/**
 * Gets the client's current level.
 *
 * @param id        The index of the client.
 * @return        The current level of the client, else -1 if not a valid id.
 */
native sh_get_user_lvl(id);

/**
 * Sets the client's current level.
 *
 * @param id        The index of the client.
 * @param level        The level to set on the client.
 * @return        The level set on the client, else -1 if not a valid level.
 */
native sh_set_user_lvl(idlevel);

/**
 * Gets the client's current XP.
 *
 * @param id        The index of the client.
 * @return        The current XP of the client.
 */
native sh_get_user_xp(id);

/**
 * Sets or Adds to the client's current XP.
 *
 * @param id        The index of the client.
 * @param xp        The xp to set/add on the client.
 * @param addtoxp    False to set client xp to the xp specified, true to add xp to client's current xp.
 * @return        1 if success, -1 if invalid client.
 */
native sh_set_user_xp(idxpbool:addtoxp false);

/**
 * Adds to the client's current XP in the amount equal to if client killed victim.
 * As if client killed victim with sh_extra_damage, client recives the xp for that kill.
 *
 * @param id        The index of the client.
 * @param victim    The index of the client to calculate kill xp amount to add to id.
 * @param multiplier    Amount to multiply the kill xp by.
 * @noreturn
 */
native sh_add_kill_xp(idvictimFloat:multiplier 1.0);

/**
 * Gets the client's max Health based on heroes client has.
 *
 * @param id        The index of the client.
 * @return        The max hero HP of the client, else 0 if invalid client.
 */
native sh_get_max_hp(id);

/**
 * Gets the client's max SuperHero Armor.
 *
 * @param id        The index of the client.
 * @return        The max hero AP of the client, else 0 if invalid client.
 */
native sh_get_max_ap(id);

//------------
// Hero Creation/Property Natives
//------------
// IMPORTANT: Make sure these are set AFTER cvars are registered

/**
 * Creates the hero and returns the heroID. (Required)
 *
 * @note    This must be the first property set as it returns the hero index to be used for the rest.
 *
 * @param heroName    The name of the Hero. (max 24 characters)
 * @param pcvarMinLevel    The pcvar value for minmum Level required CVAR for the hero.
 * @return        The hero's index, -1 on failure.
 */
native sh_create_hero(const heroName[], pcvarMinLevel);

/**
 * Sets the hero's power description and help info. (Required)
 *
 * @param heroID    The index of the hero.
 * @param powerInfo    The short info for the heroes power, used in the power select menu. (max 49 characters)
 * @param powerHelp    The long description for the heroes power, hud message displayed when users chooses the hero. (max 127 characters)
 * @noreturn
 */
native sh_set_hero_info(heroID, const powerInfo[] = "", const powerHelp[] = "");

/**
 * Sets the hero to use a +power bind key. (Optional)
 * Use only if hero requires a bound key.
 *
 * @param heroID    The index of the hero.
 * @noreturn
 */
native sh_set_hero_bind(heroID);

/**
 * Sets hero's shield restriction status. (Optional)
 *
 * @note        Set this on heroes that give weapons to avoid invisible shield bug.
 *
 * @param heroID    The index of the hero.
 * @param restricted    Set true to restict hero from allowing shield use, otherwise false.
 * @noreturn
 */
native sh_set_hero_shield(heroIDbool:restricted false);

/**
 * Sets hero's max Health and Armor. (Optional)
 * Health and Armor do not stack, values from heroes are compared and greatest is applied.
 *
 * @note        If you only want to set one of the values, set the other to 0 or underscore "_" to use the default set value of 0.
 *
 * @param heroID    The index of the hero.
 * @param pcvarHealth    The pcvar value for maximum Health CVAR for the hero, CVAR values below 100 are ignored.
 * @param pcvarArmor    The pcvar value for maximum Armor CVAR for the hero.
 * @noreturn
 */
native sh_set_hero_hpap(heroIDpcvarHealth 0pcvarArmor 0);

/**
 * Sets hero's max speed dependent on currently held weapon. (Optional)
 * Speeds do not stack, values from heroes are compared and greatest is applied.
 * weapons[] is an array of weapons this speed is good for, check CSW_ constants for weapon values.
 * {29, 30} would equal the CSW_ weapon constants corresponding to {CSW_KNIFE, CSW_P90}, etc... (see amxconst.inc)
 *
 * @note        This setting does not effect speed of sniper rifles when scoped.
 *                Max possible running speed is 2000, limited by half-life.
 *                Clients are also limited by cl_***speed client cvars defaulted to 400.
 *                Scout is the fastest default weapon at 260 and the other 3 snipers slowest at 150 when scoped.
 *
 * @param heroID    The index of the hero.
 * @param pcvarSpeed    The pcvar value for maximum Speed CVAR for the hero.
 * @param weapons    Array of weapon CSW_ constant values to set speed for, 0 is for all weapons.
 * @param numofwpns    The size of the weapons array, this MUST be passed in CORRECTLY!
 * @noreturn
 */
native sh_set_hero_speed(heroIDpcvarSpeed, const weapons[] = {0}, numofwpns 1);

/**
 * Sets hero's min gravity dependent on currently held weapon. (Optional)
 * Gravities do not stack, values from heroes are compared and lowest is applied.
 * weapons[] is an array of weapons this gravity is good for, check CSW_ constants for weapon values.
 * {29, 30} would equal the CSW_ weapon constants corresponding to {CSW_KNIFE, CSW_P90}, etc... (see amxconst.inc)
 *
 * @note        A Gravity value 0.0 or below is ignored, 1.0 is normal gravity (800).
 *                ***Weapon based gravity is not implemented yet. Maybe in next version, undecided.***
 *
 * @param heroID    The index of the hero.
 * @param pcvarGravity    The pcvar value for minimum Gravity CVAR for the hero.
 * @param weapons    Array of weapon CSW_ constant values to set gravity for, 0 is for all weapons.
 * @param numofwpns    The size of the weapons array, this MUST be passed in CORRECTLY!
 * @noreturn
 */
native sh_set_hero_grav(heroIDpcvarGravity, const weapons[] = {0}, numofwpns 1);


/**
 * Sets hero's damage multiplier for the specified cs/cz weapon. (Optional)
 * Multipliers do not stack, values from user's heroes are compared and greatest is applied.
 * If multiple weapons required, native must be called separately for each weapon.
 *
 * @note        A Multiplier value of 1.0 or below is ignored.
 *                Multiplier is applied before armor reduces damage.
 *
 * @param heroID    The index of the hero.
 * @param pcvarSpeed    The pcvar value of the damage multiplier CVAR for the specified weaponID.
 * @param weaponID    The CSW_ constant of the weapon to set damage multiplier for, 0 is for all weapons. (see amxconst.inc)
 * @noreturn
 */
native sh_set_hero_dmgmult(heroIDpcvarWpnMult, const weaponID 0);

//------------

/**
 * Forces client to drop weapon if they have it in inventory.
 *
 * @param id        The index of the client.
 * @param weaponID    The CSW_ index of the weapon. (see amxconst.inc)
 * @param remove    Set True to remove the weapon from world on drop, otherwise False to drop it like normal.
 * @noreturn
 */
native sh_drop_weapon(idweaponIDbool:remove false);

/**
 * Gives client a weapon.
 *
 * @note        This can be overridden by server using shweapon.cfg.
 *                If giving a primary weapon set sh_set_hero_shield() in hero to avoid invisible shield bug.
 *
 * @param id        The index of the client.
 * @param weaponID    The CSW_ index of the weapon. (see amxconst.inc)
 * @param switchTo    Set True to force client to switch to given weapon, otherwise False.
 * @noreturn
 */
native sh_give_weapon(idweaponIDbool:switchTo false);

/**
 * Gives client an item. (Use sh_give_weapon for better weapon_ handling)
 *
 * @note        Weapons can be overridden by server using shweapon.cfg.
 *                If giving a primary weapon set sh_set_hero_shield() in hero to avoid invisible shield bug.
 *
 * @param id        The index of the client.
 * @param itemName    The "item_*", "ammo_*", or "weapon_*" name of the desired item.
 * @param switchTo    Set True to force client to switch to given item if it's a weapon, otherwise False.
 * @noreturn
 */
native sh_give_item(id, const itemName[], bool:switchTo false);

/**
 * Sets ammo reload method.
 *
 * @note        You are responsible for when this is called, usually when clip is empty.
 *
 * @param id        The index of the client.
 * @param mode        The mode    0 - follow server sh_reloadmode CVAR
 *                    1 - continuous shooting, no reload
 *                    2 - fill the backpack (must reload)
 *                    3 - drop the gun and get a new one with full clip
 * @noreturn
 */
native sh_reload_ammo(idmode 0);

/**
 * Cause non-default extra damage.
 * Use this for non-default damage to correctly send damage messages and handle XP.
 *
 * @note        Set dmgFFmsg to false for looping extra damage, to avoid team attack chat spam.
 *                The default dmgOrigin of {0,0,0} will use attacker as the damage direction.
 *                Victim is unaffected if victim has godmode (this includes insta kill dmgMode).
 *
 * @param victim        The index of the victim.
 * @param attacker        The index of the attacker.
 * @param damage        Value of damage to cause, see dmgMode for effect on victim.
 * @param wpnDescription    Name of the weapon that causes the damage.
 * @param headshot        Set 1 if damage is a headshot else 0.
 * @param dmgMode        Type of damage, how victim is effected by damage value. See superheroconst.inc for types and explanations.
 * @param dmgStun        Set True to emulate damage stun on victim, otherwise False. (currently only sets horizontal velocity to 0)
 * @param dmgFFmsg        Set True to show friendly fire chat message "John Doe attacked a teammate", otherwise False.
 * @param dmgOrigin        Origin of damage bits direction (red flash indicators).
 * @noreturn
 */
native sh_extra_damage(victimattackerdamage, const wpnDescription[], headshot 0dmgMode SH_DMG_MULTbool:dmgStun falsebool:dmgFFmsg true, const Float:dmgOrigin[3] = {0.0,0.0,0.0});

/**
 * Speed stuns client for time specified. Bind powers are not usable when stunned.
 *
 * @note        Does not combine time, the highest time will override.
 *
 * @param id        The index of the client.
 * @param howLong    The length of time in seconds the stun lasts.
 * @param speed        The speed of the client when stunned.
 * @noreturn
 */
native sh_set_stun(idFloat:howLongFloat:speed 1.0);

/**
 * Returns a clients speed stun status.
 *
 * @param id        The index of the client.
 * @return        Returns 1 if client is in a stun, otherwise 0.
 */
native sh_get_stun(id);

/**
 * Sets godmode on client for time specified.
 *
 * @note        Does not combine time, the highest time will override.
 *                Client will sh glow blue {0,0,128} to indicate godmode. (This may be removed in a future version)
 *
 * @param id        The index of the client.
 * @param howLong    The length of time in seconds godmode lasts.
 * @noreturn
 */
native sh_set_godmode(idFloat:howLong);

/**
 * Gets hero's index.
 *
 * @param heroName    The name of the hero. (name must be exact spelling and case tense)
 * @return        Returns hero's index, -1 on failure
 */
native sh_get_hero_id(const heroName[]);

/**
 * Checks if the client has the hero.
 *
 * @param id        The index of the client.
 * @param heroID    The index of the hero.
 * @return        Returns 1 if client has hero, otherwise 0.
 */
native sh_user_has_hero(idheroID);

/**
 * Reset client's max speed according to heroes they have.
 * Useful incase a temporary value was set.
 *
 * @param id        The index of the client.
 * @noreturn
 */
native sh_reset_max_speed(id);

/**
 * Reset client's min gravity according to heroes they have.
 * Useful incase a temporary value was set.
 *
 * @param id        The index of the client.
 * @noreturn
 */
native sh_reset_min_gravity(id);

/**
 * Sends a chat message thru core to append colored [SH] to front of message.
 * If heroID is supplied hero's name will be colored in parentheses ie "[SH](Batman) message displayed here"
 *
 * @note        Max characters for message without heroID supplied is 186.
 *                 Max characters for message with heroID supplied is
 *                 between 183 and 160 depending on size of hero's name.
 *
 * @param id        The index of the client.
 * @param heroID    The index of the hero, appends hero name to message. Set -1 to not append a hero name.
 * @param message    The chat message itself.
 * @noreturn
 */
native sh_chat_message(idheroID = -1, const message[], any:...);

/**
 * Pass messages for debugging or set level to 0 and will always print message to log.
 *
 * @note        Adds "DEBUG: " to begining of message, may confuse some users if not an error.
 *
 * @param id        The index of the client.
 * @param level        The sh_debug_messages CVAR level to show the message at.
 * @param message    The message itself.
 * @noreturn
 */
native sh_debug_message(idlevel, const message[],  any:...);


/**************************
 *         STOCKS         *
 **************************/

/**
 * Checks if SuperHero is currently on or off.
 *
 * @return        Returns true if Shmod is active, otherwise false.
 */
stock bool:sh_is_active()
{
    static 
sv_superheros;

    if ( !
sv_superheros ) {
        
sv_superheros get_cvar_pointer("sv_superheros");
    }

    return (
sv_superheros ? (get_pcvar_num(sv_superheros) ? true false) : false);
}

/**
 * Checks if friendly fire is currently on or off.
 *
 * @return        Returns true if friendly fire is on, otherwise false.
 */
stock bool:sh_friendlyfire_on()
{
    static 
mp_friendlyfire;

    if ( !
mp_friendlyfire ) {
        
mp_friendlyfire get_cvar_pointer("mp_friendlyfire");
    }

    return (
get_pcvar_num(mp_friendlyfire) ? true false);
}

/**
 * Checks max players setting of server, better then using SH_MAXSLOTS most times.
 *
 * @return        Returns max players of server.
 */
stock sh_maxplayers()
{
    static 
maxplayers;

    if ( !
maxplayers )
        
maxplayers get_maxplayers();

    return 
maxplayers;
}

/**
 * Plays sound to inform the client they can not comply with the current action.
 *
 * @param id        The index of the client.
 * @noreturn
 */
stock sh_sound_deny(id)
{
    
// gSoundDeny precached by core
    
client_cmd(id"spk %s"gSoundDeny);
}

/**
 * Forces client to switch to specified weapon if they have the weapon.
 *
 * @param id        The index of the client.
 * @param weaponID    The CSW_ index of the weapon. (see amxconst.inc)
 * @noreturn
 */
stock sh_switch_weapon(idweaponID)
{
    if ( 
weaponID CSW_P228 || weaponID CSW_P90 ) return;

    if ( 
user_has_weapon(idweaponID) ) {
        static 
weaponName[32];
        
get_weaponname(weaponIDweaponNamecharsmax(weaponName));
        
engclient_cmd(idweaponName);
    }
}

/**
 * Creates a screen fade on the client.
 *
 * @param id        The index of the client.
 * @param fadeTime    The time in seconds the fade lasts.
 * @param holdTime    The time in seconds the fade is held.
 * @param red        The red rgb color value of the fade. (0-255)
 * @param green        The green rgb color value of the fade. (0-255)
 * @param blue        The blue rgb color value of the fade. (0-255)
 * @param alpha        The alpha transparency value of the fade. (0-255)
 * @param type        The type of fade. (see superheroconst.inc)
 * @noreturn
 */
stock sh_screen_fade(idFloat:fadeTimeFloat:holdTimeredgreenbluealphatype SH_FFADE_IN)
{
    static 
msgScreenFade;

    if ( !
msgScreenFade ) {
        
msgScreenFade get_user_msgid("ScreenFade");
    }

    
// Check unsigned short range
    
new fadehold;
    
fade clamp(floatround(fadeTime float(1<<12)), 00xFFFF);
    
hold clamp(floatround(holdTime float(1<<12)), 00xFFFF);

    
message_begin(MSG_ONE_UNRELIABLEmsgScreenFade_id);
    
write_short(fade);    // fade lasts this long duration
    
write_short(hold);    // fade lasts this long hold time
    
write_short(type);    // fade type (in / out)
    
write_byte(red);    // fade red
    
write_byte(green);    // fade green
    
write_byte(blue);    // fade blue
    
write_byte(alpha);    // fade alpha
    
message_end();
}

/**
 * Creates a screen shake on the client.
 *
 * @param id        The index of the client.
 * @param amplitude    The amount of displacement of the shake.
 * @param duration    The period of time of the shake.
 * @param frequency    The rate at which displacement of the shake is repeated.
 * @noreturn
 */
stock sh_screen_shake(idFloat:amplitudeFloat:durationFloat:frequency)
{
    static 
msgScreenShake;

    if ( !
msgScreenShake ) {
        
msgScreenShake get_user_msgid("ScreenShake");
    }

    
// Check unsigned short range
    
new ampdurafreq;
    
amp clamp(floatround(amplitude float(1<<12)), 00xFFFF);
    
dura clamp(floatround(duration float(1<<12)), 00xFFFF);
    
freq clamp(floatround(frequency float(1<<8)), 00xFFFF);

    
message_begin(MSG_ONE_UNRELIABLEmsgScreenShake_id);
    
write_short(amp);    // amplitude
    
write_short(dura);    // duration
    
write_short(freq);    // frequency
    
message_end();
}

/**
 * Set a render on an entity.
 * To set a typical glow set fx to kRenderFxGlowShell, the alpha amount of 16 is preferred.
 * To reset a glow or render on a client use sh_set_rendering(id).
 *
 * @note        For client's, lower visiblity takes preference unless it's a render reset.
 *
 * @param entity    The index of the entity.
 * @param r        The red color rgb value of the render. (0-255)
 * @param g        The green color rgb value of the render. (0-255)
 * @param b        The blue color rgb value of the render. (0-255)
 * @param amount    The alpha transparency value of the render. (0-255)
 * @param fx        The fx type of the render. (see amxconst.inc)
 * @param render    The type of render. (see amxconst.inc)
 * @return        Returns 1 on success, 0 on failure.
 */
stock sh_set_rendering(entity255255255amount 16fx kRenderFxNonerender kRenderNormal)
{
    if ( !
pev_valid(entity) ) return 0;

    new 
Float:alpha float(amount);

    
// This check is only to favor invisibility of a player over any other render expect a reset
    
if ( entity <= sh_maxplayers() ) {

        
// If client is in an alpha render do we need to block this render setting.
        
if ( pev(entitypev_rendermode) == kRenderTransAlpha ) {

            
// If just resetting render allow it to reset
            
if ( != 255 || != 255 || != 255 || amount != 16 || fx != kRenderFxNone || render != kRenderNormal ) {

                
// Skip setting any other render type, allow user to stay in alpha render
                
if ( render != kRenderTransAlpha ) return 0;

                new 
Float:currentAlpha;
                
pev(entitypev_renderamtcurrentAlpha);

                
// Only set alpha render if equal or less visible (equal to allow color changes etc.)
                
if ( alpha currentAlpha ) return 0;
            }
        }
    }

    new 
Float:renderColor[3];
    
renderColor[0] = float(r);
    
renderColor[1] = float(g);
    
renderColor[2] = float(b);

    
set_pev(entitypev_renderfxfx);
    
set_pev(entitypev_rendercolorrenderColor);
    
set_pev(entitypev_rendermoderender);
    
set_pev(entitypev_renderamtalpha);

    return 
1;
}

/**
 * Add to client's current health, up to a max limit.
 *
 * @param id        The index of the client.
 * @param hitPoints    The amount of health to add.
 * @param maxHealth    The maxium possible health to add up to, set 0 to use max from client's heroes.
 * @return        The amount of health added, 0 on failure.
 */
stock sh_add_hp(idhitPointsmaxHealth 0)
{
    if ( 
hitPoints == ) return 0;

    if ( 
maxHealth == maxHealth sh_get_max_hp(id);

    new 
currentHealth get_user_health(id);

    if ( 
currentHealth maxHealth ) {
        new 
newHealth min((currentHealth hitPoints), maxHealth);
        
set_user_health(idnewHealth);
        return 
newHealth currentHealth;
    }

    return 
0;
}

/**
 * Add to client's current armor, up to a max limit.
 *
 * @note    Armor power does not set til approx 0.6 seconds after spawn,
 *            do not regen armor during that time to allow sh to properly set AP.
 *
 * @param id        The index of the client.
 * @param armorPoints    The amount of armor to add.
 * @param maxArmor    The maxium possible armor to add up to, set 0 to use max from client's heroes.
 * @return        The amount of health added, 0 on failure.
 */
stock sh_add_ap(idarmorPointsmaxArmor 0)
{
    if ( 
armorPoints == ) return 0;

    if ( 
maxArmor == maxArmor sh_get_max_ap(id);

    new 
CsArmorType:armorType;
    new 
currentArmor cs_get_user_armor(idarmorType);

    if ( 
currentArmor maxArmor ) {
        if ( !
currentArmor armorType CS_ARMOR_VESTHELM;

        new 
newArmor min((currentArmor armorPoints), maxArmor);
        
cs_set_user_armor(idnewArmorarmorType);
        return 
newArmor currentArmor;
    }

    return 
0;
}

/**
 * Returns server flags for sh_blockvip cvar, can be used in heroes for custom VIP blocks.
 * (see superheroconst.inc for flag types)
 *
 * @note    You are still responsible to check if user is vip, use cs_get_user_vip(id).
 *             example usage: if(cs_get_user_vip(id) && sh_vip_flags()&VIP_BLOCK_CUSTOM) {//do something}
 *
 * @return    The flags currently set.
 */
stock sh_vip_flags()
{
    static 
sh_blockvip;

    if ( !
sh_blockvip ) {
        
sh_blockvip get_cvar_pointer("sh_blockvip");
    }

    if ( !
sh_blockvip ) return 0;

    static 
temp[9];
    
get_pcvar_string(sh_blockviptempcharsmax(temp));

    return 
read_flags(temp);
}

/**
 * Checks a hull to see if it is empty.
 * Good for checking if a client is or can be stuck at an origin.
 *
 * @note        While not very useful hitent is passed byref.
 *                 hitent is the index of ent in hull if any was found, otherwise 0 is passed.
 *
 * @param id        The index of the client that is ignored in the hull that is checked.
 * @param origin    The origin of the hull to check.
 * @param hullType    The type of hull to check, HULL_HEAD for crouching or HULL_HUMAN for standing. (see hlsdk_const.inc)
 * @return        True if hull is empty, otherwise false.
 */
stock bool:sh_hull_vacant(id, const Float:origin[3], hullType HULL_HEAD, &hitent 0)
{
    
// Thanks to VEN for his is_hull_vacant stock which this is based on

    // Find an open space and ignore id in that space
    
engfunc(EngFunc_TraceHulloriginorigin0hullTypeid0);

    
// byref index of what was hit, multiple things may be in hull so may not return what you expect
    
hitent get_tr2(0TraceResult:TR_pHit);

    
// Is the origin's hull empty for the hull type
    
if ( !get_tr2(0TraceResult:TR_StartSolid) && !get_tr2(0TraceResult:TR_AllSolid) && get_tr2(0TraceResult:TR_InOpen) )
        return 
true;

    return 
false;
}

/**
 * Gets a velocity to or from an origin.
 * Usually used for movement of created entities or to push players away from an explosion.
 *
 * @note        +/- speed is limited by servers sv_maxvelocity setting (default 2000)
 *                For explosions, set inital[2] a bit above final[2] to give a bit of a upward lift
 *
 * @param initial    The start origin. Generally an entity's origin on which to set velocity on.
 * @param final        The end origin. Generally the point where velocity is set to or from.
 * @param speed        Speed of the velocity to set:
 *                    - Positive value will set velocity TO final vector.
 *                    - Negative value will set velocity FROM final vector.
 * @param velocity    The return velocity. If a velocity is passed in, the return will add to it.
 */
stock sh_get_velocity(const Float:initial[3], const Float:final[3], Float:speedFloat:velocity[3])
{
    
// Lets make sure we are within range
    
static sv_maxvelocity;

    if ( !
sv_maxvelocity ) {
        
sv_maxvelocity get_cvar_pointer("sv_maxvelocity");
    }

    new 
Float:maxSpeed get_pcvar_float(sv_maxvelocity);

    
// Time = Distance / Speed
    
new Float:fTime vector_distance(initial, final) / floatclamp(speed, -maxSpeedmaxSpeed);

    
// Velocity = Distance / Time
    
velocity[0] += (final[0] - initial[0]) / fTime;
    
velocity[1] += (final[1] - initial[1]) / fTime;
    
velocity[2] += (final[2] - initial[2]) / fTime;
}

//------------
// Simple Functions to Help with Power Cooldowns.
//------------
// NOTE: The core will cancel cooldown task on a new spawn for safety, but
//       the hero itself must reset the gPlayerInCooldown variable to false.

/**
 * Global variable for cooldown status.
 *
 * @noreturn
 */
stock bool:gPlayerInCooldown[SH_MAXSLOTS+1];

/**
 * Sets a cooldown in a hero.
 *
 * @param id        The index of the client.
 * @param secs        The time in seconds the cooldown lasts before it is removed.
 * @noreturn
 */
stock sh_set_cooldown(idFloat:secs)
{
    
gPlayerInCooldown[id] = true;

    
set_task(secs"sh_end_cooldown"id+SH_COOLDOWN_TASKID);

    
sh_debug_message(id5"Cooldown Timer Started");
}

/**
 * Ends the cooldown in a hero.
 * This must be a public function since it is called by a task, rest can be stocks.
 *
 * @note        Called by cooldown through a task, so you do not need to call this.
 *                 However, it can be used to remove a cooldown earlier than task called to end it.
 *
 * @param id        The index of the client + SH_COOLDOWN_TASKID.
 * @noreturn
 */
public sh_end_cooldown(id)
{
    
// This is only here incase user wants to manually end cooldown
    // before task is over, does not matter if task is not going on.
    
remove_task(id);

    
id -= SH_COOLDOWN_TASKID;
    
gPlayerInCooldown[id] = false;

    
sh_debug_message(id5"Cooldown Timer Ended");
}

//------------
// Weapon Look Up Tables, faster then a switch statements.
//------------

/**
 * Returns max backpack ammo of weapon.
 *
 * @note        Stock created in superheroconst.inc, explained here for usage reference.
 *
 * @param weaponID    The CSW_ index of the weapon. (see amxconst.inc)
 * @return        The weapon's max backpack ammo.
 */
//sh_get_max_bpammo(weaponID)

/**
 * Returns max clip ammo of weapon.
 *
 * @note        Stock created in superheroconst.inc, explained here for usage reference.
 *
 * @param weaponID    The CSW_ index of the weapon. (see amxconst.inc)
 * @return        The weapon's max clip ammo.
 */
//sh_get_max_clipammo(weaponID)

/**
 * Returns weapon slot of weapon.
 * Useful to run code only on guns not on grenades, etc.
 *
 * @note        Stock created in superheroconst.inc, explained here for usage reference.
 *
 * @param weaponID    The CSW_ index of the weapon. (see amxconst.inc)
 * @return        The weapon slot.
 */
//sh_get_weapon_slot(weaponID)

/**
 * Gets the default speed of a weapon.
 *
 * @param weaponID    The CSW_ index of the weapon. (see amxconst.inc)
 * @param zoomed    Set True if weapon speed while zoomed is wanted, otherwise False.
 * @return        The speed of the weapon.
 */
stock Float:sh_get_weapon_speed(weaponIDbool:zoomed false)
{
    if ( 
zoomed ) {
        
// Only the 4 sniper rifles actually have different speeds when zoomed
        // And 3 of those have the same speed so lets just use a switch for them.
        
switch(weaponID) {
            case 
CSW_SCOUT: return 220.0;
            case 
CSW_SG550CSW_AWPCSW_G3SG1: return 150.0;
        }
    }

    return 
gWeaponSpeed[weaponID];
}

//------------
// Odd Stocks for core, not useful to most.
//------------

/**
 * Breaks a string into two parts, Left[] and Right[], keeping the quotes intact.
 *
 * @param text        The string to break.
 * @param Left        The string containing the first paramter broken.
 * @param leftLen    The size of the Left string.
 * @param Right        The string containing the rest after first parameter was broken off, not including the starting space. 
 * @param rightLen    The size of the Right string.
 * @return        Returns true upon completion.
 */
stock strbrkqt(const text[], Left[], leftLenRight[], rightLen)
{
    
// Breaks text[] into two parts, Left[], and Right[]
    // Left[] will contain the first parameter (either quoted or non-quoted)
    // Right[] contain the rest of the string after Left[], not including the space
    
new bool:in_quotes false;
    new 
bool:done_flag false;
    new 
ileft_pos 0;
    new 
textLen strlen(text);

    for ( 
0textLeni++) {

        if ( 
text[i] == '^"' && !done_flag ) {
            if ( 
in_quotes ) {
                
done_flag true;
                
in_quotes false;
            }
            else 
in_quotes true;
        }
        else if ( 
isspace(text[i]) && !in_quotes ) {
            if ( 
left_pos ) {
                
done_flag true;
            }
        }
        else if ( !
done_flag && left_pos <= leftLen ) {
            
setc(Left[left_pos], 1text[i]);
            
left_pos++;
        }
        else if ( 
done_flag ) break;
    }

    
Left[left_pos] = '^0';
    
copy(RightrightLentext[i]);

    return 
true;
}

/**
 * Prints heapsize. This is ONLY used to debug runtime 3 errors.
 *
 * @note        Unused but keep incase it is needed for debugging.
 *
 * @noreturn
 */
stock print_heapsize()
{
    
server_print("[SH] HeapSize: %i"heapspace());
}


//----------------------------------------------------------------------------------------------
// Below is for Backward compatibility layer only, please do not code with it any longer.
// You can test your code for compilance by commenting out SH_BACKCOMPAT in superheroconst.inc
// and compiling your hero. Then fix any compile errors with new functions above, below
// can be a reference.
//----------------------------------------------------------------------------------------------


#if defined SH_BACKCOMPAT


/**************************
 * BACKWARD COMPATIBILITY *
 **************************/

stock shCreateHero(const heroName[], const heroPower[], const heroHelp[], bool:requiresKeyEvents false, const heroLevel[])
{
    new 
heroID sh_create_hero(heroNameget_cvar_pointer(heroLevel));
    if ( 
heroID != -) {
        
sh_set_hero_info(heroIDheroPowerheroHelp);
        if ( 
requiresKeyEvents ) {
            
sh_set_hero_bind(heroID);
        }
    }
    return 
heroID;
}

stock shSetShieldRestrict(const heroName[])
{
    new 
heroID sh_get_hero_id(heroName);

    if ( 
heroID != -) {
        
sh_set_hero_shield(heroIDtrue);
    }
}

stock shSetMaxHealth(const heroName[], const heroHPCVAR[])
{
    new 
heroID sh_get_hero_id(heroName);

    if ( 
heroID != -) {
        
sh_set_hero_hpap(heroIDget_cvar_pointer(heroHPCVAR), _);
    }
}

stock shSetMaxArmor(const heroName[], const heroArmorCVAR[])
{
    new 
heroID sh_get_hero_id(heroName);

    if ( 
heroID != -) {
        
sh_set_hero_hpap(heroID_get_cvar_pointer(heroArmorCVAR));
    }
}

stock shSetMaxSpeed(const heroName[], const heroSpeedCVAR[], weaponString[])
{
    new 
heroID sh_get_hero_id(heroName);

    if ( 
heroID != -) {
        
//Convert old sh weapon string into an array of weapons
        
new number[3], weaponArray[33], i0;
        for ( 
0weaponString[i] != '^0'i++ ) {
            switch(
weaponString[i]) {
                case 
'[': continue;

                case 
']': {
                    
//Setup array
                    
weaponArray[x] = str_to_num(number);
                    ++
x;
                    
number[0] = '^0';
                }

                default: {
                    
//Single out weapon number
                    
add(numbercharsmax(number), weaponString[i]);
                }
            }
        }

        
sh_set_hero_speed(heroIDget_cvar_pointer(heroSpeedCVAR), weaponArray x);
    }
}

stock shSetMinGravity(const heroName[], const heroGravityCVAR[])
{
    new 
heroID sh_get_hero_id(heroName);

    if ( 
heroID != -) {
        
sh_set_hero_grav(heroIDget_cvar_pointer(heroGravityCVAR));
    }
}

//stock playSoundDenySelect(id)
#define playSoundDenySelect sh_sound_deny

//stock shAddXP(id, victim, Float:multiplier = 1.0 )
#define shAddXP sh_add_kill_xp

//stock shModActive()
#define shModActive sh_is_active

//stock shGetNumLevels()
#define shGetNumLevels sh_get_num_lvls

//stock hasRoundStarted()
#define hasRoundStarted() !sh_is_freezetime()

//stock shReloadAmmo(id, dropwpn = 0)
#define shReloadAmmo sh_reload_ammo

//stock shExtraDamage(id, attacker, damage, weaponDescription[], headshot = 0 )
#define shExtraDamage sh_extra_damage

#define getMaxClipAmmo(%1) gMaxClipAmmo[%1]
#define getMaxBPAmmo(%1) gMaxBPAmmo[%1]

//stock shResetSpeed(id)
#define shResetSpeed sh_reset_max_speed

//stock shSetGravityPower(id)
#define shSetGravityPower sh_reset_min_gravity

//stock shGiveWeapon(id, const weaponName[], bool:switchTo = false)
#define shGiveWeapon sh_give_item

//stock shGiveWeaponID(id, weaponID, bool:switchTo = false)
#define shGiveWeaponID sh_give_weapon

//stock shSwitchWeaponID(id, weaponID)
stock shSwitchWeaponID(idweaponID)
{
    if ( !
is_user_alive(id) ) return;

    
sh_switch_weapon(idweaponID);
}

//stock shOwnsWeaponID(id, weaponID)
#define shOwnsWeaponID user_has_weapon

//stock shOwnsWeapon(id, weaponName[])
#define shOwnsWeapon(%1, %2) user_has_weapon(%1, get_weaponid(%2))

//stock shUnglow(id)
#define shUnglow sh_set_rendering

//stock shAddHPs(id, hitPoints, maxHealth = 100)
stock shAddHPs(idhitPointsmaxHealth 100)
{
    if ( !
sh_is_active() ) return;

    
sh_add_hp(idhitPointsmaxHealth);
}

//stock shStun(id, secs)
stock shStun(idsecs)
{
    
sh_set_stun(idfloat(secs));
}

//stock shSetGodMode(id, secs)
stock shSetGodMode(idsecs)
{
    
sh_set_godmode(idfloat(secs));
}

//stock debugMessage(const message[], id = 0, level = 1)
stock debugMessage(const message[], id 0level 1)
{
    
sh_debug_message(idlevelmessage);
}

//stock shGlow(id, r, g, b)
stock shGlow(idrgb)
{
    
sh_set_rendering(idrgb16kRenderFxGlowShell);
}

//stock sh_setScreenFlash(id, red, green, blue, decisecs, alpha)
//stock setScreenFlash(id, red, green, blue, decisecs, alpha)
#define sh_setScreenFlash setScreenFlash
stock setScreenFlash(idredgreenbluedecisecsalpha)
{
    if ( !
is_user_connected(id) ) return;

    
sh_screen_fade(idfloat(decisecs)/10.0float(decisecs)/20.0redgreenbluealpha);
}

//stock sh_screenShake(id, amplitude, duration, frequency)
//stock setScreenShake(id, amplitude, duration, frequency)
#define sh_screenShake setScreenShake
stock setScreenShake(idamplitudedurationfrequency)
{
    if ( !
is_user_connected(id) ) return;

    
sh_screen_shake(idfloat(amplitude)/10.0float(duration)/10.0float(frequency)/10.0);
}

//cooldown stuff
#define gPlayerUltimateUsed gPlayerInCooldown
#define ultimateTimer sh_set_cooldown
#define enableUltimate sh_end_cooldown

stock shRegKeyUp(const heroName[], const keyUpFunction[])
{
    
server_cmd("sh_regKeyUp ^"%s^" ^"%s^""heroNamekeyUpFunction);
}

stock shRegKeyDown(const heroName[], const keyDownFunction[])
{
    
server_cmd("sh_regKeyDown ^"%s^" ^"%s^""heroNamekeyDownFunction);
}

stock shRegLevels(const heroName[], const levelFunction[])
{
    
server_cmd("sh_regLevels ^"%s^" ^"%s^""heroNamelevelFunction);
}

stock shRegMaxHealth(const heroName[], const healthFunction[])
{
    
server_cmd("sh_regMaxHealth ^"%s^" ^"%s^""heroNamehealthFunction);
}

stock shRegHeroInit(const heroName[], const initFunction[])
{
    
server_cmd("sh_regInit ^"%s^" ^"%s^""heroNameinitFunction);
}

//These stocks should now be ignored since removal upon hero drop is done in core
//Kept to allow heroes to compile without error
stock shResetShield(id)
{
    return 
id;
}
stock shRemHealthPower(id)
{
    return 
id;
}

stock shRemArmorPower(id)
{
    return 
id;
}

stock shRemGravityPower(id)
{
    return 
id;
}

stock shRemSpeedPower(id)
{
    return 
id;
}

//This is pointless, kept for backward compat only
stock bool:isDebugOn()
{
    static 
sh_debug_messages;

    if ( !
sh_debug_messages ) {
        
sh_debug_messages get_cvar_pointer("sh_debug_messages");
    }

    return (
get_pcvar_num(sh_debug_messages) > true false);
}

//------------
// Depreciated stocks
//------------

//Now in amxmodx 1.80.
#define maxof floatmax
#define minof floatmin

//old cmath.inc port of sqroot no longer needed.
#define sqrt(%1) sqroot(%1)

//This stock was moved to core.
//Forcing old heroes to throw a compile error so that they are
//forced to update to sh_extra_damage for better compatibility.
//stock logKill(id, victim, const weaponDescription[])


#endif 
Any ideeas?
Bladell is offline
anon12
Member
Join Date: Aug 2013
Old 11-06-2013 , 13:02   Re: Error log
Reply With Quote #2

Check if user is alive and connected?
anon12 is offline
Bladell
Senior Member
Join Date: Jun 2012
Old 11-08-2013 , 14:50   Re: Error log
Reply With Quote #3

I don't think that errors says something about if player is connected or alive...
Bladell is offline
Jelle
[b]MOAR CANDY[/b]
Join Date: Aug 2009
Location: Denmark
Old 11-10-2013 , 08:34   Re: Error log
Reply With Quote #4

L 11/05/2013 - 20:54:26: [FUN] Invalid player 1

It says that player index 1 was not found, so yes, it is because the player is not connected.
__________________
No idea what to write here...
Jelle is offline
Send a message via MSN to Jelle
Bladell
Senior Member
Join Date: Jun 2012
Old 11-11-2013 , 10:53   Re: Error log
Reply With Quote #5

Ok, ok...where I suppose to check if is connected and alive?
Bladell is offline
anon12
Member
Join Date: Aug 2013
Old 11-11-2013 , 15:04   Re: Error log
Reply With Quote #6

I think here:
PHP Code:
public colossus_endgodmode(id

    
stopSound(id
    
g_colossusTimer[id]=
    
    
if(!is_user_alive(id) || !is_user_connected(id))
        return
    
    if ( 
get_user_godmode(id) == 1
        { 
    
// Turn off GODMODE 
    
set_user_godmode(id,0
    
set_user_rendering(id,kRenderFxGlowShell,0,0,0,kRenderNormal,255
    } 

PHP Code:
public proto_damage() 

    new 
id=gProtoId 
    
    
if(!is_user_alive(id) || !is_user_connected(id))
        return
        
    if (
gProtoShield==1) { 
    new 
damage read_data(2//This reads the damage done to ID  
    
new weaponbodypart get_user_attacker(id,weapon,bodypart
    if (
weapon!=CSW_KNIFE
    { 
    
shAddHPs(id, (damage), 100)//Nullify damage 
    

    } 

anon12 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:01.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode