This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

Delete entity problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Neeeeeeeeeel.-
Some Guy Yellin'
Join Date: Jul 2010
Location: Argentina
Old 07-29-2011 , 13:58   Delete entity problem
Reply With Quote #1

Hi, i have a problem deleting an entity... i dont know much about entitys so i can't repair it, the code is not mine.

Edit: I forgot the global vars
PHP Code:
new const MODEL_KIT[] = { "models/winebottle.mdl" }
new 
gGMsgFade;
new 
gGMsgItemPickup;
new const 
gMedKitClassname[] = "medkit_entity";
#define MEDKIT_MINSZ     Float:{ -23.160000, -13.660000, -0.050000 }
#define MEDKIT_MAXSZ     Float:{ 11.470000, 12.780000, 6.720000 } 
Here i create the entity:

Its called when someone die.
PHP Code:
public drop_kit()
{
    new 
victim read_data(2);
    
    static 
Float:origin[3];
    
pev(victimpev_originorigin);
    
    new 
ent engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"info_target"));
    
    
origin[2] -= 36
    
    
engfunc(EngFunc_SetOriginentorigin);
    
    if(!
pev_valid(ent))
        return 
PLUGIN_HANDLED;
    
    
set_pev(entpev_classnamegMedKitClassname);
    
engfunc(EngFunc_SetModelentMODEL_KIT);
    
dllfunc(DLLFunc_Spawnent);
    
set_pev(entpev_solidSOLID_BBOX);
    
set_pev(entpev_movetypeMOVETYPE_NONE);
    
engfunc(EngFunc_SetSizeentMEDKIT_MINSZMEDKIT_MAXSZ);
    
engfunc(EngFunc_DropToFloorent);
    
    
fm_set_rendering(entkRenderFxGlowShell255255255kRenderFxNone27);
    
    return 
PLUGIN_HANDLED;

And here when someone touch the entity i give him random ammopacks, then some effects and at the end i delete the entity:

PHP Code:
public ForwardTouch(entid)
{
    if(!
pev_valid(ent))
        return 
FMRES_IGNORED;
    
    new 
classname[32];
    
pev(entpev_classnameclassnamecharsmax(classname));
    
    if(!
equalclassnamegMedKitClassname))
        return 
FMRES_IGNORED;
    
    
    new 
count random_num(10200)
    
ChatColor(id,"!g[ZP]!y Ganaste %d ammopacks por tomar un ale."count)
    
g_ammopacks[id] += count
    check_level
(id)
    
    
message_begin(MSG_ONE_UNRELIABLEgGMsgItemPickup_id); // line 2075
    
write_string("item_healthkit");
    
message_end();
    
message_beginMSG_ONE_UNRELIABLEgGMsgFade _id);
    
write_short(1<<10);
    
write_short(1<<10);
    
write_short(FFADE_IN);
    
write_byte(255);
    
write_byte(0);
    
write_byte(0); 
    
write_byte(75);
    
message_end();
    
    
engfuncEngFunc_RemoveEntityent );
    
    return 
FMRES_IGNORED;

These are the errorlogs:
Code:
L 07/29/2011 - 14:25:14: [AMXX] Displaying debug trace (plugin "zp-infernus.amxx")
L 07/29/2011 - 14:25:14: [AMXX] Run time error 10: native error (native "message_begin")
L 07/29/2011 - 14:25:14: [AMXX]    [0] zp-infernus.sma::ForwardTouch (line 2075)
L 07/29/2011 - 14:25:14: [AMXX]    [1] zp-infernus.sma::ForwardTouch (line 2073)
L 07/29/2011 - 14:25:14: Plugin called message_begin with an invalid message id (0).
Thanks.
__________________

Last edited by Neeeeeeeeeel.-; 07-29-2011 at 14:03.
Neeeeeeeeeel.- is offline
Send a message via Skype™ to Neeeeeeeeeel.-
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 07-29-2011 , 14:07   Re: Delete entity problem
Reply With Quote #2

Show where you set gGMsgItemPickup (usually in plugin_init)
__________________
Quote:
Originally Posted by DarkGod View Post
nikhilgupta generates his plugins using sheer awesome.
If you like my work, please
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
Neeeeeeeeeel.-
Some Guy Yellin'
Join Date: Jul 2010
Location: Argentina
Old 07-29-2011 , 14:34   Re: Delete entity problem
Reply With Quote #3

Ohh that's it, i forgot it... now i' ll test... if still work bad i will replay again.
Thank you
__________________
Neeeeeeeeeel.- is offline
Send a message via Skype™ to Neeeeeeeeeel.-
Neeeeeeeeeel.-
Some Guy Yellin'
Join Date: Jul 2010
Location: Argentina
Old 07-29-2011 , 14:42   Re: Delete entity problem
Reply With Quote #4

Works perfectly thanks.
__________________
Neeeeeeeeeel.- is offline
Send a message via Skype™ to Neeeeeeeeeel.-
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 01:31.


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