Raised This Month: $ Target: $400
 0% 

Cast Bar


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Podarok
BANNED
Join Date: Jan 2011
Location: Narnia
Old 03-09-2013 , 05:38   Cast Bar
Reply With Quote #1

How can i make a specific castbar : if a person moves, he interrupts a cast or if he releases a button also nothing will happen and the final function which has to happen after castbar finishes is:
PHP Code:
client_print(idprint_chat"KABOOOM"); 
How can i make that please help.
P.s. the function for castbar is
PHP Code:
Create_BarTimeidlenght); 

Last edited by Podarok; 03-09-2013 at 05:38.
Podarok is offline
didoWEE
Senior Member
Join Date: Oct 2012
Location: Bulgaria
Old 03-14-2013 , 14:34   Re: Cast Bar
Reply With Quote #2

Not tested !

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

new bool:g_bCast[33];

new 
g_BarMsg;

public 
plugin_init()
{
    
register_plugin("Cast Bar""beta""didoWEE");
    
    
register_forward(FM_CmdStart"CmdStart");
    
    
g_BarMsg get_user_msgid("BarTime2");
    
    
register_clcmd("kabooom""Cast");
}

public 
client_putinserver(idg_bCast[id] = false;
public 
client_disconnect(idg_bCast[id] = false;

public 
Bar(const id, const time)
{
    
message_begin(MSG_ONE_UNRELIABLEg_BarMsg,. player id);
    
write_short(time);
    
write_short(0);
    
message_end();
}

public 
Kabooom(id)
{
    if(
is_user_connected(id) && is_user_alive(id))
    {
        
g_bCast[id] = false;
        
client_print(idprint_chat"KABOOOM");
    }
}

public 
Cast(id)
{
    if(!
g_bCast[id])
    {
        new 
time 5;
        
Bar(idtime);
        
g_bCast[id] = true;
        
set_task(float(time), "Kabooom"id);
    }
}

public 
CmdStart(idHandle)
{
    if(
is_user_alive(id))
    {
        static 
button;
        
button get_uc(HandleUC_Buttons);

        if (
button IN_LEFT
        
|| button IN_RIGHT
        
|| button IN_FORWARD
        
|| button IN_BACK)
        {
            if(
g_bCast[id])
            {
                
Bar(id0);
                
g_bCast[id] = false;
                
client_print(idprint_chat"Cast Interrupted");
            }
        }
        
set_uc(HandleUC_Buttonsbutton);
    }

didoWEE is offline
Podarok
BANNED
Join Date: Jan 2011
Location: Narnia
Old 03-14-2013 , 14:46   Re: Cast Bar
Reply With Quote #3

Ty gonna try it.
Podarok is offline
didoWEE
Senior Member
Join Date: Oct 2012
Location: Bulgaria
Old 03-14-2013 , 15:00   Re: Cast Bar
Reply With Quote #4

tell if working or not (or if there's a bug)

Last edited by didoWEE; 03-14-2013 at 15:38.
didoWEE is offline
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 21:49.


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