Raised This Month: $ Target: $400
 0% 

Creating an entity with a model


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 01-07-2008 , 15:14   Re: Creating an entity with a model
Reply With Quote #2

Try to use fakemeta instead of engine, is more efficient and is more handy.

Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
 
#define PLUGIN "Radioactive Waste"
#define AUTHOR "Harman"
#define VERSION "1.0"
 
new isotopeModel[] = "models/chromegibs.mdl"
new aimVector[3]
 
public plugin_precache()
{
 precache_model(isotopeModel)
}
 
public plugin_init()
{
 register_plugin(PLUGIN, AUTHOR, VERSION)
 register_clcmd("waste", "radiate")
}
 
public radiate(id)
{
 //new isotopeEnt = create_entity("info_target")
 new isotopeEnt = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString,"info_target"));
 
 //entity_set_string(isotopeEnt,EV_SZ_classname,"isotope")
 set_pev(isotopeEnt, pev_classname, "isotope");
 get_user_origin(id, aimVector, 3) //where the player is aiming
 
 new Float:fOrigin[3];
 IVecFVec(aimVector, fOrigin); //covert aim origin(int) to float.
 
 set_pev(isotopeEnt, pev_origin, fOrigin);
 //entity_set_model(isotopeEnt, isotopeModel)
 engfunc(EngFunc_SetModel, isotopeEnt, isotopeModel);
 
 message_begin(MSG_BROADCAST,SVC_TEMPENTITY) //implosion effect
 write_byte(TE_IMPLOSION)
 write_coord(aimVector[0])
 write_coord(aimVector[1])
 write_coord(aimVector[2])
 write_byte(100) //radius
 write_byte(50)  //count
 write_byte(25)  //lifetime
 message_end()
 
 client_print(id, print_chat, "Test")
 
 return PLUGIN_HANDLED
}
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
 



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 11:12.


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