Raised This Month: $51 Target: $400
 12% 

Sprite above head


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
wicho
Veteran Member
Join Date: Feb 2012
Location: GuateAmala
Old 08-04-2020 , 18:57   Sprite above head
Reply With Quote #1

Hi all, well what I want to do is that when a player chooses a sprite it comes out above the player's head the problem is that the sprite comes out in the center of the player, how can I fix that? .. Thanks in advance

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <engine>
#include <hamsandwich>

#include <emotions>
#include <emotions_control>

#define PLUGIN_NAME "Emotions: Sprite Up"
#define PLUGIN_VERSION "1.0"
#define PLUGIN_AUTHOR "Denzer"

// Emotion sprite up scale
const Float:EMOTION_SPRITE_UP_SCALE 0.30

// Emotion sprite up classname
new const EMOTION_SPRITE_UP_CLASSNAME[] = "emotion_up"

public plugin_init()
{
         
register_plugin(PLUGIN_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR)
}

public 
client_disconnected(id)
{
         new 
iEnt 32+1

         
while ((iEnt find_ent_by_class(iEntEMOTION_SPRITE_UP_CLASSNAME)))
         {
        if (
pev(iEntpev_owner) != id)
                           continue

        
set_pev(iEntpev_flagsFL_KILLME)
         }
}

public 
emotions_menu_handler(idmenuitem)
{    
    new 
szKey[MAX_EMOTION_KEY_LENGTH]; menu_item_getinfo(menuitem_szKeycharsmax(szKey))

         new 
index emotions_emotion_find_index(szKey)

         if (
index == -1)
         {
                  return 
PLUGIN_HANDLED
         
}

         new 
eTempEmotion[EmotionData_s]; emotions_emotion_getinfo(indexeTempEmotion)

         new 
iEnt create_entity("info_target")

         if (!
pev_valid(iEnt))
         {
                  return 
PLUGIN_HANDLED
         
}
    
    static 
Float:flOrigin[3]
    
pev(idpev_originflOrigin)
    
    
flOrigin[2] += 60.0
            
    engfunc
(EngFunc_SetOriginiEntflOrigin)
         
engfunc(EngFunc_SetModeliEnteTempEmotion[EMOTION_SPRITE_UP])
    
set_pev(iEntpev_classnameEMOTION_SPRITE_UP_CLASSNAME)
    
set_pev(iEntpev_movetypeMOVETYPE_FOLLOW)
    
set_pev(iEntpev_aimentid)
    
set_pev(iEntpev_ownerid)
    
set_pev(iEntpev_scaleEMOTION_SPRITE_UP_SCALE)

         if (
eTempEmotion[EMOTION_SPRITE_UP_FRAME] != -1)
         {
         
set_pev(iEntpev_framefloat(eTempEmotion[EMOTION_SPRITE_UP_FRAME]))
         }

    
set_pev(iEntpev_nextthinkget_gametime() + emotions_get_emotion_delay() - 0.5)
    
set_task(5.0"ThinkRemove"iEnt)

         return 
PLUGIN_CONTINUE
}

public 
ThinkRemove(iEnt)
{
         if (!
pev_valid(iEnt))
         {
                  return
         }

    
set_pev(iEntpev_flagsFL_KILLME)

wicho is offline
DjSoftero
Veteran Member
Join Date: Nov 2014
Location: Lithuania
Old 08-15-2020 , 08:23   Re: Sprite above head
Reply With Quote #2

"flOrigin[2] += 60.0" increase this value further until it meets your expectations. you can check whether the player is crouching and subtract 18.0 units for the sprite to hover above the players head
__________________
retired chump
DjSoftero is offline
wicho
Veteran Member
Join Date: Feb 2012
Location: GuateAmala
Old 11-15-2020 , 22:36   Re: Sprite above head
Reply With Quote #3

sorry to revive but I changed the value but it still appears in the center of the player
wicho is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 11-16-2020 , 07:01   Re: Sprite above head
Reply With Quote #4

1st method edit the sprite and give it a height.
2ec method edit the script and use the TE_PLAYERATTACHMENT message type.
__________________
@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
wicho
Veteran Member
Join Date: Feb 2012
Location: GuateAmala
Old 11-16-2020 , 18:15   Re: Sprite above head
Reply With Quote #5

a question I use a sprite with 20 frames can be assigned a frame using TE_PLAYERATTACHMENT?
wicho is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 11-17-2020 , 06:45   Re: Sprite above head
Reply With Quote #6

I don't see a reason not to, test it.
__________________
@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
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 23:35.


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