AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Cast Bar (https://forums.alliedmods.net/showthread.php?t=210311)

Podarok 03-09-2013 05:38

Cast Bar
 
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); 


didoWEE 03-14-2013 14:34

Re: Cast Bar
 
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);
    }



Podarok 03-14-2013 14:46

Re: Cast Bar
 
Ty gonna try it.

didoWEE 03-14-2013 15:00

Re: Cast Bar
 
tell if working or not (or if there's a bug) :D


All times are GMT -4. The time now is 21:49.

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