Raised This Month: $32 Target: $400
 8% 

remove_entity crash


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
rak
Veteran Member
Join Date: Oct 2011
Location: banned country
Old 08-28-2012 , 22:09   remove_entity crash
Reply With Quote #1

hi i don't know why this crash my HLDS;

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

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "[R]ak"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say /remove""cmdRemove")
}

public 
cmdRemove(id) {
    
    if(!
is_user_alive(id))
        return 
PLUGIN_HANDLED
    
    
new Ent find_ent_by_owner(-1"weapon_knife"id)
        
    
remove_entity(Ent)
        
    return 
PLUGIN_HANDLED
    

any idea?

thanks for reading
__________________

www.amxmodx-es.com

Steam: Luchokoldo
rak is offline
Send a message via MSN to rak Send a message via Skype™ to rak
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viņa del Mar, Chile
Old 08-28-2012 , 22:15   Re: remove_entity crash
Reply With Quote #2

Why you're doing that, lol, that's not the right way for removing a weapon from the world. remove_entity doesn't work at the same way for every entity.

What are you trying to do?
__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross

Last edited by meTaLiCroSS; 08-28-2012 at 22:23.
meTaLiCroSS is offline
rak
Veteran Member
Join Date: Oct 2011
Location: banned country
Old 08-28-2012 , 23:45   Re: remove_entity crash
Reply With Quote #3

i try remove only the knife xD

edit: done xD

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

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "[R]ak"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say /remove""cmdRemove")
}

public 
cmdRemove(id) {
    
    if(!
is_user_alive(id))
        return 
PLUGIN_HANDLED
    
    ham_strip_weapon
(id"weapon_knife")
    
    return 
PLUGIN_HANDLED
    
}

stock ham_strip_weapon(id,weapon[]) {
    
    if(!
equal(weapon,"weapon_",7))
        return 
0
    
    
new wId get_weaponid(weapon)
    
    if(!
wId)
        return 
0
    
    
new wEnt
    
    wEnt 
find_ent_by_owner(-1"weapon_knife"id)
    
    if(!
wEnt) return 0;
    
    if(
get_user_weapon(id) == wId)
        
ExecuteHamB(Ham_Weapon_RetireWeapon,wEnt)
    
    if(!
ExecuteHamB(Ham_RemovePlayerItem,id,wEnt))
        return 
0
    
    ExecuteHamB
(Ham_Item_Kill,wEnt)
    
    
entity_set_int(idEV_INT_weaponsentity_get_int(idEV_INT_weapons) & ~(1<<wId));
    
    return 
1
    

__________________

www.amxmodx-es.com

Steam: Luchokoldo

Last edited by rak; 08-29-2012 at 00:18.
rak is offline
Send a message via MSN to rak Send a message via Skype™ to rak
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 21:19.


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