Raised This Month: $7 Target: $400
 1% 

Model/Sprite Spawner w/ Auto-Respawner


Post New Thread Reply   
 
Thread Tools Display Modes
GHW_Chronic
SourceMod Donor
Join Date: Sep 2004
Location: Texas
Old 01-03-2009 , 20:41   Re: Model/Sprite Spawner w/ Auto-Respawner
Reply With Quote #71

Quote:
Originally Posted by Plug me up View Post
i hav a question...
spawnin sprites gonna make ppl hav to download them when connecting to my server?
only if they are custom sprites. You can spawn HL sprites or models and they won't have to DL.
GHW_Chronic is offline
Send a message via AIM to GHW_Chronic
KadiR
Unnecessary Member
Join Date: Aug 2008
Location: Zürich / Switzerland
Old 11-08-2009 , 07:10   Re: Model/Sprite Spawner w/ Auto-Respawner
Reply With Quote #72

I have this in the ini file:

Quote:
models/server/hi/bob.mdl bob all 0
models/server/hi/lawl.mdl lawl all 0
models/server/hi/grr.mdl grr all 0
And this is in the log:

[GHW_Entspawner.amxx] [Ent-Spawner] Invalid sprite/model precache on line 1 of GHW_entspawner.ini
[GHW_Entspawner.amxx] [Ent-Spawner] Invalid sprite/model precache on line 2 of GHW_entspawner.ini
[GHW_Entspawner.amxx] [Ent-Spawner] Invalid sprite/model precache on line 3 of GHW_entspawner.ini[/QUOTE]

I am running the newest AMXx version.
KadiR is offline
'-_-'<3zok<3'-_-'
Senior Member
Join Date: Feb 2010
Location: Norway
Old 05-28-2010 , 20:59   Re: Model/Sprite Spawner w/ Auto-Respawner
Reply With Quote #73

Quote:
Originally Posted by GHW_Chronic View Post
only if they are custom sprites. You can spawn HL sprites or models and they won't have to DL.
Wonder why w cant pay em for doing that for "Clan stuff", well well.. never mind.
'-_-'<3zok<3'-_-' is offline
Send a message via Skype™ to '-_-'<3zok<3'-_-'
Silverss
Junior Member
Join Date: Mar 2010
Location: Hungary
Old 07-01-2011 , 18:46   Re: Model/Sprite Spawner w/ Auto-Respawner
Reply With Quote #74

You can drop the model or sprite to the air (Original plugin) and you can drop the model or sprite to the floor with this.
I hope it works!
I was not able to test it today. :$
This is my first rewritten plugin, i hope so not trouble.

Original plugin by: GHW_Chronic


Sorry for my bad english!
PHP Code:
#define VERSION    "3.0b"

#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta>

#define MAX_PRECACHES    200

new num
new precached[MAX_PRECACHES][32]
new 
precached_name[MAX_PRECACHES][32]
new 
precached_sequence[MAX_PRECACHES]
new 
configsdir[200]
new 
refferencefile[200]

public 
plugin_init()
{
    
register_plugin("Model / Sprite Spawner",VERSION,"GHW_Chronic|Silverss")
    
register_concmd("amx_spawn_air","spawnent_air",ADMIN_LEVEL_G," Spawns a Model / Sprite to the air <part of ent name> [Non-Default Sequence #]")
    
register_concmd("amx_spawn_floor","spawnent_floor",ADMIN_LEVEL_G," Spawns a Model / Sprite to the floor <part of ent name> [Non-Default Sequence #]")
    
register_concmd("amx_spawn_remove","removeent",ADMIN_LEVEL_G," Removes Model / Sprite you are standing next to. ")
    
register_concmd("amx_spawn_list","listents",ADMIN_LEVEL_G," Lists Models / Sprites precached for this map. ")
    
set_task(1.0,"map_load")
}

public 
plugin_precache()
{
    
register_dictionary("GHW_Entspawner.txt")

    
get_configsdir(configsdir,199)
    new 
precachefile[200]
    
format(precachefile,199,"%s/GHW_entspawner.ini",configsdir)
    
format(refferencefile,199,"%s/GHW_entspawner_refferences.ini",configsdir)
    if(
file_exists(precachefile))
    {
        new 
mapname[32]
        
get_mapname(mapname,31)
        new 
read[96], trash
        
new string[96]
        new 
modelname[32]
        new 
modelname2[32]
        new 
map[32]
        new 
sequence
        
for(new i=0;i<file_size(precachefile,1);i++)
        {
            
read_file(precachefile,i,read,95,trash)
            
strbreak(read,modelname,31,string,95)
            
strbreak(string,modelname2,31,string,95)
            
strbreak(string,map,31,string,95)
            
sequence str_to_num(string)
            if(
strlen(modelname) && strlen(map) && containi(modelname,";")!=0)
            {
                if(
equali(map,mapname) || equali(map,"all"))
                {
                    if(
containi(modelname,".spr")!=strlen(modelname)-&& containi(modelname,".mdl")!=strlen(modelname)-4)
                    {
                        
log_amx("[Ent-Spawner] %L",0,"MSG_INVALIDLOAD",i+1)
                    }
                    else
                    {
                        
precache_model(modelname)
                        
format(precached[num],31,"%s",modelname)
                        
format(precached_name[num],31,"%s",modelname2)
                        
precached_sequence[num] = sequence
                        num
++
                    }
                }
            }
        }
    }
}

public 
map_load()
{
    if(
file_exists(refferencefile))
    {
        new 
mapname[32]
        
get_mapname(mapname,31)
        
format(mapname,31,"[%s]",mapname)
        new 
read[32], trash
        
new modelname[32], sequenceFloat:origin[3], Float:angles[3], Float:v_angle[3]
        for(new 
i=0;i<file_size(refferencefile,1);i++)
        {
            
read_file(refferencefile,i,read,31,trash)
            if(
equali(read,mapname))
            {
                
i++
                
read_file(refferencefile,i,read,31,trash)
                for(new 
i2=0;i2<num;i2++)
                {
                    if(
equali(precached[i2],read))
                    {
                        
format(modelname,31,"%s",read)
                        
i++
                        
read_file(refferencefile,i,read,31,trash)
                        
sequence str_to_num(read)
                        
i++
                        
read_file(refferencefile,i,read,31,trash)
                        
origin[0] = str_to_float(read)
                        
i++
                        
read_file(refferencefile,i,read,31,trash)
                        
origin[1] = str_to_float(read)
                        
i++
                        
read_file(refferencefile,i,read,31,trash)
                        
origin[2] = str_to_float(read)
                        
i++
                        
read_file(refferencefile,i,read,31,trash)
                        
angles[0] = str_to_float(read)
                        
i++
                        
read_file(refferencefile,i,read,31,trash)
                        
angles[1] = str_to_float(read)
                        
i++
                        
read_file(refferencefile,i,read,31,trash)
                        
angles[2] = str_to_float(read)
                        
i++
                        
read_file(refferencefile,i,read,31,trash)
                        
v_angle[0] = str_to_float(read)
                        
i++
                        
read_file(refferencefile,i,read,31,trash)
                        
v_angle[1] = str_to_float(read)
                        
i++
                        
read_file(refferencefile,i,read,31,trash)
                        
v_angle[2] = str_to_float(read)

                        new 
ent create_entity("info_target")

                        
entity_set_string(ent,EV_SZ_classname,"ghw_spawned_ent")

                        
entity_set_model(ent,modelname)

                        
entity_set_origin(ent,origin)
                        
entity_set_vector(ent,EV_VEC_v_angle,v_angle)
                        
entity_set_vector(ent,EV_VEC_angles,angles)

                        
entity_set_int(entEV_INT_solid,SOLID_NOT)
                        
entity_set_int(ent,EV_INT_movetype,MOVETYPE_FLY)
                        
entity_set_edict(ent,EV_ENT_owner,33)

                        
entity_set_float(ent,EV_FL_framerate,1.0)
                        
entity_set_int(ent,EV_INT_sequence,sequence)

                        
entity_set_size(ent,Float:{-0.1, -0.1, -0.1},Float:{0.10.10.1})

                        break;
                    }
                    if(
i2==num-1)
                    {
                        
log_amx("[Ent-Spawner] %L",0,"MSG_INVALIDSPAWN",read)
                    }
                }
            }
        }
    }
    return 
PLUGIN_CONTINUE
}

public 
listents(id,level,cid)
{
    if(!
cmd_access(id,level,cid,1))
    {
        return 
PLUGIN_HANDLED
    
}
    
console_print(id,"")
    
console_print(id,"[AMXX] %L",id,"MSG_LIST_BEGINNING1",num)
    
console_print(id,"[AMXX] %L",id,"MSG_LIST_BEGINNING2")
    
console_print(id,"[AMXX] -------")
    for(new 
i=0;i<num;i++)
    {
        
console_print(id,"[AMXX] %L",id,"MSG_LIST_MIDDLE ",1,precached[i],precached_name[i],precached_sequence[i])
    }
    
console_print(id,"[AMXX] -------")
    
console_print(id,"")
    return 
PLUGIN_HANDLED
}

public 
removeent(id,level,cid)
{
    if(!
cmd_access(id,level,cid,1))
    {
        return 
PLUGIN_HANDLED
    
}
    new 
Float:origin[3]
    
entity_get_vector(id,EV_VEC_origin,origin)
    new 
closest=0
    
new Float:closestdis=99999.0
    
new ent find_ent_in_sphere(get_maxplayers(),origin,100.0)
    new 
Float:origin2[3]
    new 
classname[32]
    while(
ent)
    {
        
entity_get_string(ent,EV_SZ_classname,classname,31)
        if(
equali(classname,"ghw_spawned_ent_inair"))
        if(
equali(classname,"ghw_spawned_ent_onfloor"))
        {
            
entity_get_vector(ent,EV_VEC_origin,origin2)
            if(
get_distance_f(origin,origin2)<closestdis)
            {
                
closestdis=get_distance_f(origin,origin2)
                
closest=ent
            
}
        }
        
ent find_ent_in_sphere(ent,origin,100.0)
    }
    if(
closest)
    {
        
entity_get_vector(closest,EV_VEC_origin,origin)
        new 
read[32], trash
        
new string[8]
        new 
mapname[32]
        
get_mapname(mapname,31)
        
format(mapname,31,"[%s]",mapname)
        for(new 
i=0;i<file_size(refferencefile,1);i++)
        {
            
read_file(refferencefile,i,read,31,trash)
            if(
equali(read,mapname))
            {
                
i+=3
                read_file
(refferencefile,i,read,31,trash)
                
format(string,7,"%f",origin[0])
                if(
str_to_float(read)==origin[0])
                {
                    
console_print(id,"2")
                    
i++
                    
read_file(refferencefile,i,read,31,trash)
                    
format(string,7,"%f",origin[1])
                    if(
str_to_float(read)==origin[1])
                    {
                        
i++
                        
read_file(refferencefile,i,read,31,trash)
                        
format(string,7,"%f",origin[2])
                        if(
str_to_float(read)==origin[2])
                        {
                            
remove_entity(closest)
                            
write_file(refferencefile,"",i-5)
                            
write_file(refferencefile,"",i-4)
                            
write_file(refferencefile,"",i-3)
                            
write_file(refferencefile,"",i-2)
                            
write_file(refferencefile,"",i-1)
                            
write_file(refferencefile,"",i)
                            
write_file(refferencefile,"",i+1)
                            
write_file(refferencefile,"",i+2)
                            
write_file(refferencefile,"",i+3)
                            
write_file(refferencefile,"",i+4)
                            
write_file(refferencefile,"",i+5)
                            
write_file(refferencefile,"",i+6)
                            
console_print(id,"[AMXX] %L",id,"MSG_REMOVED")
                            return 
PLUGIN_HANDLED
                        
}
                    }
                }
            }
        }
    }
    
console_print(id,"[AMXX] %L",id,"MSG_NOREMOVE")
    return 
PLUGIN_HANDLED
}

public 
spawnent_air(id,level,cid)
{
    if(!
cmd_access(id,level,cid,2))
    {
        return 
PLUGIN_HANDLED
    
}
    new 
arg1[32]
    
read_argv(1,arg1,31)
    new 
arg2[32]
    
read_argv(2,arg2,31)
    new 
num2=-1
    
for(new i=0;i<num;i++)
    {
        if(
containi(precached_name[i],arg1)!=-1)
        {
            if(
num2!=-1)
            {
                
console_print(id,"[AMXX] %L",id,"MSG_NOSPAWN_MORE",arg1)
                return 
PLUGIN_HANDLED
            
}
            
num2=i
        
}
    }
    if(
num2==-1)
    {
        
console_print(id,"[AMXX] %L",id,"MSG_NOSPAWN_NONE",arg1)
        return 
PLUGIN_HANDLED
    
}
    new 
sequence str_to_num(arg2)
    if(!
strlen(arg2))
    {
        
sequence precached_sequence[num2]
    }
    new 
Float:origin[3]
    new 
Float:angles[3]
    new 
Float:v_angle[3]
    
entity_get_vector(id,EV_VEC_origin,origin)
    
entity_get_vector(id,EV_VEC_v_angle,v_angle)
    
entity_get_vector(id,EV_VEC_angles,angles)

    new 
ent create_entity("info_target")

    
entity_set_string(ent,EV_SZ_classname,"ghw_spawned_ent")

    
entity_set_model(ent,precached[num2])

    
entity_set_origin(ent,origin)
    
entity_set_vector(ent,EV_VEC_v_angle,v_angle)
    
entity_set_vector(ent,EV_VEC_angles,angles)

    
entity_set_int(entEV_INT_solid,SOLID_NOT)
    
entity_set_int(ent,EV_INT_movetype,MOVETYPE_FLY)
    
entity_set_edict(ent,EV_ENT_owner,33)

    
entity_set_float(ent,EV_FL_framerate,1.0)
    
entity_set_int(ent,EV_INT_sequence,sequence)

    
entity_set_size(ent,Float:{-0.1, -0.1, -0.1},Float:{0.10.10.1})

    new 
mapname[32]
    new 
string[16]
    
get_mapname(mapname,31)
    
format(mapname,31,"[%s]",mapname)
    
write_file(refferencefile,mapname,-1)
    
write_file(refferencefile,precached[num2],-1)
    
format(string,15,"%d",sequence)
    
write_file(refferencefile,string,-1)
    
format(string,15,"%f",origin[0])
    
write_file(refferencefile,string,-1)
    
format(string,15,"%f",origin[1])
    
write_file(refferencefile,string,-1)
    
format(string,15,"%f",origin[2])
    
write_file(refferencefile,string,-1)
    
format(string,15,"%f",angles[0])
    
write_file(refferencefile,string,-1)
    
format(string,15,"%f",angles[1])
    
write_file(refferencefile,string,-1)
    
format(string,15,"%f",angles[2])
    
write_file(refferencefile,string,-1)
    
format(string,15,"%f",v_angle[0])
    
write_file(refferencefile,string,-1)
    
format(string,15,"%f",v_angle[1])
    
write_file(refferencefile,string,-1)
    
format(string,15,"%f",v_angle[2])
    
write_file(refferencefile,string,-1)

    
console_print(id,"[AMXX] %L",id,"MSG_SPAWN",precached_name[num2],sequence)
    return 
PLUGIN_HANDLED
}

public 
spawnent_floor(id,level,cid)
{
    if(!
cmd_access(id,level,cid,2))
    {
        return 
PLUGIN_HANDLED
    
}
    new 
arg1[32]
    
read_argv(1,arg1,31)
    new 
arg2[32]
    
read_argv(2,arg2,31)
    new 
num2=-1
    
for(new i=0;i<num;i++)
    {
        if(
containi(precached_name[i],arg1)!=-1)
        {
            if(
num2!=-1)
            {
                
console_print(id,"[AMXX] %L",id,"MSG_NOSPAWN_MORE",arg1)
                return 
PLUGIN_HANDLED
            
}
            
num2=i
        
}
    }
    if(
num2==-1)
    {
        
console_print(id,"[AMXX] %L",id,"MSG_NOSPAWN_NONE",arg1)
        return 
PLUGIN_HANDLED
    
}
    new 
sequence str_to_num(arg2)
    if(!
strlen(arg2))
    {
        
sequence precached_sequence[num2]
    }
    new 
Float:origin[3]
    new 
Float:angles[3]
    new 
Float:v_angle[3]
    
entity_get_vector(id,EV_VEC_origin,origin)
    
entity_get_vector(id,EV_VEC_v_angle,v_angle)
    
entity_get_vector(id,EV_VEC_angles,angles)

    new 
ent create_entity("info_target")

    
entity_set_string(ent,EV_SZ_classname,"ghw_spawned_ent")

    
entity_set_model(ent,precached[num2])

    
entity_set_origin(ent,origin)
    
entity_set_vector(ent,EV_VEC_v_angle,v_angle)
    
entity_set_vector(ent,EV_VEC_angles,angles)

    
entity_set_int(entEV_INT_solid,SOLID_NOT)
    
entity_set_int(ent,EV_INT_movetype,MOVETYPE_FLY)
    
entity_set_edict(ent,EV_ENT_owner,33)

    
entity_set_float(ent,EV_FL_framerate,1.0)
    
entity_set_int(ent,EV_INT_sequence,sequence)

    
entity_set_size(ent,Float:{-0.1, -0.1, -0.1},Float:{0.10.10.1})
    
    
engfunc(EngFunc_DropToFloorent)

    new 
mapname[32]
    new 
string[16]
    
get_mapname(mapname,31)
    
format(mapname,31,"[%s]",mapname)
    
write_file(refferencefile,mapname,-1)
    
write_file(refferencefile,precached[num2],-1)
    
format(string,15,"%d",sequence)
    
write_file(refferencefile,string,-1)
    
format(string,15,"%f",origin[0])
    
write_file(refferencefile,string,-1)
    
format(string,15,"%f",origin[1])
    
write_file(refferencefile,string,-1)
    
format(string,15,"%f",origin[2])
    
write_file(refferencefile,string,-1)
    
format(string,15,"%f",angles[0])
    
write_file(refferencefile,string,-1)
    
format(string,15,"%f",angles[1])
    
write_file(refferencefile,string,-1)
    
format(string,15,"%f",angles[2])
    
write_file(refferencefile,string,-1)
    
format(string,15,"%f",v_angle[0])
    
write_file(refferencefile,string,-1)
    
format(string,15,"%f",v_angle[1])
    
write_file(refferencefile,string,-1)
    
format(string,15,"%f",v_angle[2])
    
write_file(refferencefile,string,-1)

    
console_print(id,"[AMXX] %L",id,"MSG_SPAWN",precached_name[num2],sequence)
    return 
PLUGIN_HANDLED

Commands:
amx_spawn_air
amx_spawn_floor


UPDATE! 2011.07.02 1:06

3.0b First Release! + Fix bug.

Tested! It works! Have Fun!

Last edited by Silverss; 08-29-2011 at 08:34. Reason: Fix2
Silverss is offline
Send a message via MSN to Silverss Send a message via Skype™ to Silverss
Trethy
Member
Join Date: Jun 2011
Old 07-06-2011 , 06:51   Re: Model/Sprite Spawner w/ Auto-Respawner
Reply With Quote #75

Cool!
__________________
Im new at coding..
And i need things for my jailbreak server

But no one help me..
Trethy is offline
kbr
Member
Join Date: Sep 2011
Old 09-09-2013 , 04:22   Re: Model/Sprite Spawner w/ Auto-Respawner
Reply With Quote #76

Can someone add "amx_spawn_removeall" in order to remove all sprites and models?

Quote:
Originally Posted by Silverss View Post
Tested! It works! Have Fun!
Doesn't work, they still spawn on air.

btw is there any way to make them solid?

Last edited by kbr; 09-10-2013 at 14:59.
kbr is offline
Syturi0
Veteran Member
Join Date: Aug 2014
Location: Your mom house -Portugal
Old 08-29-2014 , 01:38   Re: Model/Sprite Spawner w/ Auto-Respawner
Reply With Quote #77

I can only spawn default models from CS, if i add a custom one it doesnt recognizes it. Can someone fix that?
Syturi0 is offline
ANTICHRISTUS
kingdom of weird stuff
Join Date: Jun 2010
Location: My kingdom is not in thi
Old 09-01-2014 , 17:57   Re: Model/Sprite Spawner w/ Auto-Respawner
Reply With Quote #78

try to reread the previous posts, if there is nothing similar to your request then use a precache plugin to precache your needed resources. where to find it ? search precache* in titles (plugins sub-forums) .
__________________
ANTICHRISTUS is offline
davidkoh007
Junior Member
Join Date: Mar 2015
Old 12-12-2016 , 09:45   Re: Model/Sprite Spawner w/ Auto-Respawner
Reply With Quote #79

can i spawn a model that plays some certain music? like the radio in cs italy
davidkoh007 is offline
james 007
Member
Join Date: Dec 2014
Location: Portugal
Old 03-22-2019 , 09:13   Re: Model/Sprite Spawner w/ Auto-Respawner
Reply With Quote #80

[bp]
MSG_INVALIDLOAD = Precache de sprite / modelo invalido na linha %d de GHW_entspawner.ini
MSG_INVALIDSPAWN = Modelo %s nao pre-cache. Nao foi possível carregar automaticamente a entidade gerada a partir do arquivo de referencia.
MSG_LIST_BEGINNING1 = %d precaches para este mapa.
MSG_LIST_BEGINNING2 = #. Nome - Nome do arquivo - Sequencia padrao
MSG_LIST_MIDDLE = %d. %s - %s - %d
MSG_REMOVED = 1 entidade gerada removida.
MSG_NOREMOVE = Voce nao esta perto de uma entidade gerada.
MSG_NOSPAWN_MORE = Mais que 1 model/sprite contendo ^"%s^" foi encontrado.
MSG_NOSPAWN_NONE = Nenhum model/sprite contendo ^"%s^" foi encontrado.
MSG_SPAWN = Gerou um %s Entre em sua localização usando a sequência %d.
__________________
james 007 is offline
Reply


Thread Tools
Display Modes

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:34.


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