Raised This Month: $12 Target: $400
 3% 

Creating an entitiy with model


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Des12
Senior Member
Join Date: Jan 2005
Old 12-04-2005 , 22:11   Creating an entitiy with model
Reply With Quote #1

I looked at the example in the documentation, and tried this:

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


// Addon to make some windows unbreakable in simi_valley and add banker models
public plugin_init()
{
	register_plugin( "Model Test", "v1", "BALOPAIN" )
	set_task(1.0,"setup")
}

public plugin_precache()
{
	precache_model( "models/mecklenburg/banker.mdl" )
}

public setup()
{
	//create a basic entity
	new entid = create_entity("info_target")
	//set its classname
	entity_set_string(entid, EV_SZ_classname, "some_guy")
	//set its model
	entity_set_model(entid, "models/mecklenburg/banker.mdl")
	new Float:Vec[3] = { 268.0, 2886.0, 196.0 }
	//set its origin 
	entity_set_origin(entid, Vec)
	//set some basic properties
	entity_set_int(entid, EV_INT_solid, 1)
	entity_set_int(entid, EV_INT_movetype, 6)
	/*****************************************
	//create the weapon - thanks to pimp_daddy!
	new entWeapon = create_entity("info_target")
	entity_set_string(entWeapon, EV_SZ_classname, weapString)
	//set to follow
	entity_set_int(entWeapon, EV_INT_movetype, MOVETYPE_FOLLOW)
	entity_set_int(entWeapon, EV_INT_solid, SOLID_NOT)
	entity_set_edict(entWeapon, EV_ENT_aiment, entid)
	entity_set_model(entWeapon, "models/p_m4.mdl")
	//*********************************************
	*/
}
I commented out the weapon section, because it had an error on weapString (guessing that is cstrike module)

But the problem is, the main model does not show up in game...did I do something wrong?
__________________
-Dest Romano

www.JustRP.com
A TSRP Server

Quote:
Originally Posted by Brad
Don't you go be bringing reality into this.
Des12 is offline
LynX
Veteran Member
Join Date: Oct 2004
Old 12-06-2005 , 08:35  
Reply With Quote #2

If you are using Harbu's TS plugins or some other stuff like that, it won't work ever.

But here :

Code:
new entity = create_entity("info_target") entity_set_model(entity, "models/somemodel.mdl") // be sure to precache new Float:Origin[3] // player origin new Float:Origin2[3] // entity origin pev(id, pev_origin, Origin) // store the player origin in array "Origin" Origin2[0] = Origin[0] // Origin2[1] = Origin[1] // You can modify the Origin[x] to place the entity in wanted position Origin2[2] = Origin[2] // engfunc(EngFunc_SetOrigin, entity, Origin2) // if you want to set entity in some REALLY strict position, just modify Origin2[x] and make it containt numbers except Origin[x] new Float:Min[3] = {-4.0, -4.0, -1.0} new Float:Max[3] = {4.0, 4.0, 12.0} engfunc(EngFunc_SetSize, entity, Min, Max )

This should work...
__________________
Current plugin : SoulPunisher anti-cheat
Percentage done : {||--------} 20%

If you think v3x is a PIMP, paste this into your sig!

If you think Bailopan is DA BOMB, paste this into your sig
LynX is offline
Send a message via ICQ to LynX
Des12
Senior Member
Join Date: Jan 2005
Old 12-06-2005 , 13:04  
Reply With Quote #3

So why would you need a model origin and a player origin?
__________________
-Dest Romano

www.JustRP.com
A TSRP Server

Quote:
Originally Posted by Brad
Don't you go be bringing reality into this.
Des12 is offline
LynX
Veteran Member
Join Date: Oct 2004
Old 12-07-2005 , 09:13  
Reply With Quote #4

Its just there if you want to make entity nearby player.

You can erase all the origin stuff if ya want and do it your way
__________________
Current plugin : SoulPunisher anti-cheat
Percentage done : {||--------} 20%

If you think v3x is a PIMP, paste this into your sig!

If you think Bailopan is DA BOMB, paste this into your sig
LynX is offline
Send a message via ICQ to LynX
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 15:28.


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