Raised This Month: $ Target: $400
 0% 

adding model


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
alvedro
Member
Join Date: Feb 2012
Old 05-16-2012 , 12:13   adding model
Reply With Quote #1

Hi,
How do the simplest addition model (entity) in the place where I stand now? For example, using the command: /add.
alvedro is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 05-16-2012 , 12:19   Re: adding model
Reply With Quote #2

PHP Code:
static ent
ent 
create_entity("info_target")
if(
ent)
{
entity_set_string(ent,EV_SZ_classname,"entity_classname"// put your entity classname here...
entity_set_model(ent,"models/..."// put your entity model path here (you should precache it first)
 
entity_set_int(ent,EV_INT_solid,SOLID_NOT// don't make it solid
entity_set_int(ent,EV_INT_movetype,MOVETYPE_NONE// don't move
 
static Float:origin[3]
entity_get_vector(id,EV_VEC_origin,origin// get origin of the player
 
entity_set_vector(ent,EV_VEC_origin,origin// set player origin to entity

__________________
<VeCo> is offline
alvedro
Member
Join Date: Feb 2012
Old 05-16-2012 , 14:23   Re: adding model
Reply With Quote #3

Is that correct? Where to download class_name of a model?

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <engine>

#define PLUGIN "test"
#define VERSION "1.0"
#define AUTHOR "xxx"

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say /create","CreateEnt")
}

public 
plugin_precache() {
    
precache_model("models/chick.mdl")
    return 
PLUGIN_CONTINUE
}

public 
CreateEnt(id) {
    static 
ent
    ent 
create_entity("info_target")
    
entity_set_string(ent,EV_SZ_classname,"chick"// put your entity classname here...
    
entity_set_model(ent,"models/chick.mdl"// put your entity model path here (you should precache it first)

    
entity_set_int(ent,EV_INT_solid,SOLID_NOT// don't make it solid
    
entity_set_int(ent,EV_INT_movetype,MOVETYPE_NONE// don't move

    
static Float:origin[3]
    
entity_get_vector(id,EV_VEC_origin,origin// get origin of the player

    
entity_set_vector(ent,EV_VEC_origin,origin// set player origin to entity

alvedro is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 05-16-2012 , 15:33   Re: adding model
Reply With Quote #4

Test it.

You don't need to put return in plugin_precache().
__________________
<VeCo> is offline
alvedro
Member
Join Date: Feb 2012
Old 05-17-2012 , 11:33   Re: adding model
Reply With Quote #5

Well what does not work. Any ideas?
alvedro is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 05-17-2012 , 11:42   Re: adding model
Reply With Quote #6

I've tested it now - it works.

Btw, it's good to make a check like I've made:

PHP Code:
if(ent)
{
// entity has been created successfully (is valid)

__________________
<VeCo> is offline
alvedro
Member
Join Date: Feb 2012
Old 05-17-2012 , 12:34   Re: adding model
Reply With Quote #7

This code works for you? For me does not create the model.

PHP Code:
/* Plugin generated by AMXX-Studio */ 

#include <amxmodx> 
#include <amxmisc> 
#include <cstrike> 
#include <engine> 

#define PLUGIN "test" 
#define VERSION "1.0" 
#define AUTHOR "xxx" 

public plugin_init() { 
    
register_plugin(PLUGINVERSIONAUTHOR
    
    
register_clcmd("say /create","CreateEnt"


public 
plugin_precache() { 
    
precache_model("models/chick.mdl"


public 
CreateEnt(id) { 
    static 
ent 
    ent 
create_entity("info_target"
    if(
ent) {
        
entity_set_string(ent,EV_SZ_classname,"chick"// put your entity classname here... 
        
entity_set_model(ent,"models/chick.mdl"// put your entity model path here (you should precache it first) 

        
entity_set_int(ent,EV_INT_solid,SOLID_NOT// don't make it solid 
        
entity_set_int(ent,EV_INT_movetype,MOVETYPE_NONE// don't move 

        
static Float:origin[3
        
entity_get_vector(id,EV_VEC_origin,origin// get origin of the player 

        
entity_set_vector(ent,EV_VEC_origin,origin// set player origin to entity 
    
}

alvedro is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 05-17-2012 , 12:42   Re: adding model
Reply With Quote #8

Did you move after creating it? Because it creates it exaclty where you stand and you can't see it if you don't move.
__________________

Last edited by <VeCo>; 05-17-2012 at 12:43.
<VeCo> is offline
alvedro
Member
Join Date: Feb 2012
Old 05-17-2012 , 13:42   Re: adding model
Reply With Quote #9

So I move. And is the correct name class_name is here important?
alvedro is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 05-17-2012 , 13:46   Re: adding model
Reply With Quote #10

It doesn't really matter what classname do you type.
__________________
<VeCo> 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 00:28.


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