Try to compile this:
PHP Code:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#pragma newdecls required
#pragma semicolon 1
#define DickPath "models/3d/penis/penis.mdl"
#define PLUGIN_AUTHOR "Hexah"
#define PLUGIN_VERSION "1.00"
bool bEquipDick[MAXPLAYERS + 1] = false;
int iEntIndex[MAXPLAYERS + 1] = -1;
public Plugin myinfo =
{
name = "Hexah | Blocks from zeph",
author = PLUGIN_AUTHOR,
description = "",
version = PLUGIN_VERSION,
url = "https://forums.alliedmods.net/showthread.php?t=298804"
};
public void OnPluginStart()
{
RegAdminCmd("sm_dick", Command_Dick, ADMFLAG_RESERVATION, "Equip a dick!");
HookEvent("player_spawn", OnPlayerSpawn, EventHookMode_Post);
}
public void OnPlayerSpawn(Event event, const char[] name, bool dontbroadcast)
{
int client = GetClientOfUserId(event.GetInt("userid"));
if (bEquipDick[client])
{
CreateHat(client);
}
}
public void OnMapStart()
{
PrecacheModel2(DickPath);
}
public Action Command_Dick(int client, int args)
{
if (!IsPlayerAlive(client))
{
ReplyToCommand(client, "[SM] You need to be alive to use this command");
return Plugin_Handled;
}
if (!bEquipDick[client])
{
ReplyToCommand(client, "[SM] You equiped the dick");
CreateHat(client);
bEquipDick[client] = true;
}
else
{
ReplyToCommand(client, "[SM] You unquiped the dick");
RemoveHat(client);
bEquipDick[client] = false;
}
return Plugin_Handled;
}
//From zeph store
void CreateHat(int client)
{
int m_iEnt = CreateEntityByName("prop_dynamic_override");
DispatchKeyValue(m_iEnt, "model", DickPath);
DispatchKeyValue(m_iEnt, "spawnflags", "256");
DispatchKeyValue(m_iEnt, "solid", "0");
SetEntPropEnt(m_iEnt, Prop_Send, "m_hOwnerEntity", client);
float fHatOrigin[3];
fHatOrigin[0] = -0.500000;
fHatOrigin[1] = -4.500000;
fHatOrigin[2] = -44.000000;
float fHatAngles[3];
fHatAngles[0] = 5.000000;
fHatAngles[1] = 0.000000;
fHatAngles[2] = 1.000000;
DispatchSpawn(m_iEnt);
AcceptEntityInput(m_iEnt, "TurnOn", m_iEnt, m_iEnt, 0);
iEntIndex[client] = m_iEnt;
// We don't want the client to see his own hat
SDKHook(m_iEnt, SDKHook_SetTransmit, Hook_SetTransmit);
// Teleport the hat to the right position and attach it
TeleportEntity(m_iEnt, fHatOrigin, fHatAngles, NULL_VECTOR);
SetVariantString("!activator");
AcceptEntityInput(m_iEnt, "SetParent", client, m_iEnt, 0);
SetVariantString(DickPath);
AcceptEntityInput(m_iEnt, "SetParentAttachmentMaintainOffset", m_iEnt, m_iEnt, 0);
}
void RemoveHat(int client)
{
if (IsValidEdict(iEntIndex[client]))
{
SDKUnhook(iEntIndex[client], SDKHook_SetTransmit, Hook_SetTransmit);
char m_szClassname[64];
GetEdictClassname(iEntIndex[client], m_szClassname, sizeof(m_szClassname));
if (strcmp("prop_dynamic", m_szClassname) == 0)
AcceptEntityInput(iEntIndex[client], "Kill");
}
}
//From zeph stock
stock int PrecacheModel2(const char[] model, bool preload = false)
{
static int m_unModelPrecache = INVALID_STRING_TABLE;
if (m_unModelPrecache == INVALID_STRING_TABLE)
{
m_unModelPrecache = FindStringTable("modelprecache");
}
return PrecacheModel(model, preload);
}
public Action Hook_SetTransmit(int ent, int client)
{
if (client && IsClientInGame(client) && bEquipDick[client] && ent == iEntIndex[client])
{
return Plugin_Handled;
}
return Plugin_Continue;
}
It's my first time that "I work" with models... If you won't i'll test it after...
the command is: "sm_dick" and the default flag is "a".
You'll need use another plugin to download the models, if you want i can try to add an automatic download.
__________________