Raised This Month: $51 Target: $400
 12% 

[TF2] Halloween Boss Killfeed


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
PC Gamer
Veteran Member
Join Date: Mar 2014
Old 09-30-2021 , 02:51   [TF2] Halloween Boss Killfeed
Reply With Quote #1

When I use this Skeleton King plugin the kill feed shows the attacker as SKELETON when I use fists or stomp. It shows my player name of PC Gamer in the kill feed when I use spell. It shows ERRORNAME when dominating. The plugin works fine other than that.

Questions:
1. How can I ensure the attacker appears as SKELETON for all kills made while player is the Skeleton King?
2. How can I ensure the attacker appears as the player's name for all kills made while the player is the Skeleton King?


Plugin is attached, changeteam.txt goes in gamedata folder. Fair warning... The Skeleton King is going to be waaaaaay too powerful for your server unless you are running Uber Upgrades or X10.

Code:
PHP Code:
#include <sdkhooks>
#include <tf2_stocks>
#include <tf2attributes> 

//#pragma newdecls required;

#define MODEL_SKELETON    "models/bots/skeleton_sniper_boss/skeleton_sniper_boss.mdl"
#define PLUGIN_VERSION    "1.6"


#define SPAWN "vo/halloween_mann_brothers/sf13_blutarch_enemies13.mp3"
#define SPAWN2    "ui/halloween_boss_summoned_fx.wav" 
#define DEATH "vo/halloween_boss/knight_dying.mp3"
#define DEATHBOSS     "ui/halloween_boss_defeated_fx.wav"

#define TEAM_CLASSNAME "tf_team"


#define FIREBALL    0 // Done
#define BATS         1 // Done
#define PUMPKIN     2 // Done
#define TELE         3 // Done
#define LIGHTNING     4 // Done
#define BOSS         5 // Done
#define METEOR         6 // Done
#define ZOMBIEH     7 // Done
#define ZOMBIE         8
#define PUMPKIN2     9

bool g_bSpecial[MAXPLAYERS 1];
bool g_bSkeleton[MAXPLAYERS 1];
TFTeam g_iOldTeam[MAXPLAYERS 1];

Handle g_hCvarStompDamage;

new 
lastTeam[MAXPLAYERS 1];
new 
Handle:g_hSDKTeamAddPlayer;
new 
Handle:g_hSDKTeamRemovePlayer;
new 
bool:g_wait[MAXPLAYERS 1]; 

Handle g_hWearableEquip;

public 
Plugin myinfo =
{
    
name "[TF2] Be The Skeleton King!",
    
author "Pelipoika, modified by PC Gamer",
    
description "Spooky scary skeleton",
    
version PLUGIN_VERSION,
    
url ""
}

public 
void OnPluginStart()
{
    
Handle hGameData LoadGameConfigFile("changeteam");
    
    
StartPrepSDKCall(SDKCall_Entity);
    
PrepSDKCall_SetFromConf(hGameDataSDKConf_Virtual"CTeam::AddPlayer");
    
PrepSDKCall_AddParameter(SDKType_CBasePlayerSDKPass_Pointer);
    
g_hSDKTeamAddPlayer EndPrepSDKCall();
    if(
g_hSDKTeamAddPlayer == INVALID_HANDLE)
    
SetFailState("Could not find CTeam::AddPlayer!");
    
    
StartPrepSDKCall(SDKCall_Entity);
    
PrepSDKCall_SetFromConf(hGameDataSDKConf_Virtual"CTeam::RemovePlayer");
    
PrepSDKCall_AddParameter(SDKType_CBasePlayerSDKPass_Pointer);
    
g_hSDKTeamRemovePlayer EndPrepSDKCall();
    if(
g_hSDKTeamRemovePlayer == INVALID_HANDLE)
    
SetFailState("Could not find CTeam::RemovePlayer!");
    
    
delete hGameData;

    
AddTempEntHook("TFBlood"TempHook);

    
RegAdminCmd("sm_beskeletonking"Command_SkeletonADMFLAG_SLAY);
    
    
HookEvent("post_inventory_application"Event_SkeletonDeath);
    
HookEvent("player_death"Event_SkeletonDeathEventHookMode_Pre);
    
HookEvent("round_end"Event_SkeletonDeath);    
    
    
CreateConVar("tf2_beskeleton_version"PLUGIN_VERSION"Be the Skeleton King version"FCVAR_NOTIFY|FCVAR_DONTRECORD|FCVAR_SPONLY);
    
g_hCvarStompDamage CreateConVar("tf2_beskeleton_stompdamage""120""Movement speed penalty when carrying a bomb"FCVAR_NOTIFY|FCVAR_DONTRECORDtrue0.0true1.0);
    
    for (
int client 1client <= MaxClientsclient++)
    {
        if(
client && client <= MaxClients && IsClientInGame(client))
        {
            
g_bSkeleton[client] = false;
            
g_bSpecial[client] = false;
            
g_iOldTeam[client] = TF2_GetClientTeam(client);
            
            
SDKHook(clientSDKHook_OnTakeDamageAliveTakeDamage);
        }
    }
    
    
AddNormalSoundHook(SkeletonSH);
    
    
GameData hTF2 = new GameData("sm-tf2.games"); // sourcemod's tf2 gamedata

    
if (!hTF2)
    
SetFailState("This plugin is designed for a TF2 dedicated server only.");

    
StartPrepSDKCall(SDKCall_Player);
    
PrepSDKCall_SetVirtual(hTF2.GetOffset("RemoveWearable") - 1);    // EquipWearable offset is always behind RemoveWearable, subtract its value by 1
    
PrepSDKCall_AddParameter(SDKType_CBaseEntitySDKPass_Pointer);
    
g_hWearableEquip EndPrepSDKCall();

    if (!
g_hWearableEquip)
    
SetFailState("Failed to create call: CBasePlayer::EquipWearable");

    
delete hTF2
}    

public 
Action TempHook(const char[] te_name, const Players[], int numClientsfloat delay)
{
    
int client TE_ReadNum("entindex");
    if (
client && client <= MaxClients && IsClientInGame(client) && g_bSkeleton[client])
    {
        
float m_vecOrigin[3];
        
m_vecOrigin[0] = TE_ReadFloat("m_vecOrigin[0]");
        
m_vecOrigin[1] = TE_ReadFloat("m_vecOrigin[1]");
        
m_vecOrigin[2] = TE_ReadFloat("m_vecOrigin[2]");
        
        if(
GetEntProp(clientProp_Send"m_iTeamNum") == 0)
        {
            
CreateParticle("spell_skeleton_goop_green"m_vecOrigin);
        }
        else
        {
            switch(
TF2_GetClientTeam(client))
            {
            case 
TFTeam_Red:        CreateParticle("spell_pumpkin_mirv_goop_red"m_vecOrigin);
            case 
TFTeam_Blue:        CreateParticle("spell_pumpkin_mirv_goop_blue"m_vecOrigin);
            }
        }
        
        return 
Plugin_Stop;
    }
    
    return 
Plugin_Continue;
}

public 
void OnMapStart()
{
    
PrecacheModel(MODEL_SKELETON);
    
    
PrecacheSound("misc/halloween/skeleton_break.wav");
    
PrecacheSound(SPAWN);
    
PrecacheSound(SPAWN2);
    
PrecacheSound(DEATH);
    
PrecacheSound(DEATHBOSS);    
}

public 
void OnClientPutInServer(int client)
{
    
g_bSkeleton[client] = false;
    
g_bSpecial[client] = false;
    
g_iOldTeam[client] = TFTeam_Spectator;

    
SDKHook(clientSDKHook_OnTakeDamageAliveTakeDamage);
}

public 
Action Command_Skeleton(int clientint args)
{
    if (
client && client <= MaxClients && IsClientInGame(client))
    {
        
char arg1[32], arg2[6];
        
GetCmdArg(1arg1sizeof(arg1));
        
GetCmdArg(2arg2sizeof(arg2));
        
        if(
args 1)
        {
            
MakeSkeleton(client);
            
EmitSoundToAll(SPAWN);
            
EmitSoundToAll(SPAWN2);
        }
        else
        {
            
char target_name[MAX_TARGET_LENGTH];
            
int target_list[MAXPLAYERS];
            
int    target_count;
            
bool tn_is_ml;
            if ((
target_count ProcessTargetString(
                            
arg1,
                            
client
                            
target_list
                            
MAXPLAYERS
                            
0,
                            
target_name,
                            
sizeof(target_name),
                            
tn_is_ml)) <= 0)
            {
                
ReplyToTargetError(clienttarget_count);
                return 
Plugin_Handled;
            }
            
            for (
int i 0target_counti++)
            {
                
int player target_list[i];
                
                if(
player && player <= MaxClients && IsClientInGame(player) && IsPlayerAlive(player))
                {
                    if(
StringToInt(arg2) == 1)
                    
MakeSkeleton(playertrue);
                    else
                    
MakeSkeleton(player);
                }
                
EmitSoundToAll(SPAWN);
                
EmitSoundToAll(SPAWN2);                
            }
        }
    }
    
    return 
Plugin_Handled;
}

public 
Action GetMaxHealth(int clientint &MaxHealth)
{
    if (
client && client <= MaxClients && IsClientInGame(client))
    {
        
MaxHealth 1000;
        return 
Plugin_Changed;
    }
    
    return 
Plugin_Continue;
}

public 
Action SetModel(int client, const char[] model)
{
    
SetVariantString(model);
    
AcceptEntityInput(client"SetCustomModel");
    
SetEntProp(clientProp_Send"m_bUseClassAnimations"1);        
}

stock void MakeSkeleton(int clientbool spectator false)
{
    if(
spectator)
    {
        
g_iOldTeam[client] = TF2_GetClientTeam(client);
        
SetEntProp(clientProp_Send"m_bForcedSkin"1);
        
SetEntProp(clientProp_Send"m_nForcedSkin"2);
        
        
SetEntProp(clientProp_Send"m_iTeamNum"0);
    }

    
TF2_SetPlayerClass(clientTFClass_Sniper_false);
    
ServerCommand("tf_models_remove #%d"GetClientUserId(client));    

    
lastTeam[client] = GetClientTeam(client);     
    
ChangeClientTeamEx(client0);
    
    
SetVariantString("1.5");
    
AcceptEntityInput(client"SetModelScale");
    
    
SetModel(clientMODEL_SKELETON);
    
    
TF2_RemoveAllWearables(client);
    
TF2_RemoveAllWeapons(client);

    
CreateHat(client342106); //Prince Tavish Crown
    
    
TF2_RemoveWeaponSlot(client2);
    
CreateWeapon(client"tf_weapon_fists"569920);
    
int iEntity GetPlayerWeaponSlot(client2);
    
    
SetEntityRenderMode(iEntityRENDER_TRANSCOLOR);
    
SetEntityRenderColor(iEntity2552552550);
    
SetEntProp(iEntityProp_Send"m_fEffects"16);
    
    
char anim[16];
    
Format(anim32"spawn0%i"GetRandomInt(17));
    
PlayAnimation(clientanim);
    
    
g_bSpecial[client] = true;
    
    
SetNextAttack(iEntity2.0);
    
    
SDKHook(clientSDKHook_GetMaxHealthGetMaxHealth);
    
    
SetEntProp(clientProp_Send"m_iHealth"40000);

    
CreateTimer(0.0Timer_SetModelclient);
    
    
g_bSkeleton[client] = true;
    
    
TF2Attrib_RemoveAll(client);     

    
TF2Attrib_SetByName(client"health from packs decreased"0.001);        
    
TF2Attrib_SetByName(client"cancel falling damage"1.0);            
    
TF2Attrib_SetByName(client"dmg taken from blast reduced"0.3);
    
TF2Attrib_SetByName(client"dmg taken from fire reduced"0.3);
    
TF2Attrib_SetByName(client"dmg taken from bullets reduced"0.3);
    
TF2Attrib_SetByName(client"dmg taken from crit reduced"0.3);
    
TF2Attrib_SetByName(client"dmg from ranged reduced"0.3);
    
TF2Attrib_SetByName(client"SET BONUS: dmg from sentry reduced"0.3);    
    
TF2Attrib_SetByName(client"damage force reduction"0.3);                
    
TF2Attrib_SetByName(client"cannot be backstabbed"1.0);
    
TF2Attrib_SetByName(client"airblast vulnerability multiplier"0.0);
    
TF2Attrib_SetByName(client"airblast vertical vulnerability multiplier"0.0);
    
TF2Attrib_SetByName(client"cannot pick up intelligence"1.0);        

    new 
Weapon3 GetPlayerWeaponSlot(client2);
    
TF2Attrib_RemoveAll(Weapon3);
    
TF2Attrib_SetByName(Weapon3"melee attack rate bonus"0.4);    
    
TF2Attrib_SetByName(Weapon3"melee bounds multiplier"5.0);                    
    
TF2Attrib_SetByName(Weapon3"melee range multiplier"5.0);    
    
TF2Attrib_SetByName(Weapon3"damage bonus"12.0);
    
TF2Attrib_SetByName(Weapon3"armor piercing"100.0);
    
TF2Attrib_SetByName(Weapon3"dmg pierces resists absorbs"1.0);
    
TF2Attrib_SetByName(Weapon3"dmg bonus vs buildings"5.0);    
    
    
PrintToChat(client"You are the Skeleton King!");
    
PrintToChat(client"Skeleton King Commands: Use Right-Click to Stomp players,");
    
PrintToChat(client"Use Mouse3 button (press down on mousewheel) to cast a Lightning spell");
    
PrintToChat(client"You can attack BOTH Teams.");

    
PrintCenterText(client"Skeleton King Commands: Use Right-Click to Stomp players, Use Mouse3 button (press down on mousewheel) to cast a Lightning spell, You can attack BOTH Teams.");    
}

stock void PlayAnimation(int clientchar[] anim)
{
    
TeleportEntity(clientNULL_VECTORNULL_VECTORview_as<float>({0.00.00.0}));
    
SetEntityRenderMode(clientRENDER_TRANSCOLOR);
    
SetEntityRenderColor(client2552552550);
    
    
SetEntProp(clientProp_Send"m_bUseClassAnimations"0);    
    
SetEntityMoveType(clientMOVETYPE_NONE);
    
    
float vecOrigin[3], vecAngles[3];
    
GetClientAbsOrigin(clientvecOrigin);
    
GetClientAbsAngles(clientvecAngles);
    
vecAngles[0] = 0.0;

    
int animationentity CreateEntityByName("prop_dynamic_override");
    if(
IsValidEntity(animationentity))
    {
        
DispatchKeyValueVector(animationentity"origin"vecOrigin);
        
DispatchKeyValueVector(animationentity"angles"vecAngles);
        
DispatchKeyValue(animationentity"model"MODEL_SKELETON);
        
DispatchKeyValue(animationentity"defaultanim"anim);
        
DispatchSpawn(animationentity);
        
SetEntPropEnt(animationentityProp_Send"m_hOwnerEntity"client);
        
        if(
GetEntProp(clientProp_Send"m_iTeamNum") == 0)
        
SetEntProp(animationentityProp_Send"m_nSkin"GetEntProp(clientProp_Send"m_nForcedSkin"));
        else
        
SetEntProp(animationentityProp_Send"m_nSkin"GetClientTeam(client) - 2);
        
        
SetEntPropFloat(animationentityProp_Send"m_flModelScale"1.5);
        
        
SetVariantString("OnAnimationDone !self:KillHierarchy::0.0:1");
        
AcceptEntityInput(animationentity"AddOutput");
        
        
HookSingleEntityOutput(animationentity"OnAnimationDone"OnAnimationDonetrue);
    }
}

public 
void OnAnimationDone(const char[] outputint callerint activatorfloat delay)
{    
    if(
IsValidEntity(caller))
    {
        
int client GetEntPropEnt(callerProp_Send"m_hOwnerEntity");
        if(
client && client <= MaxClients && IsClientInGame(client) && IsPlayerAlive(client))
        {
            
SetEntityMoveType(clientMOVETYPE_WALK);
            
SetEntProp(clientProp_Send"m_bUseClassAnimations"1);        
            
SetEntityRenderMode(clientRENDER_TRANSCOLOR);
            
SetEntityRenderColor(client255255255255);
            
            
g_bSpecial[client] = false;
        }
    }
}

public 
Action OnPlayerRunCmd(int clientint &iButtonsint &iImpulsefloat fVel[3], float fAng[3], int &iWeapon
{
    if (
IsPlayerAlive(client))
    {
        if(
iButtons IN_ATTACK2 && !g_bSpecial[client] && g_bSkeleton[client] && GetEntPropEnt(clientProp_Send"m_hGroundEntity") != -1)
        {
            
SetNextAttack(GetPlayerWeaponSlot(clientTFWeaponSlot_Melee), 2.0);
            
PlayAnimation(client"MELEE_swing3");
            
g_bSpecial[client] = true;
            
            
float vecAngles[3], vecOrigin[3];
            
GetClientAbsAngles(clientvecAngles);
            
GetClientAbsOrigin(clientvecOrigin);
            
vecAngles[0] = 0.0;
            
            
Handle pack;
            
CreateDataTimer(0.75Timer_PerformStomppackTIMER_FLAG_NO_MAPCHANGE);
            
WritePackCell(packclient);
            
WritePackFloat(packvecOrigin[0]);
            
WritePackFloat(packvecOrigin[1]);
            
WritePackFloat(packvecOrigin[2]);
            
            
WritePackFloat(packvecAngles[0]);
            
WritePackFloat(packvecAngles[1]);
            
WritePackFloat(packvecAngles[2]);
        }
        else if(
iButtons IN_ATTACK3 && g_bSkeleton[client] == true && g_wait[client] == false)         
        { 
            
ShootProjectile(clientLIGHTNING);
            
g_wait[client] = true;
            
CreateTimer(5.0Waitingclient);        
        }
    }
    
    return 
Plugin_Continue;
}

public 
Action Timer_PerformStomp(Handle timerHandle pack)
{
    
ResetPack(pack);
    
int client ReadPackCell(pack);
    
float vecAngles[3], vecOrigin[3];
    
vecOrigin[0] = ReadPackFloat(pack);
    
vecOrigin[1] = ReadPackFloat(pack);
    
vecOrigin[2] = ReadPackFloat(pack);
    
    
vecAngles[0] = ReadPackFloat(pack);
    
vecAngles[1] = ReadPackFloat(pack);
    
vecAngles[2] = ReadPackFloat(pack);
    
    
float vForward[3], vLeft[3];
    
GetAngleVectors(vecAnglesvForwardNULL_VECTORNULL_VECTOR);
    
GetAngleVectors(vecAnglesNULL_VECTORvLeftNULL_VECTOR);
    
vecOrigin[0] += (vForward[0] * 55);
    
vecOrigin[1] += (vForward[1] * 55);
    
vecOrigin[2] += (vForward[2] * 55);
    
    
vecOrigin[0] += (vLeft[0] * -35);
    
vecOrigin[1] += (vLeft[1] * -35);
    
vecOrigin[2] += (vLeft[2] * -35);
    
    
CreateParticle("bomibomicon_ring"vecOrigin);    //The effect actually comes out of his leg VALVE
    
    
float pos2[3], Vec[3], AngBuff[3];
    
    for(
int i 1<= MaxClientsi++)
    {
        if(
IsClientInGame(i) && IsPlayerAlive(i) && != client && GetClientTeam(i) != GetClientTeam(client))
        {
            
GetClientAbsOrigin(ipos2);

            if(
GetVectorDistance(vecOriginpos2) <= 200.0)
            {
                
MakeVectorFromPoints(vecOriginpos2Vec);
                
GetVectorAngles(VecAngBuff);
                
AngBuff[0] -= 30.0
                
GetAngleVectors(AngBuffVecNULL_VECTORNULL_VECTOR);
                
NormalizeVector(VecVec);
                
ScaleVector(Vec500.0);    
                
Vec[2] += 250.0;
                
SDKHooks_TakeDamage(iclientclientGetConVarFloat(g_hCvarStompDamage));
                
TeleportEntity(iNULL_VECTORNULL_VECTORVec);
            }
        }
    }
}

public 
Action TakeDamage(int victimint &attackerint &inflictorfloat &damageint &damagetype)
{
    if(
victim && victim <= MaxClients && IsClientInGame(victim
            && 
attacker && attacker <= MaxClients && IsClientInGame(attacker)
            && 
attacker != victim)
    {
        if(
g_bSkeleton[attacker])
        {
            
//damage = GetRandomFloat(95.0, 120.0);
            
damage damage 20
            
return Plugin_Changed;
        }
    }
    
    return 
Plugin_Continue
}

public 
Action Event_SkeletonDeath(Handle hEventchar[] namebool dontBroadcast)
{
    
int client GetClientOfUserId(GetEventInt(hEvent"userid"));
    
int attacker GetEventInt(hEvent"inflictor_entindex");
    
    if(
g_bSkeleton[client])
    {
        
EmitSoundToAll("misc/halloween/skeleton_break.wav"client);
        
EmitSoundToAll(DEATH);
        
EmitSoundToAll(DEATHBOSS);        

        
TF2Attrib_RemoveAll(client);
        
ForcePlayerSuicide(client);        
        
        
g_bSkeleton[client] = false;
        
g_bSpecial[client] = false;
        
        
SDKUnhook(clientSDKHook_GetMaxHealthGetMaxHealth);
        
        
SetEntityMoveType(clientMOVETYPE_WALK);
        
SetEntProp(clientProp_Send"m_bUseClassAnimations"1);        
        
SetEntProp(clientProp_Send"m_bForcedSkin"0);
        if(
GetEntProp(clientProp_Send"m_iTeamNum") == 0)
        {
            
SetEntProp(clientProp_Send"m_iTeamNum"g_iOldTeam[client]);
            
g_iOldTeam[client] = TFTeam_Spectator;
        }
        
SetEntityRenderMode(clientRENDER_TRANSCOLOR);
        
SetEntityRenderColor(client255255255255);
        
        
SetVariantString("");
        
AcceptEntityInput(client"SetCustomModel");
        
        
SetVariantString("1.0");
        
AcceptEntityInput(client"SetModelScale");
        
        
RemoveModel(client);
        
ChangeClientTeamEx(clientlastTeam[client]);        
        
ForcePlayerSuicide(client);
        
        
float vecOrigin[3];
        
GetClientAbsOrigin(clientvecOrigin);
        
        
//Drop a Rare spellbook
        
int spell CreateEntityByName("tf_spell_pickup");
        if(
IsValidEntity(spell))
        {
            
DispatchKeyValueVector(spell"origin"vecOrigin);
            
DispatchKeyValueVector(spell"basevelocity"view_as<float>({0.00.00.0}));
            
DispatchKeyValueVector(spell"velocity"view_as<float>({0.00.00.0}));
            
DispatchKeyValue(spell"powerup_model""models/props_halloween/hwn_spellbook_upright_major.mdl");
            
DispatchKeyValue(spell"OnPlayerTouch""!self,Kill,,0,-1");
            
            
DispatchSpawn(spell);
            
            
SetVariantString("OnUser1 !self:kill::60:1");
            
AcceptEntityInput(spell"AddOutput");
            
AcceptEntityInput(spell"FireUser1");
            
            
SetEntPropEnt(spellProp_Send"m_hOwnerEntity"client);
            
SetEntProp(spellProp_Data"m_nTier"1);
        }
    }
    
    if(
attacker && attacker <= MaxClients && IsClientInGame(attacker) && g_bSkeleton[attacker])
    {
        
SetEventInt(hEvent"attacker"0);
        
SetEventString(hEvent"weapon""spellbook_skeleton"); 
        
SetEventInt(hEvent"customkill"66); 
        
SetEventString(hEvent"weapon_logclassname""spellbook_skeleton");
    }
    
    return 
Plugin_Continue;
}

public 
Action SkeletonSH(clients[64], int &numClientschar sample[PLATFORM_MAX_PATH], int &entityint &channelfloat &volumeint &levelint &pitchint &flagschar soundEntry[PLATFORM_MAX_PATH], int &seed)
{
    if (
entity && entity <= MaxClients && IsClientInGame(entity))
    {
        if (!
g_bSkeleton[entity]) return Plugin_Continue;
        
        if (
StrContains(sample"vo/sniper"false) != -1)
        {
            
Format(samplesizeof(sample), "misc/halloween/skeletons/skelly_giant_0%i.wav"GetRandomInt(13));
            
PrecacheSound(sample);
            
EmitSoundToAll(sampleentitychannellevelflagsvolume);
            
            return 
Plugin_Changed;
        }
    }

    return 
Plugin_Continue;
}

stock void TF2_RemoveAllWearables(int client)
{
    
int wearable = -1;
    while ((
wearable FindEntityByClassname(wearable"tf_wearable*")) != -1)
    {
        if (
IsValidEntity(wearable))
        {
            
int player GetEntPropEnt(wearableProp_Send"m_hOwnerEntity");
            if (
client == player)
            {
                
TF2_RemoveWearable(clientwearable);
            }
        }
    }
    
    while ((
wearable FindEntityByClassname(wearable"vgui_screen")) != -1)
    {
        if (
IsValidEntity(wearable))
        {
            
int player GetEntPropEnt(wearableProp_Data"m_hOwnerEntity");
            if (
client == player)
            {
                
AcceptEntityInput(wearable"Kill");
            }
        }
    }

    while ((
wearable FindEntityByClassname(wearable"tf_powerup_bottle")) != -1)
    {
        if (
IsValidEntity(wearable))
        {
            
int player GetEntPropEnt(wearableProp_Send"m_hOwnerEntity");
            if (
client == player)
            {
                
TF2_RemoveWearable(clientwearable);
            }
        }
    }

    while ((
wearable FindEntityByClassname(wearable"tf_weapon_spellbook")) != -1)
    {
        if (
IsValidEntity(wearable))
        {
            
int player GetEntPropEnt(wearableProp_Send"m_hOwnerEntity");
            if (
client == player)
            {
                
TF2_RemoveWearable(clientwearable);
            }
        }
    }
}

stock void SetNextAttack(int weaponfloat duration 0.0)
{
    if (!
IsValidEntity(weapon)) return;
    
    
float next GetGameTime() + duration;
    
    
SetEntPropFloat(weaponProp_Send"m_flNextPrimaryAttack"next);
    
SetEntPropFloat(weaponProp_Send"m_flNextSecondaryAttack"next);
}

stock void CreateParticle(char[] particlefloat pos[3])
{
    
int tblidx FindStringTable("ParticleEffectNames");
    
char tmp[256];
    
int count GetStringTableNumStrings(tblidx);
    
int stridx INVALID_STRING_INDEX;
    
    for(
int i 0counti++)
    {
        
ReadStringTable(tblidxitmpsizeof(tmp));
        if(
StrEqual(tmpparticlefalse))
        {
            
stridx i;
            break;
        }
    }
    
    for(
int i 1<= MaxClientsi++)
    {
        if(!
IsValidEntity(i)) continue;
        if(!
IsClientInGame(i)) continue;
        
TE_Start("TFParticleEffect");
        
TE_WriteFloat("m_vecOrigin[0]"pos[0]);
        
TE_WriteFloat("m_vecOrigin[1]"pos[1]);
        
TE_WriteFloat("m_vecOrigin[2]"pos[2]);
        
TE_WriteNum("m_iParticleSystemIndex"stridx);
        
TE_WriteNum("entindex", -1);
        
TE_WriteNum("m_iAttachType"5);    //Dont associate with any entity
        
TE_SendToClient(i0.0);
    }
}

public 
int Native_SetSkeleton(Handle pluginint args)
{
    
MakeSkeleton(GetNativeCell(1));
}

public 
int Native_IsSkeleton(Handle pluginint args)
{
    return 
g_bSkeleton[GetNativeCell(1)];
}

public 
Action:RemoveModel(client)
{
    if (
IsValidClient(client))
    {
        
SetEntPropFloat(clientProp_Send"m_flModelScale"1.0);
        
SetVariantString("");
        
AcceptEntityInput(client"SetCustomModel");
    }
}

stock bool:IsValidClient(client)
{
    if (
client <= 0) return false;
    if (
client MaxClients) return false;
    return 
IsClientInGame(client);
}

public 
Action:Timer_SetModel(Handle:timerany:client)
{
    if (
IsValidClient(client))
    
SetModel(clientMODEL_SKELETON);
}

void ChangeClientTeamEx(iClientint iNewTeamNum)
{
    
int iTeamNum GetEntProp(iClientProp_Send"m_iTeamNum");
    
    
// Safely swap team
    
int iTeam MaxClients+1;
    while ((
iTeam FindEntityByClassname(iTeamTEAM_CLASSNAME)) != -1)
    {
        
int iAssociatedTeam GetEntProp(iTeamProp_Send"m_iTeamNum");
        if (
iAssociatedTeam == iTeamNum)
        
SDK_Team_RemovePlayer(iTeamiClient);
        else if (
iAssociatedTeam == iNewTeamNum)
        
SDK_Team_AddPlayer(iTeamiClient);
    }
    
    
SetEntProp(iClientProp_Send"m_iTeamNum"iNewTeamNum);
}

void SDK_Team_AddPlayer(int iTeamint iClient)
{
    if (
g_hSDKTeamAddPlayer != INVALID_HANDLE)
    {
        
SDKCall(g_hSDKTeamAddPlayeriTeamiClient);
    }
}

void SDK_Team_RemovePlayer(int iTeamint iClient)
{
    if (
g_hSDKTeamRemovePlayer != INVALID_HANDLE)
    {
        
SDKCall(g_hSDKTeamRemovePlayeriTeamiClient);
    }
}

ShootProjectile(clientspell)
{
    new 
Float:vAngles[3]; // original
    
new Float:vPosition[3]; // original
    
GetClientEyeAngles(clientvAngles);
    
GetClientEyePosition(clientvPosition);
    new 
String:strEntname[45] = "";
    switch(
spell)
    {
    case 
FIREBALL:         strEntname "tf_projectile_spellfireball";
    case 
LIGHTNING:     strEntname "tf_projectile_lightningorb";
    case 
PUMPKIN:         strEntname "tf_projectile_spellmirv";
    case 
PUMPKIN2:         strEntname "tf_projectile_spellpumpkin";
    case 
BATS:             strEntname "tf_projectile_spellbats";
    case 
METEOR:         strEntname "tf_projectile_spellmeteorshower";
    case 
TELE:             strEntname "tf_projectile_spelltransposeteleport";
    case 
BOSS:            strEntname "tf_projectile_spellspawnboss";
    case 
ZOMBIEH:        strEntname "tf_projectile_spellspawnhorde";
    case 
ZOMBIE:        strEntname "tf_projectile_spellspawnzombie";
    }
    new 
iTeam GetClientTeam(client);
    new 
iSpell CreateEntityByName(strEntname);
    
    if(!
IsValidEntity(iSpell))
    return -
1;
    
    
decl Float:vVelocity[3];
    
decl Float:vBuffer[3];
    
    
GetAngleVectors(vAnglesvBufferNULL_VECTORNULL_VECTOR);
    
    
vVelocity[0] = vBuffer[0]*1100.0//Speed of a tf2 rocket.
    
vVelocity[1] = vBuffer[1]*1100.0;
    
vVelocity[2] = vBuffer[2]*1100.0;
    
    
SetEntPropEnt(iSpellProp_Send"m_hOwnerEntity"client);
    
SetEntProp(iSpell,    Prop_Send"m_bCritical", (GetRandomInt(0100) <= 5)? 01);
    
SetEntProp(iSpell,    Prop_Send"m_iTeamNum",     iTeam1);
    
SetEntProp(iSpell,    Prop_Send"m_nSkin", (iTeam-2));
    
    
TeleportEntity(iSpellvPositionvAnglesNULL_VECTOR);
    
    
SetVariantInt(iTeam);
    
AcceptEntityInput(iSpell"TeamNum", -1, -10);
    
SetVariantInt(iTeam);
    
AcceptEntityInput(iSpell"SetTeam", -1, -10); 
    
    
DispatchSpawn(iSpell);

    
TeleportEntity(iSpellNULL_VECTORNULL_VECTORvVelocity);
    
    return 
iSpell;
}

public 
Action:Waiting(Handle:timerany:client
{
    
g_wait[client] = false
}

bool CreateHat(int clientint itemindexint levelint quality)
{
    
int hat CreateEntityByName("tf_wearable");
    
    if (!
IsValidEntity(hat))
    {
        return 
false;
    }
    
    
char entclass[64];
    
GetEntityNetClass(hatentclasssizeof(entclass));
    
SetEntData(hatFindSendPropInfo(entclass"m_iItemDefinitionIndex"), itemindex);
    
SetEntData(hatFindSendPropInfo(entclass"m_bInitialized"), 1);     
    
SetEntData(hatFindSendPropInfo(entclass"m_iEntityLevel"), level);
    
SetEntData(hatFindSendPropInfo(entclass"m_iEntityQuality"), quality);
    
SetEntProp(hatProp_Send"m_bValidatedAttachedEntity"1);    

    if (
level)
    {
        
SetEntData(hatFindSendPropInfo(entclass"m_iEntityLevel"), level);
    }
    else
    {
        
SetEntData(hatFindSendPropInfo(entclass"m_iEntityLevel"), GetRandomInt(1,100));
    }

    
SetEntData(hatFindSendPropInfo(entclass"m_iEntityQuality"), 5);
    
TF2Attrib_SetByDefIndex(hat13437.0);
    
    
DispatchSpawn(hat);
    
SDKCall(g_hWearableEquipclienthat);
    return 
true;
}

bool CreateWeapon(int clientchar[] classnameint itemindexint qualityint levelint slotint paint)
{
    
TF2_RemoveWeaponSlot(clientslot);

    
int weapon CreateEntityByName(classname);

    if (!
IsValidEntity(weapon))
    {
        return 
false;
    }
    
    
quality 7;
    
    
char entclass[64];
    
GetEntityNetClass(weaponentclasssizeof(entclass));
    
SetEntProp(weaponProp_Send"m_iItemDefinitionIndex"itemindex);     
    
SetEntProp(weaponProp_Send"m_bInitialized"1);
    
SetEntData(weaponFindSendPropInfo(entclass"m_iEntityQuality"), quality);
    
SetEntProp(weaponProp_Send"m_bValidatedAttachedEntity"1);
    
    if (
level)
    {
        
SetEntData(weaponFindSendPropInfo(entclass"m_iEntityLevel"), level);
    }
    else
    {
        
SetEntData(weaponFindSendPropInfo(entclass"m_iEntityLevel"), 20);
    }

    
TF2Attrib_SetByDefIndex(weapon834view_as<float>(paint));
    
    
DispatchSpawn(weapon);
    
EquipPlayerWeapon(clientweapon); 

    return 
true;

Attached Files
File Type: sp Get Plugin or Get Source (beskeletonking.sp - 28 views - 25.6 KB)
File Type: smx beskeletonking.smx (18.3 KB, 31 views)
File Type: txt changeteam.txt (339 Bytes, 31 views)
PC Gamer is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 19:51.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode