temporarily fucking with giving weapons to clients
This commit is contained in:
parent
ce5f153ebc
commit
c8b124af30
@ -6,6 +6,8 @@
|
|||||||
#include <dhooks>
|
#include <dhooks>
|
||||||
|
|
||||||
Handle hGiveNamedItem;
|
Handle hGiveNamedItem;
|
||||||
|
Handle g_hLimitGiveNamedTimer = null;
|
||||||
|
bool allow_given_named_item;
|
||||||
|
|
||||||
//the trololo guy is actively checking all plugins running. he should not be aware that we got somehwere.
|
//the trololo guy is actively checking all plugins running. he should not be aware that we got somehwere.
|
||||||
|
|
||||||
@ -20,6 +22,7 @@ public Plugin myinfo =
|
|||||||
|
|
||||||
public void OnPluginStart()
|
public void OnPluginStart()
|
||||||
{
|
{
|
||||||
|
allow_given_named_item = true;
|
||||||
Handle conf = LoadGameConfigFile("track_give_named_item.css");
|
Handle conf = LoadGameConfigFile("track_give_named_item.css");
|
||||||
if (conf == INVALID_HANDLE)
|
if (conf == INVALID_HANDLE)
|
||||||
SetFailState("Failed to load gamedata track_give_named_item.css");
|
SetFailState("Failed to load gamedata track_give_named_item.css");
|
||||||
@ -39,12 +42,32 @@ public void OnPluginStart()
|
|||||||
SetFailState("Failed to detour CCSPlayer::GiveNamedItem");
|
SetFailState("Failed to detour CCSPlayer::GiveNamedItem");
|
||||||
|
|
||||||
delete conf;
|
delete conf;
|
||||||
|
|
||||||
|
g_hLimitGiveNamedTimer = CreateTimer(0.10, Timer_Permit_given_named_item, _, TIMER_REPEAT);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Action Timer_Permit_given_named_item(Handle hTimer)
|
||||||
|
{
|
||||||
|
allow_given_named_item = true;
|
||||||
|
return Plugin_Handled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnPluginEnd()
|
||||||
|
{
|
||||||
|
if (g_hLimitGiveNamedTimer != null)
|
||||||
|
delete g_hLimitGiveNamedTimer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MRESReturn track_give_named_item(int pThis, Handle hReturn, Handle hParams)
|
public MRESReturn track_give_named_item(int pThis, Handle hReturn, Handle hParams)
|
||||||
{
|
{
|
||||||
char pszName[512];
|
char pszName[512];
|
||||||
DHookGetParamString(hParams, 1, pszName, sizeof(pszName));
|
DHookGetParamString(hParams, 1, pszName, sizeof(pszName));
|
||||||
|
if (!allow_given_named_item && !StrEqual(pszName, "weapon_knife"))
|
||||||
|
{
|
||||||
|
DHookSetReturn(hReturn, 0);
|
||||||
|
return MRES_Supercede;
|
||||||
|
}
|
||||||
|
allow_given_named_item = false;
|
||||||
|
|
||||||
int iSubType = DHookGetParam(hParams, 2);
|
int iSubType = DHookGetParam(hParams, 2);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user