Raised This Month: $ Target: $400
 0% 

Fakemeta Entity Spawn


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Minimum
Senior Member
Join Date: Jun 2006
Old 04-27-2007 , 22:53   Fakemeta Entity Spawn
Reply With Quote #1

Heres the problem, I cannot get this entity to appear when I execute this function. I know it spawns the item because it does not display the error message I have in here. Any suggestions on how to get this to work? I have already precached the model just for your info.

Code:
public spawn_item(itemid,amount,origin[3]) {     new targetname[64], Float:forigin[3]     formatex(targetname,63,"%i|%i",itemid,amount)     new Float:minsx[3] = { -2.5, -2.5, -2.5 }     new Float:maxsx[3] = { 2.5, 2.5, -2.5 }     new Float:angles[3] = { 0.0, 0.0, 0.0 }     forigin[0] = float(origin[0])     forigin[1] = float(origin[1])     forigin[2] = float(origin[2])     angles[1] = float(random_num(0,360))     new item = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))     if(!item) {         log_amx("ERROR: Item failed to spawn.")         return PLUGIN_HANDLED     }     set_pev(item,pev_targetname,targetname)     set_pev(item,pev_classname,"dropped_item")     set_pev(item,pev_mins,minsx)     set_pev(item,pev_maxs,maxsx)     set_pev(item,pev_angles,angles)     set_pev(item,pev_dmg,0.0)     set_pev(item,pev_dmg_take,0.0)     set_pev(item,pev_max_health,50000.0)     set_pev(item,pev_health,50000.0)     set_pev(item,pev_solid,SOLID_TRIGGER)     set_pev(item,pev_movetype,MOVETYPE_TOSS)     set_pev(item,pev_model,"models/roleplay/w_backpack.mdl")     set_pev(item,pev_origin,forigin)     return PLUGIN_HANDLED }
Minimum is offline
Send a message via AIM to Minimum Send a message via MSN to Minimum
stupok
Veteran Member
Join Date: Feb 2006
Old 04-28-2007 , 00:27   Re: Fakemeta Entity Spawn
Reply With Quote #2

Give this a whirl:

Code:
public spawn_item(itemid, amount, Float:origin[3]) {     new targetname[64]     formatex(targetname,63,"%i|%i",itemid,amount)         new item = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))         if(!pev_valid(item))     {         log_amx("ERROR: Item failed to spawn.")         return PLUGIN_HANDLED     }         set_pev(item,pev_targetname,targetname)     set_pev(item,pev_classname,"dropped_item")     set_pev(item,pev_mins,{ -2.5, -2.5, -2.5 })     set_pev(item,pev_maxs,{ 2.5, 2.5, -2.5 })     set_pev(item,pev_angles,{ 0.0, random_float(0.0, 360.0), 0.0 })     set_pev(item,pev_dmg,0.0) //necessary?     set_pev(item,pev_dmg_take,0.0) //necessary?     set_pev(item,pev_max_health,50000.0) //necessary?     set_pev(item,pev_health,50000.0) //necessary?     set_pev(item,pev_solid,SOLID_TRIGGER)     set_pev(item,pev_movetype,MOVETYPE_TOSS)     set_pev(item,pev_model,"models/roleplay/w_backpack.mdl")     //set_pev(item,pev_origin,forigin)     engfunc(EngFunc_SetOrigin, item, origin)     return PLUGIN_HANDLED }
stupok is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 04-28-2007 , 00:35   Re: Fakemeta Entity Spawn
Reply With Quote #3

Can you say,

Code:
dllfunc(DLLFunc_Spawn, item);
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred

Last edited by Zenith77; 04-29-2007 at 21:17.
Zenith77 is offline
stupok
Veteran Member
Join Date: Feb 2006
Old 04-28-2007 , 00:42   Re: Fakemeta Entity Spawn
Reply With Quote #4

Zenith I'm pretty sure that isn't necessary.
stupok is offline
Minimum
Senior Member
Join Date: Jun 2006
Old 04-28-2007 , 01:35   Re: Fakemeta Entity Spawn
Reply With Quote #5

Zenith's way did not work.

Stupok69's way made it return this:
Got a NaN origin on dropped_item
Minimum is offline
Send a message via AIM to Minimum Send a message via MSN to Minimum
Minimum
Senior Member
Join Date: Jun 2006
Old 04-28-2007 , 18:30   Re: Fakemeta Entity Spawn
Reply With Quote #6

Found the problem. It was the pev_model line. I changed it to the following and it worked:

engfunc(EngFunc_SetModel, item, "models/roleplay/w_backpack.mdl")
Minimum is offline
Send a message via AIM to Minimum Send a message via MSN to Minimum
Zenith77
Veteran Member
Join Date: Aug 2005
Old 04-29-2007 , 21:17   Re: Fakemeta Entity Spawn
Reply With Quote #7

Quote:
Originally Posted by stupok69 View Post
Zenith I'm pretty sure that isn't necessary.
Actually it is, search the forums for why.
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
stupok
Veteran Member
Join Date: Feb 2006
Old 04-29-2007 , 21:39   Re: Fakemeta Entity Spawn
Reply With Quote #8

I'm not going to bother, because I didn't use that line when I was playing around with ents using fakemeta and everything worked just fine. It looks like Minimum didn't use that line either.

If you want to give a link or a brief explanation, that'd be nice.
stupok is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 04-29-2007 , 21:58   Re: Fakemeta Entity Spawn
Reply With Quote #9

I'll find one later. It all depends on what you're doing with the entity, like are you editing keyvalues or other stuff.
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 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 06:45.


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