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_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
}
public client_disconnected(id)
{
new iEnt = 32+1
while ((iEnt = find_ent_by_class(iEnt, EMOTION_SPRITE_UP_CLASSNAME)))
{
if (pev(iEnt, pev_owner) != id)
continue
set_pev(iEnt, pev_flags, FL_KILLME)
}
}
public emotions_menu_handler(id, menu, item)
{
new szKey[MAX_EMOTION_KEY_LENGTH]; menu_item_getinfo(menu, item, _, szKey, charsmax(szKey))
new index = emotions_emotion_find_index(szKey)
if (index == -1)
{
return PLUGIN_HANDLED
}
new eTempEmotion[EmotionData_s]; emotions_emotion_getinfo(index, eTempEmotion)
new iEnt = create_entity("info_target")
if (!pev_valid(iEnt))
{
return PLUGIN_HANDLED
}
static Float:flOrigin[3]
pev(id, pev_origin, flOrigin)
flOrigin[2] += 60.0
engfunc(EngFunc_SetOrigin, iEnt, flOrigin)
engfunc(EngFunc_SetModel, iEnt, eTempEmotion[EMOTION_SPRITE_UP])
set_pev(iEnt, pev_classname, EMOTION_SPRITE_UP_CLASSNAME)
set_pev(iEnt, pev_movetype, MOVETYPE_FOLLOW)
set_pev(iEnt, pev_aiment, id)
set_pev(iEnt, pev_owner, id)
set_pev(iEnt, pev_scale, EMOTION_SPRITE_UP_SCALE)
if (eTempEmotion[EMOTION_SPRITE_UP_FRAME] != -1)
{
set_pev(iEnt, pev_frame, float(eTempEmotion[EMOTION_SPRITE_UP_FRAME]))
}
set_pev(iEnt, pev_nextthink, get_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(iEnt, pev_flags, FL_KILLME)
}