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

Does not give the corresponding frame


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
wicho
Veteran Member
Join Date: Feb 2012
Location: GuateAmala
Old 08-05-2020 , 19:12   Does not give the corresponding frame
Reply With Quote #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"},
         { 
"Scream"},
         { 
"Kiss"},
         { 
"Giggle"},
         { 
"Fall in love"},
         { 
"Perplex"},
         { 
"Angry"},
         { 
"Wink"},
         { 
"Smiling"},
         { 
"Whistles"},
         { 
"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(PLUGINVERSIONAUTHOR)
     
         
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 
0sizeof(Emotions); i++)
         {
                  
formatex(szBuffercharsmax(szBuffer), "%s"Emotions[i][Name])
                  
menu_additem(menuszBuffer)   
         }
      
         
menu_setprop(menuMPROP_EXITMEXIT_ALL)   
         
menu_display(idmenu0)
    
         return 
PLUGIN_HANDLED
}

public 
menu_emotions(idmenuitem)
{
    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(idEV_VEC_originflOrigin)
            
flOrigin[2] += 40.0
            entity_set_vector
(g_iEnt[id], EV_VEC_originflOrigin)
            
entity_set_float(g_iEnt[id], EV_FL_framerate1.0)
            
entity_set_float(g_iEnt[id], EV_FL_framefloat(Frame))
            
entity_set_float(g_iEnt[id], EV_FL_scale0.3)
            
entity_set_int(g_iEnt[id], EV_INT_movetypeMOVETYPE_NOCLIP)
            
            
engfunc(EngFunc_SetModelg_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(idEV_VEC_originflOrigin)
            
flOrigin[2] += 40.0
            entity_set_vector
(g_iEnt[id], EV_VEC_originflOrigin)
        }
    }
}

stock printf(idcolor, const msg[], any:...) 
{   
         static 
Buffer[192], MsgSayTextMsgTeamInfoTeam[32]
    
         if(!
MsgSayText
    {       
                  
MsgTeamInfo get_user_msgid("TeamInfo")       
                  
MsgSayText get_user_msgid("SayText")      
         }
        
         
vformat(Buffer[1], charsmax(Buffer) - 1msg4)
    
         static const 
Teams[2][10] = 
    {
                  
"TERRORIST",
                  
"CT"
         
}

         switch (
color
    {       
                  case DEFAULT: 
        {           
                           
Buffer[0] = 0x01
                           printf_do
(idid id 33BufferMsgSayText)
                  }       
                  case 
GREEN
        {           
                           
Buffer[0] = 0x04            
                           printf_do
(idid id 33BufferMsgSayText)           
                  }       
                  case 
GRAY
        {          
                           
Buffer[0] = 0x03           
                           printf_do
(id33BufferMsgSayText)           
                  }       
                  case 
REDBLUE
        {           
                           
Buffer[0] = 0x03          
                           
if (id
            {              
                                    if (
get_user_team(idTeamcharsmax(Team)) == color
                     {                   
                                             
printf_do(ididBufferMsgSayText)                    
                                     }
                                    else 
                     {                  
                                             
printf_do(ididTeams[color-1], MsgTeamInfo)                   
                                             
printf_do(ididBufferMsgSayText)                    
                                             
printf_do(ididTeamMsgTeamInfo)
                }
                           }
                           else 
                 {           
                                    static 
Num         
                                    get_players
(TeamNum"e"Teams[color-1])
                
                                    if (
Num
                     {                    
                                             
printf_do(idTeam[0], BufferMsgSayText)
                                    }
                                    else 
                     {                  
                                             
get_players(TeamNum"h");
                    
                                             if (!
Num
                    {                       
                                                      return                       
                                              }
                    
                                             
Num Team[0]                  
                                             
get_user_team(NumTeamcharsmax(Team))
                    
                                             
printf_do(NumNumTeams[color-1], MsgTeamInfo)       
                                             
printf_do(idNumBufferMsgSayText)        
                                             
printf_do(NumNumTeamMsgTeamInfo)                   
                                    }               
                           }           
                  }       
         }
}

printf_do(idsender, const data[], MsgID
{   
         
message_begin(id MSG_ONE_UNRELIABLE MSG_BROADCASTMsgID_id)         
         
write_byte(sender)        
         
write_string(data)         
         
message_end()   


Last edited by wicho; 08-05-2020 at 19:23.
wicho is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 08-05-2020 , 21:13   Re: Does not give the corresponding frame
Reply With Quote #2

Replace this

float(Frame)

With

float(Emotions[item][Frame])
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 08-05-2020 at 21:13.
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 08:29.


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