AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Spawn a Info_Target (https://forums.alliedmods.net/showthread.php?t=133127)

mottzi 07-22-2010 05:28

Spawn a Info_Target
 
hello guys,

i try to spawn a info_target with a model but the i cant see the model then i type /a..

PHP Code:

public lol(id)
{
            new 
origin[3]
            
get_user_origin(idorigin0)
            
            
            new 
ent engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"info_target")) 

            if(!
pev_valid(ent)) return 

            engfunc
(EngFunc_SetModelent"models\akirby.mdl"
            
engfunc(EngFunc_SetOriginentorigin)
            
            return 
PLUGIN_CONTINUE


my second question is: How can i set a classname? I need it, because i wanna do something when the player touches the model...








Edit. I also tried this version:
PHP Code:

new const classname[] = "kirby"
new const model[] = "models/akirby.mdl"

            
new float:origin[3]
            
get_user_origin(idorigin0)
            
            new 
iKirby create_entity("info_target")
            
            if(!
is_valid_ent(iKirby))
                return 
PLUGIN_CONTINUE;
                
            
entity_set_stringiKirbyEV_SZ_classnameclassname);
            
entity_set_intiKirbyEV_INT_solidSOLID_TRIGGER );
            
entity_set_vectoriKirbyEV_VEC_originorigin);
            
entity_set_modeliKirbymodel);    
            return 
PLUGIN_CONTINUE;


public 
plugin_precache()
    
precache_model(model

but the model also dont spawn...

Peoples Army 07-22-2010 07:01

Re: Spawn a Info_Target
 
Ok well first , to make sure that your entity is actually being created , after your create entity code , add something like this

PHP Code:



client_print
(client ,print_chat"%i"ent); 

That should print out the id of the entity you created


All times are GMT -4. The time now is 00:13.

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