I want to add a weapon to "F2", when issued its "give_item(id, "weapon_m4a1")"
Code:
void _ClientCommand(edict_t *pEntity)
{
//........................
else if (FStrEq(pcmd, "cl_setrebuy"))
{
if (CMD_ARGC() == 2)
{
player->InitRebuyData(CMD_ARGV(1));
BOOL oldval = g_bClientPrintEnable;
g_bClientPrintEnable = false;
player->Rebuy();
g_bClientPrintEnable = oldval;
}
return;
}
//........................
}
Code:
void CBasePlayer::Rebuy(void)
{
char *string = m_rebuyString;
char *token;
m_bIsInRebuy = true;
while(1)
{
string = MP_COM_Parse(string);
token = MP_COM_GetToken();
if(!string) break;
if(!stricmp(token, "primaryWeapon")) RebuyPrimaryWeapon();
else if(!stricmp(token, "primaryAmmo")) RebuyPrimaryAmmo();
else if(!stricmp(token, "secondaryWeapon")) RebuySecondaryWeapon();
else if(!stricmp(token, "secondaryAmmo")) RebuySecondaryAmmo();
else if(!stricmp(token, "hegrenade")) RebuyHEGrenade();
else if(!stricmp(token, "flashbang")) RebuyFlashbang();
else if(!stricmp(token, "smokegrenade")) RebuySmokeGrenade();
else if(!stricmp(token, "defuser")) RebuyDefuser();
else if(!stricmp(token, "nightvision")) RebuyNightVision();
else if(!stricmp(token, "armor")) RebuyArmor();
}
m_bIsInRebuy = false;
}
Code:
char *m_rebuyString; /* 2356 4 */
PHP Code:
static bufer[256]; get_pdata_string(id, 2356, bufer, charsmax(bufer), 1, 4)
client_print(id, print_chat, bufer)
CS crashes...