Raised This Month: $ Target: $400
 0% 

i want to create multiple CLASSNAME


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
gcz
Junior Member
Join Date: Feb 2016
Old 02-17-2017 , 08:40   i want to create multiple CLASSNAME
Reply With Quote #1

how to create ten chicken and ten classname

// create ten chicken
for( i=0; i<10; i++ )
{
Ent = create_entity("info_target")
...
.....
........
entity_set_string( Ent, EV_SZ_classname, CLASSNAME + i ); // CLASSNAME1 CLASSNAME2 ...... CLASSNAME10
........
......
....
}

// find ten chicken
while ( Ent = find_ent_by_class( Ent, CLASSNAME1 ) > 0 )
while ( Ent = find_ent_by_class( Ent, CLASSNAME2 ) > 0 )
....
......
.........
while Ent = find_ent_by_class( Ent, CLASSNAME10 ) > 0 )


thank you so mush

Code:
/* Plugin generated by AMXX-Studio */
  
#include <amxmodx>
#include <amxmisc>
#include <engine>
  
#define PLUGIN "[engine.inc] set_rendering"
#define VERSION "1.0"
#define AUTHOR "Admin"
  
new Ent
new g_Model[] = {"models/chick.mdl"}
  
public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_clcmd("say /chick","add_chicken")
      
}
public plugin_precache(){
    precache_model(g_Model)
}

public add_chicken(id){
      
    Ent = create_entity("info_target")
      
    if(is_valid_ent(Ent)){
          
        entity_set_model(Ent, g_Model)
        entity_set_size(Ent,Float:{-6.0, -10.0, 0.0},Float:{6.0, 10.0, 18.0})
        new Float:f_Origin[3]
        entity_get_vector(id, EV_VEC_origin, f_Origin)    
        f_Origin[0] += 50.0
        entity_set_origin(Ent, f_Origin)        
        entity_set_int(Ent,EV_INT_solid,SOLID_BBOX)

    
       entity_set_string(Ent, EV_SZ_classname, CLASSNAME);
          
        entity_set_float(Ent, EV_FL_takedamage, DAMAGE_YES)
          
        new Float:angles[3]
        angles[0] = 0.0
        angles[1] = 0.0
        angles[2] = 0.0
        entity_set_vector(Ent,EV_VEC_angles,angles)
          
        drop_to_floor(Ent)
    }
}
gcz is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 02-17-2017 , 09:02   Re: i want to create multiple CLASSNAME
Reply With Quote #2

..?
PHP Code:
new i=1;

while(++
<= 10)
new 
Ent create_entity("info_target"); 
__________________

Last edited by edon1337; 02-17-2017 at 09:06.
edon1337 is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 02-17-2017 , 09:37   Re: i want to create multiple CLASSNAME
Reply With Quote #3

PHP Code:
/* Plugin generated by AMXX-Studio */
  
#include <amxmodx>
#include <amxmisc>
#include <engine>
  
#define PLUGIN "Chickens"
#define VERSION "1.0"
#define AUTHOR "Natsheh"

#define CHICKEN_CLASSNAME "chicken"

new g_Model[] = {"models/chick.mdl"}
  
public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say""clcmd_say")
    
register_clcmd("say_team""clcmd_say")
}

public 
plugin_precache()
{
    
precache_model(g_Model)
}

public 
clcmd_say(idlevelcid)
{
    new 
sString[40]
    
read_args(sStringcharsmax(sString))
    
remove_quotes(sString)
    
    new 
sCmd[16], sAmount[4];
    
strtok(sStringsCmdcharsmax(sCmd), sAmountcharsmax(sAmount))
    
    if(
equali(sCmd"/chicken") || equali(sCmd"!chicken"))
    {
        new 
iAmount str_to_num(sAmount);
        if(
iAmount <= 0iAmount 1;
        
add_chicken(idiAmount)
    }
}

public 
add_chicken(idamount)
{
    new 
iEnt = -1Float:f_Origin[3], Float:angles[3], iChickens;
    new 
sWord[24], sName[32], i;
    
    while( (
find_ent_by_class(iEntCHICKEN_CLASSNAME) != 0) )
    {
        
iChickens ++;
    }
    
    new 
newamount iChickens amount;
        
    for(
iChickensnewamounti++)
    {
        
iEnt create_entity("info_target")
    
        if(!
is_valid_ent(iEnt))
        {
            continue;
        }
        
        
entity_set_model(iEntg_Model)
        
entity_set_size(iEntFloat:{-6.0, -10.00.0}, Float:{6.010.018.0})
        
entity_get_vector(idEV_VEC_originf_Origin)    
        
f_Origin[0] += 50.0
        entity_set_origin
(iEntf_Origin)
        
entity_set_int(iEntEV_INT_solidSOLID_BBOX)
        
entity_set_string(iEntEV_SZ_classnameCHICKEN_CLASSNAME);
        
entity_set_float(iEntEV_FL_takedamageDAMAGE_YES)
        
entity_set_vector(iEntEV_VEC_anglesangles)
        
num_to_word(isWordcharsmax(sWord))
        
formatex(sNamecharsmax(sName), "chicken_%s"sWord)
        
entity_set_string(iEntEV_SZ_globalnamesName)
        
        
drop_to_floor(iEnt)
    }

__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 02-17-2017 at 09:59.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
PRoSToTeM@
Veteran Member
Join Date: Jan 2010
Location: Russia, Ivanovo
Old 02-17-2017 , 09:39   Re: i want to create multiple CLASSNAME
Reply With Quote #4

???
PHP Code:
entity_set_string(EntEV_SZ_classnamefmt("%s%d"CLASSNAMEi)); 
__________________
PRoSToTeM@ is offline
Send a message via ICQ to PRoSToTeM@ Send a message via Skype™ to PRoSToTeM@
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 02-17-2017 , 09:48   Re: i want to create multiple CLASSNAME
Reply With Quote #5

I think he just wants to execute create_entity 10 times.
__________________
edon1337 is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 02-17-2017 , 09:55   Re: i want to create multiple CLASSNAME
Reply With Quote #6

Quote:
Originally Posted by PRoSToTeM@ View Post
???
PHP Code:
entity_set_string(EntEV_SZ_classnamefmt("%s%d"CLASSNAMEi)); 

then it will be hard to find the ent
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 02-17-2017 , 09:56   Re: i want to create multiple CLASSNAME
Reply With Quote #7

Well, it isn't our fault is it?
__________________
edon1337 is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 02-17-2017 , 09:56   Re: i want to create multiple CLASSNAME
Reply With Quote #8

Quote:
Originally Posted by edon1337 View Post
Well, it isn't our fault is it?

check out the code i posted
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 02-17-2017 at 09:58.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
gcz
Junior Member
Join Date: Feb 2016
Old 02-18-2017 , 10:38   Re: i want to create multiple CLASSNAME
Reply With Quote #9

that right thank you so mush for scripte

Quote:
Originally Posted by Natsheh View Post
PHP Code:
/* Plugin generated by AMXX-Studio */
  
#include <amxmodx>
#include <amxmisc>
#include <engine>
  
#define PLUGIN "Chickens"
#define VERSION "1.0"
#define AUTHOR "Natsheh"

#define CHICKEN_CLASSNAME "chicken"

new g_Model[] = {"models/chick.mdl"}
  
public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say""clcmd_say")
    
register_clcmd("say_team""clcmd_say")
}

public 
plugin_precache()
{
    
precache_model(g_Model)
}

public 
clcmd_say(idlevelcid)
{
    new 
sString[40]
    
read_args(sStringcharsmax(sString))
    
remove_quotes(sString)
    
    new 
sCmd[16], sAmount[4];
    
strtok(sStringsCmdcharsmax(sCmd), sAmountcharsmax(sAmount))
    
    if(
equali(sCmd"/chicken") || equali(sCmd"!chicken"))
    {
        new 
iAmount str_to_num(sAmount);
        if(
iAmount <= 0iAmount 1;
        
add_chicken(idiAmount)
    }
}

public 
add_chicken(idamount)
{
    new 
iEnt = -1Float:f_Origin[3], Float:angles[3], iChickens;
    new 
sWord[24], sName[32], i;
    
    while( (
find_ent_by_class(iEntCHICKEN_CLASSNAME) != 0) )
    {
        
iChickens ++;
    }
    
    new 
newamount iChickens amount;
        
    for(
iChickensnewamounti++)
    {
        
iEnt create_entity("info_target")
    
        if(!
is_valid_ent(iEnt))
        {
            continue;
        }
        
        
entity_set_model(iEntg_Model)
        
entity_set_size(iEntFloat:{-6.0, -10.00.0}, Float:{6.010.018.0})
        
entity_get_vector(idEV_VEC_originf_Origin)    
        
f_Origin[0] += 50.0
        entity_set_origin
(iEntf_Origin)
        
entity_set_int(iEntEV_INT_solidSOLID_BBOX)
        
entity_set_string(iEntEV_SZ_classnameCHICKEN_CLASSNAME);
        
entity_set_float(iEntEV_FL_takedamageDAMAGE_YES)
        
entity_set_vector(iEntEV_VEC_anglesangles)
        
num_to_word(isWordcharsmax(sWord))
        
formatex(sNamecharsmax(sName), "chicken_%s"sWord)
        
entity_set_string(iEntEV_SZ_globalnamesName)
        
        
drop_to_floor(iEnt)
    }

gcz is offline
gcz
Junior Member
Join Date: Feb 2016
Old 02-18-2017 , 10:43   Re: i want to create multiple CLASSNAME
Reply With Quote #10

Quote:
Originally Posted by edon1337 View Post
I think he just wants to execute create_entity 10 times.
i use many 100+ entity in my game
gcz 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 20:59.


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