Raised This Month: $51 Target: $400
 12% 

Subplugin Submission [T] List of Modified + Requested Plugins


Post New Thread Reply   
 
Thread Tools Display Modes
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 01-10-2016 , 03:39   Re: [T] List of Modified + Requested Plugins
Reply With Quote #1081

Which ability you want to have cooldown? Next, just ignore the loose indentation warning. It will not effect the gameplay.
zmd94 is offline
New and Clueless
Senior Member
Join Date: Dec 2015
Old 01-10-2016 , 15:29   Re: [T] List of Modified + Requested Plugins
Reply With Quote #1082

Quote:
Originally Posted by zmd94 View Post
Which ability you want to have cooldown? Next, just ignore the loose indentation warning. It will not effect the gameplay.
if possible everything, so you will only get the armor, hp, unlimited clip, speed boost when you use ability, and only able to use ability 1 time per round, and thanks alot for the plugins and everything


edit: can you tell me the difference between this plugin: https://forums.alliedmods.net/showpo...&postcount=188
and this one https://forums.alliedmods.net/showpo...&postcount=157

edit2: and any chance to make this plugin give you ammo pack and frag for killing zombie with knife?
https://forums.alliedmods.net/showpo...&postcount=313

Last edited by New and Clueless; 01-10-2016 at 17:45.
New and Clueless is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 01-11-2016 , 03:59   Re: [T] List of Modified + Requested Plugins
Reply With Quote #1083

This plugin (https://forums.alliedmods.net/showpo...&postcount=188) will allow player to know their rank via chat. Just write /rank or rank in chat. It also has "Kill per Death" ratio feature. Yet, it hud color will be fixed.

Then, for this plugin (https://forums.alliedmods.net/showpo...&postcount=157), it have random hud color with host name. However, player cannot write anything to know their rank. The rank only will be displayed automatically at their first connect to the server.

Next, just use below code for the powerful knife:
Code:
#include <amxmodx>
#include <engine>
#include <zombieplague>
#include <hamsandwich>
#include <fakemeta>
#include <cstrike>
#include <fun>

new Float:g_Leap[33]

new iHumanS[33]
new g_JumpCount[33], g_Right[33]
new g_iLight, g_iSmo
new g_iSpecial
new g_iFrag, g_iAPBonus, g_iJump, g_iLeapForce, g_iLeapHeight, g_iLeapCooldown, g_iHealth, g_iArmor
new g_iMaxPlayers

public plugin_init()
{
    register_plugin( "[ZP] Human Class: Special", "0.1", "zmd94" );
    
    register_clcmd("chooseteam", "clcmd_changeteam")
    
    g_iSpecial = zp_register_extra_item("Special Human", 30, ZP_TEAM_HUMAN) 
    
    register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
    
    RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
    RegisterHam(Ham_Killed, "player", "fw_PlayerKilled", 1)
    RegisterHam(Ham_Player_Jump, "player", "fw_PlayerJump", 0)
    RegisterHam(Ham_Touch, "weaponbox", "fw_TouchWeapon")
    RegisterHam(Ham_Touch, "armoury_entity", "fw_TouchWeapon")
    RegisterHam(Ham_Touch, "weapon_shield", "fw_TouchWeapon")
    
    register_forward(FM_CmdStart, "fw_Start")
    register_forward(FM_PlayerPreThink, "fw_PlayerPreThink")
    
    g_iAPBonus = register_cvar("zp_AP_bonus", "1") // Amount of AP bonus
    g_iFrag = register_cvar("zp_frag_bonus", "1") // Amount of frag bonus
    g_iHealth = register_cvar("zp_health_bonus", "150") // Amount of health bonus
    g_iArmor = register_cvar("zp_armor_bonus", "50") // Amount of armor bonus
    g_iJump = register_cvar("zp_multi_jump_amount", "3") // Amount of multi-jump given
    g_iLeapForce = register_cvar("zp_leap_force", "500") // Amount of leap force
    g_iLeapHeight = register_cvar("zp_leap_height", "300") // Amount of leap height
    g_iLeapCooldown = register_cvar("zp_leap_cooldown", "10.0") // Amount of leap cooldown
    
    g_iMaxPlayers = get_maxplayers()
}

public plugin_precache()
{
    g_iLight = precache_model( "sprites/lgtning.spr" );
    g_iSmo = precache_model( "sprites/steam1.spr" );
}

public clcmd_changeteam(id)
{
    if(is_user_alive(id) && iHumanS[id])
    {
        client_print(id, print_chat, "[ZP] The menu is disabled!")
        return PLUGIN_HANDLED
    }
    return PLUGIN_CONTINUE
}

public event_round_start()
{
    for (new id = 1; id <= g_iMaxPlayers; id++)
    {
        iHumanS[id] = false
    }
}

public fw_Start(id) 
{
    if(!is_user_alive(id) || !iHumanS[id]) 
        return

    if( pev(id, pev_button) & IN_ATTACK2) 
    {
        g_Right[id] = true
    }
}

public fw_PlayerPreThink(id)
{
    if (!is_user_alive(id) || !iHumanS[id])
        return FMRES_IGNORED

    if (allowed_Leap(id))
    {  
        static Float:velocity[3]
        velocity_by_aim(id, get_pcvar_num(g_iLeapForce), velocity)
        
        velocity[2] = get_pcvar_float(g_iLeapHeight)
        
        set_pev(id, pev_velocity, velocity)

        g_Leap[id] = get_gametime()

    }
    
    return FMRES_IGNORED
}

allowed_Leap(id)
{   
    if (!is_user_alive(id) || !iHumanS[id])
        return false
       
    static buttons
    buttons = pev(id, pev_button)
    
    if (!(pev(id, pev_flags) & FL_ONGROUND) || fm_get_speed(id) < 20 || !(buttons & IN_JUMP) || !(buttons & IN_DUCK))
        return false

    if (get_gametime() - g_Leap[id] < get_pcvar_float(g_iLeapCooldown))
        return false
        
    return true
}

public fw_TouchWeapon(weapon, id)
{
    if (is_user_alive(id) && iHumanS[id])
    {
        return HAM_SUPERCEDE;
    }
    return HAM_IGNORED;
}

public zp_extra_item_selected(id, itemid)
{
    if (itemid == g_iSpecial)
    {
        strip_user_weapons(id)
        give_item(id, "weapon_knife")
        
        set_user_health(id, get_user_health(id) + get_pcvar_num(g_iHealth))
        set_user_armor(id, get_user_armor(id) + get_pcvar_num(g_iArmor))
        
        client_print(id, print_chat, "[ZP] You are now Special Human!")
        iHumanS[id] = true
    }
}

public zp_user_infected_post(id, infector)
{
    if (is_user_alive(id) && iHumanS[id])
    {
        iHumanS[id] = false
    }
}

public fw_PlayerJump(id) 
{
    if(is_user_alive(id) && iHumanS[id])
    {
        new Flags = pev(id, pev_flags)
        
        if( Flags & FL_WATERJUMP || pev(id, pev_waterlevel) >= 2 || !(get_pdata_int(id, 246) & IN_JUMP) )
        {
            return HAM_IGNORED
        }
        if(Flags & FL_ONGROUND) 
        {
            g_JumpCount[id] = 0
            return HAM_IGNORED
        }
        if(get_pcvar_num(g_iJump)) 
        {
            if( get_pdata_float(id, 251) < 500 && ++g_JumpCount[id] <= get_pcvar_num(g_iJump)) 
            {
                new Float:fVelocity[3]
                pev(id, pev_velocity, fVelocity)
                fVelocity[2] = 268.328157
                set_pev(id, pev_velocity, fVelocity)
                
                return HAM_HANDLED
            }
        }
    }
    return HAM_IGNORED
}

public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type)
{
    if (!is_user_alive(attacker) || victim == attacker)
        return
    
    if (!zp_get_user_zombie(attacker) && g_Right[attacker])
    {
        if(get_user_weapon(attacker) == CSW_KNIFE)
        {
            if(zp_get_user_zombie(victim))
            {
                new vorigin[ 3 ], pos[ 3 ];
                get_user_origin( victim, vorigin );
                vorigin[ 2 ] -= 26;
                pos[ 0 ] = vorigin[ 0 ] + 150;
                pos[ 1 ] = vorigin[ 1 ] + 150;
                pos[ 2 ] = vorigin[ 2 ] + 800;
                
                user_kill(victim)
                bThunder( pos, vorigin );
                bSmo( vorigin, 10, 10 );
                
                ExecuteHam(Ham_AddPoints, attacker, get_pcvar_num(g_iFrag), true)
                
                g_Right[attacker] = false
            }
        }
    }
}

public fw_PlayerKilled(victim, attacker)  
{
    if (!is_user_alive(attacker) || victim == attacker)
        return
    
    if (!zp_get_user_zombie(attacker) && g_Right[attacker])
    {
        if(get_user_weapon(attacker) == CSW_KNIFE)
        {
            zp_set_user_ammo_packs(attacker, zp_get_user_ammo_packs(attacker) + get_pcvar_num(g_iAPBonus))
            
        }
    }
}

bThunder( start[ 3 ], end[ 3 ] )
{
    message_begin( MSG_BROADCAST, SVC_TEMPENTITY ); 
    write_byte( TE_BEAMPOINTS ); 
    write_coord( start[ 0 ] ); 
    write_coord( start[ 1 ] ); 
    write_coord( start[ 2 ] ); 
    write_coord( end[ 0 ] ); 
    write_coord( end[ 1 ] ); 
    write_coord( end[ 2 ] ); 
    write_short( g_iLight ); 
    write_byte( 1 );
    write_byte( 5 );
    write_byte( 7 );
    write_byte( 150 );
    write_byte( 30 );
    write_byte( 200 ); 
    write_byte( 200 );
    write_byte( 200 );
    write_byte( 200 );
    write_byte( 200 );
    message_end();

    message_begin( MSG_PVS, SVC_TEMPENTITY, end );
    write_byte( TE_SPARKS );
    write_coord( end[ 0 ]  );
    write_coord( end[ 1 ]);
    write_coord( end[ 2 ] );
    message_end();
}

bSmo( iorigin[ 3 ], scale, framerate )
{
    message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
    write_byte( TE_SMOKE );
    write_coord( iorigin[ 0 ] );
    write_coord( iorigin[ 1 ] );
    write_coord( iorigin[ 2 ] );
    write_short( g_iSmo );
    write_byte( scale );
    write_byte( framerate );
    message_end();
}

stock fm_get_speed(entity)
{
    static Float:velocity[3]
    pev(entity, pev_velocity, velocity)
    
    return floatround(vector_length(velocity))
}
Lastly, for the ability cooldown, just try below:
Code:
/*    

    //////////////////////////////////////////////////////////////////
    //   OWNER CAN ACTIVE THE SPEED BOOST BY PRESSING [E] BUTTON    //
    //////////////////////////////////////////////////////////////////

    //////////////////////////////////////////////////////////////////
    //                      ADMIN + OWNER                           //
    //                                                              //
    //         JUST say /freehealth TO RECIEVE FREE HEALTH          //
    //          JUST say /freearmor TO RECIEVE FREE ARMOR           //
    //                                                              //
    //////////////////////////////////////////////////////////////////    
        
*/
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <cstrike>
#include <fun>

//////////////////////////////////////////////////////////////////
//                        DEFINE FLAG                           //
//////////////////////////////////////////////////////////////////
#define OWNER_FLAG ADMIN_IMMUNITY
#define ADMIN_FLAG ADMIN_BAN
//////////////////////////////////////////////////////////////////

new g_bRecieveArmor[33], g_bRecieveHP[33]

new cvar_multijump, cvar_health, cvar_armor
new cvar_boost_amount, cvar_boost_duration

const TASK_SPEED_BOOST = 100
#define ID_SPEED_BOOST (taskid - TASK_SPEED_BOOST)

new Ham:Ham_Player_ResetMaxSpeed = Ham_Item_PreFrame

// CS Offsets
#if cellbits == 32
const OFFSET_CLIPAMMO = 51
#else
const OFFSET_CLIPAMMO = 65
#endif
const OFFSET_LINUX_WEAPONS = 4

// Max Clip for weapons
new const MAXCLIP[] = { -1, 13, -1, 10, 1, 7, -1, 30, 30, 1, 30, 20, 25, 30, 35, 25, 12, 20,
            10, 30, 100, 8, 30, 30, 20, 2, 7, 30, 30, -1, 50 }

new g_UnlimitedC[33], g_JumpCount[33], g_iSpeed[33]
new g_iMaxPlayers

public plugin_init()
{
    register_plugin("[ZP] Addon: Admin Ability", "1.0", "zmd94")
    
    register_clcmd("say /freehealth", "iHealth")
    register_clcmd("say_team /freehealth", "iHealth")
    register_clcmd("say /freearmor", "iArmor")
    register_clcmd("say_team /freearmor", "iArmor")
    
    register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
    register_event("CurWeapon", "current_weapon", "be", "1=1")
    register_message(get_user_msgid("CurWeapon"), "message_cur_weapon")
    
    RegisterHam(Ham_Player_Jump, "player", "fw_PlayerJump", 0)
    RegisterHam(Ham_Spawn, "player", "fw_PlayerRespawn", 1)
    RegisterHam(Ham_Player_ResetMaxSpeed, "player", "fw_ResetMaxSpeed_Post", 1)
    RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")
    
    register_forward(FM_CmdStart, "fw_Start")
    
    //////////////////////////////////////////////////////////////////
    //                      ADMIN + OWNER                           //
    //////////////////////////////////////////////////////////////////
    cvar_multijump = register_cvar("aa_multijump_amount", "0") // Amount of multi-jump given
    cvar_health = register_cvar("aa_health_amount", "100") // Amount of health given
    cvar_armor = register_cvar("aa_armor_amount", "50") // Amount of armor given
    
    //////////////////////////////////////////////////////////////////
    //                        OWNER ONLY                            //
    //////////////////////////////////////////////////////////////////
    cvar_boost_amount = register_cvar("aa_boost_amount", "100.0") // Amount of speed boost
    cvar_boost_duration = register_cvar("aa_boost_duration", "30.0") // Duration of speed boost
    
    g_iMaxPlayers = get_maxplayers()
}

public current_weapon(id)
{
    if(g_UnlimitedC[id])
    {
        new iWeapon = get_user_weapon(id) 
        if(iWeapon == CSW_HEGRENADE)
        {
            give_item(id, "weapon_hegrenade")
            cs_set_user_bpammo(id, CSW_HEGRENADE, 245)
        }
        
        if(iWeapon == CSW_HEGRENADE)
        {
            give_item( id, "weapon_flashbang" )
            cs_set_user_bpammo(id, CSW_FLASHBANG, 245)
        }
        
        if(iWeapon == CSW_HEGRENADE)
        {
            give_item( id, "weapon_smokegrenade" )
            cs_set_user_bpammo(id, CSW_SMOKEGRENADE, 245)
        }    
    }
}

public fw_Start(id) 
{
    if(is_user_alive(id) && get_user_flags(id) & OWNER_FLAG) 
    {
        if( pev(id, pev_button) & IN_USE) 
        {
            if(g_iSpeed[id])
            {
                set_hudmessage(random_num(10,255), random(256), random(256), -1.0, 0.20, 0, 6.0, 12.0, 0.0, 0.0, -1)
                show_hudmessage(id, "You already use this ability for this round. Just wait until next round!")
            }
            else
            {
                // Player frozen (or CS freezetime)
                if (pev(id, pev_maxspeed) <= 1)
                {
                    set_hudmessage(random_num(10,255), random(256), random(256), -1.0, 0.20, 0, 6.0, 12.0, 0.0, 0.0, -1)
                    show_hudmessage(id, "You can't use this ability when frozen!")
                    return PLUGIN_HANDLED;
                }
                
                // Enable speed boost
                g_iSpeed[id] = true
                
                set_hudmessage(random_num(10,255), random(256), random(256), -1.0, 0.20, 0, 6.0, 12.0, 0.0, 0.0, -1)
                show_hudmessage(id, "Speed boost enabled!")
                
                // Set the restore speed task
                set_task(get_pcvar_float(cvar_boost_duration), "restore_maxspeed", id + TASK_SPEED_BOOST)
                
                // Update player's maxspeed
                ExecuteHamB(Ham_Player_ResetMaxSpeed, id)
            }
        }
    }
    
    return PLUGIN_CONTINUE;
}

public restore_maxspeed(taskid)
{
    // Disable speed boost
    g_iSpeed[ID_SPEED_BOOST] = false
    
    set_hudmessage(random_num(10,255), random(256), random(256), -1.0, 0.20, 0, 6.0, 12.0, 0.0, 0.0, -1)
    show_hudmessage(ID_SPEED_BOOST, "Speed boost is over!")

    // Update player's maxspeed
    ExecuteHamB(Ham_Player_ResetMaxSpeed, ID_SPEED_BOOST)
}

public fw_PlayerKilled(victim)
{
    g_iSpeed[victim] = false
    remove_task(victim + TASK_SPEED_BOOST)
}

public client_disconnect(id)
{
    g_iSpeed[id] = false
    remove_task(id + TASK_SPEED_BOOST)
}

// Remove speed boost at round start
public event_round_start()
{
    for (new id = 1; id <= g_iMaxPlayers; id++)
    {
        g_iSpeed[id] = false
        g_bRecieveArmor[id] = false
        g_bRecieveHP[id] = false
        remove_task(id + TASK_SPEED_BOOST)
    }
}

public fw_ResetMaxSpeed_Post(id)
{
    if (!is_user_alive(id) || !g_iSpeed[id])
        return;
    
    // Apply speed boost
    new Float:current_maxspeed
    pev(id, pev_maxspeed, current_maxspeed)
    set_pev(id, pev_maxspeed, current_maxspeed + get_pcvar_float(cvar_boost_amount))
}

public fw_PlayerRespawn(id)
{
    if(is_user_alive(id) && get_user_flags(id) & ADMIN_FLAG)
    {
        g_UnlimitedC[id] = true
        set_task(5.0, "iHealth", id)
        set_task(6.0, "iArmor", id)
    }
}

public iHealth(id)
{
    if(is_user_alive(id) && get_user_flags(id) & ADMIN_FLAG)
    {
        if(g_bRecieveHP[id])
        {
            set_hudmessage(random_num(10,255), random(256), random(256), -1.0, 0.20, 0, 6.0, 12.0, 0.0, 0.0, -1)
            show_hudmessage(id, "You already recieved free HP. Just wait until new round!")
        }
        else
        {
            set_user_health(id, get_user_health(id) + get_pcvar_num(cvar_health))
            g_bRecieveHP[id] = true
        }
    }
}
    
public iArmor(id)
{
    if(is_user_alive(id) && get_user_flags(id) & ADMIN_FLAG)
    {
        if(g_bRecieveArmor[id])
        {
            set_hudmessage(random_num(10,255), random(256), random(256), -1.0, 0.20, 0, 6.0, 12.0, 0.0, 0.0, -1)
            show_hudmessage(id, "You already recieved free armor. Just wait until new round!")
        }
        else
        {
            set_user_armor(id, get_user_armor(id) + get_pcvar_num(cvar_armor))
            g_bRecieveArmor[id] = true
        }
    }
}

public fw_PlayerJump( id ) 
{    
    if( is_user_alive(id) && get_user_flags(id) & ADMIN_FLAG )    
    {    
        new Flags = pev( id, pev_flags )
        
        if( Flags & FL_WATERJUMP || pev(id, pev_waterlevel) >= 2 || !(get_pdata_int(id, 246) & IN_JUMP) )
        {
            return HAM_IGNORED
        }
        
        if( Flags & FL_ONGROUND ) 
        {
            g_JumpCount[ id ] = 0
            return HAM_IGNORED
        }
        new Multi = get_pcvar_num(cvar_multijump)
        if( Multi ) 
        {
            if( get_pdata_float(id, 251) < 500 && ++ g_JumpCount[id] <= Multi ) 
            {
                new Float:fVelocity[ 3 ]
                pev( id, pev_velocity, fVelocity )
                fVelocity[ 2 ] = 268.328157
                set_pev( id, pev_velocity, fVelocity )

                return HAM_HANDLED
            }
        }
    }
    return HAM_IGNORED
}

public message_cur_weapon(msg_id, msg_dest, msg_entity)
{
    // Player doesn't have the unlimited clip upgrade
    if (!g_UnlimitedC[msg_entity])
        return;
    
    // Player not alive or not an active weapon
    if (!is_user_alive(msg_entity) || get_msg_arg_int(1) != 1)
        return;
    
    static weapon, clip
    weapon = get_msg_arg_int(2) // get weapon ID
    clip = get_msg_arg_int(3) // get weapon clip
    
    // Unlimited Clip Ammo
    if (MAXCLIP[weapon] > 1) // skip grenades
    {
        set_msg_arg_int(3, get_msg_argtype(3), MAXCLIP[weapon]) // HUD should show full clip all the time
        
        if (clip < 2) // refill when clip is nearly empty
        {
            // Get the weapon entity
            static wname[32], weapon_ent
            get_weaponname(weapon, wname, sizeof wname - 1)
            weapon_ent = fm_find_ent_by_owner(-1, wname, msg_entity)
            
            // Set max clip on weapon
            fm_set_weapon_ammo(weapon_ent, MAXCLIP[weapon])
        }
    }
}

// Find entity by its owner (from fakemeta_util)
stock fm_find_ent_by_owner(entity, const classname[], owner)
{
    while ((entity = engfunc(EngFunc_FindEntityByString, entity, "classname", classname)) && pev(entity, pev_owner) != owner) {}
    
    return entity;
}

// Set Weapon Clip Ammo
stock fm_set_weapon_ammo(entity, amount)
{
    set_pdata_int(entity, OFFSET_CLIPAMMO, amount, OFFSET_LINUX_WEAPONS);
}
zmd94 is offline
New and Clueless
Senior Member
Join Date: Dec 2015
Old 01-11-2016 , 17:32   Re: [T] List of Modified + Requested Plugins
Reply With Quote #1084

Quote:
Originally Posted by zmd94 View Post
This plugin (https://forums.alliedmods.net/showpo...&postcount=188) will allow player to know their rank via chat. Just write /rank or rank in chat. It also has "Kill per Death" ratio feature. Yet, it hud color will be fixed.

Then, for this plugin (https://forums.alliedmods.net/showpo...&postcount=157), it have random hud color with host name. However, player cannot write anything to know their rank. The rank only will be displayed automatically at their first connect to the server.

Next, just use below code for the powerful knife:
Code:
#include <amxmodx>
#include <engine>
#include <zombieplague>
#include <hamsandwich>
#include <fakemeta>
#include <cstrike>
#include <fun>

new Float:g_Leap[33]

new iHumanS[33]
new g_JumpCount[33], g_Right[33]
new g_iLight, g_iSmo
new g_iSpecial
new g_iFrag, g_iAPBonus, g_iJump, g_iLeapForce, g_iLeapHeight, g_iLeapCooldown, g_iHealth, g_iArmor
new g_iMaxPlayers

public plugin_init()
{
    register_plugin( "[ZP] Human Class: Special", "0.1", "zmd94" );
    
    register_clcmd("chooseteam", "clcmd_changeteam")
    
    g_iSpecial = zp_register_extra_item("Special Human", 30, ZP_TEAM_HUMAN) 
    
    register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
    
    RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
    RegisterHam(Ham_Killed, "player", "fw_PlayerKilled", 1)
    RegisterHam(Ham_Player_Jump, "player", "fw_PlayerJump", 0)
    RegisterHam(Ham_Touch, "weaponbox", "fw_TouchWeapon")
    RegisterHam(Ham_Touch, "armoury_entity", "fw_TouchWeapon")
    RegisterHam(Ham_Touch, "weapon_shield", "fw_TouchWeapon")
    
    register_forward(FM_CmdStart, "fw_Start")
    register_forward(FM_PlayerPreThink, "fw_PlayerPreThink")
    
    g_iAPBonus = register_cvar("zp_AP_bonus", "1") // Amount of AP bonus
    g_iFrag = register_cvar("zp_frag_bonus", "1") // Amount of frag bonus
    g_iHealth = register_cvar("zp_health_bonus", "150") // Amount of health bonus
    g_iArmor = register_cvar("zp_armor_bonus", "50") // Amount of armor bonus
    g_iJump = register_cvar("zp_multi_jump_amount", "3") // Amount of multi-jump given
    g_iLeapForce = register_cvar("zp_leap_force", "500") // Amount of leap force
    g_iLeapHeight = register_cvar("zp_leap_height", "300") // Amount of leap height
    g_iLeapCooldown = register_cvar("zp_leap_cooldown", "10.0") // Amount of leap cooldown
    
    g_iMaxPlayers = get_maxplayers()
}

public plugin_precache()
{
    g_iLight = precache_model( "sprites/lgtning.spr" );
    g_iSmo = precache_model( "sprites/steam1.spr" );
}

public clcmd_changeteam(id)
{
    if(is_user_alive(id) && iHumanS[id])
    {
        client_print(id, print_chat, "[ZP] The menu is disabled!")
        return PLUGIN_HANDLED
    }
    return PLUGIN_CONTINUE
}

public event_round_start()
{
    for (new id = 1; id <= g_iMaxPlayers; id++)
    {
        iHumanS[id] = false
    }
}

public fw_Start(id) 
{
    if(!is_user_alive(id) || !iHumanS[id]) 
        return

    if( pev(id, pev_button) & IN_ATTACK2) 
    {
        g_Right[id] = true
    }
}

public fw_PlayerPreThink(id)
{
    if (!is_user_alive(id) || !iHumanS[id])
        return FMRES_IGNORED

    if (allowed_Leap(id))
    {  
        static Float:velocity[3]
        velocity_by_aim(id, get_pcvar_num(g_iLeapForce), velocity)
        
        velocity[2] = get_pcvar_float(g_iLeapHeight)
        
        set_pev(id, pev_velocity, velocity)

        g_Leap[id] = get_gametime()

    }
    
    return FMRES_IGNORED
}

allowed_Leap(id)
{   
    if (!is_user_alive(id) || !iHumanS[id])
        return false
       
    static buttons
    buttons = pev(id, pev_button)
    
    if (!(pev(id, pev_flags) & FL_ONGROUND) || fm_get_speed(id) < 20 || !(buttons & IN_JUMP) || !(buttons & IN_DUCK))
        return false

    if (get_gametime() - g_Leap[id] < get_pcvar_float(g_iLeapCooldown))
        return false
        
    return true
}

public fw_TouchWeapon(weapon, id)
{
    if (is_user_alive(id) && iHumanS[id])
    {
        return HAM_SUPERCEDE;
    }
    return HAM_IGNORED;
}

public zp_extra_item_selected(id, itemid)
{
    if (itemid == g_iSpecial)
    {
        strip_user_weapons(id)
        give_item(id, "weapon_knife")
        
        set_user_health(id, get_user_health(id) + get_pcvar_num(g_iHealth))
        set_user_armor(id, get_user_armor(id) + get_pcvar_num(g_iArmor))
        
        client_print(id, print_chat, "[ZP] You are now Special Human!")
        iHumanS[id] = true
    }
}

public zp_user_infected_post(id, infector)
{
    if (is_user_alive(id) && iHumanS[id])
    {
        iHumanS[id] = false
    }
}

public fw_PlayerJump(id) 
{
    if(is_user_alive(id) && iHumanS[id])
    {
        new Flags = pev(id, pev_flags)
        
        if( Flags & FL_WATERJUMP || pev(id, pev_waterlevel) >= 2 || !(get_pdata_int(id, 246) & IN_JUMP) )
        {
            return HAM_IGNORED
        }
        if(Flags & FL_ONGROUND) 
        {
            g_JumpCount[id] = 0
            return HAM_IGNORED
        }
        if(get_pcvar_num(g_iJump)) 
        {
            if( get_pdata_float(id, 251) < 500 && ++g_JumpCount[id] <= get_pcvar_num(g_iJump)) 
            {
                new Float:fVelocity[3]
                pev(id, pev_velocity, fVelocity)
                fVelocity[2] = 268.328157
                set_pev(id, pev_velocity, fVelocity)
                
                return HAM_HANDLED
            }
        }
    }
    return HAM_IGNORED
}

public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type)
{
    if (!is_user_alive(attacker) || victim == attacker)
        return
    
    if (!zp_get_user_zombie(attacker) && g_Right[attacker])
    {
        if(get_user_weapon(attacker) == CSW_KNIFE)
        {
            if(zp_get_user_zombie(victim))
            {
                new vorigin[ 3 ], pos[ 3 ];
                get_user_origin( victim, vorigin );
                vorigin[ 2 ] -= 26;
                pos[ 0 ] = vorigin[ 0 ] + 150;
                pos[ 1 ] = vorigin[ 1 ] + 150;
                pos[ 2 ] = vorigin[ 2 ] + 800;
                
                user_kill(victim)
                bThunder( pos, vorigin );
                bSmo( vorigin, 10, 10 );
                
                ExecuteHam(Ham_AddPoints, attacker, get_pcvar_num(g_iFrag), true)
                
                g_Right[attacker] = false
            }
        }
    }
}

public fw_PlayerKilled(victim, attacker)  
{
    if (!is_user_alive(attacker) || victim == attacker)
        return
    
    if (!zp_get_user_zombie(attacker) && g_Right[attacker])
    {
        if(get_user_weapon(attacker) == CSW_KNIFE)
        {
            zp_set_user_ammo_packs(attacker, zp_get_user_ammo_packs(attacker) + get_pcvar_num(g_iAPBonus))
            
        }
    }
}

bThunder( start[ 3 ], end[ 3 ] )
{
    message_begin( MSG_BROADCAST, SVC_TEMPENTITY ); 
    write_byte( TE_BEAMPOINTS ); 
    write_coord( start[ 0 ] ); 
    write_coord( start[ 1 ] ); 
    write_coord( start[ 2 ] ); 
    write_coord( end[ 0 ] ); 
    write_coord( end[ 1 ] ); 
    write_coord( end[ 2 ] ); 
    write_short( g_iLight ); 
    write_byte( 1 );
    write_byte( 5 );
    write_byte( 7 );
    write_byte( 150 );
    write_byte( 30 );
    write_byte( 200 ); 
    write_byte( 200 );
    write_byte( 200 );
    write_byte( 200 );
    write_byte( 200 );
    message_end();

    message_begin( MSG_PVS, SVC_TEMPENTITY, end );
    write_byte( TE_SPARKS );
    write_coord( end[ 0 ]  );
    write_coord( end[ 1 ]);
    write_coord( end[ 2 ] );
    message_end();
}

bSmo( iorigin[ 3 ], scale, framerate )
{
    message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
    write_byte( TE_SMOKE );
    write_coord( iorigin[ 0 ] );
    write_coord( iorigin[ 1 ] );
    write_coord( iorigin[ 2 ] );
    write_short( g_iSmo );
    write_byte( scale );
    write_byte( framerate );
    message_end();
}

stock fm_get_speed(entity)
{
    static Float:velocity[3]
    pev(entity, pev_velocity, velocity)
    
    return floatround(vector_length(velocity))
}
Lastly, for the ability cooldown, just try below:
Code:
/*    

    //////////////////////////////////////////////////////////////////
    //   OWNER CAN ACTIVE THE SPEED BOOST BY PRESSING [E] BUTTON    //
    //////////////////////////////////////////////////////////////////

    //////////////////////////////////////////////////////////////////
    //                      ADMIN + OWNER                           //
    //                                                              //
    //         JUST say /freehealth TO RECIEVE FREE HEALTH          //
    //          JUST say /freearmor TO RECIEVE FREE ARMOR           //
    //                                                              //
    //////////////////////////////////////////////////////////////////    
        
*/
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <cstrike>
#include <fun>

//////////////////////////////////////////////////////////////////
//                        DEFINE FLAG                           //
//////////////////////////////////////////////////////////////////
#define OWNER_FLAG ADMIN_IMMUNITY
#define ADMIN_FLAG ADMIN_BAN
//////////////////////////////////////////////////////////////////

new g_bRecieveArmor[33], g_bRecieveHP[33]

new cvar_multijump, cvar_health, cvar_armor
new cvar_boost_amount, cvar_boost_duration

const TASK_SPEED_BOOST = 100
#define ID_SPEED_BOOST (taskid - TASK_SPEED_BOOST)

new Ham:Ham_Player_ResetMaxSpeed = Ham_Item_PreFrame

// CS Offsets
#if cellbits == 32
const OFFSET_CLIPAMMO = 51
#else
const OFFSET_CLIPAMMO = 65
#endif
const OFFSET_LINUX_WEAPONS = 4

// Max Clip for weapons
new const MAXCLIP[] = { -1, 13, -1, 10, 1, 7, -1, 30, 30, 1, 30, 20, 25, 30, 35, 25, 12, 20,
            10, 30, 100, 8, 30, 30, 20, 2, 7, 30, 30, -1, 50 }

new g_UnlimitedC[33], g_JumpCount[33], g_iSpeed[33]
new g_iMaxPlayers

public plugin_init()
{
    register_plugin("[ZP] Addon: Admin Ability", "1.0", "zmd94")
    
    register_clcmd("say /freehealth", "iHealth")
    register_clcmd("say_team /freehealth", "iHealth")
    register_clcmd("say /freearmor", "iArmor")
    register_clcmd("say_team /freearmor", "iArmor")
    
    register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
    register_event("CurWeapon", "current_weapon", "be", "1=1")
    register_message(get_user_msgid("CurWeapon"), "message_cur_weapon")
    
    RegisterHam(Ham_Player_Jump, "player", "fw_PlayerJump", 0)
    RegisterHam(Ham_Spawn, "player", "fw_PlayerRespawn", 1)
    RegisterHam(Ham_Player_ResetMaxSpeed, "player", "fw_ResetMaxSpeed_Post", 1)
    RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")
    
    register_forward(FM_CmdStart, "fw_Start")
    
    //////////////////////////////////////////////////////////////////
    //                      ADMIN + OWNER                           //
    //////////////////////////////////////////////////////////////////
    cvar_multijump = register_cvar("aa_multijump_amount", "0") // Amount of multi-jump given
    cvar_health = register_cvar("aa_health_amount", "100") // Amount of health given
    cvar_armor = register_cvar("aa_armor_amount", "50") // Amount of armor given
    
    //////////////////////////////////////////////////////////////////
    //                        OWNER ONLY                            //
    //////////////////////////////////////////////////////////////////
    cvar_boost_amount = register_cvar("aa_boost_amount", "100.0") // Amount of speed boost
    cvar_boost_duration = register_cvar("aa_boost_duration", "30.0") // Duration of speed boost
    
    g_iMaxPlayers = get_maxplayers()
}

public current_weapon(id)
{
    if(g_UnlimitedC[id])
    {
        new iWeapon = get_user_weapon(id) 
        if(iWeapon == CSW_HEGRENADE)
        {
            give_item(id, "weapon_hegrenade")
            cs_set_user_bpammo(id, CSW_HEGRENADE, 245)
        }
        
        if(iWeapon == CSW_HEGRENADE)
        {
            give_item( id, "weapon_flashbang" )
            cs_set_user_bpammo(id, CSW_FLASHBANG, 245)
        }
        
        if(iWeapon == CSW_HEGRENADE)
        {
            give_item( id, "weapon_smokegrenade" )
            cs_set_user_bpammo(id, CSW_SMOKEGRENADE, 245)
        }    
    }
}

public fw_Start(id) 
{
    if(is_user_alive(id) && get_user_flags(id) & OWNER_FLAG) 
    {
        if( pev(id, pev_button) & IN_USE) 
        {
            if(g_iSpeed[id])
            {
                set_hudmessage(random_num(10,255), random(256), random(256), -1.0, 0.20, 0, 6.0, 12.0, 0.0, 0.0, -1)
                show_hudmessage(id, "You already use this ability for this round. Just wait until next round!")
            }
            else
            {
                // Player frozen (or CS freezetime)
                if (pev(id, pev_maxspeed) <= 1)
                {
                    set_hudmessage(random_num(10,255), random(256), random(256), -1.0, 0.20, 0, 6.0, 12.0, 0.0, 0.0, -1)
                    show_hudmessage(id, "You can't use this ability when frozen!")
                    return PLUGIN_HANDLED;
                }
                
                // Enable speed boost
                g_iSpeed[id] = true
                
                set_hudmessage(random_num(10,255), random(256), random(256), -1.0, 0.20, 0, 6.0, 12.0, 0.0, 0.0, -1)
                show_hudmessage(id, "Speed boost enabled!")
                
                // Set the restore speed task
                set_task(get_pcvar_float(cvar_boost_duration), "restore_maxspeed", id + TASK_SPEED_BOOST)
                
                // Update player's maxspeed
                ExecuteHamB(Ham_Player_ResetMaxSpeed, id)
            }
        }
    }
    
    return PLUGIN_CONTINUE;
}

public restore_maxspeed(taskid)
{
    // Disable speed boost
    g_iSpeed[ID_SPEED_BOOST] = false
    
    set_hudmessage(random_num(10,255), random(256), random(256), -1.0, 0.20, 0, 6.0, 12.0, 0.0, 0.0, -1)
    show_hudmessage(ID_SPEED_BOOST, "Speed boost is over!")

    // Update player's maxspeed
    ExecuteHamB(Ham_Player_ResetMaxSpeed, ID_SPEED_BOOST)
}

public fw_PlayerKilled(victim)
{
    g_iSpeed[victim] = false
    remove_task(victim + TASK_SPEED_BOOST)
}

public client_disconnect(id)
{
    g_iSpeed[id] = false
    remove_task(id + TASK_SPEED_BOOST)
}

// Remove speed boost at round start
public event_round_start()
{
    for (new id = 1; id <= g_iMaxPlayers; id++)
    {
        g_iSpeed[id] = false
        g_bRecieveArmor[id] = false
        g_bRecieveHP[id] = false
        remove_task(id + TASK_SPEED_BOOST)
    }
}

public fw_ResetMaxSpeed_Post(id)
{
    if (!is_user_alive(id) || !g_iSpeed[id])
        return;
    
    // Apply speed boost
    new Float:current_maxspeed
    pev(id, pev_maxspeed, current_maxspeed)
    set_pev(id, pev_maxspeed, current_maxspeed + get_pcvar_float(cvar_boost_amount))
}

public fw_PlayerRespawn(id)
{
    if(is_user_alive(id) && get_user_flags(id) & ADMIN_FLAG)
    {
        g_UnlimitedC[id] = true
        set_task(5.0, "iHealth", id)
        set_task(6.0, "iArmor", id)
    }
}

public iHealth(id)
{
    if(is_user_alive(id) && get_user_flags(id) & ADMIN_FLAG)
    {
        if(g_bRecieveHP[id])
        {
            set_hudmessage(random_num(10,255), random(256), random(256), -1.0, 0.20, 0, 6.0, 12.0, 0.0, 0.0, -1)
            show_hudmessage(id, "You already recieved free HP. Just wait until new round!")
        }
        else
        {
            set_user_health(id, get_user_health(id) + get_pcvar_num(cvar_health))
            g_bRecieveHP[id] = true
        }
    }
}
    
public iArmor(id)
{
    if(is_user_alive(id) && get_user_flags(id) & ADMIN_FLAG)
    {
        if(g_bRecieveArmor[id])
        {
            set_hudmessage(random_num(10,255), random(256), random(256), -1.0, 0.20, 0, 6.0, 12.0, 0.0, 0.0, -1)
            show_hudmessage(id, "You already recieved free armor. Just wait until new round!")
        }
        else
        {
            set_user_armor(id, get_user_armor(id) + get_pcvar_num(cvar_armor))
            g_bRecieveArmor[id] = true
        }
    }
}

public fw_PlayerJump( id ) 
{    
    if( is_user_alive(id) && get_user_flags(id) & ADMIN_FLAG )    
    {    
        new Flags = pev( id, pev_flags )
        
        if( Flags & FL_WATERJUMP || pev(id, pev_waterlevel) >= 2 || !(get_pdata_int(id, 246) & IN_JUMP) )
        {
            return HAM_IGNORED
        }
        
        if( Flags & FL_ONGROUND ) 
        {
            g_JumpCount[ id ] = 0
            return HAM_IGNORED
        }
        new Multi = get_pcvar_num(cvar_multijump)
        if( Multi ) 
        {
            if( get_pdata_float(id, 251) < 500 && ++ g_JumpCount[id] <= Multi ) 
            {
                new Float:fVelocity[ 3 ]
                pev( id, pev_velocity, fVelocity )
                fVelocity[ 2 ] = 268.328157
                set_pev( id, pev_velocity, fVelocity )

                return HAM_HANDLED
            }
        }
    }
    return HAM_IGNORED
}

public message_cur_weapon(msg_id, msg_dest, msg_entity)
{
    // Player doesn't have the unlimited clip upgrade
    if (!g_UnlimitedC[msg_entity])
        return;
    
    // Player not alive or not an active weapon
    if (!is_user_alive(msg_entity) || get_msg_arg_int(1) != 1)
        return;
    
    static weapon, clip
    weapon = get_msg_arg_int(2) // get weapon ID
    clip = get_msg_arg_int(3) // get weapon clip
    
    // Unlimited Clip Ammo
    if (MAXCLIP[weapon] > 1) // skip grenades
    {
        set_msg_arg_int(3, get_msg_argtype(3), MAXCLIP[weapon]) // HUD should show full clip all the time
        
        if (clip < 2) // refill when clip is nearly empty
        {
            // Get the weapon entity
            static wname[32], weapon_ent
            get_weaponname(weapon, wname, sizeof wname - 1)
            weapon_ent = fm_find_ent_by_owner(-1, wname, msg_entity)
            
            // Set max clip on weapon
            fm_set_weapon_ammo(weapon_ent, MAXCLIP[weapon])
        }
    }
}

// Find entity by its owner (from fakemeta_util)
stock fm_find_ent_by_owner(entity, const classname[], owner)
{
    while ((entity = engfunc(EngFunc_FindEntityByString, entity, "classname", classname)) && pev(entity, pev_owner) != owner) {}
    
    return entity;
}

// Set Weapon Clip Ammo
stock fm_set_weapon_ammo(entity, amount)
{
    set_pdata_int(entity, OFFSET_CLIPAMMO, amount, OFFSET_LINUX_WEAPONS);
}
alright, so for super human or first code it still didnt give ammo packs to killer or even frag (there was bug, when i bought super human i lost my weapons and i couldnt pick any weapon back up from the ground, but i could buy from extra menu and then use it, very weird bug) and for code number 2 or admin ability, when i spawn or start the game i got the extra hp and armor and unlimited ammo before i use the ability, and when i use the ability i get movement speed and message "you already use this ability for this round, wait next round" but i could still use the ability more than one time per round, if it is possible for you to do, i want no abilities for admin before he use the ability, so no hp no armor no unlimited clip when spawn, only when he use the ability he gets those things, thanks for trying dude!
New and Clueless is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 01-12-2016 , 21:10   Re: [T] List of Modified + Requested Plugins
Reply With Quote #1085

For the powerful knife, just try below:
Code:
#include <amxmodx>
#include <engine>
#include <zombieplague>
#include <hamsandwich>
#include <fakemeta>
#include <cstrike>
#include <fun>

new Float:g_Leap[33]

new iHumanS[33]
new g_JumpCount[33], g_Right[33]
new g_iLight, g_iSmo
new g_iSpecial
new g_iFrag, g_iAPBonus, g_iJump, g_iLeapForce, g_iLeapHeight, g_iLeapCooldown, g_iHealth, g_iArmor
new g_iMaxPlayers

public plugin_init()
{
    register_plugin( "[ZP] Human Class: Special", "0.1", "zmd94" );
    
    register_clcmd("chooseteam", "clcmd_changeteam")
    
    g_iSpecial = zp_register_extra_item("Special Human", 30, ZP_TEAM_HUMAN) 
    
    register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
    
    RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
    RegisterHam(Ham_Killed, "player", "fw_PlayerKilled", 1)
    RegisterHam(Ham_Player_Jump, "player", "fw_PlayerJump", 0)
    RegisterHam(Ham_Touch, "weaponbox", "fw_TouchWeapon")
    RegisterHam(Ham_Touch, "armoury_entity", "fw_TouchWeapon")
    RegisterHam(Ham_Touch, "weapon_shield", "fw_TouchWeapon")
    
    register_forward(FM_CmdStart, "fw_Start")
    register_forward(FM_PlayerPreThink, "fw_PlayerPreThink")
    
    g_iAPBonus = register_cvar("zp_AP_bonus", "1") // Amount of AP bonus
    g_iFrag = register_cvar("zp_frag_bonus", "1") // Amount of frag bonus
    g_iHealth = register_cvar("zp_health_bonus", "150") // Amount of health bonus
    g_iArmor = register_cvar("zp_armor_bonus", "50") // Amount of armor bonus
    g_iJump = register_cvar("zp_multi_jump_amount", "3") // Amount of multi-jump given
    g_iLeapForce = register_cvar("zp_leap_force", "500") // Amount of leap force
    g_iLeapHeight = register_cvar("zp_leap_height", "300") // Amount of leap height
    g_iLeapCooldown = register_cvar("zp_leap_cooldown", "10.0") // Amount of leap cooldown
    
    g_iMaxPlayers = get_maxplayers()
}

public plugin_precache()
{
    g_iLight = precache_model( "sprites/lgtning.spr" );
    g_iSmo = precache_model( "sprites/steam1.spr" );
}

public clcmd_changeteam(id)
{
    if(is_user_alive(id) && iHumanS[id])
    {
        client_print(id, print_chat, "[ZP] The menu is disabled!")
        return PLUGIN_HANDLED
    }
    return PLUGIN_CONTINUE
}

public event_round_start()
{
    for (new id = 1; id <= g_iMaxPlayers; id++)
    {
        iHumanS[id] = false
    }
}

public fw_Start(id) 
{
    if(!is_user_alive(id) || !iHumanS[id]) 
        return

    if( pev(id, pev_button) & IN_ATTACK2) 
    {
        g_Right[id] = true
    }
}

public fw_PlayerPreThink(id)
{
    if (!is_user_alive(id) || !iHumanS[id])
        return FMRES_IGNORED

    if (allowed_Leap(id))
    {  
        static Float:velocity[3]
        velocity_by_aim(id, get_pcvar_num(g_iLeapForce), velocity)
        
        velocity[2] = get_pcvar_float(g_iLeapHeight)
        
        set_pev(id, pev_velocity, velocity)

        g_Leap[id] = get_gametime()

    }
    
    return FMRES_IGNORED
}

allowed_Leap(id)
{   
    if (!is_user_alive(id) || !iHumanS[id])
        return false
       
    static buttons
    buttons = pev(id, pev_button)
    
     if (!(pev(id, pev_flags) & FL_ONGROUND) || fm_get_speed(id) < 20  || !(buttons & IN_JUMP) || !(buttons & IN_DUCK))
        return false

    if (get_gametime() - g_Leap[id] < get_pcvar_float(g_iLeapCooldown))
        return false
        
    return true
}

public zp_extra_item_selected(id, itemid)
{
    if (itemid == g_iSpecial)
    {
        set_user_health(id, get_user_health(id) + get_pcvar_num(g_iHealth))
        set_user_armor(id, get_user_armor(id) + get_pcvar_num(g_iArmor))
        
        client_print(id, print_chat, "[ZP] You are now Special Human!")
        iHumanS[id] = true
    }
}

public zp_user_infected_post(id, infector)
{
    if (is_user_alive(id) && iHumanS[id])
    {
        iHumanS[id] = false
    }
}

public fw_PlayerJump(id) 
{
    if(is_user_alive(id) && iHumanS[id])
    {
        new Flags = pev(id, pev_flags)
        
        if( Flags & FL_WATERJUMP || pev(id, pev_waterlevel) >= 2 || !(get_pdata_int(id, 246) & IN_JUMP) )
        {
            return HAM_IGNORED
        }
        if(Flags & FL_ONGROUND) 
        {
            g_JumpCount[id] = 0
            return HAM_IGNORED
        }
        if(get_pcvar_num(g_iJump)) 
        {
            if( get_pdata_float(id, 251) < 500 && ++g_JumpCount[id] <= get_pcvar_num(g_iJump)) 
            {
                new Float:fVelocity[3]
                pev(id, pev_velocity, fVelocity)
                fVelocity[2] = 268.328157
                set_pev(id, pev_velocity, fVelocity)
                
                return HAM_HANDLED
            }
        }
    }
    return HAM_IGNORED
}

public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type)
{
    if (!is_user_alive(attacker) || victim == attacker)
        return
    
    if (!zp_get_user_zombie(attacker) && iHumanS[attacker])
    {
        if(get_user_weapon(attacker) == CSW_KNIFE)
        {
            if(zp_get_user_zombie(victim))
            {
                new vorigin[ 3 ], pos[ 3 ];
                get_user_origin( victim, vorigin );
                vorigin[ 2 ] -= 26;
                pos[ 0 ] = vorigin[ 0 ] + 150;
                pos[ 1 ] = vorigin[ 1 ] + 150;
                pos[ 2 ] = vorigin[ 2 ] + 800;
                
                user_kill(victim)
                bThunder( pos, vorigin );
                bSmo( vorigin, 10, 10 );
                
                ExecuteHam(Ham_AddPoints, attacker, get_pcvar_num(g_iFrag), true)
            }
        }
    }
}

public fw_PlayerKilled(victim, attacker)  
{
    if (!is_user_alive(attacker) || victim == attacker)
        return
    
    if (!zp_get_user_zombie(attacker) && iHumanS[attacker])
    {
        if(get_user_weapon(attacker) == CSW_KNIFE)
        {
            zp_set_user_ammo_packs(attacker, zp_get_user_ammo_packs(attacker) + get_pcvar_num(g_iAPBonus))
            
        }
    }
}

bThunder( start[ 3 ], end[ 3 ] )
{
    message_begin( MSG_BROADCAST, SVC_TEMPENTITY ); 
    write_byte( TE_BEAMPOINTS ); 
    write_coord( start[ 0 ] ); 
    write_coord( start[ 1 ] ); 
    write_coord( start[ 2 ] ); 
    write_coord( end[ 0 ] ); 
    write_coord( end[ 1 ] ); 
    write_coord( end[ 2 ] ); 
    write_short( g_iLight ); 
    write_byte( 1 );
    write_byte( 5 );
    write_byte( 7 );
    write_byte( 150 );
    write_byte( 30 );
    write_byte( 200 ); 
    write_byte( 200 );
    write_byte( 200 );
    write_byte( 200 );
    write_byte( 200 );
    message_end();

    message_begin( MSG_PVS, SVC_TEMPENTITY, end );
    write_byte( TE_SPARKS );
    write_coord( end[ 0 ]  );
    write_coord( end[ 1 ]);
    write_coord( end[ 2 ] );
    message_end();
}

bSmo( iorigin[ 3 ], scale, framerate )
{
    message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
    write_byte( TE_SMOKE );
    write_coord( iorigin[ 0 ] );
    write_coord( iorigin[ 1 ] );
    write_coord( iorigin[ 2 ] );
    write_short( g_iSmo );
    write_byte( scale );
    write_byte( framerate );
    message_end();
}

stock fm_get_speed(entity)
{
    static Float:velocity[3]
    pev(entity, pev_velocity, velocity)
    
    return floatround(vector_length(velocity))
}
For the ability plugin, just test below code:
Code:
/*    

    //////////////////////////////////////////////////////////////////
    //   OWNER CAN ACTIVE THE SPEED BOOST BY PRESSING [E] BUTTON    //
    //////////////////////////////////////////////////////////////////

    //////////////////////////////////////////////////////////////////
    //                      ADMIN + OWNER                           //
    //                                                              //
    //         JUST say /freehealth TO RECIEVE FREE HEALTH          //
    //          JUST say /freearmor TO RECIEVE FREE ARMOR           //
    //                                                              //
    //////////////////////////////////////////////////////////////////    
        
*/
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <cstrike>
#include <fun>

//////////////////////////////////////////////////////////////////
//                        DEFINE FLAG                           //
//////////////////////////////////////////////////////////////////
#define OWNER_FLAG ADMIN_IMMUNITY
#define ADMIN_FLAG ADMIN_BAN
//////////////////////////////////////////////////////////////////

new g_bRecieveArmor[33], g_bRecieveHP[33]

new cvar_multijump, cvar_health, cvar_armor
new cvar_boost_amount, cvar_boost_duration

const TASK_SPEED_BOOST = 100
#define ID_SPEED_BOOST (taskid - TASK_SPEED_BOOST)

new Ham:Ham_Player_ResetMaxSpeed = Ham_Item_PreFrame

// CS Offsets
#if cellbits == 32
const OFFSET_CLIPAMMO = 51
#else
const OFFSET_CLIPAMMO = 65
#endif
const OFFSET_LINUX_WEAPONS = 4

// Max Clip for weapons
new const MAXCLIP[] = { -1, 13, -1, 10, 1, 7, -1, 30, 30, 1, 30, 20, 25, 30, 35, 25, 12, 20,
            10, 30, 100, 8, 30, 30, 20, 2, 7, 30, 30, -1, 50 }

new g_bAbility[33], g_JumpCount[33]
new g_iMaxPlayers

public plugin_init()
{
    register_plugin("[ZP] Admin Ability", "1.0", "zmd94")
    
    register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
    register_event("CurWeapon", "current_weapon", "be", "1=1")
    register_message(get_user_msgid("CurWeapon"), "message_cur_weapon")
    
    RegisterHam(Ham_Player_Jump, "player", "fw_PlayerJump", 0)
    RegisterHam(Ham_Spawn, "player", "fw_PlayerRespawn", 1)
    RegisterHam(Ham_Player_ResetMaxSpeed, "player", "fw_ResetMaxSpeed_Post", 1)
    RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")
    
    register_forward(FM_CmdStart, "fw_Start")
    
    cvar_multijump = register_cvar("aa_multijump_amount", "2") // Amount of multi-jump given
    cvar_health = register_cvar("aa_health_amount", "100") // Amount of health given
    cvar_armor = register_cvar("aa_armor_amount", "50") // Amount of armor given
    cvar_boost_amount = register_cvar("aa_boost_amount", "100.0") // Amount of speed boost
    cvar_ability_duration = register_cvar("aa_ability_duration", "30.0") // Duration of all abilities
    
    g_iMaxPlayers = get_maxplayers()
}

public current_weapon(id)
{
    if(g_bAbility[id])
    {
        new iWeapon = get_user_weapon(id) 
        if(iWeapon == CSW_HEGRENADE)
        {
            give_item(id, "weapon_hegrenade")
            cs_set_user_bpammo(id, CSW_HEGRENADE, 245)
        }
        
        if(iWeapon == CSW_HEGRENADE)
        {
            give_item( id, "weapon_flashbang" )
            cs_set_user_bpammo(id, CSW_FLASHBANG, 245)
        }
        
        if(iWeapon == CSW_HEGRENADE)
        {
            give_item( id, "weapon_smokegrenade" )
            cs_set_user_bpammo(id, CSW_SMOKEGRENADE, 245)
        }    
    }
}

public fw_Start(id) 
{
    if(is_user_alive(id) && get_user_flags(id) & OWNER_FLAG) 
    {
        if( pev(id, pev_button) & IN_USE) 
        {
            if(g_bAbility[id])
            {
                set_hudmessage(random_num(10,255), random(256), random(256), -1.0, 0.20, 0, 6.0, 12.0, 0.0, 0.0, -1)
                show_hudmessage(id, "You already use this ability for this round. Just wait until next round!")
            }
            else
            {
                // Player frozen (or CS freezetime)
                if (pev(id, pev_maxspeed) <= 1)
                {
                    set_hudmessage(random_num(10,255), random(256), random(256), -1.0, 0.20, 0, 6.0, 12.0, 0.0, 0.0, -1)
                    show_hudmessage(id, "You can't use this ability when frozen!")
                    return PLUGIN_HANDLED;
                }
                
                g_bAbility[id] = true
                
                set_user_health(id, get_user_health(id) + get_pcvar_num(cvar_health))
                set_user_armor(id, get_user_armor(id) + get_pcvar_num(cvar_armor))
                
                set_hudmessage(random_num(10,255), random(256), random(256), -1.0, 0.20, 0, 6.0, 12.0, 0.0, 0.0, -1)
                show_hudmessage(id, "Speed boost enabled!")
                
                // Set the restore speed task
                set_task(get_pcvar_float(cvar_ability_duration), "restore_maxspeed", id + TASK_SPEED_BOOST)
                
                // Update player's maxspeed
                ExecuteHamB(Ham_Player_ResetMaxSpeed, id)
            }
        }
    }
    
    return PLUGIN_CONTINUE;
}

public restore_maxspeed(taskid)
{
    // Disable speed boost
    g_bAbility[ID_SPEED_BOOST] = false
    
    set_hudmessage(random_num(10,255), random(256), random(256), -1.0, 0.20, 0, 6.0, 12.0, 0.0, 0.0, -1)
    show_hudmessage(ID_SPEED_BOOST, "Speed boost is over!")

    // Update player's maxspeed
    ExecuteHamB(Ham_Player_ResetMaxSpeed, ID_SPEED_BOOST)
}

public fw_PlayerKilled(victim)
{
    g_bAbility[victim] = false
    remove_task(victim + TASK_SPEED_BOOST)
}

public client_disconnect(id)
{
    g_bAbility[id] = false
    remove_task(id + TASK_SPEED_BOOST)
}

// Remove speed boost at round start
public event_round_start()
{
    for (new id = 1; id <= g_iMaxPlayers; id++)
    {
        g_bAbility[id] = false
        remove_task(id + TASK_SPEED_BOOST)
    }
}

public fw_ResetMaxSpeed_Post(id)
{
    if (!is_user_alive(id) || !g_bAbility[id])
        return;
    
    // Apply speed boost
    new Float:current_maxspeed
    pev(id, pev_maxspeed, current_maxspeed)
    set_pev(id, pev_maxspeed, current_maxspeed + get_pcvar_float(cvar_boost_amount))
}

public fw_PlayerJump( id ) 
{    
    if( is_user_alive(id) && get_user_flags(id) & ADMIN_FLAG && g_bAbility[id])    
    {    
        new Flags = pev( id, pev_flags )
        
        if( Flags & FL_WATERJUMP || pev(id, pev_waterlevel) >= 2 || !(get_pdata_int(id, 246) & IN_JUMP) )
        {
            return HAM_IGNORED
        }
        
        if( Flags & FL_ONGROUND ) 
        {
            g_JumpCount[ id ] = 0
            return HAM_IGNORED
        }
        new Multi = get_pcvar_num(cvar_multijump)
        if( Multi ) 
        {
            if( get_pdata_float(id, 251) < 500 && ++ g_JumpCount[id] <= Multi ) 
            {
                new Float:fVelocity[ 3 ]
                pev( id, pev_velocity, fVelocity )
                fVelocity[ 2 ] = 268.328157
                set_pev( id, pev_velocity, fVelocity )

                return HAM_HANDLED
            }
        }
    }
    return HAM_IGNORED
}

public message_cur_weapon(msg_id, msg_dest, msg_entity)
{
    // Player doesn't have the unlimited clip upgrade
    if (!g_bAbility[msg_entity])
        return;
    
    // Player not alive or not an active weapon
    if (!is_user_alive(msg_entity) || get_msg_arg_int(1) != 1)
        return;
    
    static weapon, clip
    weapon = get_msg_arg_int(2) // get weapon ID
    clip = get_msg_arg_int(3) // get weapon clip
    
    // Unlimited Clip Ammo
    if (MAXCLIP[weapon] > 1) // skip grenades
    {
        set_msg_arg_int(3, get_msg_argtype(3), MAXCLIP[weapon]) // HUD should show full clip all the time
        
        if (clip < 2) // refill when clip is nearly empty
        {
            // Get the weapon entity
            static wname[32], weapon_ent
            get_weaponname(weapon, wname, sizeof wname - 1)
            weapon_ent = fm_find_ent_by_owner(-1, wname, msg_entity)
            
            // Set max clip on weapon
            fm_set_weapon_ammo(weapon_ent, MAXCLIP[weapon])
        }
    }
}

// Find entity by its owner (from fakemeta_util)
stock fm_find_ent_by_owner(entity, const classname[], owner)
{
     while ((entity = engfunc(EngFunc_FindEntityByString, entity,  "classname", classname)) && pev(entity, pev_owner) != owner) {}
    
    return entity;
}

// Set Weapon Clip Ammo
stock fm_set_weapon_ammo(entity, amount)
{
    set_pdata_int(entity, OFFSET_CLIPAMMO, amount, OFFSET_LINUX_WEAPONS);
}
zmd94 is offline
New and Clueless
Senior Member
Join Date: Dec 2015
Old 01-13-2016 , 08:10   Re: [T] List of Modified + Requested Plugins
Reply With Quote #1086

Quote:
Originally Posted by zmd94 View Post
For the powerful knife, just try below:
Code:
#include <amxmodx>
#include <engine>
#include <zombieplague>
#include <hamsandwich>
#include <fakemeta>
#include <cstrike>
#include <fun>

new Float:g_Leap[33]

new iHumanS[33]
new g_JumpCount[33], g_Right[33]
new g_iLight, g_iSmo
new g_iSpecial
new g_iFrag, g_iAPBonus, g_iJump, g_iLeapForce, g_iLeapHeight, g_iLeapCooldown, g_iHealth, g_iArmor
new g_iMaxPlayers

public plugin_init()
{
    register_plugin( "[ZP] Human Class: Special", "0.1", "zmd94" );
    
    register_clcmd("chooseteam", "clcmd_changeteam")
    
    g_iSpecial = zp_register_extra_item("Special Human", 30, ZP_TEAM_HUMAN) 
    
    register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
    
    RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
    RegisterHam(Ham_Killed, "player", "fw_PlayerKilled", 1)
    RegisterHam(Ham_Player_Jump, "player", "fw_PlayerJump", 0)
    RegisterHam(Ham_Touch, "weaponbox", "fw_TouchWeapon")
    RegisterHam(Ham_Touch, "armoury_entity", "fw_TouchWeapon")
    RegisterHam(Ham_Touch, "weapon_shield", "fw_TouchWeapon")
    
    register_forward(FM_CmdStart, "fw_Start")
    register_forward(FM_PlayerPreThink, "fw_PlayerPreThink")
    
    g_iAPBonus = register_cvar("zp_AP_bonus", "1") // Amount of AP bonus
    g_iFrag = register_cvar("zp_frag_bonus", "1") // Amount of frag bonus
    g_iHealth = register_cvar("zp_health_bonus", "150") // Amount of health bonus
    g_iArmor = register_cvar("zp_armor_bonus", "50") // Amount of armor bonus
    g_iJump = register_cvar("zp_multi_jump_amount", "3") // Amount of multi-jump given
    g_iLeapForce = register_cvar("zp_leap_force", "500") // Amount of leap force
    g_iLeapHeight = register_cvar("zp_leap_height", "300") // Amount of leap height
    g_iLeapCooldown = register_cvar("zp_leap_cooldown", "10.0") // Amount of leap cooldown
    
    g_iMaxPlayers = get_maxplayers()
}

public plugin_precache()
{
    g_iLight = precache_model( "sprites/lgtning.spr" );
    g_iSmo = precache_model( "sprites/steam1.spr" );
}

public clcmd_changeteam(id)
{
    if(is_user_alive(id) && iHumanS[id])
    {
        client_print(id, print_chat, "[ZP] The menu is disabled!")
        return PLUGIN_HANDLED
    }
    return PLUGIN_CONTINUE
}

public event_round_start()
{
    for (new id = 1; id <= g_iMaxPlayers; id++)
    {
        iHumanS[id] = false
    }
}

public fw_Start(id) 
{
    if(!is_user_alive(id) || !iHumanS[id]) 
        return

    if( pev(id, pev_button) & IN_ATTACK2) 
    {
        g_Right[id] = true
    }
}

public fw_PlayerPreThink(id)
{
    if (!is_user_alive(id) || !iHumanS[id])
        return FMRES_IGNORED

    if (allowed_Leap(id))
    {  
        static Float:velocity[3]
        velocity_by_aim(id, get_pcvar_num(g_iLeapForce), velocity)
        
        velocity[2] = get_pcvar_float(g_iLeapHeight)
        
        set_pev(id, pev_velocity, velocity)

        g_Leap[id] = get_gametime()

    }
    
    return FMRES_IGNORED
}

allowed_Leap(id)
{   
    if (!is_user_alive(id) || !iHumanS[id])
        return false
       
    static buttons
    buttons = pev(id, pev_button)
    
     if (!(pev(id, pev_flags) & FL_ONGROUND) || fm_get_speed(id) < 20  || !(buttons & IN_JUMP) || !(buttons & IN_DUCK))
        return false

    if (get_gametime() - g_Leap[id] < get_pcvar_float(g_iLeapCooldown))
        return false
        
    return true
}

public zp_extra_item_selected(id, itemid)
{
    if (itemid == g_iSpecial)
    {
        set_user_health(id, get_user_health(id) + get_pcvar_num(g_iHealth))
        set_user_armor(id, get_user_armor(id) + get_pcvar_num(g_iArmor))
        
        client_print(id, print_chat, "[ZP] You are now Special Human!")
        iHumanS[id] = true
    }
}

public zp_user_infected_post(id, infector)
{
    if (is_user_alive(id) && iHumanS[id])
    {
        iHumanS[id] = false
    }
}

public fw_PlayerJump(id) 
{
    if(is_user_alive(id) && iHumanS[id])
    {
        new Flags = pev(id, pev_flags)
        
        if( Flags & FL_WATERJUMP || pev(id, pev_waterlevel) >= 2 || !(get_pdata_int(id, 246) & IN_JUMP) )
        {
            return HAM_IGNORED
        }
        if(Flags & FL_ONGROUND) 
        {
            g_JumpCount[id] = 0
            return HAM_IGNORED
        }
        if(get_pcvar_num(g_iJump)) 
        {
            if( get_pdata_float(id, 251) < 500 && ++g_JumpCount[id] <= get_pcvar_num(g_iJump)) 
            {
                new Float:fVelocity[3]
                pev(id, pev_velocity, fVelocity)
                fVelocity[2] = 268.328157
                set_pev(id, pev_velocity, fVelocity)
                
                return HAM_HANDLED
            }
        }
    }
    return HAM_IGNORED
}

public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type)
{
    if (!is_user_alive(attacker) || victim == attacker)
        return
    
    if (!zp_get_user_zombie(attacker) && iHumanS[attacker])
    {
        if(get_user_weapon(attacker) == CSW_KNIFE)
        {
            if(zp_get_user_zombie(victim))
            {
                new vorigin[ 3 ], pos[ 3 ];
                get_user_origin( victim, vorigin );
                vorigin[ 2 ] -= 26;
                pos[ 0 ] = vorigin[ 0 ] + 150;
                pos[ 1 ] = vorigin[ 1 ] + 150;
                pos[ 2 ] = vorigin[ 2 ] + 800;
                
                user_kill(victim)
                bThunder( pos, vorigin );
                bSmo( vorigin, 10, 10 );
                
                ExecuteHam(Ham_AddPoints, attacker, get_pcvar_num(g_iFrag), true)
            }
        }
    }
}

public fw_PlayerKilled(victim, attacker)  
{
    if (!is_user_alive(attacker) || victim == attacker)
        return
    
    if (!zp_get_user_zombie(attacker) && iHumanS[attacker])
    {
        if(get_user_weapon(attacker) == CSW_KNIFE)
        {
            zp_set_user_ammo_packs(attacker, zp_get_user_ammo_packs(attacker) + get_pcvar_num(g_iAPBonus))
            
        }
    }
}

bThunder( start[ 3 ], end[ 3 ] )
{
    message_begin( MSG_BROADCAST, SVC_TEMPENTITY ); 
    write_byte( TE_BEAMPOINTS ); 
    write_coord( start[ 0 ] ); 
    write_coord( start[ 1 ] ); 
    write_coord( start[ 2 ] ); 
    write_coord( end[ 0 ] ); 
    write_coord( end[ 1 ] ); 
    write_coord( end[ 2 ] ); 
    write_short( g_iLight ); 
    write_byte( 1 );
    write_byte( 5 );
    write_byte( 7 );
    write_byte( 150 );
    write_byte( 30 );
    write_byte( 200 ); 
    write_byte( 200 );
    write_byte( 200 );
    write_byte( 200 );
    write_byte( 200 );
    message_end();

    message_begin( MSG_PVS, SVC_TEMPENTITY, end );
    write_byte( TE_SPARKS );
    write_coord( end[ 0 ]  );
    write_coord( end[ 1 ]);
    write_coord( end[ 2 ] );
    message_end();
}

bSmo( iorigin[ 3 ], scale, framerate )
{
    message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
    write_byte( TE_SMOKE );
    write_coord( iorigin[ 0 ] );
    write_coord( iorigin[ 1 ] );
    write_coord( iorigin[ 2 ] );
    write_short( g_iSmo );
    write_byte( scale );
    write_byte( framerate );
    message_end();
}

stock fm_get_speed(entity)
{
    static Float:velocity[3]
    pev(entity, pev_velocity, velocity)
    
    return floatround(vector_length(velocity))
}
For the ability plugin, just test below code:
Code:
/*    

    //////////////////////////////////////////////////////////////////
    //   OWNER CAN ACTIVE THE SPEED BOOST BY PRESSING [E] BUTTON    //
    //////////////////////////////////////////////////////////////////

    //////////////////////////////////////////////////////////////////
    //                      ADMIN + OWNER                           //
    //                                                              //
    //         JUST say /freehealth TO RECIEVE FREE HEALTH          //
    //          JUST say /freearmor TO RECIEVE FREE ARMOR           //
    //                                                              //
    //////////////////////////////////////////////////////////////////    
        
*/
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <cstrike>
#include <fun>

//////////////////////////////////////////////////////////////////
//                        DEFINE FLAG                           //
//////////////////////////////////////////////////////////////////
#define OWNER_FLAG ADMIN_IMMUNITY
#define ADMIN_FLAG ADMIN_BAN
//////////////////////////////////////////////////////////////////

new g_bRecieveArmor[33], g_bRecieveHP[33]

new cvar_multijump, cvar_health, cvar_armor
new cvar_boost_amount, cvar_boost_duration

const TASK_SPEED_BOOST = 100
#define ID_SPEED_BOOST (taskid - TASK_SPEED_BOOST)

new Ham:Ham_Player_ResetMaxSpeed = Ham_Item_PreFrame

// CS Offsets
#if cellbits == 32
const OFFSET_CLIPAMMO = 51
#else
const OFFSET_CLIPAMMO = 65
#endif
const OFFSET_LINUX_WEAPONS = 4

// Max Clip for weapons
new const MAXCLIP[] = { -1, 13, -1, 10, 1, 7, -1, 30, 30, 1, 30, 20, 25, 30, 35, 25, 12, 20,
            10, 30, 100, 8, 30, 30, 20, 2, 7, 30, 30, -1, 50 }

new g_bAbility[33], g_JumpCount[33]
new g_iMaxPlayers

public plugin_init()
{
    register_plugin("[ZP] Admin Ability", "1.0", "zmd94")
    
    register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
    register_event("CurWeapon", "current_weapon", "be", "1=1")
    register_message(get_user_msgid("CurWeapon"), "message_cur_weapon")
    
    RegisterHam(Ham_Player_Jump, "player", "fw_PlayerJump", 0)
    RegisterHam(Ham_Spawn, "player", "fw_PlayerRespawn", 1)
    RegisterHam(Ham_Player_ResetMaxSpeed, "player", "fw_ResetMaxSpeed_Post", 1)
    RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")
    
    register_forward(FM_CmdStart, "fw_Start")
    
    cvar_multijump = register_cvar("aa_multijump_amount", "2") // Amount of multi-jump given
    cvar_health = register_cvar("aa_health_amount", "100") // Amount of health given
    cvar_armor = register_cvar("aa_armor_amount", "50") // Amount of armor given
    cvar_boost_amount = register_cvar("aa_boost_amount", "100.0") // Amount of speed boost
    cvar_ability_duration = register_cvar("aa_ability_duration", "30.0") // Duration of all abilities
    
    g_iMaxPlayers = get_maxplayers()
}

public current_weapon(id)
{
    if(g_bAbility[id])
    {
        new iWeapon = get_user_weapon(id) 
        if(iWeapon == CSW_HEGRENADE)
        {
            give_item(id, "weapon_hegrenade")
            cs_set_user_bpammo(id, CSW_HEGRENADE, 245)
        }
        
        if(iWeapon == CSW_HEGRENADE)
        {
            give_item( id, "weapon_flashbang" )
            cs_set_user_bpammo(id, CSW_FLASHBANG, 245)
        }
        
        if(iWeapon == CSW_HEGRENADE)
        {
            give_item( id, "weapon_smokegrenade" )
            cs_set_user_bpammo(id, CSW_SMOKEGRENADE, 245)
        }    
    }
}

public fw_Start(id) 
{
    if(is_user_alive(id) && get_user_flags(id) & OWNER_FLAG) 
    {
        if( pev(id, pev_button) & IN_USE) 
        {
            if(g_bAbility[id])
            {
                set_hudmessage(random_num(10,255), random(256), random(256), -1.0, 0.20, 0, 6.0, 12.0, 0.0, 0.0, -1)
                show_hudmessage(id, "You already use this ability for this round. Just wait until next round!")
            }
            else
            {
                // Player frozen (or CS freezetime)
                if (pev(id, pev_maxspeed) <= 1)
                {
                    set_hudmessage(random_num(10,255), random(256), random(256), -1.0, 0.20, 0, 6.0, 12.0, 0.0, 0.0, -1)
                    show_hudmessage(id, "You can't use this ability when frozen!")
                    return PLUGIN_HANDLED;
                }
                
                g_bAbility[id] = true
                
                set_user_health(id, get_user_health(id) + get_pcvar_num(cvar_health))
                set_user_armor(id, get_user_armor(id) + get_pcvar_num(cvar_armor))
                
                set_hudmessage(random_num(10,255), random(256), random(256), -1.0, 0.20, 0, 6.0, 12.0, 0.0, 0.0, -1)
                show_hudmessage(id, "Speed boost enabled!")
                
                // Set the restore speed task
                set_task(get_pcvar_float(cvar_ability_duration), "restore_maxspeed", id + TASK_SPEED_BOOST)
                
                // Update player's maxspeed
                ExecuteHamB(Ham_Player_ResetMaxSpeed, id)
            }
        }
    }
    
    return PLUGIN_CONTINUE;
}

public restore_maxspeed(taskid)
{
    // Disable speed boost
    g_bAbility[ID_SPEED_BOOST] = false
    
    set_hudmessage(random_num(10,255), random(256), random(256), -1.0, 0.20, 0, 6.0, 12.0, 0.0, 0.0, -1)
    show_hudmessage(ID_SPEED_BOOST, "Speed boost is over!")

    // Update player's maxspeed
    ExecuteHamB(Ham_Player_ResetMaxSpeed, ID_SPEED_BOOST)
}

public fw_PlayerKilled(victim)
{
    g_bAbility[victim] = false
    remove_task(victim + TASK_SPEED_BOOST)
}

public client_disconnect(id)
{
    g_bAbility[id] = false
    remove_task(id + TASK_SPEED_BOOST)
}

// Remove speed boost at round start
public event_round_start()
{
    for (new id = 1; id <= g_iMaxPlayers; id++)
    {
        g_bAbility[id] = false
        remove_task(id + TASK_SPEED_BOOST)
    }
}

public fw_ResetMaxSpeed_Post(id)
{
    if (!is_user_alive(id) || !g_bAbility[id])
        return;
    
    // Apply speed boost
    new Float:current_maxspeed
    pev(id, pev_maxspeed, current_maxspeed)
    set_pev(id, pev_maxspeed, current_maxspeed + get_pcvar_float(cvar_boost_amount))
}

public fw_PlayerJump( id ) 
{    
    if( is_user_alive(id) && get_user_flags(id) & ADMIN_FLAG && g_bAbility[id])    
    {    
        new Flags = pev( id, pev_flags )
        
        if( Flags & FL_WATERJUMP || pev(id, pev_waterlevel) >= 2 || !(get_pdata_int(id, 246) & IN_JUMP) )
        {
            return HAM_IGNORED
        }
        
        if( Flags & FL_ONGROUND ) 
        {
            g_JumpCount[ id ] = 0
            return HAM_IGNORED
        }
        new Multi = get_pcvar_num(cvar_multijump)
        if( Multi ) 
        {
            if( get_pdata_float(id, 251) < 500 && ++ g_JumpCount[id] <= Multi ) 
            {
                new Float:fVelocity[ 3 ]
                pev( id, pev_velocity, fVelocity )
                fVelocity[ 2 ] = 268.328157
                set_pev( id, pev_velocity, fVelocity )

                return HAM_HANDLED
            }
        }
    }
    return HAM_IGNORED
}

public message_cur_weapon(msg_id, msg_dest, msg_entity)
{
    // Player doesn't have the unlimited clip upgrade
    if (!g_bAbility[msg_entity])
        return;
    
    // Player not alive or not an active weapon
    if (!is_user_alive(msg_entity) || get_msg_arg_int(1) != 1)
        return;
    
    static weapon, clip
    weapon = get_msg_arg_int(2) // get weapon ID
    clip = get_msg_arg_int(3) // get weapon clip
    
    // Unlimited Clip Ammo
    if (MAXCLIP[weapon] > 1) // skip grenades
    {
        set_msg_arg_int(3, get_msg_argtype(3), MAXCLIP[weapon]) // HUD should show full clip all the time
        
        if (clip < 2) // refill when clip is nearly empty
        {
            // Get the weapon entity
            static wname[32], weapon_ent
            get_weaponname(weapon, wname, sizeof wname - 1)
            weapon_ent = fm_find_ent_by_owner(-1, wname, msg_entity)
            
            // Set max clip on weapon
            fm_set_weapon_ammo(weapon_ent, MAXCLIP[weapon])
        }
    }
}

// Find entity by its owner (from fakemeta_util)
stock fm_find_ent_by_owner(entity, const classname[], owner)
{
     while ((entity = engfunc(EngFunc_FindEntityByString, entity,  "classname", classname)) && pev(entity, pev_owner) != owner) {}
    
    return entity;
}

// Set Weapon Clip Ammo
stock fm_set_weapon_ammo(entity, amount)
{
    set_pdata_int(entity, OFFSET_CLIPAMMO, amount, OFFSET_LINUX_WEAPONS);
}
okay so for special human or powerful knife the plugin didnt even work, when i buy it from extra item menu it only takes my ammo packs and doesn't do anything, and for admin ability i didnt get any armor or hp at first, but after like 5 seconds when everybody can move i got the armor and hp without pressing/using [E] and also unlimited clip, when i press [E] i get movement speed and message "can only use this one time per round" but i could still keep using it

edit: i am also buying a script for class limiter for zp43 if you are up for the job, one like this where it shows on the side how many you can pick: https://forums.alliedmods.net/showth...66027?t=166027

edit: if you dont understand what i mean by the admin ability, i didnt get any hp and armor at the start when round start, but after 5 sec when everybody can move i got the hp and armor and unlimited clip automatic without using the ability

edit: from one of the plugins (i think the powerful knife one) some of my zombies classes were invisible
__________________

ANY SCRIPTER ON THIS FORUM HAS FREE VIP/ADMIN IN MY SERVER!

Last edited by New and Clueless; 01-13-2016 at 08:22.
New and Clueless is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 01-14-2016 , 05:45   Re: [T] List of Modified + Requested Plugins
Reply With Quote #1087

For Special Human plugin, do you get below mesage when bought it?
Quote:
[ZP] You are now Special Human!
Next, just try below code for the admin ability:
Code:
*/
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <cstrike>
#include <fun>

//////////////////////////////////////////////////////////////////
//                        DEFINE FLAG                           //
//////////////////////////////////////////////////////////////////
#define OWNER_FLAG ADMIN_IMMUNITY
#define ADMIN_FLAG ADMIN_BAN
//////////////////////////////////////////////////////////////////

new g_bRecieveArmor[33], g_bRecieveHP[33]

new cvar_multijump, cvar_health, cvar_armor
new cvar_boost_amount, cvar_boost_duration

const TASK_SPEED_BOOST = 100
#define ID_SPEED_BOOST (taskid - TASK_SPEED_BOOST)

new Ham:Ham_Player_ResetMaxSpeed = Ham_Item_PreFrame

// CS Offsets
#if cellbits == 32
const OFFSET_CLIPAMMO = 51
#else
const OFFSET_CLIPAMMO = 65
#endif
const OFFSET_LINUX_WEAPONS = 4

// Max Clip for weapons
new const MAXCLIP[] = { -1, 13, -1, 10, 1, 7, -1, 30, 30, 1, 30, 20, 25, 30, 35, 25, 12, 20,
            10, 30, 100, 8, 30, 30, 20, 2, 7, 30, 30, -1, 50 }

new g_bAbility[33], g_JumpCount[33]
new g_iMaxPlayers

public plugin_init()
{
    register_plugin("[ZP] Admin Ability", "1.0", "zmd94")
    
    register_logevent("round_start", 2, "1=Round_Start")
    
    register_event("CurWeapon", "current_weapon", "be", "1=1")
    register_message(get_user_msgid("CurWeapon"), "message_cur_weapon")
    
    RegisterHam(Ham_Player_Jump, "player", "fw_PlayerJump", 0)
    RegisterHam(Ham_Player_ResetMaxSpeed, "player", "fw_ResetMaxSpeed_Post", 1)
    RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")
    
    register_forward(FM_CmdStart, "fw_Start")
    
    cvar_multijump = register_cvar("aa_multijump_amount", "2") // Amount of multi-jump given
    cvar_health = register_cvar("aa_health_amount", "100") // Amount of health given
    cvar_armor = register_cvar("aa_armor_amount", "50") // Amount of armor given
    cvar_boost_amount = register_cvar("aa_boost_amount", "100.0") // Amount of speed boost
    cvar_ability_duration = register_cvar("aa_ability_duration", "30.0") // Duration of all abilities
    
    g_iMaxPlayers = get_maxplayers()
}

public current_weapon(id)
{
    if(g_bAbility[id])
    {
        new iWeapon = get_user_weapon(id) 
        if(iWeapon == CSW_HEGRENADE)
        {
            give_item(id, "weapon_hegrenade")
            cs_set_user_bpammo(id, CSW_HEGRENADE, 245)
        }
        
        if(iWeapon == CSW_HEGRENADE)
        {
            give_item( id, "weapon_flashbang" )
            cs_set_user_bpammo(id, CSW_FLASHBANG, 245)
        }
        
        if(iWeapon == CSW_HEGRENADE)
        {
            give_item( id, "weapon_smokegrenade" )
            cs_set_user_bpammo(id, CSW_SMOKEGRENADE, 245)
        }    
    }
}

public fw_Start(id) 
{
    if(is_user_alive(id) && get_user_flags(id) & OWNER_FLAG) 
    {
        if( pev(id, pev_button) & IN_USE) 
        {
            if(g_bAbility[id])
            {
                set_hudmessage(random_num(10,255), random(256), random(256), -1.0, 0.20, 0, 6.0, 12.0, 0.0, 0.0, -1)
                show_hudmessage(id, "You already use this ability for this round. Just wait until next round!")
            }
            else
            {
                // Player frozen (or CS freezetime)
                if (pev(id, pev_maxspeed) <= 1)
                {
                    set_hudmessage(random_num(10,255), random(256), random(256), -1.0, 0.20, 0, 6.0, 12.0, 0.0, 0.0, -1)
                    show_hudmessage(id, "You can't use this ability when frozen!")
                    return PLUGIN_HANDLED;
                }
                
                g_bAbility[id] = true
                
                set_user_health(id, get_user_health(id) + get_pcvar_num(cvar_health))
                set_user_armor(id, get_user_armor(id) + get_pcvar_num(cvar_armor))
                
                set_hudmessage(random_num(10,255), random(256), random(256), -1.0, 0.20, 0, 6.0, 12.0, 0.0, 0.0, -1)
                show_hudmessage(id, "Speed boost enabled!")
                
                // Set the restore speed task
                set_task(get_pcvar_float(cvar_ability_duration), "restore_maxspeed", id + TASK_SPEED_BOOST)
                
                // Update player's maxspeed
                ExecuteHamB(Ham_Player_ResetMaxSpeed, id)
            }
        }
    }
    
    return PLUGIN_CONTINUE;
}

public restore_maxspeed(taskid)
{
    // Disable speed boost
    g_bAbility[ID_SPEED_BOOST] = false
    
    set_hudmessage(random_num(10,255), random(256), random(256), -1.0, 0.20, 0, 6.0, 12.0, 0.0, 0.0, -1)
    show_hudmessage(ID_SPEED_BOOST, "Speed boost is over!")

    // Update player's maxspeed
    ExecuteHamB(Ham_Player_ResetMaxSpeed, ID_SPEED_BOOST)
}

public fw_PlayerKilled(victim)
{
    g_bAbility[victim] = false
    remove_task(victim + TASK_SPEED_BOOST)
}

public client_disconnect(id)
{
    g_bAbility[id] = false
    remove_task(id + TASK_SPEED_BOOST)
}

public round_start()
{
    new iPlayers[32], iPlayerCount, i, id
    
    get_players(iPlayers, iPlayerCount, "a") 
    for(i = 0; i < iPlayerCount; i++)
    {
        id = iPlayers[i]
        
        g_bAbility[id] = false
        remove_task(id + TASK_SPEED_BOOST)
    }
}

public fw_ResetMaxSpeed_Post(id)
{
    if (!is_user_alive(id) || !g_bAbility[id])
        return;
    
    // Apply speed boost
    new Float:current_maxspeed
    pev(id, pev_maxspeed, current_maxspeed)
    set_pev(id, pev_maxspeed, current_maxspeed + get_pcvar_float(cvar_boost_amount))
}

public fw_PlayerJump( id ) 
{    
    if( is_user_alive(id) && get_user_flags(id) & ADMIN_FLAG && g_bAbility[id])    
    {    
        new Flags = pev( id, pev_flags )
        
        if( Flags & FL_WATERJUMP || pev(id, pev_waterlevel) >= 2 || !(get_pdata_int(id, 246) & IN_JUMP) )
        {
            return HAM_IGNORED
        }
        
        if( Flags & FL_ONGROUND ) 
        {
            g_JumpCount[ id ] = 0
            return HAM_IGNORED
        }
        new Multi = get_pcvar_num(cvar_multijump)
        if( Multi ) 
        {
            if( get_pdata_float(id, 251) < 500 && ++ g_JumpCount[id] <= Multi ) 
            {
                new Float:fVelocity[ 3 ]
                pev( id, pev_velocity, fVelocity )
                fVelocity[ 2 ] = 268.328157
                set_pev( id, pev_velocity, fVelocity )

                return HAM_HANDLED
            }
        }
    }
    return HAM_IGNORED
}

public message_cur_weapon(msg_id, msg_dest, msg_entity)
{
    // Player doesn't have the unlimited clip upgrade
    if (!g_bAbility[msg_entity])
        return;
    
    // Player not alive or not an active weapon
    if (!is_user_alive(msg_entity) || get_msg_arg_int(1) != 1)
        return;
    
    static weapon, clip
    weapon = get_msg_arg_int(2) // get weapon ID
    clip = get_msg_arg_int(3) // get weapon clip
    
    // Unlimited Clip Ammo
    if (MAXCLIP[weapon] > 1) // skip grenades
    {
        set_msg_arg_int(3, get_msg_argtype(3), MAXCLIP[weapon]) // HUD should show full clip all the time
        
        if (clip < 2) // refill when clip is nearly empty
        {
            // Get the weapon entity
            static wname[32], weapon_ent
            get_weaponname(weapon, wname, sizeof wname - 1)
            weapon_ent = fm_find_ent_by_owner(-1, wname, msg_entity)
            
            // Set max clip on weapon
            fm_set_weapon_ammo(weapon_ent, MAXCLIP[weapon])
        }
    }
}

// Find entity by its owner (from fakemeta_util)
stock fm_find_ent_by_owner(entity, const classname[], owner)
{
     while ((entity = engfunc(EngFunc_FindEntityByString, entity,  "classname", classname)) && pev(entity, pev_owner) != owner) {}
    
    return entity;
}

// Set Weapon Clip Ammo
stock fm_set_weapon_ammo(entity, amount)
{
    set_pdata_int(entity, OFFSET_CLIPAMMO, amount, OFFSET_LINUX_WEAPONS);
}
Please take note that when you want to use the ability just press E button once. No need to hold it.
zmd94 is offline
New and Clueless
Senior Member
Join Date: Dec 2015
Old 01-15-2016 , 02:28   Re: [T] List of Modified + Requested Plugins
Reply With Quote #1088

Quote:
Originally Posted by zmd94 View Post
For Special Human plugin, do you get below mesage when bought it?
Next, just try below code for the admin ability:
Code:
*/
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <cstrike>
#include <fun>

//////////////////////////////////////////////////////////////////
//                        DEFINE FLAG                           //
//////////////////////////////////////////////////////////////////
#define OWNER_FLAG ADMIN_IMMUNITY
#define ADMIN_FLAG ADMIN_BAN
//////////////////////////////////////////////////////////////////

new g_bRecieveArmor[33], g_bRecieveHP[33]

new cvar_multijump, cvar_health, cvar_armor
new cvar_boost_amount, cvar_boost_duration

const TASK_SPEED_BOOST = 100
#define ID_SPEED_BOOST (taskid - TASK_SPEED_BOOST)

new Ham:Ham_Player_ResetMaxSpeed = Ham_Item_PreFrame

// CS Offsets
#if cellbits == 32
const OFFSET_CLIPAMMO = 51
#else
const OFFSET_CLIPAMMO = 65
#endif
const OFFSET_LINUX_WEAPONS = 4

// Max Clip for weapons
new const MAXCLIP[] = { -1, 13, -1, 10, 1, 7, -1, 30, 30, 1, 30, 20, 25, 30, 35, 25, 12, 20,
            10, 30, 100, 8, 30, 30, 20, 2, 7, 30, 30, -1, 50 }

new g_bAbility[33], g_JumpCount[33]
new g_iMaxPlayers

public plugin_init()
{
    register_plugin("[ZP] Admin Ability", "1.0", "zmd94")
    
    register_logevent("round_start", 2, "1=Round_Start")
    
    register_event("CurWeapon", "current_weapon", "be", "1=1")
    register_message(get_user_msgid("CurWeapon"), "message_cur_weapon")
    
    RegisterHam(Ham_Player_Jump, "player", "fw_PlayerJump", 0)
    RegisterHam(Ham_Player_ResetMaxSpeed, "player", "fw_ResetMaxSpeed_Post", 1)
    RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")
    
    register_forward(FM_CmdStart, "fw_Start")
    
    cvar_multijump = register_cvar("aa_multijump_amount", "2") // Amount of multi-jump given
    cvar_health = register_cvar("aa_health_amount", "100") // Amount of health given
    cvar_armor = register_cvar("aa_armor_amount", "50") // Amount of armor given
    cvar_boost_amount = register_cvar("aa_boost_amount", "100.0") // Amount of speed boost
    cvar_ability_duration = register_cvar("aa_ability_duration", "30.0") // Duration of all abilities
    
    g_iMaxPlayers = get_maxplayers()
}

public current_weapon(id)
{
    if(g_bAbility[id])
    {
        new iWeapon = get_user_weapon(id) 
        if(iWeapon == CSW_HEGRENADE)
        {
            give_item(id, "weapon_hegrenade")
            cs_set_user_bpammo(id, CSW_HEGRENADE, 245)
        }
        
        if(iWeapon == CSW_HEGRENADE)
        {
            give_item( id, "weapon_flashbang" )
            cs_set_user_bpammo(id, CSW_FLASHBANG, 245)
        }
        
        if(iWeapon == CSW_HEGRENADE)
        {
            give_item( id, "weapon_smokegrenade" )
            cs_set_user_bpammo(id, CSW_SMOKEGRENADE, 245)
        }    
    }
}

public fw_Start(id) 
{
    if(is_user_alive(id) && get_user_flags(id) & OWNER_FLAG) 
    {
        if( pev(id, pev_button) & IN_USE) 
        {
            if(g_bAbility[id])
            {
                set_hudmessage(random_num(10,255), random(256), random(256), -1.0, 0.20, 0, 6.0, 12.0, 0.0, 0.0, -1)
                show_hudmessage(id, "You already use this ability for this round. Just wait until next round!")
            }
            else
            {
                // Player frozen (or CS freezetime)
                if (pev(id, pev_maxspeed) <= 1)
                {
                    set_hudmessage(random_num(10,255), random(256), random(256), -1.0, 0.20, 0, 6.0, 12.0, 0.0, 0.0, -1)
                    show_hudmessage(id, "You can't use this ability when frozen!")
                    return PLUGIN_HANDLED;
                }
                
                g_bAbility[id] = true
                
                set_user_health(id, get_user_health(id) + get_pcvar_num(cvar_health))
                set_user_armor(id, get_user_armor(id) + get_pcvar_num(cvar_armor))
                
                set_hudmessage(random_num(10,255), random(256), random(256), -1.0, 0.20, 0, 6.0, 12.0, 0.0, 0.0, -1)
                show_hudmessage(id, "Speed boost enabled!")
                
                // Set the restore speed task
                set_task(get_pcvar_float(cvar_ability_duration), "restore_maxspeed", id + TASK_SPEED_BOOST)
                
                // Update player's maxspeed
                ExecuteHamB(Ham_Player_ResetMaxSpeed, id)
            }
        }
    }
    
    return PLUGIN_CONTINUE;
}

public restore_maxspeed(taskid)
{
    // Disable speed boost
    g_bAbility[ID_SPEED_BOOST] = false
    
    set_hudmessage(random_num(10,255), random(256), random(256), -1.0, 0.20, 0, 6.0, 12.0, 0.0, 0.0, -1)
    show_hudmessage(ID_SPEED_BOOST, "Speed boost is over!")

    // Update player's maxspeed
    ExecuteHamB(Ham_Player_ResetMaxSpeed, ID_SPEED_BOOST)
}

public fw_PlayerKilled(victim)
{
    g_bAbility[victim] = false
    remove_task(victim + TASK_SPEED_BOOST)
}

public client_disconnect(id)
{
    g_bAbility[id] = false
    remove_task(id + TASK_SPEED_BOOST)
}

public round_start()
{
    new iPlayers[32], iPlayerCount, i, id
    
    get_players(iPlayers, iPlayerCount, "a") 
    for(i = 0; i < iPlayerCount; i++)
    {
        id = iPlayers[i]
        
        g_bAbility[id] = false
        remove_task(id + TASK_SPEED_BOOST)
    }
}

public fw_ResetMaxSpeed_Post(id)
{
    if (!is_user_alive(id) || !g_bAbility[id])
        return;
    
    // Apply speed boost
    new Float:current_maxspeed
    pev(id, pev_maxspeed, current_maxspeed)
    set_pev(id, pev_maxspeed, current_maxspeed + get_pcvar_float(cvar_boost_amount))
}

public fw_PlayerJump( id ) 
{    
    if( is_user_alive(id) && get_user_flags(id) & ADMIN_FLAG && g_bAbility[id])    
    {    
        new Flags = pev( id, pev_flags )
        
        if( Flags & FL_WATERJUMP || pev(id, pev_waterlevel) >= 2 || !(get_pdata_int(id, 246) & IN_JUMP) )
        {
            return HAM_IGNORED
        }
        
        if( Flags & FL_ONGROUND ) 
        {
            g_JumpCount[ id ] = 0
            return HAM_IGNORED
        }
        new Multi = get_pcvar_num(cvar_multijump)
        if( Multi ) 
        {
            if( get_pdata_float(id, 251) < 500 && ++ g_JumpCount[id] <= Multi ) 
            {
                new Float:fVelocity[ 3 ]
                pev( id, pev_velocity, fVelocity )
                fVelocity[ 2 ] = 268.328157
                set_pev( id, pev_velocity, fVelocity )

                return HAM_HANDLED
            }
        }
    }
    return HAM_IGNORED
}

public message_cur_weapon(msg_id, msg_dest, msg_entity)
{
    // Player doesn't have the unlimited clip upgrade
    if (!g_bAbility[msg_entity])
        return;
    
    // Player not alive or not an active weapon
    if (!is_user_alive(msg_entity) || get_msg_arg_int(1) != 1)
        return;
    
    static weapon, clip
    weapon = get_msg_arg_int(2) // get weapon ID
    clip = get_msg_arg_int(3) // get weapon clip
    
    // Unlimited Clip Ammo
    if (MAXCLIP[weapon] > 1) // skip grenades
    {
        set_msg_arg_int(3, get_msg_argtype(3), MAXCLIP[weapon]) // HUD should show full clip all the time
        
        if (clip < 2) // refill when clip is nearly empty
        {
            // Get the weapon entity
            static wname[32], weapon_ent
            get_weaponname(weapon, wname, sizeof wname - 1)
            weapon_ent = fm_find_ent_by_owner(-1, wname, msg_entity)
            
            // Set max clip on weapon
            fm_set_weapon_ammo(weapon_ent, MAXCLIP[weapon])
        }
    }
}

// Find entity by its owner (from fakemeta_util)
stock fm_find_ent_by_owner(entity, const classname[], owner)
{
     while ((entity = engfunc(EngFunc_FindEntityByString, entity,  "classname", classname)) && pev(entity, pev_owner) != owner) {}
    
    return entity;
}

// Set Weapon Clip Ammo
stock fm_set_weapon_ammo(entity, amount)
{
    set_pdata_int(entity, OFFSET_CLIPAMMO, amount, OFFSET_LINUX_WEAPONS);
}
Please take note that when you want to use the ability just press E button once. No need to hold it.
for special human no message, no effect from plugin at all, and for admin ability i cant compile now

Code:
//// zp_zadmin_ability.sma
// C:\Program Files (x86)\Steam\steamapps\common\Half-Life\cstrike\addons\amxmod
x\scripting\zp_zadmin_ability.sma(1) : error 010: invalid function or declaratio
n
// C:\Program Files (x86)\Steam\steamapps\common\Half-Life\cstrike\addons\amxmod
x\scripting\zp_zadmin_ability.sma(59) : error 017: undefined symbol "cvar_abilit
y_duration"
// C:\Program Files (x86)\Steam\steamapps\common\Half-Life\cstrike\addons\amxmod
x\scripting\zp_zadmin_ability.sma(119) : error 017: undefined symbol "cvar_abili
ty_duration"
// C:\Program Files (x86)\Steam\steamapps\common\Half-Life\cstrike\addons\amxmod
x\scripting\zp_zadmin_ability.sma(119 -- 122) : error 001: expected token: ",",
but found "-identifier-"
// C:\Program Files (x86)\Steam\steamapps\common\Half-Life\cstrike\addons\amxmod
x\scripting\zp_zadmin_ability.sma(249) : warning 217: loose indentation
// C:\Program Files (x86)\Steam\steamapps\common\Half-Life\cstrike\addons\amxmod
x\scripting\zp_zadmin_ability.sma(256) : warning 203: symbol is never used: "cva
r_boost_duration"
// C:\Program Files (x86)\Steam\steamapps\common\Half-Life\cstrike\addons\amxmod
x\scripting\zp_zadmin_ability.sma(256) : warning 203: symbol is never used: "g_b
RecieveArmor"
// C:\Program Files (x86)\Steam\steamapps\common\Half-Life\cstrike\addons\amxmod
x\scripting\zp_zadmin_ability.sma(256) : warning 203: symbol is never used: "g_b
RecieveHP"
// C:\Program Files (x86)\Steam\steamapps\common\Half-Life\cstrike\addons\amxmod
x\scripting\zp_zadmin_ability.sma(256) : warning 204: symbol is assigned a value
 that is never used: "g_iMaxPlayers"
//
// 4 Errors.
// Could not locate output file compiled\zp_zadmin_ability.amx (compile failed).

//
// Compilation Time: 0.14 sec
// ----------------------------------------
__________________

ANY SCRIPTER ON THIS FORUM HAS FREE VIP/ADMIN IN MY SERVER!
New and Clueless is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 01-15-2016 , 09:50   Re: [T] List of Modified + Requested Plugins
Reply With Quote #1089

Fixed:
Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <cstrike>
#include <fun>

//////////////////////////////////////////////////////////////////
//                        DEFINE FLAG                           //
//////////////////////////////////////////////////////////////////
#define OWNER_FLAG ADMIN_IMMUNITY
#define ADMIN_FLAG ADMIN_BAN
//////////////////////////////////////////////////////////////////

new g_bRecieveArmor[33], g_bRecieveHP[33]

new cvar_multijump, cvar_health, cvar_armor
new cvar_boost_amount, cvar_boost_duration

const TASK_SPEED_BOOST = 100
#define ID_SPEED_BOOST (taskid - TASK_SPEED_BOOST)

new Ham:Ham_Player_ResetMaxSpeed = Ham_Item_PreFrame

// CS Offsets
#if cellbits == 32
const OFFSET_CLIPAMMO = 51
#else
const OFFSET_CLIPAMMO = 65
#endif
const OFFSET_LINUX_WEAPONS = 4

// Max Clip for weapons
new const MAXCLIP[] = { -1, 13, -1, 10, 1, 7, -1, 30, 30, 1, 30, 20, 25, 30, 35, 25, 12, 20,
            10, 30, 100, 8, 30, 30, 20, 2, 7, 30, 30, -1, 50 }

new g_bAbility[33], g_JumpCount[33]

public plugin_init()
{
    register_plugin("[ZP] Admin Ability", "1.0", "zmd94")
    
    register_logevent("round_start", 2, "1=Round_Start")
    
    register_event("CurWeapon", "current_weapon", "be", "1=1")
    register_message(get_user_msgid("CurWeapon"), "message_cur_weapon")
    
    RegisterHam(Ham_Player_Jump, "player", "fw_PlayerJump", 0)
    RegisterHam(Ham_Player_ResetMaxSpeed, "player", "fw_ResetMaxSpeed_Post", 1)
    RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")
    
    register_forward(FM_CmdStart, "fw_Start")
    
    cvar_multijump = register_cvar("aa_multijump_amount", "2") // Amount of multi-jump given
    cvar_health = register_cvar("aa_health_amount", "100") // Amount of health given
    cvar_armor = register_cvar("aa_armor_amount", "50") // Amount of armor given
    cvar_boost_amount = register_cvar("aa_boost_amount", "100.0") // Amount of speed boost
    cvar_ability_duration = register_cvar("aa_ability_duration", "30.0") // Duration of all abilities
}

public current_weapon(id)
{
    if(g_bAbility[id])
    {
        new iWeapon = get_user_weapon(id) 
        if(iWeapon == CSW_HEGRENADE)
        {
            give_item(id, "weapon_hegrenade")
            cs_set_user_bpammo(id, CSW_HEGRENADE, 245)
        }
        
        if(iWeapon == CSW_HEGRENADE)
        {
            give_item( id, "weapon_flashbang" )
            cs_set_user_bpammo(id, CSW_FLASHBANG, 245)
        }
        
        if(iWeapon == CSW_HEGRENADE)
        {
            give_item( id, "weapon_smokegrenade" )
            cs_set_user_bpammo(id, CSW_SMOKEGRENADE, 245)
        }    
    }
}

public fw_Start(id) 
{
    if(is_user_alive(id) && get_user_flags(id) & OWNER_FLAG) 
    {
        if( pev(id, pev_button) & IN_USE) 
        {
            if(g_bAbility[id])
            {
                set_hudmessage(random_num(10,255), random(256), random(256), -1.0, 0.20, 0, 6.0, 12.0, 0.0, 0.0, -1)
                show_hudmessage(id, "You already use this ability for this round. Just wait until next round!")
            }
            else
            {
                // Player frozen (or CS freezetime)
                if (pev(id, pev_maxspeed) <= 1)
                {
                    set_hudmessage(random_num(10,255), random(256), random(256), -1.0, 0.20, 0, 6.0, 12.0, 0.0, 0.0, -1)
                    show_hudmessage(id, "You can't use this ability when frozen!")
                    return PLUGIN_HANDLED;
                }
                
                g_bAbility[id] = true
                
                set_user_health(id, get_user_health(id) + get_pcvar_num(cvar_health))
                set_user_armor(id, get_user_armor(id) + get_pcvar_num(cvar_armor))
                
                set_hudmessage(random_num(10,255), random(256), random(256), -1.0, 0.20, 0, 6.0, 12.0, 0.0, 0.0, -1)
                show_hudmessage(id, "Speed boost enabled!")
                
                // Set the restore speed task
                set_task(get_pcvar_float(cvar_ability_duration), "restore_maxspeed", id + TASK_SPEED_BOOST)
                
                // Update player's maxspeed
                ExecuteHamB(Ham_Player_ResetMaxSpeed, id)
            }
        }
    }
    
    return PLUGIN_CONTINUE;
}

public restore_maxspeed(taskid)
{
    // Disable speed boost
    g_bAbility[ID_SPEED_BOOST] = false
    
    set_hudmessage(random_num(10,255), random(256), random(256), -1.0, 0.20, 0, 6.0, 12.0, 0.0, 0.0, -1)
    show_hudmessage(ID_SPEED_BOOST, "Speed boost is over!")

    // Update player's maxspeed
    ExecuteHamB(Ham_Player_ResetMaxSpeed, ID_SPEED_BOOST)
}

public fw_PlayerKilled(victim)
{
    g_bAbility[victim] = false
    remove_task(victim + TASK_SPEED_BOOST)
}

public client_disconnect(id)
{
    g_bAbility[id] = false
    remove_task(id + TASK_SPEED_BOOST)
}

public round_start()
{
    new iPlayers[32], iPlayerCount, i, id
    
    get_players(iPlayers, iPlayerCount, "a") 
    for(i = 0; i < iPlayerCount; i++)
    {
        id = iPlayers[i]
        
        g_bAbility[id] = false
        remove_task(id + TASK_SPEED_BOOST)
    }
}

public fw_ResetMaxSpeed_Post(id)
{
    if (!is_user_alive(id) || !g_bAbility[id])
        return;
    
    // Apply speed boost
    new Float:current_maxspeed
    pev(id, pev_maxspeed, current_maxspeed)
    set_pev(id, pev_maxspeed, current_maxspeed + get_pcvar_float(cvar_boost_amount))
}

public fw_PlayerJump( id ) 
{    
    if( is_user_alive(id) && get_user_flags(id) & ADMIN_FLAG && g_bAbility[id])    
    {    
        new Flags = pev( id, pev_flags )
        
        if( Flags & FL_WATERJUMP || pev(id, pev_waterlevel) >= 2 || !(get_pdata_int(id, 246) & IN_JUMP) )
        {
            return HAM_IGNORED
        }
        
        if( Flags & FL_ONGROUND ) 
        {
            g_JumpCount[ id ] = 0
            return HAM_IGNORED
        }
        new Multi = get_pcvar_num(cvar_multijump)
        if( Multi ) 
        {
            if( get_pdata_float(id, 251) < 500 && ++ g_JumpCount[id] <= Multi ) 
            {
                new Float:fVelocity[ 3 ]
                pev( id, pev_velocity, fVelocity )
                fVelocity[ 2 ] = 268.328157
                set_pev( id, pev_velocity, fVelocity )

                return HAM_HANDLED
            }
        }
    }
    return HAM_IGNORED
}

public message_cur_weapon(msg_id, msg_dest, msg_entity)
{
    // Player doesn't have the unlimited clip upgrade
    if (!g_bAbility[msg_entity])
        return;
    
    // Player not alive or not an active weapon
    if (!is_user_alive(msg_entity) || get_msg_arg_int(1) != 1)
        return;
    
    static weapon, clip
    weapon = get_msg_arg_int(2) // get weapon ID
    clip = get_msg_arg_int(3) // get weapon clip
    
    // Unlimited Clip Ammo
    if (MAXCLIP[weapon] > 1) // skip grenades
    {
        set_msg_arg_int(3, get_msg_argtype(3), MAXCLIP[weapon]) // HUD should show full clip all the time
        
        if (clip < 2) // refill when clip is nearly empty
        {
            // Get the weapon entity
            static wname[32], weapon_ent
            get_weaponname(weapon, wname, sizeof wname - 1)
            weapon_ent = fm_find_ent_by_owner(-1, wname, msg_entity)
            
            // Set max clip on weapon
            fm_set_weapon_ammo(weapon_ent, MAXCLIP[weapon])
        }
    }
}

// Find entity by its owner (from fakemeta_util)
stock fm_find_ent_by_owner(entity, const classname[], owner)
{
      while ((entity = engfunc(EngFunc_FindEntityByString, entity,   "classname", classname)) && pev(entity, pev_owner) != owner) {}
    
    return entity;
}

// Set Weapon Clip Ammo
stock fm_set_weapon_ammo(entity, amount)
{
    set_pdata_int(entity, OFFSET_CLIPAMMO, amount, OFFSET_LINUX_WEAPONS);
}
zmd94 is offline
New and Clueless
Senior Member
Join Date: Dec 2015
Old 01-15-2016 , 16:47   Re: [T] List of Modified + Requested Plugins
Reply With Quote #1090

Quote:
Originally Posted by zmd94 View Post
Fixed:
Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <cstrike>
#include <fun>

//////////////////////////////////////////////////////////////////
//                        DEFINE FLAG                           //
//////////////////////////////////////////////////////////////////
#define OWNER_FLAG ADMIN_IMMUNITY
#define ADMIN_FLAG ADMIN_BAN
//////////////////////////////////////////////////////////////////

new g_bRecieveArmor[33], g_bRecieveHP[33]

new cvar_multijump, cvar_health, cvar_armor
new cvar_boost_amount, cvar_boost_duration

const TASK_SPEED_BOOST = 100
#define ID_SPEED_BOOST (taskid - TASK_SPEED_BOOST)

new Ham:Ham_Player_ResetMaxSpeed = Ham_Item_PreFrame

// CS Offsets
#if cellbits == 32
const OFFSET_CLIPAMMO = 51
#else
const OFFSET_CLIPAMMO = 65
#endif
const OFFSET_LINUX_WEAPONS = 4

// Max Clip for weapons
new const MAXCLIP[] = { -1, 13, -1, 10, 1, 7, -1, 30, 30, 1, 30, 20, 25, 30, 35, 25, 12, 20,
            10, 30, 100, 8, 30, 30, 20, 2, 7, 30, 30, -1, 50 }

new g_bAbility[33], g_JumpCount[33]

public plugin_init()
{
    register_plugin("[ZP] Admin Ability", "1.0", "zmd94")
    
    register_logevent("round_start", 2, "1=Round_Start")
    
    register_event("CurWeapon", "current_weapon", "be", "1=1")
    register_message(get_user_msgid("CurWeapon"), "message_cur_weapon")
    
    RegisterHam(Ham_Player_Jump, "player", "fw_PlayerJump", 0)
    RegisterHam(Ham_Player_ResetMaxSpeed, "player", "fw_ResetMaxSpeed_Post", 1)
    RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")
    
    register_forward(FM_CmdStart, "fw_Start")
    
    cvar_multijump = register_cvar("aa_multijump_amount", "2") // Amount of multi-jump given
    cvar_health = register_cvar("aa_health_amount", "100") // Amount of health given
    cvar_armor = register_cvar("aa_armor_amount", "50") // Amount of armor given
    cvar_boost_amount = register_cvar("aa_boost_amount", "100.0") // Amount of speed boost
    cvar_ability_duration = register_cvar("aa_ability_duration", "30.0") // Duration of all abilities
}

public current_weapon(id)
{
    if(g_bAbility[id])
    {
        new iWeapon = get_user_weapon(id) 
        if(iWeapon == CSW_HEGRENADE)
        {
            give_item(id, "weapon_hegrenade")
            cs_set_user_bpammo(id, CSW_HEGRENADE, 245)
        }
        
        if(iWeapon == CSW_HEGRENADE)
        {
            give_item( id, "weapon_flashbang" )
            cs_set_user_bpammo(id, CSW_FLASHBANG, 245)
        }
        
        if(iWeapon == CSW_HEGRENADE)
        {
            give_item( id, "weapon_smokegrenade" )
            cs_set_user_bpammo(id, CSW_SMOKEGRENADE, 245)
        }    
    }
}

public fw_Start(id) 
{
    if(is_user_alive(id) && get_user_flags(id) & OWNER_FLAG) 
    {
        if( pev(id, pev_button) & IN_USE) 
        {
            if(g_bAbility[id])
            {
                set_hudmessage(random_num(10,255), random(256), random(256), -1.0, 0.20, 0, 6.0, 12.0, 0.0, 0.0, -1)
                show_hudmessage(id, "You already use this ability for this round. Just wait until next round!")
            }
            else
            {
                // Player frozen (or CS freezetime)
                if (pev(id, pev_maxspeed) <= 1)
                {
                    set_hudmessage(random_num(10,255), random(256), random(256), -1.0, 0.20, 0, 6.0, 12.0, 0.0, 0.0, -1)
                    show_hudmessage(id, "You can't use this ability when frozen!")
                    return PLUGIN_HANDLED;
                }
                
                g_bAbility[id] = true
                
                set_user_health(id, get_user_health(id) + get_pcvar_num(cvar_health))
                set_user_armor(id, get_user_armor(id) + get_pcvar_num(cvar_armor))
                
                set_hudmessage(random_num(10,255), random(256), random(256), -1.0, 0.20, 0, 6.0, 12.0, 0.0, 0.0, -1)
                show_hudmessage(id, "Speed boost enabled!")
                
                // Set the restore speed task
                set_task(get_pcvar_float(cvar_ability_duration), "restore_maxspeed", id + TASK_SPEED_BOOST)
                
                // Update player's maxspeed
                ExecuteHamB(Ham_Player_ResetMaxSpeed, id)
            }
        }
    }
    
    return PLUGIN_CONTINUE;
}

public restore_maxspeed(taskid)
{
    // Disable speed boost
    g_bAbility[ID_SPEED_BOOST] = false
    
    set_hudmessage(random_num(10,255), random(256), random(256), -1.0, 0.20, 0, 6.0, 12.0, 0.0, 0.0, -1)
    show_hudmessage(ID_SPEED_BOOST, "Speed boost is over!")

    // Update player's maxspeed
    ExecuteHamB(Ham_Player_ResetMaxSpeed, ID_SPEED_BOOST)
}

public fw_PlayerKilled(victim)
{
    g_bAbility[victim] = false
    remove_task(victim + TASK_SPEED_BOOST)
}

public client_disconnect(id)
{
    g_bAbility[id] = false
    remove_task(id + TASK_SPEED_BOOST)
}

public round_start()
{
    new iPlayers[32], iPlayerCount, i, id
    
    get_players(iPlayers, iPlayerCount, "a") 
    for(i = 0; i < iPlayerCount; i++)
    {
        id = iPlayers[i]
        
        g_bAbility[id] = false
        remove_task(id + TASK_SPEED_BOOST)
    }
}

public fw_ResetMaxSpeed_Post(id)
{
    if (!is_user_alive(id) || !g_bAbility[id])
        return;
    
    // Apply speed boost
    new Float:current_maxspeed
    pev(id, pev_maxspeed, current_maxspeed)
    set_pev(id, pev_maxspeed, current_maxspeed + get_pcvar_float(cvar_boost_amount))
}

public fw_PlayerJump( id ) 
{    
    if( is_user_alive(id) && get_user_flags(id) & ADMIN_FLAG && g_bAbility[id])    
    {    
        new Flags = pev( id, pev_flags )
        
        if( Flags & FL_WATERJUMP || pev(id, pev_waterlevel) >= 2 || !(get_pdata_int(id, 246) & IN_JUMP) )
        {
            return HAM_IGNORED
        }
        
        if( Flags & FL_ONGROUND ) 
        {
            g_JumpCount[ id ] = 0
            return HAM_IGNORED
        }
        new Multi = get_pcvar_num(cvar_multijump)
        if( Multi ) 
        {
            if( get_pdata_float(id, 251) < 500 && ++ g_JumpCount[id] <= Multi ) 
            {
                new Float:fVelocity[ 3 ]
                pev( id, pev_velocity, fVelocity )
                fVelocity[ 2 ] = 268.328157
                set_pev( id, pev_velocity, fVelocity )

                return HAM_HANDLED
            }
        }
    }
    return HAM_IGNORED
}

public message_cur_weapon(msg_id, msg_dest, msg_entity)
{
    // Player doesn't have the unlimited clip upgrade
    if (!g_bAbility[msg_entity])
        return;
    
    // Player not alive or not an active weapon
    if (!is_user_alive(msg_entity) || get_msg_arg_int(1) != 1)
        return;
    
    static weapon, clip
    weapon = get_msg_arg_int(2) // get weapon ID
    clip = get_msg_arg_int(3) // get weapon clip
    
    // Unlimited Clip Ammo
    if (MAXCLIP[weapon] > 1) // skip grenades
    {
        set_msg_arg_int(3, get_msg_argtype(3), MAXCLIP[weapon]) // HUD should show full clip all the time
        
        if (clip < 2) // refill when clip is nearly empty
        {
            // Get the weapon entity
            static wname[32], weapon_ent
            get_weaponname(weapon, wname, sizeof wname - 1)
            weapon_ent = fm_find_ent_by_owner(-1, wname, msg_entity)
            
            // Set max clip on weapon
            fm_set_weapon_ammo(weapon_ent, MAXCLIP[weapon])
        }
    }
}

// Find entity by its owner (from fakemeta_util)
stock fm_find_ent_by_owner(entity, const classname[], owner)
{
      while ((entity = engfunc(EngFunc_FindEntityByString, entity,   "classname", classname)) && pev(entity, pev_owner) != owner) {}
    
    return entity;
}

// Set Weapon Clip Ammo
stock fm_set_weapon_ammo(entity, amount)
{
    set_pdata_int(entity, OFFSET_CLIPAMMO, amount, OFFSET_LINUX_WEAPONS);
}
Code:
//// zp_zadmin_ability.sma
// C:\Program Files (x86)\Steam\steamapps\common\Half-Life\cstrike\addons\amxmod
x\scripting\zp_zadmin_ability.sma(57) : error 017: undefined symbol "cvar_abilit
y_duration"
// C:\Program Files (x86)\Steam\steamapps\common\Half-Life\cstrike\addons\amxmod
x\scripting\zp_zadmin_ability.sma(115) : error 017: undefined symbol "cvar_abili
ty_duration"
// C:\Program Files (x86)\Steam\steamapps\common\Half-Life\cstrike\addons\amxmod
x\scripting\zp_zadmin_ability.sma(115 -- 118) : error 001: expected token: ",",
but found "-identifier-"
// C:\Program Files (x86)\Steam\steamapps\common\Half-Life\cstrike\addons\amxmod
x\scripting\zp_zadmin_ability.sma(245) : warning 217: loose indentation
// C:\Program Files (x86)\Steam\steamapps\common\Half-Life\cstrike\addons\amxmod
x\scripting\zp_zadmin_ability.sma(252) : warning 203: symbol is never used: "cva
r_boost_duration"
// C:\Program Files (x86)\Steam\steamapps\common\Half-Life\cstrike\addons\amxmod
x\scripting\zp_zadmin_ability.sma(252) : warning 203: symbol is never used: "g_b
RecieveArmor"
// C:\Program Files (x86)\Steam\steamapps\common\Half-Life\cstrike\addons\amxmod
x\scripting\zp_zadmin_ability.sma(252) : warning 203: symbol is never used: "g_b
RecieveHP"
//
// 3 Errors.
// Could not locate output file compiled\zp_zadmin_ability.amx (compile failed).

//
// Compilation Time: 0.14 sec
// ----------------------------------------
__________________

ANY SCRIPTER ON THIS FORUM HAS FREE VIP/ADMIN IN MY SERVER!
New and Clueless 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 07:41.


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