Raised This Month: $ Target: $400
 0% 

How to catch holding fire button


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Apokalipsisa
Member
Join Date: May 2012
Old 09-07-2012 , 07:57   Re: How to catch holding fire button
Reply With Quote #7

Thank you all for the answers.I dont wan't to post a new topic(becouse i will make to much spam) and i will ask my another question here.Can someone tell me why my noob code doesn't work ?

PHP Code:
#include <amxmodx>
#include <engine>
#include <cstrike>
#include <fakemeta>
#include <csx>
#include <colorchat>


public plugin_init()
{
    
register_plugin("C4 Anti-Camper","1.0","Apokalipsisa")
    
    
register_logevent("start",2,"1=Round_Start")
    
register_forward(FM_CmdStart,"fwd_FM_CmdStart_pre",0)
    
    if(
engfunc(EngFunc_FindEntityByString, -1"classname","func_bomb_target") || engfunc(EngFunc_FindEntityByString, -1"classname","info_bomb_target"))
    {        
        
register_event("StatusIcon""event_bomb_pickup""be""1=1""1=2""2=c4")
        
register_event("TextMsg""event_bomb_pickup""bc""2&#Got_bomb")
        
register_event("TextMsg""event_bomb_dropped""bc""2&#Game_bomb_d")
    }
    else
    {
        
pause("ad")
        
        return
    } 
}

public 
event_bomb_pickup(id)
{
    if(!
is_user_alive(id)) return
        
    if(
cs_get_user_team(id) == CS_TEAM_T)
    {
        
remove_task(id 222)
        
set_task(1.0,"CheckMoving",id 111 __"b")
    }


public 
event_bomb_dropped()
{
    new 
players[32],numi,id
    get_players
(players,num)
    
    for(
i=0;i<num;i++)
    {
        
id players[i]
    
        if(!
is_user_alive(id)) return
    
        
remove_task(id 111)
        
set_task(2.0,"BombPlant",id 222 __"b")
    }
}

public 
bomb_planted(id)
{
    if(!
is_user_alive(id)) return
        
    
remove_task(111)
        
    if(
cs_get_user_team(id) == CS_TEAM_CT)
    {
        
set_task(1.0,"CheckMoving",id 111 __"b")
    }
}

public 
CheckMoving(id)
{
    static 
iStillCounter[33]
    static 
FloatfVelocity[3]
        
    if(!
is_user_alive(id)) return
        
    
pev(id,pev_velocity,fVelocity)
    
    if(
fVelocity[0] || fVelocity[1] || fVelocity[2])
    {
        
iStillCounter[id] = 0
    
}
    else
    {
        if (++
iStillCounter[id] >= 5)
        {
            if(
cs_get_user_team(id) == CS_TEAM_T)
            {
                
ColorChat(id,GREEN,"PLANT C4!")
                
user_slap(id,0)
            }
                    
            if(
cs_get_user_team(id) == CS_TEAM_CT)
            {
                
ColorChat(id,GREEN,"DEFUSE C4!")
                
user_slap(id,0)
            }
        }
    }
}

public 
bomb_defusing(id)
{
    new 
buttons pev(idpev_button)
    new 
oldbuttons pev(idpev_oldbuttons)
    
    if(
buttons IN_USE)
    {
        
remove_task(id 111)
    }
    
    if(
oldbuttons IN_USE && !(buttons IN_USE))
    {
        
set_task(1.0,"CheckMoving",id 111 __"b")
    }
    
    if(
buttons IN_USE && !(oldbuttons IN_USE))
    {
        
ColorChat(id,GREEN,"test test test")
    }
    
    return 
FMRES_IGNORED
}

public 
start(id)
{
    
remove_task(id 111)
}

public 
bomb_defused(id)
{
    
remove_task(id 111)
}

public 
bomb_explode(id)
{
    
remove_task(id 111)
}

public 
BombPlant(id)
{
    if(!
is_user_alive(id)) return
    
    
ColorChat(id,GREEN,"TAKE C4 AND PLANT!")
    
user_slap(id,0)
}

public 
bomb_planting(id)
{
    new 
button;
    
button pev(idpev_button);
    
    if (
button IN_ATTACK)
    {
        
remove_task(id 111)
    }
    else
    {
        
set_task(1.0,"CheckMoving",id 111 __"b")
    }

Apokalipsisa is offline
 



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:20.


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