Post: C++ Question
01-05-2016, 01:37 AM #1
xPurpBoyyx
Bounty hunter
(adsbygoogle = window.adsbygoogle || []).push({});
I use this code to give weapons


void Gold(int client)
{
Game::GiveWeapon(client, "deserteaglegold_mp", false, true, true);
}


But when it gives me the weapon, I get no ammo for it.? And it makes my menu freeze...

I'd really appreciate some help Smile

:salute:
(adsbygoogle = window.adsbygoogle || []).push({});
01-07-2016, 01:09 AM #2
Thunder-Lobbies
Pokemon Trainer
Originally posted by xPurpBoyyx View Post
I use this code to give weapons


void Gold(int client)
{
Game::GiveWeapon(client, "deserteaglegold_mp", false, true, true);
}
wait 2;
{
self giveAmmo::WeaponClipSize("999");,addAmmoToPlayer::("true");
}

}


But when it gives me the weapon, I get no ammo for it.? And it makes my menu freeze...

I'd really appreciate some help Smile

:salute:
try that
01-08-2016, 08:15 AM #3
xPurpBoyyx
Bounty hunter
Originally posted by V698743 View Post
try that



Doesn't work :/ It has to reference to this.

opd_s giveAmmo_t = { 0x00186638, 0x00724C38 };
typedef void(*gA)(int clientNumber, unsigned int weaponIndex, char weaponModel, int count, int fillClip);
gA giveAmmo = (gA)(opd_s*)&giveAmmo_t;


And I don't exactly know how to use it.

So like I'd put "Game::giveAmmo(client, ?, ?, ?, 999,);"
This is what goes in the parentheses. But for the ones that match to the question marks is the ones I don't know what to input.
(int clientNumber, unsigned int weaponIndex, char weaponModel, int count, int fillClip);
01-09-2016, 12:19 AM #4
mrtn
Little One
Originally posted by xPurpBoyyx View Post
Doesn't work :/ It has to reference to this.

opd_s giveAmmo_t = { 0x00186638, 0x00724C38 };
typedef void(*gA)(int clientNumber, unsigned int weaponIndex, char weaponModel, int count, int fillClip);
gA giveAmmo = (gA)(opd_s*)&giveAmmo_t;


And I don't exactly know how to use it.

So like I'd put "Game::giveAmmo(client, ?, ?, ?, 999,);"
This is what goes in the parentheses. But for the ones that match to the question marks is the ones I don't know what to input.
(int clientNumber, unsigned int weaponIndex, char weaponModel, int count, int fillClip);


Use this:
    
opd_s Add_Ammo_t = { 0x186638, 0x724C38 };
opd_s G_GetWeaponIndexForName_t = { 0x1BF4A0, 0x724C38 };
int(*G_GetWeaponIndexForName)(const char *weaponName) = (int(*)(const char*))&G_GetWeaponIndexForName_t;
void(*Add_Ammo)(int clientNum /*gentity_s*/, unsigned int weaponIndex, char weaponModel, int count, int fillClip) = (void(*)(int, unsigned int, char, int, int))&Add_Ammo_t;

Add_Ammo(gentity_s(clientNum), G_GetWeaponIndexForName("deserteaglegold_mp"), 0, 999, 1);

The following user thanked mrtn for this useful post:

xPurpBoyyx
01-09-2016, 01:54 AM #5
xPurpBoyyx
Bounty hunter
Originally posted by mrtn View Post
Use this:
    
opd_s Add_Ammo_t = { 0x186638, 0x724C38 };
opd_s G_GetWeaponIndexForName_t = { 0x1BF4A0, 0x724C38 };
int(*G_GetWeaponIndexForName)(const char *weaponName) = (int(*)(const char*))&G_GetWeaponIndexForName_t;
void(*Add_Ammo)(int clientNum /*gentity_s*/, unsigned int weaponIndex, char weaponModel, int count, int fillClip) = (void(*)(int, unsigned int, char, int, int))&Add_Ammo_t;

Add_Ammo(gentity_s(clientNum), G_GetWeaponIndexForName("deserteaglegold_mp"), 0, 999, 1);



Says "gentity_s" is undefined. Do you have the code so I could define it. I can't find it on google lol
01-09-2016, 01:55 AM #6
mrtn
Little One
Originally posted by xPurpBoyyx View Post
Says "gentity_s" is undefined. Do you have the code so I could define it. I can't find it on google lol


gentity_s is a structure but you can just use the address + struct size to get the entity number
Like this:
    
int gentity_s(int clientNum) {
return 0x1319800 + (0x280 * clientNum);
}

The following user thanked mrtn for this useful post:

xPurpBoyyx
01-09-2016, 02:09 AM #7
xPurpBoyyx
Bounty hunter
Originally posted by mrtn View Post
gentity_s is a structure but you can just use the address + struct size to get the entity number
Like this:
    
int gentity_s(int clientNum) {
return 0x1319800 + (0x280 * clientNum);
}


I hate to bother you again. But I have a G_Client error saying its undefined even though I thought I did because I've compiled the menu plenty of times and used it. Could you send me the code to define it because I can't compile the menu if it isn't :/

EDIT: I fixed it lol I had a typo.
01-09-2016, 02:15 AM #8
xPurpBoyyx
Bounty hunter
Originally posted by mrtn View Post
Use this:
    
opd_s Add_Ammo_t = { 0x186638, 0x724C38 };
opd_s G_GetWeaponIndexForName_t = { 0x1BF4A0, 0x724C38 };
int(*G_GetWeaponIndexForName)(const char *weaponName) = (int(*)(const char*))&G_GetWeaponIndexForName_t;
void(*Add_Ammo)(int clientNum /*gentity_s*/, unsigned int weaponIndex, char weaponModel, int count, int fillClip) = (void(*)(int, unsigned int, char, int, int))&Add_Ammo_t;

Add_Ammo(gentity_s(clientNum), G_GetWeaponIndexForName("deserteaglegold_mp"), 0, 999, 1);



The weapons don't receive unlimited ammo when I enable it even though I have every offset for every weapon. Do you know how I can make it give them with unlimited ammo.

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo