Raised This Month: $ Target: $400
 0% 

Copy and paste ents


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mateo10
Veteran Member
Join Date: Jan 2006
Old 06-09-2007 , 16:02   Copy and paste ents
Reply With Quote #1

This function:
Code:
public function_paste_ent( id ) {     if( ! get_pcvar_num( p_enable ) )     {         return PLUGIN_HANDLED;     }         if( ! is_user_admin( id ) )     {         return PLUGIN_HANDLED;     }         if( ! g_hascopied )     {         return PLUGIN_HANDLED;     }         new ent = engfunc( EngFunc_CreateNamedEntity, engfunc( EngFunc_AllocString, "func_wall" ) );         new Float: xorigin[ 3 ];     get_user_hitpoint( id, xorigin );         engfunc( EngFunc_SetModel, ent, g_model );     engfunc( EngFunc_SetSize, ent, g_mins, g_maxs );         set_pev( ent, pev_mins, g_mins );     set_pev( ent, pev_maxs, g_maxs );     set_pev( ent, pev_absmin, g_mins );     set_pev( ent, pev_absmax, g_maxs );         engfunc( EngFunc_SetOrigin, ent, xorigin );         set_pev( ent, pev_solid, SOLID_BBOX );     set_pev( ent, pev_movetype, MOVETYPE_FLY );     set_pev( ent, pev_takedamage, DAMAGE_NO );         static Float: rvec[ 3 ];     pev( id, pev_v_angle, rvec );         rvec[ 0 ] = 0.0;         set_pev( ent, pev_angles, rvec );         engfunc(EngFunc_DropToFloor, ent );         client_print( id, print_center, "Ent succefully pasted!" );         return PLUGIN_HANDLED; }
gives me this error:
Code:
L 06/09/2007 - 22:12:07: [FAKEMETA] Invalid entity
L 06/09/2007 - 22:12:07: [AMXX] Displaying debug trace (plugin "entmod.amxx")
L 06/09/2007 - 22:12:07: [AMXX] Run time error 10: native error (native "engfunc")
L 06/09/2007 - 22:12:07: [AMXX]    [0] entmod.sma::function_paste_ent (line

Last edited by mateo10; 06-10-2007 at 03:49.
mateo10 is offline
regalis
Veteran Member
Join Date: Jan 2007
Location: F*cking Germany
Old 06-09-2007 , 16:14   Re: Copy and paste ents
Reply With Quote #2

Code:
    if( ! g_hascopied )
    {
        return PLUGIN_HANDLED;
    }
greetz regalis
__________________
regalis is offline
mateo10
Veteran Member
Join Date: Jan 2006
Old 06-09-2007 , 16:15   Re: Copy and paste ents
Reply With Quote #3

What is wrong now (just updated the post) ?
mateo10 is offline
regalis
Veteran Member
Join Date: Jan 2007
Location: F*cking Germany
Old 06-09-2007 , 16:21   Re: Copy and paste ents
Reply With Quote #4

you should build in more debug messages...
and tell us which line the error exists...(the error message is truncated..)

Maybe here is a problem:
Code:
    new ent = engfunc( EngFunc_CreateEntity, engfunc( EngFunc_AllocString, "func_wall" ) );
i would do that with
Code:
ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
__________________

Last edited by regalis; 06-09-2007 at 16:24.
regalis is offline
pRED*
Join Date: Dec 2006
Old 06-09-2007 , 18:48   Re: Copy and paste ents
Reply With Quote #5

Yea regalis Is right.

But you can leave it as a func_wall.

It needs to be createNAMEDentity not just createentity..
pRED* is offline
mateo10
Veteran Member
Join Date: Jan 2006
Old 06-10-2007 , 03:39   Re: Copy and paste ents
Reply With Quote #6

Thank you for your help.

EDIT: Another problem, now it says "Ent succefully pasted", but nothing happens. The ent doesn't spawn.

Last edited by mateo10; 06-10-2007 at 03:49.
mateo10 is offline
regalis
Veteran Member
Join Date: Jan 2007
Location: F*cking Germany
Old 06-10-2007 , 05:05   Re: Copy and paste ents
Reply With Quote #7

Sorry i was very tired yesterday...
I just read that you want to spawn a func_wall...
AFAIK you have to do that in plugin_precache..
And also you have to set_kvd for that entity because it is a brushbased entity...please correct me if im wrong!

greetz regalis

PS: something like this..don't know exactly..maybe play a little with it..
Code:
public precache_ent()
{
    ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "func_wall"));
    
    set_kvd(0, KV_KeyName, "rendermode");
    set_kvd(0, KV_Value, "2");
    set_kvd(0, KV_fHandled, 0);
    dllfunc(DLLFunc_KeyValue, ent, 0);
    
    set_kvd(0, KV_KeyName, "renderamt");
    set_kvd(0, KV_Value, "255");
    set_kvd(0, KV_fHandled, 0);
    dllfunc(DLLFunc_KeyValue, ent, 0);
    
    dllfunc(DLLFunc_Spawn, ent);
    engfunc(EngFunc_SetOrigin, ent, origin); 
}
__________________
regalis is offline
mateo10
Veteran Member
Join Date: Jan 2006
Old 06-10-2007 , 09:36   Re: Copy and paste ents
Reply With Quote #8

I took the creating of entities from SAMURAI16's Pallets with bags plugin. It works for him...
mateo10 is offline
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 10:44.


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