Raised This Month: $ Target: $400
 0% 

Replace Sprites


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 01-22-2009 , 14:13   Replace Sprites
Reply With Quote #1

Hey,

is there anyway to replace sprits like models?

example : myhud.spr replaced on hud.spr like the weapon model erplacer.
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-22-2009 , 14:24   Re: Replace Sprites
Reply With Quote #2

Negative for hud sprites (like weapons sprites), yes for in space sprites (like explosions sprites).
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 01-22-2009 , 14:32   Re: Replace Sprites
Reply With Quote #3

Quote:
Originally Posted by ConnorMcLeod View Post
Negative for hud sprites (like weapons sprites), yes for in space sprites (like explosions sprites).
Hey,

Ok how can i replace another sprites?ì wannt to add own buy menu.with my own pics & ...or this is too imp.?
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 01-22-2009 , 14:34   Re: Replace Sprites
Reply With Quote #4

I think those are generated from client-side files.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 01-22-2009 , 14:43   Re: Replace Sprites
Reply With Quote #5

Quote:
Originally Posted by Exolent[jNr] View Post
I think those are generated from client-side files.
Hey,

so then no way :-(

i thinked anything about this would work :-(

PHP Code:
#define VERSION    "1"

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

#define MAX_SOUNDS    50
#define MAX_p_spriteS    50
#define MAX_v_spriteS    50
#define MAX_w_spriteS    50

#define MAP_CONFIGS    1

new new_sounds[MAX_SOUNDS][48]
new 
old_sounds[MAX_SOUNDS][48]
new 
sounds_team[MAX_SOUNDS]
new 
soundsnum

new new_p_sprites[MAX_p_spriteS][48]
new 
old_p_sprites[MAX_p_spriteS][48]
new 
p_sprites_team[MAX_p_spriteS]
new 
p_spritesnum

new new_v_sprites[MAX_v_spriteS][48]
new 
old_v_sprites[MAX_v_spriteS][48]
new 
v_sprites_team[MAX_p_spriteS]
new 
v_spritesnum

new new_w_sprites[MAX_w_spriteS][48]
new 
old_w_sprites[MAX_w_spriteS][48]
new 
w_sprites_team[MAX_p_spriteS]
new 
w_spritesnum

new maxplayers

public plugin_init()
{
    
register_plugin("test",VERSION,"test")
    
register_forward(FM_EmitSound,"Sound_Hook")
    
register_forward(FM_Setsprite,"W_sprite_Hook",1)
    
register_logevent("newround",2,"1=Round_Start")
    
register_event("Curhud","Changehud_Hook","be","1=1")
    
maxplayers get_maxplayers()
}

public 
plugin_precache()
{
    new 
configfile[200]
    new 
configsdir[200]
    new 
map[32]
    
get_configsdir(configsdir,199)
    
get_mapname(map,31)
    
format(configfile,199,"%s/new_huds_%s.ini",configsdir,map)
    if(
file_exists(configfile))
    {
        
load_spritesprites(configfile)
    }
    else
    {
        
format(configfile,199,"%s/new_huds.ini",configsdir)
        
load_sprites(configfile)
    }
}

public 
load_sprites(configfile[])
{
    if(
file_exists(configfile))
    {
        new 
read[96], left[48], right[48], right2[32], trashteam
        
for(new i=0;i<file_size(configfile,1);i++)
        {
            
read_file(configfile,i,read,95,trash)
            if(
containi(read,";")!=&& containi(read," ")!=-1)
            {
                
strbreak(read,left,47,right,47)
                
team=0
                
if(containi(right," ")!=-1)
                {
                    
strbreak(right,right,47,right2,31)
                    
replace_all(right2,31,"^"","")
                    if(
                    equali(right2,"
T") ||
                    equali(right2,"
Terrorist") ||
                    equali(right2,"
Terrorists") ||
                    equali(right2,"
Blue") ||
                    equali(right2,"B") ||
                    equali(right2,"
Allies") ||
                    equali(right2,"
1")
                    ) team=1
                    else if(
                    equali(right2,"
CT") ||
                    equali(right2,"
Counter") ||
                    equali(right2,"
Counter-Terrorist") ||
                    equali(right2,"
Counter-Terrorists") ||
                    equali(right2,"
CounterTerrorists") ||
                    equali(right2,"
CounterTerrorist") ||
                    equali(right2,"
Red") ||
                    equali(right2,"
R") ||
                    equali(right2,"
Axis") ||
                    equali(right2,"
2")
                    ) team=2
                    else if(
                    equali(right2,"
Yellow") ||
                    equali(right2,"
Y") ||
                    equali(right2,"
3")
                    ) team=3
                    else if(
                    equali(right2,"
Green") ||
                    equali(right2,"
G") ||
                    equali(right2,"
4")
                    ) team=4
                }
                replace_all(right,47,"
^"","")
                if(
file_exists(right))
                {
                    if(
containi(right,".mdl")==strlen(right)-4)
                    {
                        if(!
precache_sprite(right))
                        {
                            
log_amx("Error attempting to precache sprite: ^"%s^" (Line %d of new_huds.ini)",right,i+1)
                        }
                        else if(
containi(left,"sprite/p_")==0)
                        {
                            
format(new_p_sprite[p_spritesnum],47,right)
                            
format(old_p_sprites[p_spritesnum],47,left)
                            
p_sprites_team[p_spritesnum]=team
                            p_spritesnum
++
                        }
                        else if(
containi(left,"sprites/v_")==0)
                        {
                            
format(new_v_sprites[v_spritesnum],47,right)
                            
format(old_v_sprites[v_spritesnum],47,left)
                            
v_sprites_team[v_spritesnum]=team
                            v_spritesnum
++
                        }
                        else if(
containi(left,"sprites/w_")==0)
                        {
                            
format(new_w_sprites[w_spritesnum],47,right)
                            
format(old_w_sprites[w_spritesnum],47,left)
                            
w_sprites_team[w_spritesnum]=team
                            w_spritesnum
++
                        }
                        else
                        {
                            
log_amx("sprite type(p_ / v_ / w_) unknown for sprite: ^"%s^" (Line %d of new_huds.ini)",right,i+1)
                        }
                    }
                    else if(
containi(right,".wav")==strlen(right)-|| containi(right,".mp3")==strlen(right)-4)
                    {
                        
replace(right,47,"sound/","")
                        
replace(left,47,"sound/","")
                        if(!
precache_sound(right))
                        {
                            
log_amx("Error attempting to precache sound: ^"%s^" (Line %d of new_huds.ini)",right,i+1)
                        }
                        else
                        {
                            
format(new_sounds[soundsnum],47,right)
                            
format(old_sounds[soundsnum],47,left)
                            
sounds_team[soundsnum]=team
                            soundsnum
++
                        }
                    }
                    else
                    {
                        
log_amx("Invalid File: ^"%s^" (Line %d of new_huds.ini)",right,i+1)
                    }
                }
                else
                {
                    
log_amx("File Inexistent: ^"%s^" (Line %d of new_huds.ini)",right,i+1)
                }
                
/*if(!file_exists(left))
                {
                    log_amx("Warning: File Inexistent: ^"%s^" (Line %d of new_huds.ini). ONLY A WARNING. PLUGIN WILL STILL WORK!!!!",left,i+1)
                }*/
            
}
        }
    }
}

public 
Changehud_Hook(id)
{
    if(!
is_user_alive(id))
    {
        return 
PLUGIN_CONTINUE
    
}
    static 
sprite[32], iteam

    team 
get_user_team(id)

    
pev(id,pev_viewsprite2,sprite,31)
    for(
i=0;i<v_spritesnum;i++)
    {
        if(
equali(sprite,old_v_sprites[i]))
        {
            if(
v_sprites_team[i]==team || !v_sprites_team[i])
            {
                
set_pev(id,pev_viewsprite2,new_v_sprites[i])
                break;
            }
        }
    }

    
pev(id,pev_hudsprite2,sprite,31)
    for(
i=0;i<p_spritesnum;i++)
    {
        if(
equali(sprite,old_p_sprites[i]))
        {
            if(
p_sprites_team[i]==team || !p_sprites_team[i])
            {
                
set_pev(id,pev_hudsprite2,new_p_sprites[i])
                break;
            }
        }
    }
    return 
PLUGIN_CONTINUE
}

public 
Sound_Hook(id,channel,sample[])
{
    if(!
is_user_alive(id))
    {
        return 
FMRES_IGNORED
    
}
    if(
channel!=CHAN_hud && channel!=CHAN_ITEM)
    {
        return 
FMRES_IGNORED
    
}

    static 
iteam

    team 
get_user_team(id)

    for(
i=0;i<soundsnum;i++)
    {
        if(
equali(sample,old_sounds[i]))
        {
            if(
sounds_team[i]==team || !sounds_team[i])
            {
                
engfunc(EngFunc_EmitSound,id,CHAN_hud,new_sounds[i],1.0,ATTN_NORM,0,PITCH_NORM)
                return 
FMRES_SUPERCEDE
            
}
        }
    }
    return 
FMRES_IGNORED
}

public 
W_sprite_Hook(ent,sprite[])
{
    if(!
pev_valid(ent))
    {
        return 
FMRES_IGNORED
    
}
    static 
i
    
for(i=0;i<w_spritesnum;i++)
    {
        if(
equali(sprite,old_w_sprites[i]))
        {
            
engfunc(EngFunc_Setsprite,ent,new_w_sprites[i])
            return 
FMRES_SUPERCEDE
        
}
    }
    return 
FMRES_IGNORED
}

public 
newround()
{
    static 
entclassname[8], sprite[32]
    
ent engfunc(EngFunc_FindEntityInSphere,maxplayers,Float:{0.0,0.0,0.0},4800.0)
    while(
ent)
    {
        if(
pev_valid(ent))
        {
            
pev(ent,pev_classname,classname,7)
            if(
containi(classname,"armoury")!=-1)
            {
                
pev(ent,pev_sprite,sprite,31)
                
W_sprite_Hook(ent,sprite)
            }
        }
        
ent engfunc(EngFunc_FindEntityInSphere,ent,Float:{0.0,0.0,0.0},4800.0)
    }

__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
Sn!ff3r
Veteran Member
Join Date: Aug 2007
Location: Poland
Old 01-22-2009 , 14:46   Re: Replace Sprites
Reply With Quote #6

PHP Code:
register_forward(FM_Setsprite,"W_sprite_Hook",1
PHP Code:
set_pev(id,pev_viewsprite2 
PHP Code:
register_event("Curhud","Changehud_Hook","be","1=1"
PHP Code:
pev(id,pev_hudsprite2,sprite,31
Wtf?

Funny
__________________
Join US - custom Zombie Server - Custom Addons:




Last edited by Sn!ff3r; 01-22-2009 at 14:48.
Sn!ff3r is offline
Send a message via Skype™ to Sn!ff3r
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 01-22-2009 , 14:48   Re: Replace Sprites
Reply With Quote #7

Quote:
Originally Posted by Sn!ff3r View Post
PHP Code:
register_forward(FM_Setsprite,"W_sprite_Hook",1
PHP Code:
set_pev(id,pev_viewsprite2 
Wtf ?
Hey,

this was just a test & i wont to show u what i mean.4get this code.its just a exaple :-(
Yea its funny cuz i just copied this from the model replacer & added sprites on models :-D how i said, just a example...
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
Sn!ff3r
Veteran Member
Join Date: Aug 2007
Location: Poland
Old 01-22-2009 , 14:49   Re: Replace Sprites
Reply With Quote #8

Ah, example, sorry...

Unfortunately you cant change them.
__________________
Join US - custom Zombie Server - Custom Addons:



Sn!ff3r is offline
Send a message via Skype™ to Sn!ff3r
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 01-22-2009 , 14:50   Re: Replace Sprites
Reply With Quote #9

Quote:
Originally Posted by Sn!ff3r View Post
Ah, example, sorry...

Unfortunately you cant change them.
Hey,

ok :-( ty
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-23-2009 , 00:41   Re: Replace Sprites
Reply With Quote #10

Have a look at fakemeta_const.inc.
Have a look at avaible events : http://wiki.amxmodx.org/Half-Life_1_Game_Events
You can't create new forwards, new events.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod 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 01:37.


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