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

Setting player ammo?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Javierko
AlliedModders Donor
Join Date: Sep 2017
Location: Czech republic
Old 05-04-2019 , 06:57   Setting player ammo?
Reply With Quote #1

Hey,
when I want to set player ammo with this func below and when I use clip or ammo to 0, weapon clip or ammo is set to default ammo or clip value, like when it's deagle it sets to 7/35 using:
PHP Code:
SetPlayerAmmo(clientiWep00); 
Function:
PHP Code:
stock void SetPlayerAmmo(int clientint weaponEntint clip = -1int ammo = -1)
{
    if (
weaponEnt == INVALID_ENT_REFERENCE || !IsValidEntity(weaponEnt))
        return;

    if (
clip != -1)
        
SetEntProp(weaponEntProp_Send"m_iClip1"clip);

    if (
ammo != -1)
    {
        
int iOffset FindDataMapInfo(client"m_iAmmo") + (GetEntProp(weaponEntProp_Data"m_iPrimaryAmmoType") * 4);
        
SetEntData(clientiOffsetammo4true);

        if (
GetEngineVersion() == Engine_CSGO
        {
            
SetEntProp(weaponEntProp_Send"m_iPrimaryReserveAmmoCount"ammo);
        }
    }

btw. no errors in error log
__________________
My Github & Sourcemod work.
If you like my work and if you want to support me, you can through PayPal.

Official SourceMod CZ/SK Discord: https://discord.gg/Qvar55a
Javierko is offline
Indarello
Senior Member
Join Date: Nov 2015
Location: Russia
Old 05-06-2019 , 05:45   Re: Setting player ammo?
Reply With Quote #2

I am not sure
But maybe you cant set player ammo
Change weapon ammo
Indarello 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 08:37.


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