Raised This Month: $ Target: $400
 0% 

one shot and reload


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Arje
Senior Member
Join Date: Apr 2020
Location: Córdoba, Argentina
Old 02-22-2022 , 07:39   one shot and reload
Reply With Quote #1

I use this code so that the deagle fires one shot at a time and reloads (it works correctly) but my problem is that if I want to change the code so that a scout or any weapon does it, it does nothing


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

public plugin_init()
{
    
register_plugin("One Shot Deagle""1.0""OciXCrom")
    
register_forward(FM_CmdStart"fwdPlayerCmdStart"1)    //def 1
}
    
public 
fwdPlayerCmdStart(idiUciRandom)
{        
    
cs_set_user_bpammo(idCSW_DEAGLE1

    new 
iEntDeagle find_ent_by_owner(-1"weapon_deagle"id)

    if(
is_user_alive(id) && get_user_weapon(id) == CSW_DEAGLE && cs_get_weapon_ammo(iEntDeagle) > 1) {
        
cs_set_weapon_ammo(iEntDeagle1)
    }

Arje is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 02-22-2022 , 13:38   Re: one shot and reload
Reply With Quote #2

Show the changed code.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Arje
Senior Member
Join Date: Apr 2020
Location: Córdoba, Argentina
Old 02-22-2022 , 14:41   Re: one shot and reload
Reply With Quote #3

I tried with the scout and the awp but if i try my cs it closes directly, but for example I tried it with other guns(pistols) and it works correctly

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

public plugin_init()
{
    
register_plugin("One Shot Deagle""1.0""OciXCrom")
    
register_forward(FM_CmdStart"fwdPlayerCmdStart"1)   
}
    
public 
fwdPlayerCmdStart(idiUciRandom)
{        
    
cs_set_user_bpammo(idCSW_SCOUT1

    new 
iEntScout find_ent_by_owner(-1"weapon_scout"id)

    if(
is_user_alive(id) && get_user_weapon(id) == CSW_SCOUT && cs_get_weapon_ammo(iEntScout) > 1) {
        
cs_set_weapon_ammo(iEntScout1)
    }

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


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