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

Bartime while button is pressed and aiming a player question...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
!Morte
Veteran Member
Join Date: May 2010
Old 07-13-2017 , 01:05   Bartime while button is pressed and aiming a player question...
Reply With Quote #1

While IN_USE button is held down and the player is aiming another player the bartime appears, and when the bartime ends something happend (that "something" is not coded). The thing is how can i make the bartime appears one time? I tried with a boolean but i don't know, i think there have to be another method, idk, and i don't know if is better to use PreThink instead CmdStart.

Btw, here is the code (is not clean and i touch it many times so i don't know if it works now xD):

PHP Code:
public Fw_CmdStart(id)
{
    if(!
is_user_alive(id))
        return 
PLUGIN_HANDLED;
        
    static 
pressedButtonoldPressedButton;
    
pressedButton pev(idpev_button);
    
oldPressedButton pev(idpev_oldbuttons);
    
showBarTime[id] = true;
    
    if((
pressedButton IN_USE))
    {
        static 
idTargetidLastTarget = -1idBody;
        
get_user_aiming(ididTargetidBody1000);
        
        if(
idTarget == idLastTarget)
        {
            
client_print(idprint_chat"You are aiming a player");
            
            
            if(
showBarTime[id])
            {
                
message_begin(MSG_ONEg_msgBarTime_id)
                
write_byte(3)
                
write_byte(0)
                
message_end()
                
                
showBarTime[id] = false;
                
                return 
PLUGIN_CONTINUE;
            }
        }
        
        if(
idLastTarget != idTarget && idLastTarget != -1)
        {
            
client_print(idprint_chat"You stop aiming a player");
            
pressedButton = !(pressedButton IN_USE);
            
showBarTime[id] = false;
            
            
message_begin(MSG_ONEg_msgBarTime_id)
            
write_byte(0)
            
write_byte(0)
            
message_end()
            
            return 
PLUGIN_CONTINUE;
        }
        
        
idLastTarget = ( idTarget == ) ? -idTarget;
    }
    
    
    if((
oldPressedButton IN_USE) && !(pressedButton IN_USE))
    {
        
client_print(idprint_chat"E released");
        
showBarTime[id] = false;
        
        
message_begin(MSG_ONEg_msgBarTime_id)
        
write_byte(0)
        
write_byte(0)
        
message_end()
    }
        
    return 
PLUGIN_CONTINUE;

__________________
First Zombie Class
[ZP] Zombie Class: Houndeye Zombie
Quote:
Originally Posted by lucas_7_94 View Post
tenes que saber pawn antes de intentar hacer algo digno.
!Morte is offline
Send a message via MSN to !Morte Send a message via Skype™ to !Morte
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 00:50.


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