Raised This Month: $ Target: $400
 0% 

Solved Single shot deagle


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Airkish
AlliedModders Donor
Join Date: Apr 2016
Location: Lithuania
Old 03-22-2017 , 16:23   Re: Single shot deagle
Reply With Quote #3

Quote:
Originally Posted by Depresie View Post
Hook the shooting event in post, then just set the user's clip to 0
EFFx's code, problem is I shoot infinite times without reloading

PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <cstrike>
#include <fakemeta>
#include <fun>

#define PLUGIN                "New Plug-In"
#define VERSION                "1.0"
#define AUTHOR                "author"

#define set_deagle_single_clip(%1)    set_pdata_int(%1, OFFSET_CLIPAMMO, DEAGLE_CLIP, OFFSET_LINUX_WEAPONS)

const CHANCE_REQUIRED =            5
const DEAGLE_CLIP =            1
const OFFSET_CLIPAMMO =            51
const OFFSET_LINUX_WEAPONS =        4
const m_pPlayer =            41
const m_pActiveItem =            373

new bool:g_bIsDeagleRound

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
RegisterHam(Ham_TakeDamage"player""HamPlayerTakeDamage_Post"0)
    
RegisterHam(Ham_Spawn"player""HamPlayerSpawn_Post"1)
    
RegisterHam(Ham_Weapon_PrimaryAttack"weapon_deagle""HamDeaglePrimaryAttackPre"0)  

    
register_event("SendAudio""event_CTWin""a""1=0""2=%!MRAD_ctwin")
    
register_event("SendAudio""event_TWin""a""1=0""2=%!MRAD_terwin")
    
register_event("HLTV""event_round_start""a""1=0""2=0")
}

public 
Dgl(id) {
    
g_bIsDeagleRound true

}

public 
event_CTWin()
{
    if(
g_bIsDeagleRound)
    {
        
g_bIsDeagleRound false
        
        client_print
(0print_chat"[Deagle Round]: Counter-Terrorists has won the Deagle round. Finishing the event...")
    }
}

public 
event_TWin()
{
    if(
g_bIsDeagleRound)
    {
        
g_bIsDeagleRound false
        
        client_print
(0print_chat"[Deagle Round]: Terrorists has won the Deagle round. Finishing the event...")
    }
}

public 
HamPlayerTakeDamage_Post(iAttackeriInflictoriVictim)
{
    if(!
g_bIsDeagleRound)
        return 
HAM_IGNORED
    
    
if(!is_user_connected(iAttacker) || !is_user_connected(iVictim))    
        return 
HAM_IGNORED
    
    SetHamParamFloat
(4999.9)
    return 
HAM_IGNORED
}

public 
HamPlayerSpawn_Post(id)
{
    if(
g_bIsDeagleRound)
    {
        if(
is_user_alive(id))
        {
            
cs_set_user_money(id0)
            
            
strip_user_weapons(id)
            
give_item(id"weapon_deagle")
            
cs_set_user_bpammo(idCSW_DEAGLE0)
            
set_deagle_single_clip(get_pdata_cbase(idm_pActiveItem))    
        }
    }
}

public 
HamDeaglePrimaryAttackPre(iWeapon)
{
    new 
id get_pdata_cbase(iWeaponm_pPlayerOFFSET_LINUX_WEAPONS)
    
    if(!
is_user_connected(id))
        return 
HAM_IGNORED
    
    set_deagle_single_clip
(get_pdata_cbase(idm_pActiveItem))
    return 
HAM_IGNORED
}

public 
event_round_start()
{
    if(!
g_bIsDeagleRound)
    {
        if(
IsNecessaryChance(CHANCE_REQUIRED))
        {
            
g_bIsDeagleRound true
            
            client_print
(0print_chat"[Deagle Round]: Deagle round percent (%d%) was hit. Starting the Deagle Round..."CHANCE_REQUIRED)
            
server_cmd("sv_restart 3")
        }
    }
}

IsNecessaryChance(const Chance)
{
    new 
iRandom random_num(0100)
    return (
iRandom Chance) ? true false

__________________
Airkish 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 17:59.


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