Raised This Month: $51 Target: $400
 12% 

[CSGO] How to set ammo clip


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Emel
New Member
Join Date: Jan 2019
Old 01-29-2019 , 07:55   [CSGO] How to set ammo clip
Reply With Quote #1

Hello, I am trying to write a plugin for the cs go server, but I don't know how to change the ammunitions in the weapon. I mean when i write command my ammo will restore to value what i want. What function should i use?

Last edited by Emel; 01-29-2019 at 07:56.
Emel is offline
Brum Brum
Junior Member
Join Date: Mar 2017
Old 01-29-2019 , 09:07   Re: [CSGO] How to set ammo clip
Reply With Quote #2

My stock to change ammo
PHP Code:
stock void SetAmmo(int entityint Ammoint ReserveAmmo)
{
    
SetVariantInt(Ammo);
    
AcceptEntityInput(entity"SetAmmoAmount");
    
SetVariantInt(ReserveAmmo);
    
AcceptEntityInput(entity"SetReserveAmmoAmount");

Example how to use
PHP Code:
public Action GiveAK(int clientint args)
{
    if (
args 0)
    {
        
PrintToChat(client"[SM] use sm_giveak ammo reserveammo");
        return 
Plugin_Handled;
    }
    
    if (
args 2)
    {
        
PrintToChat(client"[SM] use sm_giveak ammo reserveammo");
        return 
Plugin_Handled;
    }
    
    
char arg[11], arg2[11];
    
GetCmdArg(1argsizeof(arg));
    
GetCmdArg(2argsizeof(arg2));
    
int ammo StringToInt(arg);
    
int reserveammo StringToInt(arg2);
    
int ak GivePlayerItem(client"weapon_ak47");
    
SetAmmo(akammoreserveammo);
    return 
Plugin_Handled;

Brum Brum 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 19:51.


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