Raised This Month: $ Target: $400
 0% 

Detect if the weapon has a bullet


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
wicho
Veteran Member
Join Date: Feb 2012
Location: GuateAmala
Old 06-29-2020 , 03:09   Detect if the weapon has a bullet
Reply With Quote #1

Hi everyone, well I'm doing something like a mini game of usp (pistol) that tries that when the round begins it gives everyone a usp with only one bullet ready to fire, every 5 seconds it gives a bullet, my question is how can I to detect if the player still has the bullet? What I want to do is that if the player still has the bullet, he will not get another bullet, so he will not accumulate bullets, but until he has no bullets and so on.

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

#define PLUGIN "Battle Usp"
#define VERSION "1.0"
#define AUTHOR "khe"

new g_MaxPlayers

#define TASK_BULLET 655

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_event("HLTV""NewRound""a""1=0""2=0")

    
g_MaxPlayers get_maxplayers()
}

public 
NewRound() 
{    
    for (new 
id 1id <= g_MaxPlayersid++)
    {
        if (!
is_user_alive(id))
            continue

        
show_menu(id0"^n"1)        
        
strip_user_weapons(id)   
        
cs_set_weapon_ammo(give_item(id"weapon_usp"), 1)
        
set_task(5.0"Task_GiveBullet"id+TASK_BULLET__"b")
    }
}

public 
Task_GiveBullet(id)
{
    
id -= TASK_BULLET
    
    cs_set_weapon_ammo
(give_item(id"weapon_usp"), 1)

wicho 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 16:56.


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