There are two ways... I haven't found bonusweaponloadoutslot to second way.
But here is way to do it with
events.
Event's fire always in same order.
This example have also trash code, ignore it.
PHP Code:
/*
Server event "player_death", Tick 28790:
- "userid" = "12"
- "attacker" = "2"
- "assister" = "0"
- "assistedflash" = "0"
- "weapon" = "elite"
- "weapon_itemid" = "7667212035"
- "weapon_fauxitemid" = "17293822569105719298"
- "weapon_originalowner_xuid" = "76561197988592905"
- "headshot" = "1"
- "dominated" = "0"
- "revenge" = "0"
- "wipe" = "0"
- "penetrated" = "0"
- "noreplay" = "1"
Server event "item_pickup_slerp", Tick 28790:
- "userid" = "2"
- "index" = "352"
- "behavior" = "1"
Server event "item_pickup", Tick 28790:
- "userid" = "2"
- "item" = "healthshot"
- "silent" = "1"
- "defindex" = "57"
Server event "gg_leader", Tick 28790:
- "playerid" = "2"
Server event "gg_killed_enemy", Tick 28790:
- "victimid" = "12"
- "attackerid" = "2"
- "dominated" = "0"
- "revenge" = "0"
- "bonus" = "1"
*/
#include <sdktools>
public void OnPluginStart()
{
HookEventEx("player_death", gg_bonus_kill);
HookEventEx("gg_killed_enemy", gg_bonus_kill);
RegConsoleCmd("sm_test", test);
}
public void gg_bonus_kill(Event event, const char[] name, bool dontBroadcast)
{
static int tick[MAXPLAYERS+1];
static char weapon[MAXPLAYERS+1][MAX_NAME_LENGTH];
if(StrEqual(name, "player_death", false))
{
int attacker = GetClientOfUserId(event.GetInt("attacker"));
tick[attacker] = GetGameTickCount();
event.GetString("weapon", weapon[attacker], sizeof(weapon[]));
return;
}
// not bonus kill
if(event.GetInt("bonus") != 1) return;
int attackerid = GetClientOfUserId(event.GetInt("attackerid"));
// some odd reason tick doesn't match.
if(tick[attackerid] != GetGameTickCount()) return;
// success
BonusGun(attackerid, weapon[attackerid]);
}
void BonusGun(int client, const char[] weapon)
{
PrintToServer("%N %s", client, weapon);
}
public Action test(int client, int args)
{
int m_iBonusProgress = GetEntProp(client, Prop_Send, "m_iBonusProgress");
int m_iBonusChallenge = GetEntProp(client, Prop_Send, "m_iBonusChallenge");
PrintToServer("m_iBonusProgress %i\nm_iBonusChallenge%i", m_iBonusProgress, m_iBonusChallenge);
float m_flDMBonusStartTime = GameRules_GetPropFloat("m_flDMBonusStartTime");
float m_flDMBonusTimeLength = GameRules_GetPropFloat("m_flDMBonusTimeLength");
int m_unDMBonusWeaponLoadoutSlot = GameRules_GetProp("m_unDMBonusWeaponLoadoutSlot");
int m_bDMBonusActive = GameRules_GetProp("m_bDMBonusActive");
PrintToServer("m_flDMBonusStartTime %f\nm_flDMBonusTimeLength %f\nm_unDMBonusWeaponLoadoutSlot %i\nm_bDMBonusActive %i\n",
m_flDMBonusStartTime,
m_flDMBonusTimeLength,
m_unDMBonusWeaponLoadoutSlot,
m_bDMBonusActive);
PrintToServer("m_GGProgressiveWeaponOrderCT %i", GameRules_GetProp("m_GGProgressiveWeaponOrderCT", _, m_unDMBonusWeaponLoadoutSlot));
PrintToServer("m_GGProgressiveWeaponKillUpgradeOrderT %i", GameRules_GetProp("m_GGProgressiveWeaponKillUpgradeOrderT", _, m_unDMBonusWeaponLoadoutSlot));
return Plugin_Continue;
}
*edit
I think I figured out how second way is working. It has to do with items_game.txt
I add that code later here.
__________________