Raised This Month: $ Target: $400
 0% 

How to restrict weapons without server crashes?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
neverminde
Senior Member
Join Date: Feb 2011
Location: St.Piter
Old 06-10-2012 , 07:29   How to restrict weapons without server crashes?
Reply With Quote #1

Hi,
I want restrict
PHP Code:
weapon_sg550
weapon_g3sg1 
but restmenu.amxx crashes server

I also write this small plugin, but it crashes server too
PHP Code:
#include <amxmodx>

public plugin_init()
{
    
register_plugin"PLUGIN""VERSION""AUTHOR" )
    
register_event("CurWeapon""Event_CurWeapon""be""1=1")
}

public 
Event_CurWeapon(id)
{
    if(!
is_user_alive(id) || !is_user_connected(id)) 
        return 
PLUGIN_CONTINUE
        
    
new temp[2], weapon get_user_weapon(idtemp[0], temp[1])
    if( (
weapon == CSW_G3SG1) || (weapon == CSW_SG550) )
    {
        
engclient_cmd(id"drop""weapon_sg550")
        
engclient_cmd(id"drop""weapon_g3sg1")
    }
    return 
PLUGIN_CONTINUE

For restricting shield I use noshield.amxx plugin by ConnorMcLeod
http://forums.alliedmods.net/showthread.php?p=1308465
It works perfectly and server works stable with it

Can anybody tell me how rewrite noshield.sma for my case ?
neverminde is offline
tcPane
Senior Member
Join Date: Sep 2010
Old 06-10-2012 , 07:47   Re: How to restrict weapons without server crashes?
Reply With Quote #2

PHP Code:
#include <amxmodx> 

public plugin_init() 

    
register_plugin"PLUGIN""VERSION""AUTHOR" 
    
register_event("CurWeapon""Event_CurWeapon""be""1=1"


public 
Event_CurWeapon(id

    if(!
is_user_alive(id) || !is_user_connected(id))  
        return 
PLUGIN_CONTINUE 
         
    
new temp[2], weapon get_user_weapon(idtemp[0], temp[1]) 
    if( (
weapon == CSW_G3SG1) || (weapon == CSW_SG550) ) 
    { 
        
engclient_cmd(id"drop"
    } 
    return 
PLUGIN_CONTINUE 

try that

Last edited by tcPane; 06-10-2012 at 07:48.
tcPane is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 06-10-2012 , 10:15   Re: How to restrict weapons without server crashes?
Reply With Quote #3

restmenu.amxx doesn't crash the server unless you fucked something up.
hleV is offline
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 06-10-2012 , 10:26   Re: How to restrict weapons without server crashes?
Reply With Quote #4

You could do it hooking CreateNamedEntity
So, you have to write an extension!

PHP Code:
edict_t *CreateNamedEntityint iClassName )
{
  
RETURN_META( !strcmpSTRINGiClassName ), "weapon_g3sg1" ) ? MRES_SUPERCEDE MRES_IGNORED );

@hleV, I don't think you are impressing using your trivial language.
__________________

Last edited by claudiuhks; 06-10-2012 at 10:29.
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
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 06:18.


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