Raised This Month: $ Target: $400
 0% 

ham weaponbox


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
neverminde
Senior Member
Join Date: Feb 2011
Location: St.Piter
Old 04-02-2011 , 16:41   ham weaponbox
Reply With Quote #1

Code:
public plugin_init() {     
...
      RegisterHam(Ham_Touch, "weaponbox", "fwdTouch")     
...
}

public fwdTouch(ent, id) {     
      if (is_user_alive(id))     
       return HAM_SUPERCEDE     

      return HAM_IGNORED     
}
What do this part of script?
I think it doesnot allow players to pick up weapon.

if so, then i want to add bool element. true -> ignor weapon ; false -> pickup weapon. i was tring, but unsuccessfuly.
How to code it?
neverminde is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-02-2011 , 16:56   Re: ham weaponbox
Reply With Quote #2

Yes, it blocks the pick up of [only] weaponbox entities. (so weapons dropped).

Show what you have tried to do.
__________________
Arkshine is offline
neverminde
Senior Member
Join Date: Feb 2011
Location: St.Piter
Old 04-03-2011 , 07:27   Re: ham weaponbox
Reply With Quote #3

Code:
#include <amxmodx>     
#include <hamsandwich>     
#include <fakemeta_util>     
#include <fun>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

new g_ignor_w = false  

public plugin_init() {   
      register_plugin(PLUGIN, VERSION, AUTHOR) 
      
      register_event("HLTV", "eventRoundStart", "a", "1=0", "2=0")
  
      register_clcmd("say /free", "cmdFree")   

      RegisterHam(Ham_Touch, "weaponbox", "fwdTouch")     
}

public eventRoundStart() 
{     
      g_ignor_w = false
}

public cmdFree() 
{
      g_ignor_w = true
}

public fwdTouch(ent, id) {
    
    if( g_ignor_w )
    {
          if (is_user_alive(id))     
          return HAM_SUPERCEDE     
    
          return HAM_IGNORED      
    }
    //warning here :(
}
also 2 warnings
it should ignore weapon when somebody say /free
But it makes it all the time. I cant pick up guns.
neverminde is offline
Nyuszy
Senior Member
Join Date: Apr 2009
Old 04-03-2011 , 07:44   Re: ham weaponbox
Reply With Quote #4

PHP Code:
new bool:g_ignor_w 
PHP Code:
public cmdFree(id
PHP Code:
public fwdTouch(entid) {
    
    if( 
g_ignor_w )
    {
          if (
is_user_alive(id))   
               return 
HAM_SUPERCEDE       
    
}
    return 
HAM_IGNORED  

Nyuszy is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-03-2011 , 09:06   Re: ham weaponbox
Reply With Quote #5

PHP Code:
#include <amxmodx>     
#include <hamsandwich>     

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

new g_ignor_w[33// so each player can enable/disable

public plugin_init()
{   
    
register_plugin(PLUGINVERSIONAUTHOR
    
register_clcmd("say /free""cmdFree")   
    
RegisterHam(Ham_Touch"weaponbox""fwdTouch")     
    
RegisterHam(Ham_Touch"weapon_shield""fwdTouch")     
    
RegisterHam(Ham_Touch"armoury_entity""fwdTouch")     
}

public 
client_putinserverid )
{
    
g_ignor_w[id] = false // set to false when player enter the server
}

public 
cmdFree() 
{
    
// switch ability
    
g_ignor_w[id] = !g_ignor_w[id]
}

public 
fwdTouch(entid) {
    
    if( 
g_ignor_w[id] && is_user_alive(id) )
    {    
        return 
HAM_SUPERCEDE      
    
}
    
//NO MORE warning here :(
    
return HAM_IGNORED

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
neverminde
Senior Member
Join Date: Feb 2011
Location: St.Piter
Old 04-03-2011 , 09:30   Re: ham weaponbox
Reply With Quote #6

Works perfectly, thanks !
neverminde is offline
Reply


Thread Tools
Display Modes

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 14:31.


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