AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Zombie Plague Mod (https://forums.alliedmods.net/forumdisplay.php?f=126)
-   -   Subplugin Submission [ZP] Extra item: Remove Grenade (https://forums.alliedmods.net/showthread.php?t=179502)

H.RED.ZONE 03-01-2012 21:26

[ZP] Extra item: Remove Grenade
 
4 Attachment(s)
[ZP] Extra item: Remove Grenade


Info
:
Extra item for Zombies. (Small number of extra items for zombies)
Removes grenades (Fire, Frost, Flare, Force field, Kill bomb)
This is same code as my "Anti Infect Bomb"
This was made because of request.


How to use
:
Simple just buy it and every
bomb in range will be removed.
Plugin has no cvars.

In zp 5.0 version added cvars

Code:

    cvar_enable_remover = 1
    cvar_enable_zombie_remover = 1
    cvar_nemesis_remover = 1

How it works:
Click

Errors
:
If you find any please post


http://slike.milf-hosting.info/images/1327147790.jpg
Changelog:

Code:

1.0 - release
1.1 - fixed maxplayers
1.2 - fixed invalid player errors
1.3 - Long range fixed
1.4 - Full fix
1.5 - Fixed run time error
      Added ColorChat

Added zp 5.0 version

1.0 - Added new cvars fixed the code from zp version


naSTR 03-02-2012 01:36

Re: [ZP] Extra item: Remove Grenade
 
Wow this is much useful plugin. I will test it right away ;)

Still affecting force shield & sometimes fire, frost nade affecting. No error logs in debug

H.RED.ZONE 03-02-2012 03:56

Re: [ZP] Extra item: Remove Grenade
 
Just higher range. And for the force field it removes it but not when its activated.

lucas_7_94 03-02-2012 13:06

Re: [ZP] Extra item: Remove Grenade
 
cache get_maxplayers() , not all servers has 32 slots . and HLTV event doesnt have params.

H.RED.ZONE 03-02-2012 13:22

Re: [ZP] Extra item: Remove Grenade
 
Ups updated...

Excalibur.007 03-03-2012 08:10

Re: [ZP] Extra item: Remove Grenade
 
I guess, using only Engine is possible, right?

PHP Code:

/*
//------------------------------------------------------
This is: [ZP] Remove Grenade
//------------------------------------------------------ 
Description: Extra item for zombies.
Removes grenades (Fire, Frost, Flare, Force field, Kill bomb)
This is same code as my "Anti Infect Bomb"
This was made because of request.
//------------------------------------------------------
Edit: Only thing you need to edit is the range that you want (default 150)
//------------------------------------------------------ 
Version 1.0 - Release
//------------------------------------------------------
*/

//------------------------------------------------------
//Include
//------------------------------------------------------

#include <amxmodx>
#include <engine>
#include <zombieplague>

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

new g_itemid_buyremoverg
new bool:g_removeg[33]

//------------------------------------------------------
//Register
//------------------------------------------------------

public plugin_init()
{
    
//------
    
register_plugin("[ZP] Extra item: Remover""1.0""H.RED.ZONE")
    
//------    
    
register_event("HLTV""NewRG""a""1=0""2=0")
    
//------    
    
g_itemid_buyremoverg zp_register_extra_item("Remover - Remove Grenades" 20 ZP_TEAM_ZOMBIE)
    
//------    
}

//------------------------------------------------------
//------------------------------------------------------
//------------------------------------------------------
public zp_extra_item_selected(playeritemid)
{
    if (
itemid == g_itemid_buyremoverg)
    {
        
client_print(playerprint_chat"[ZP] You bought Remover (Grenades cant hurt you)")    
        
g_removeg[player] = true
    
}
    
}

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

public client_PreThink(id)
{
    if(
is_user_connected(id))
    {
        if(
g_removeg[id])
        {
            new 
infnade find_ent_by_class(-1"grenade")
            
            new 
Distance get_entity_distance(infnadeid)
            new 
owner entity_get_edict(infnadeEV_ENT_owner)
            
            if(
Distance <= 150 && !zp_get_user_zombie(owner))  //change range here
            
{
                
remove_entity(infnade)
            }
        }
    }
}

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

public NewRG(i,id)
{
    if (
g_removeg[i])
    {
        
g_removeg[i] = false
    
}


Untested. Only uses Engine.

H.RED.ZONE 03-03-2012 08:20

Re: [ZP] Extra item: Remove Grenade
 
Hmm ill look it up. It would lower cpu usage.

Excalibur.007 03-03-2012 08:30

Re: [ZP] Extra item: Remove Grenade
 
Quote:

Originally Posted by H.RED.ZONE (Post 1661630)
Hmm ill look it up. It would lower cpu usage.

You could also change is_user_connected & the boolean to bits. It's better that way. Even if you do not want to use CVars. Do something like

PHP Code:

new const Distance 150
//or
const Distance 150 

Got to go, bye.

H.RED.ZONE 03-03-2012 08:36

Re: [ZP] Extra item: Remove Grenade
 
For easy edit but still the code is small anyone can edit it, ill take you opinion in the future, thanks.

JoKeR LauGh 03-04-2012 02:05

Re: [ZP] Extra item: Remove Grenade
 
@Exacalibur

PHP Code:

new const Distance 360 

should be

PHP Code:

new const Distance[] = 360 

or

PHP Code:

new const Distance[] = "360" 

?? just a question .


All times are GMT -4. The time now is 15:23.

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