The Following is suppose to change the player's max clip size for the weapons he uses. I was going to turn it into a percentage so it works for all weapons because if it adds 10 to a shotgun you would have 18 shots...lmao. The problem is, it won't get past KillScore == 50, because I dont see it displaying the message.
PHP Code:
// *********************************************************************************
// PREPROCESSOR
// *********************************************************************************
// *********************************************************************************
#pragma semicolon 1 // Force strict semicolon mode.
// INCLUDES
// *********************************************************************************
#include <sourcemod>
#include <sdktools>
#include <sdktools_functions>
new Handle:KillScore;
// ------------------------------------------------------------------------
// OnPluginStart()
// ------------------------------------------------------------------------
public OnPluginStart()
{
KillScore = 0;
HookEvent("ammo_pickup", Event_CheckAmmo);
HookEvent("infected_death", Event_InfectedDeath);
}
// ------------------------------------------------------------------------
// Event_CheckAmmo()
// ------------------------------------------------------------------------
public Event_CheckAmmo(Handle:event, const String:name[], bool:dontBroadcast)
{
new Client = GetClientOfUserId(GetEventInt(event, "userid"));
new WeaponID = GetEntDataEnt2 (Client, FindSendPropOffs ( "CTerrorPlayer", "m_hActiveWeapon"));
new AmmoID = GetEntData (WeaponID , FindSendPropInfo("CBaseCombatWeapon", "m_iClip1"));
PrintToChatAll("Currently at %d", AmmoID);
}
public Event_InfectedDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
new Client = GetClientOfUserId(GetEventInt(event, "userid"));
KillScore = KillScore + 1;
PrintToChatAll("Player killed %d infected.", KillScore);
if (KillScore == 50)
{
new WeaponID = GetEntDataEnt2 (Client, FindSendPropOffs ( "CTerrorPlayer", "m_hActiveWeapon"));
new AmmoID = GetEntData (WeaponID , FindSendPropInfo("CBaseCombatWeapon", "m_iClip1"));
AmmoID = AmmoID + 10;
SetEntData(WeaponID, FindDataMapOffs(Client, "m_iClip1"), AmmoID);
PrintToChatAll("Player Was Set To %d", AmmoID);
}
else if (KillScore == 225)
{
new WeaponID = GetEntDataEnt2 (Client, FindSendPropOffs ( "CTerrorPlayer", "m_hActiveWeapon"));
new AmmoID = GetEntData (WeaponID , FindSendPropInfo("CBaseCombatWeapon", "m_iClip1"));
AmmoID = AmmoID + 20;
SetEntData(WeaponID, FindDataMapOffs(Client, "m_iClip1"), AmmoID);
PrintToChatAll("Player Was Set To %d", AmmoID);
}
}