Quote:
Originally Posted by cosmicfugue
Thanks for helping,
but i have fun servers, what is the plugin enable code ? i dont want plugin playing in jailbreak and other maps, i want just surf? i have maps prefix but i need plugins enable code..
|
PHP Code:
#include <sourcemod>
#include <sdktools_functions>
#include <sdktools_entinput>
#pragma newdecls required
#pragma semicolon 1
ConVar gCV_Enable;
public void OnPluginStart()
{
gCV_Enable = CreateConVar("cleanup_enable", "1", "Enables the clean up plugin.", FCVAR_NOTIFY, true, 0.0, true, 1.0);
HookEvent("player_death", Event_PlayerDeath, EventHookMode_Pre);
}
public void Event_PlayerDeath(Event hEvent, const char[] sEventName, bool bDontBroadcast)
{
if (!gCV_Enable.BoolValue)
return;
int client = GetClientOfUserId(hEvent.GetInt("userid"));
if (0 < client <= MaxClients && IsClientInGame(client))
{
int iRagdoll = GetEntPropEnt(client, Prop_Send, "m_hRagdoll");
if (IsValidEdict(iRagdoll)) AcceptEntityInput(iRagdoll, "Kill");
int offset = FindDataMapInfo(client, "m_hMyWeapons") - 4;
for (int i = 0; i < 48; i++)
{
offset += 4;
int iWeapon = GetEntDataEnt2(client, offset);
if (IsValidEdict(iWeapon))
{
int iAmmo = FindDataMapInfo(client, "m_iAmmo") + (GetEntProp(iWeapon, Prop_Data, "m_iPrimaryAmmoType") * 4);
SetEntData(client, iAmmo, 0, 4, true);
iAmmo = FindDataMapInfo(client, "m_iAmmo") + (GetEntProp(iWeapon, Prop_Data, "m_iSecondaryAmmoType") * 4);
SetEntData(client, iAmmo, 0, 4, true);
if (RemovePlayerItem(client, iWeapon))
AcceptEntityInput(iWeapon, "Kill");
}
}
}
}
cleanup_enable is the convar to enable/disable the plugin.
__________________