Veteran Member
Join Date: Feb 2012
Location: GuateAmala
|
08-05-2020
, 19:12
Does not give the corresponding frame
|
#1
|
Hi everyone, well I have a menu of emotions that when I choose one a sprite appears above the player, for that I use a sprite that has 20 frames, the problem is that when I choose any emotion from the menu, the first emotion always comes out (frame 0), How can I give it the corresponding frame?? .. Thanks in advance
PHP Code:
#include <amxmodx> #include <amxmisc> #include <hamsandwich> #include <engine> #include <fakemeta>
#define PLUGIN "Emotions Menu" #define VERSION "1.0" #define AUTHOR "covid"
enum { DEFAULT, RED, BLUE, GRAY, GREEN }
enum _:EmotionsData { Name[32], Frame }
new const Emotions[][EmotionsData] = { { "Regret", 0 }, { "Scream", 1 }, { "Kiss", 2 }, { "Giggle", 3 }, { "Fall in love", 4 }, { "Perplex", 5 }, { "Angry", 6 }, { "Wink", 7 }, { "Smiling", 8 }, { "Whistles", 9 }, { "Happy", 10 }, { "Dissatisfied", 11 }, { "Sadness", 12 }, { "Satisfied", 13 }, { "Burned", 14 }, { "In anger", 15 }, { "Mocking", 16 }, { "Surprised", 17 }, { "Great...", 18 }, { "Afunhappy...", 19 } }
new g_iEnt[MAX_PLAYERS]
public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) register_clcmd("say /emotions", "EmotionsMenu") RegisterHam(Ham_Player_PostThink, "player", "fn_pThink", true) }
public plugin_precache() { precache_model("sprites/emotions.spr") }
public client_disconnect(id) { g_iEnt[id] = 0 }
public client_putinserver(id) { g_iEnt[id] = 0 } public EmotionsMenu(id) { emotions_menu(id) }
public emotions_menu(id) { if (!is_user_alive(id)) { printf(id, DEFAULT, "^x04 ZP | ^x01You can't use the menu because you are not alive!") return PLUGIN_HANDLED } new menu = menu_create("\rEmotions", "menu_emotions") new szBuffer[40] for (new i = 0; i < sizeof(Emotions); i++) { formatex(szBuffer, charsmax(szBuffer), "%s", Emotions[i][Name]) menu_additem(menu, szBuffer) } menu_setprop(menu, MPROP_EXIT, MEXIT_ALL) menu_display(id, menu, 0) return PLUGIN_HANDLED }
public menu_emotions(id, menu, item) { if (item == MENU_EXIT) { menu_destroy(menu) return PLUGIN_HANDLED } if(!is_valid_ent(g_iEnt[id])) { g_iEnt[id] = create_entity("env_sprite") if(is_valid_ent(g_iEnt[id])) { static Float:flOrigin[3] entity_get_vector(id, EV_VEC_origin, flOrigin) flOrigin[2] += 40.0 entity_set_vector(g_iEnt[id], EV_VEC_origin, flOrigin) entity_set_float(g_iEnt[id], EV_FL_framerate, 1.0) entity_set_float(g_iEnt[id], EV_FL_frame, float(Frame)) entity_set_float(g_iEnt[id], EV_FL_scale, 0.3) entity_set_int(g_iEnt[id], EV_INT_movetype, MOVETYPE_NOCLIP) engfunc(EngFunc_SetModel, g_iEnt[id], "sprites/emotions.spr") set_task(5.0, "Del_Emoticon", id) } } printf(id, DEFAULT, "^x04 ZP | ^x01You have the emotion: ^x04%s", Emotions[item][Name]) return PLUGIN_HANDLED }
public Del_Emoticon(id) { remove_entity(g_iEnt[id]) g_iEnt[id] = 0 }
public fn_pThink(id) { if(g_iEnt[id]) { if(is_valid_ent(g_iEnt[id])) { static Float:flOrigin[3] entity_get_vector(id, EV_VEC_origin, flOrigin) flOrigin[2] += 40.0 entity_set_vector(g_iEnt[id], EV_VEC_origin, flOrigin) } } }
stock printf(id, color, const msg[], any:...) { static Buffer[192], MsgSayText, MsgTeamInfo, Team[32] if(!MsgSayText) { MsgTeamInfo = get_user_msgid("TeamInfo") MsgSayText = get_user_msgid("SayText") } vformat(Buffer[1], charsmax(Buffer) - 1, msg, 4) static const Teams[2][10] = { "TERRORIST", "CT" }
switch (color) { case DEFAULT: { Buffer[0] = 0x01 printf_do(id, id ? id : 33, Buffer, MsgSayText) } case GREEN: { Buffer[0] = 0x04 printf_do(id, id ? id : 33, Buffer, MsgSayText) } case GRAY: { Buffer[0] = 0x03 printf_do(id, 33, Buffer, MsgSayText) } case RED, BLUE: { Buffer[0] = 0x03 if (id) { if (get_user_team(id, Team, charsmax(Team)) == color) { printf_do(id, id, Buffer, MsgSayText) } else { printf_do(id, id, Teams[color-1], MsgTeamInfo) printf_do(id, id, Buffer, MsgSayText) printf_do(id, id, Team, MsgTeamInfo) } } else { static Num get_players(Team, Num, "e", Teams[color-1]) if (Num) { printf_do(id, Team[0], Buffer, MsgSayText) } else { get_players(Team, Num, "h"); if (!Num) { return } Num = Team[0] get_user_team(Num, Team, charsmax(Team)) printf_do(Num, Num, Teams[color-1], MsgTeamInfo) printf_do(id, Num, Buffer, MsgSayText) printf_do(Num, Num, Team, MsgTeamInfo) } } } } }
printf_do(id, sender, const data[], MsgID) { message_begin(id ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, MsgID, _, id) write_byte(sender) write_string(data) message_end() }
Last edited by wicho; 08-05-2020 at 19:23.
|
|