Post: [SPRX/C++] Weapon "Functions"
08-13-2014, 01:45 PM #1
(adsbygoogle = window.adsbygoogle || []).push({}); Hello NGU
How to put weapons
    void Weap1(int client, int weaponIndex)
{
opd_s Weap = {0x2a8364, TOC };
void(*ARM)(int Offset,int arma,int num) = (void(*)(int,int,int))&Weap;
ARM(0x1780f28, weaponIndex, 0);
//
opd_s Weap10 = {0x1e6838, TOC };
void(*ARM1)(int Offset,int arma,int num,int num2,int num3) = (void(*)(int,int,int,int,int))&Weap10;
ARM1(0x16b9f20, weaponIndex, 0, 0x270f, 1);
}

Example
    if(scroll == 0)
{
Functions::Weap1(client, 0x02);
Functions::iPrintInBold(client, "^1Mp7");
}

Antonio96 and iMaGiCz
(adsbygoogle = window.adsbygoogle || []).push({});

The following 3 users say thank you to _Antonio96_ for this useful post:

ALI ALHILFI, oCoyeks, xballox
08-13-2014, 05:49 PM #2
xReaperv3
Bounty hunter
Originally posted by Antonio96
Hello NGU
How to put weapons
    void Weap1(int client, int weaponIndex)
{
opd_s Weap = {0x2a8364, TOC };
void(*ARM)(int Offset,int arma,int num) = (void(*)(int,int,int))&Weap;
ARM(0x1780f28, weaponIndex, 0);
//
opd_s Weap10 = {0x1e6838, TOC };
void(*ARM1)(int Offset,int arma,int num,int num2,int num3) = (void(*)(int,int,int,int,int))&Weap10;
ARM1(0x16b9f20, weaponIndex, 0, 0x270f, 1);
}

Example
    if(scroll == 0)
{
Functions::Weap1(client, 0x02);
Functions::iPrintInBold(client, "^1Mp7");
}

Antonio96 and iMaGiCz


Nice, i used it like this, not sure if its working also.

    
opd_s G_GivePlayerWeapon_t = { Offsets::G_GivePlayerWeapon, TOC };
int(*G_GivePlayerWeapon)(int clientIndex, int weaponIndex, int Akimbo, int Camo) = (int(*)(int, int, int, int))&G_GivePlayerWeapon_t;

opd_s G_InitializeAmmo_t = { Offsets::G_InitializeAmmo, TOC };
int(*G_InitializeAmmo)(int clientIndex, int weaponIndex, int Akimbo, int Camo) = (int(*)(int, int, int, int))&G_InitializeAmmo_t;

void GivePlayerWeapon(int clientIndex, int weaponIndex)
{
G_GivePlayerWeapon(Offsets::playerstate_s + (clientIndex * Offsets::playerstate_size), weaponIndex, 0, 0);
G_InitializeAmmo(Offsets::gentity + (clientIndex * Offsets::gentity_size), weaponIndex, 0, 0);
}

The following user thanked xReaperv3 for this useful post:

ALI ALHILFI
08-14-2014, 07:13 AM #3
y not use BG_GetWeaponIndexForName(const char *name, void (__cdecl *regWeap)(unsigned int)) or BG_FindWeaponIndexForName(const char *name) instead of
Originally posted by another user
int weaponIndex

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo