Raised This Month: $ Target: $400
 0% 

[resolved] create_entity() How to make an entity at user's aim.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Zenith77
Veteran Member
Join Date: Aug 2005
Old 01-06-2007 , 21:36   Re: create_entity() How to make an entity at user's aim.
Reply With Quote #1

Try using DispatchSpawn().
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
stupok
Veteran Member
Join Date: Feb 2006
Old 01-06-2007 , 21:44   Re: create_entity() How to make an entity at user's aim.
Reply With Quote #2

Now I have the code below, but I still see no models.

Code:
public create_function(id, level, cid) {     if(!cmd_access(id, level, cid, 1))         return PLUGIN_HANDLED         new origin[3]         get_user_origin(id, origin, 3)         client_print(id, print_chat, "Origin: %5i : %5i : %5i", origin[0], origin[1], origin[2])         new ent = create_entity(CLASSNAME)     entity_set_origin(ent, float:origin)     entity_set_model(ent, MODEL)         DispatchSpawn(ent)         return PLUGIN_HANDLED }
stupok is offline
stupok
Veteran Member
Join Date: Feb 2006
Old 01-06-2007 , 22:54   Re: create_entity() How to make an entity at user's aim.
Reply With Quote #3

I learned that get_user_origin() returns the origin in integers, but an entity must be spawned at a float.. here is the working code.

Code:
public create_function(id, level, cid) {     if(!cmd_access(id, level, cid, 1))         return PLUGIN_HANDLED         new Float:float_origin[3]     new integer_origin[3]         get_user_origin(id, integer_origin, 3)         for(new i = 0; i < 3; i++)         float_origin[i] = float(integer_origin[i])     new ent = create_entity("info_target")     entity_set_string(ent,EV_SZ_classname,"stupok69_ent")     entity_set_model(ent,MODEL)     entity_set_origin(ent,float_origin)     return PLUGIN_HANDLED }
stupok 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 22:24.


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