Raised This Month: $62 Target: $400
 15% 

Sprite from anywhere


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Gabe Iggy
Veteran Member
Join Date: Mar 2011
Location: Chile
Old 04-14-2019 , 21:50   Sprite from anywhere
Reply With Quote #1

Hello

I was wondering if there's a snippet to display a sprite visible from anywhere (even through walls).
Haven't found anything so far.

Thanks in advance.
__________________

Current Handle Name: G.I. | Gabe Iggy (Steam)
Public Plugins:
Static.cfg Restoration | Sven Co-op Player vs Player | Hide Donator Icons
Discord: http://discord.daijobu.org/
Gabe Iggy is offline
SomewhereLost
Senior Member
Join Date: Mar 2014
Location: Tomorrowland
Old 04-14-2019 , 22:08   Re: Sprite from anywhere
Reply With Quote #2

I think its done thru addtofullpack.
__________________
SomewhereLost is offline
Send a message via Skype™ to SomewhereLost
Gabe Iggy
Veteran Member
Join Date: Mar 2011
Location: Chile
Old 04-16-2019 , 11:29   Re: Sprite from anywhere
Reply With Quote #3

Yes, I know it might be done in AddToFullPack, but I haven't found any example of this.

Plugins that managed to do this like Admin Spectator ESP or Peeping Tom have so much stuff in this method that is hard to read for me at least.
__________________

Current Handle Name: G.I. | Gabe Iggy (Steam)
Public Plugins:
Static.cfg Restoration | Sven Co-op Player vs Player | Hide Donator Icons
Discord: http://discord.daijobu.org/

Last edited by Gabe Iggy; 04-16-2019 at 12:38.
Gabe Iggy is offline
SomewhereLost
Senior Member
Join Date: Mar 2014
Location: Tomorrowland
Old 04-16-2019 , 13:07   Re: Sprite from anywhere
Reply With Quote #4

Okay, this plugin is used on zombie servers, see the part STW thats for seeing thru walls, basically this tree has a sprite which can be seen through any obstacle, maybe you could figure out something with this.

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta_util>
#include <hamsandwich>
#include <engine>
#include <fun>
#include <zombieplague>
#include <WPMGPrintChatColor>
#include <dhudmessage>

#define PLUGIN "NewYearTree's"
#define VERSION "1.2b"
#define AUTHOR "shel"
#define PREFIX "Tree-Spawner"

#define is_INvelid(%1)    (0<%1<33)                        //Is_user_connected...
#define TASK_DEATH_TIMER    785689                        //id of Task
#define M_TIMER    546245                                    //Don't tach this, if u don't know what it's do
#define TIMEFORSPAWNNEXT    5                            //How many second's left for next activate allow(#SPRITE squency max 255 ~ 4.14min or 255 seconds Engine limit)

//#define STW                            //Undefine if u don't like  see through walls sprite
/************************************************ SETTINGS ************************************************/
#define DHUDZ                                            //Show DHUD message's
#define COMMAND    "say tree_spawz"                        //Command for call menu
#define AFLAG    "l"                                        //AmxModX flag for acces
#define userFlags(%0) (get_user_flags(%0) & read_flags(AFLAG))
#define ELKA    "new_year_model_tree"                    //ClassName 
#define MDL        "models/new_year_tree.mdl"        //Model
#define SPRITE    "sprites/new_year_snowman.spr"    //Sprite
#define SpriteClassName    "spawn_timer"                //Sprite ClassName for register
#define PUBLIC                                        //Undefine if u use this plugin on public server's
#if !defined PUBLIC
/***************ZM***************/
/*#define RANDAMMO                                        //Random count of ammopacks
#if defined RANDAMMO
new ammo;
#define FROMA    70 
#define TOA    200
#else
#define AMMO    150                                        //How Many Ammo Give if RANDAMMO undefined
#endif
/***************ZM***************/
#else
/***************PUBLIC***************/
#define    RANDMONEY
#if defined    RANDMONEY
#define FROMAM    1500 
#define TOAM    8000
new money;
#else
#define MONEY    1500                                    //How many money give
#endif
/***************PUBLIC***************/

#endif

///Uncomment if you want use it
//if u use model with anim undefine AMDL
#define AMDL
/************************************************SETTINGS************************************************/

new g_infoTarget,g_menuId = -1,boolg_registration,g_AllTrees,boolg_ssad,HamHook:g_HamHookZ,Array:tree_id,Array:x_tree,Array:y_tree,Float:tree_fSpawn_next[8096],z_TimerZZZ[8096],Array:z_tree

public plugin_init(){
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd(COMMAND"trees")
    
g_infoTarget engfunc(EngFunc_AllocString"info_target")
}
public 
FakeMeta_AddToFullPack_Post(ES_HandleiEiEntityiHost){
    if(!
pev_valid(iEntity) || pev(iEntitypev_iuser1) != M_TIMER) return FMRES_IGNORED;
    new 
Float:vecHostOrigin[3], Float:vecNormal[3];
    
pev(iHostpev_originvecHostOrigin);
    new 
pTr create_tr2();
    
#if defined STW
    
new Float:vecEntityOrigin[3], Float:vecEndPos[3];
    
pev(iEntitypev_originvecEntityOrigin);
    
engfunc(EngFunc_TraceLinevecHostOriginvecEntityOriginIGNORE_MONSTERSiEntitypTr);
    
get_tr2(pTrTR_vecEndPosvecEndPos);
    
get_tr2(pTrTR_vecPlaneNormalvecNormal);
    
xs_vec_mul_scalar(vecNormal10.0vecNormal);
    
xs_vec_add(vecEndPosvecNormalvecNormal);
    
set_es(ES_HandleES_OriginvecNormal);
    
#endif
    
new Float:fDistFloat:fScale;
    
fDist get_distance_f(vecNormalvecHostOrigin);
    
fScale fDist 300.0;
    if(
fScale 0.4fScale 0.4;
    else if(
fScale 1.0fScale 1.0;
    
set_es(ES_HandleES_ScalefScale);
    
set_es(ES_HandleES_Frametree_fSpawn_next[pev(iEntitypev_iuser2)]);
    
free_tr2(pTr);
    return 
FMRES_IGNORED
}
boolsave_gifts(){
    new 
map[32]
    
get_mapname(mapcharsmax(map))
    
formatex(mapcharsmax(map), "%s.ini"map)
    new 
cfgDir[64], iFile[128]
    
get_configsdir(cfgDircharsmax(cfgDir))
    
formatex(cfgDircharsmax(cfgDir), "%s/gifts"cfgDir)
    
formatex(iFilecharsmax(iFile), "%s/%s"cfgDirmap)
    if(!
dir_exists(cfgDir))
        if(!
mkdir(cfgDir))
            return 
false
    delete_file
(iFile)
    if(!
g_AllTrees)
        return 
true
    
for(new 0g_AllTreesi++){
        new 
text[1024], Float:fOrigin[3], ent ArrayGetCell(tree_idi)
        
pev(entpev_originfOrigin)
        
format(textcharsmax(text),"^"%f^" ^"%f^" ^"%f^"",fOrigin[0], fOrigin[1], fOrigin[2])
        
write_file(iFiletexti)
    }
    return 
true
}
get_gifts(const iFile[1024]){    
    new 
file fopen(iFile"rt")
    if(!
file) return;        
    while(
file && !feof(file)){
        new 
sfLineData[512]
        
fgets(filesfLineDatacharsmax(sfLineData))    
        if(
sfLineData[0] == ';')
            continue    
        if(
sfLineData[0] == '/' && sfLineData[1] == '/')
            continue
        if(
equal(sfLineData""))
            continue        
        new 
origins[3][32], FloatfOrigin[3]        
        
parse(sfLineDataorigins[0], 31origins[1], 31origins[2], 31)
        
fOrigin[0] = str_to_float(origins[0])
        
fOrigin[1] = str_to_float(origins[1])
        
fOrigin[2] = str_to_float(origins[2])
        
create_gift(fOrigin)
    }
    
fclose(file)
}
boolcreate_gift(const FloatfOrigin[3]){
    new 
ent engfunc(EngFunc_CreateNamedEntityg_infoTarget)
    if(!
pev_valid(ent)) return false
    
if(!g_registration){    
        
g_HamHookZ RegisterHamFromEntity(Ham_Touchent"fw_TouchGift")
        
register_forward(FM_AddToFullPack"FakeMeta_AddToFullPack_Post"1);
        
tree_id ArrayCreate()
        
x_tree ArrayCreate()
        
y_tree ArrayCreate()
        
z_tree ArrayCreate()
        
g_registration true
    
}    
    
ArrayPushCell(tree_ident)
    
ArrayPushCell(x_treefOrigin[0])
    
ArrayPushCell(y_treefOrigin[1])
    
ArrayPushCell(z_treefOrigin[2])
    
drop_to_floor ent )
    
engfunc(EngFunc_SetModelentMDL)
    
set_pev(entpev_originfOrigin)
    
set_pev(entpev_solidSOLID_BBOX)
    
set_pev(entpev_classnameELKA)
    
engfunc(EngFunc_SetSizeentFloat:{-16.0, -16.0, -16.0}, Float:{16.716.71500.0})
    
#if defined AMDL
    
set_peventpev_framerate1.0 );
    
set_peventpev_sequence);
    
set_peventpev_animtimeget_gametime( ) );
    
#endif
    
g_AllTrees++
    return 
true 
}

public 
plugin_precache(){
    
precache_model(MDL)
    
engfunc(EngFunc_PrecacheModelSPRITE);
}

public 
plugin_cfg(){
    new 
map[32]
    
get_mapname(mapcharsmax(map))
    
formatex(mapcharsmax(map),"%s.ini",map)
    new 
cfgDir[1024], iDiriFile[1024]
    
get_configsdir(cfgDircharsmax(cfgDir))
    
formatex(cfgDircharsmax(cfgDir), "%s/gifts"cfgDir)
    
iDir open_dir(cfgDiriFilecharsmax(iFile))
    if(
iDir){
        while(
next_file(iDiriFilecharsmax(iFile))){
            if (
iFile[0] == '.')
                continue
            if(
equal(mapiFile)){
                
format(iFile1024"%s/%s"cfgDiriFile)
                
get_gifts(iFile)
                break
            }
        }
    }
}
public 
fw_TouchGift(entid){    
    if(!
is_user_alive(id)) return
    if(!
pev_valid(ent)) return
    static 
className[32]
    
pev(entpev_classnameclassName31)
    if(!
equal(classNameELKA))
        return
    if(
entity_get_int(idEV_INT_button) & IN_USE){
        new 
name[32
        
get_user_name(idname31
        
#if !defined PUBLIC
            #if defined RANDAMMO
                
ammo random_num(FROMA,TOA)
                
zp_set_user_ammo_packs(id,zp_get_user_ammo_packs(id)+ammo)
                
#if defined DHUDZ
                
set_dhudmessage255030, -1.00.3020.56.00.010.1);
                
show_dhudmessage(0,  "%s, получил %d аммо-паков, поздравляем",name,ammo)
                
#endif
            #else
                
zp_set_user_ammo_packs(id,zp_get_user_ammo_packs(id)+AMMO)
                
#if defined DHUDZ
                
set_dhudmessage255030, -1.00.3020.56.00.010.1);
                
show_dhudmessage(0,  "%s, получил %d аммо-паков, поздравляем",name,AMMO)
                
#endif
            #endif
                
        #else
            #if defined RANDMONEY
                
money random_num(FROMAM,TOAM)
                
cs_set_user_money(id,cs_get_user_money(id)+money)
                
#if defined DHUDZ
                
set_dhudmessage255030, -1.00.3020.56.00.010.1);
                
show_dhudmessage(0,  "%s got %d$, congratz!",name,money)
                
#endif
            #else
                
cs_set_user_money(id,cs_get_user_money(id)+MONEY)
            
#if defined DHUDZ
                
set_dhudmessage255030, -1.00.3020.56.00.010.1);
                
show_dhudmessage(0,  "%s got %d$, congratz!",name,MONEY)
            
#endif
            #endif
                
        #endif
        
new Float:vecOrigin[3];
        
pev(entpev_originvecOrigin);
        
set_pev(entpev_originvecOrigin);
        
vecOrigin[2] += 150.0;
        
tree_fSpawn_next[ent] = TIMEFORSPAWNNEXT.0;
        
createe_next(entvecOrigin);
        
set_task(1.0"createe_next22"ent+TASK_DEATH_TIMER,_,_,"a",TIMEFORSPAWNNEXT)
        
DisableHamForward(g_HamHookZ)
        return
    }
}
public 
createe_next22(Ent){
    
Ent -= TASK_DEATH_TIMER;
    if(
tree_fSpawn_next[Ent] -= 1.0) return;
    if(
pev_valid(z_TimerZZZ[Ent])) set_pev(z_TimerZZZ[Ent], pev_flagspev(z_TimerZZZ[Ent], pev_flags) | FL_KILLME);
    
remove_task(Ent+TASK_DEATH_TIMER);
    
EnableHamForward(g_HamHookZ)
}
public 
trees(id){
    if(!
userFlags(id)) return;
    new 
menu_name[1024];
    
format(menu_name1023"\rTrees menu, amount of presents: %d"g_AllTrees);
    
g_menuId menu_create(menu_name"menu_handler");
    
menu_additem(g_menuId"\wrespawn tree""1"0);
    if(!
g_AllTrees){
        
menu_additem(g_menuId"\ddelete last tree""2"0);
        
menu_additem(g_menuId"\ddelete all trees""3"0);
    }
    else{
        
menu_additem(g_menuId"\wdelete last tree""2"0);
        
menu_additem(g_menuId"\wdelete all trees""3"0);
    }
    if(!
g_ssad)
        
menu_additem(g_menuId"\dsave""4"0);
    else 
menu_additem(g_menuId"\wsave""4"0);
    
menu_setprop(g_menuIdMPROP_EXITMEXIT_ALL);
    
menu_setprop(g_menuIdMPROP_EXITNAME"\yВыход");
    
menu_display(idg_menuId0);
}

public 
menu_handler(idmenuitem){
    switch(
item){
        case 
0:{    
            new 
Float:fOrigin[3]
            
fm_get_aim_origin(idfOrigin)
            if(
create_gift(fOrigin))
                
g_ssad true
            menu_destroy
(menu)
            
trees(id)
        }
        case 
1:{
            if(!
g_AllTrees){
                
PrintChatColor(idPRINT_COLOR_PLAYERTEAM"!g[%s] !tno trees on map"PREFIX
                
menu_destroy(menu)
                
trees(id)
                return 
1;
            }
            
g_ssad true
            PrintChatColor
(idPRINT_COLOR_PLAYERTEAM"!g[%s] !ttree is deleted"PREFIX)
            
g_AllTrees--
            
engfunc(EngFunc_RemoveEntityArrayGetCell(tree_idg_AllTrees))
            
ArrayDeleteItem(tree_idg_AllTrees)
            
ArrayDeleteItem(x_treeg_AllTrees)
            
ArrayDeleteItem(y_treeg_AllTrees)
            
ArrayDeleteItem(z_treeg_AllTrees)
            
menu_destroy(menu)
            
trees(id)
        }
        case 
2:{
            if(!
g_AllTrees){
                
PrintChatColor(idPRINT_COLOR_PLAYERTEAM"!g[%s] !tNo trees on map"PREFIX
                
menu_destroy(menu)
                
trees(id)
                return 
PLUGIN_HANDLED
            
}
            
g_ssad true
            PrintChatColor
(idPRINT_COLOR_PLAYERTEAM"!g[%s] !tdeleted !g%d !ttrees"PREFIXg_AllTrees)
            new 
ent
            
while((ent fm_find_ent_by_class(entELKA)))
                
engfunc(EngFunc_RemoveEntityent)
            
g_AllTrees 0
            ArrayClear
(tree_id
            
ArrayClear(x_tree
            
ArrayClear(y_tree
            
ArrayClear(z_tree
            
menu_destroy(menu)
            
trees(id)            

        }
        case 
3:{
            if(!
g_ssad){
                
menu_destroy(menu);
                
trees(id);
                return 
PLUGIN_HANDLED;
            }
            
g_ssad false;
            
save_gifts();
            
menu_destroy(menu);
            
trees(id);
        } 
    }
    return 
1;
}

public 
createe_next(entFloat:vecOrigin[3]){
    static 
iszInfoTarget 0;
    if(
iszInfoTarget || (iszInfoTarget engfunc(EngFunc_AllocString"info_target"))) z_TimerZZZ[ent] = engfunc(EngFunc_CreateNamedEntityiszInfoTarget);
    if(!
pev_valid(ent)) return;
    
vecOrigin[2] += 35.0;
    
set_pev(z_TimerZZZ[ent], pev_classnameSpriteClassName);
    
set_pev(z_TimerZZZ[ent], pev_originvecOrigin);
    
set_pev(z_TimerZZZ[ent], pev_iuser1M_TIMER);
    
set_pev(z_TimerZZZ[ent], pev_iuser2ent);
    
engfunc(EngFunc_SetModelz_TimerZZZ[ent], SPRITE);
    
fm_set_user_rendering(z_TimerZZZ[ent], kRenderFxNone0.00.00.0kRenderTransAdd255.0);
    
set_pev(z_TimerZZZ[ent], pev_solidSOLID_NOT);
    
set_pev(z_TimerZZZ[ent], pev_movetypeMOVETYPE_NONE);
}
stock fm_set_user_rendering(idiRenderFxFloat:flRedFloat:flGreenFloat:flBlueiRenderMode,  Float:flRenderAmt){
    new 
Float:fRenderColor[3];
    
fRenderColor[0] = flRed;
    
fRenderColor[1] = flGreen;
    
fRenderColor[2] = flBlue;
    
set_pev(idpev_renderfxiRenderFx);
    
set_pev(idpev_rendercolorfRenderColor);
    
set_pev(idpev_rendermodeiRenderMode);
    
set_pev(idpev_renderamtflRenderAmt);
}
stock CREATE_SPRITETRAIL(const Float:fOrigin[3], pSpriteiCountiLifeiScaleiVelocityAlongVectoriRandomVelocity){
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY);
    
write_byte(TE_SPRITETRAIL);
    
engfunc(EngFunc_WriteCoordfOrigin[0]);
    
engfunc(EngFunc_WriteCoordfOrigin[1]);
    
engfunc(EngFunc_WriteCoordfOrigin[2]);
    
engfunc(EngFunc_WriteCoordfOrigin[0]);
    
engfunc(EngFunc_WriteCoordfOrigin[1]);
    
engfunc(EngFunc_WriteCoordfOrigin[2]);
    
write_short(pSprite);
    
write_byte(iCount);
    
write_byte(iLife); // 0.1's
    
write_byte(iScale);
    
write_byte(iVelocityAlongVector);
    
write_byte(iRandomVelocity);
    
message_end(); 

__________________
SomewhereLost is offline
Send a message via Skype™ to SomewhereLost
E1_531G
Senior Member
Join Date: Dec 2017
Old 04-16-2019 , 14:34   Re: Sprite from anywhere
Reply With Quote #5

Quote:
Originally Posted by Gabe Iggy View Post
Plugins that managed to do this like Admin Spectator ESP or Peeping Tom have so much stuff in this method that is hard to read for me at least.
I thought to suggest you Admin ESP, but you already know it.

The main idea that you must understand about your request is that you can't see the sprite through the wall.
Even in Admin ESP the green box is shown on the wall in front of you, not on the position where the enemy is.
So, all that boring math in the code is for this feature.
__________________
My English is A0

Last edited by E1_531G; 04-16-2019 at 14:36.
E1_531G is offline
Gabe Iggy
Veteran Member
Join Date: Mar 2011
Location: Chile
Old 04-16-2019 , 15:16   Re: Sprite from anywhere
Reply With Quote #6

Quote:
Originally Posted by E1_531G View Post
The main idea that you must understand about your request is that you can't see the sprite through the wall.
Even in Admin ESP the green box is shown on the wall in front of you, not on the position where the enemy is.
I understand, so I must trace a line towards the entity and then place the sprite (using a Message, maybe) where the line hits. Right?
__________________

Current Handle Name: G.I. | Gabe Iggy (Steam)
Public Plugins:
Static.cfg Restoration | Sven Co-op Player vs Player | Hide Donator Icons
Discord: http://discord.daijobu.org/
Gabe Iggy 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 02:19.


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