Now this plugin is a huge mess. It gets a lot of compilation errors and idk how to fix them.
Here's the whole .sp, I think that would help more than giving you a part of it.
PHP Code:
#include <sourcemod>
#include <cstrike>
#include <clientprefs>
#include <sdktools>
#include <sdkhooks>
#pragma semicolon 1
#define PLUGIN_VERSION "X"
#define MAX_FILE_LEN 80
new Handle:cvarAmount;
new teamSize[4];
new aliveNum[4];
stock Client_GiveWeaponAndAmmo(client, const String:className[], bool:switchTo=true, primaryAmmo=-1, secondaryAmmo=-1, primaryClip=-1, secondaryClip=-1);
stock Client_RemoveAllWeapons(client, const String:exclude[]="", bool:clearAmmo=false);
public OnPluginStart()
{
cvarAmount = CreateConVar("sm_survivor_maxhp", "500", "Survivor's MAX health", FCVAR_PLUGIN, true, 1.0, false, _);
HookEvent("player_death", EventPlayerDeath);
HookEvent("player_spawn", EventPlayerSpawn);
HookEvent("player_team", EventPlayerTeam);
}
public OnMapStart()
{
teamSize = {0, 0, 0, 0};
aliveNum = {0, 0, 0, 0};
AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/belt.vmt");
AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/belt.vtf");
AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/belt_n.vtf");
AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/eyes.vmt");
AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/eyes.vtf");
AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/gloves.vmt");
AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/gloves.vtf");
AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/gloves_n.vtf");
AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/hands.vmt");
AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/hands.vtf");
AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/hands_n.vtf");
AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/hair.vmt");
AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/hair.vtf");
AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/hair_n.vtf");
AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/head_n.vtf");
AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/magnum.vmt");
AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/magnum.vtf");
AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/magnum_n.vtf");
AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/pants.vmt");
AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/pants.vtf");
AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/pants_n.vtf");
AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/shirt.vmt");
AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/shirt.vtf");
AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/shirt_n.vtf");
AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/shoes.vmt");
AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/shoes.vtf");
AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/shoes_n.vtf");
AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/upperbody.vmt");
AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/upperbody.vtf");
AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/upperbody_n.vtf");
AddFileToDownloadsTable("models/player/custom_player/walkingdead/rickgrimes/rick_v2.dx90.vtx");
AddFileToDownloadsTable("models/player/custom_player/walkingdead/rickgrimes/rick_v2.mdl");
AddFileToDownloadsTable("models/player/custom_player/walkingdead/rickgrimes/rick_v2.phy");
AddFileToDownloadsTable("models/player/custom_player/walkingdead/rickgrimes/rick_v2.vvd");
PrecacheModel("models/player/custom_player/walkingdead/rickgrimes/rick_v2.mdl");
}
public OnClientDisconnect(client)
{
new team = GetClientTeam(client);
if(team < 2) return;
aliveNum[team]--;
if(aliveNum[team] == 1) OnLastMan(team);
}
public EventPlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
new team = GetClientTeam(GetClientOfUserId(GetEventInt(event, "userid")));
if(team < 2) return;
aliveNum[team]--;
if(aliveNum[team] == 1) OnLastMan(team);
}
public EventPlayerTeam(Handle:event, const String:name[], bool:dontBroadcast)
{
new oldTeam = GetEventInt(event, "oldteam");
if(oldTeam > 1) teamSize[oldTeam]--;
new newTeam = GetEventInt(event, "team");
if(newTeam > 1) teamSize[newTeam]++;
}
public EventPlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
new team = GetClientTeam(GetClientOfUserId(GetEventInt(event, "userid")));
if(team > 1) aliveNum[team]++;
}
OnLastMan(const team)
{
if(teamSize[team > 2 ? 2 : 3] < 2) return;
new playersConnected = MaxClients;
new lastManId;
for (new i = 1; i < playersConnected; i++)
{
if(IsClientInGame(i) && IsPlayerAlive(i) && team == GetClientTeam(i))
{
lastManId = i;
break;
}
}
if(team == CS_TEAM_T)
{
// T Bonuses
CreateTimer(10.0, Timer_TBonuses, GetClientSerial(lastManId));
}
else
{
// CT Bonuses
CreateTimer(10.0, Timer_CTBonuses, lastManId);
}
}
stock StripAllWeapons(lastManId)
{
new iEnt;
for (new i = 0; i <= 4; i++)
{
while ((iEnt = GetPlayerWeaponSlot(lastManId, i)) != -1)
{
RemovePlayerItem(lastManId, iEnt);
AcceptEntityInput(iEnt, "Kill");
}
}
}
public Action:Timer_Weapon(Handle:Timer, lastManId)
{
GivePlayerItem(lastManId, "weapon_xm1014");
return Plugin_Stop;
}
Public Action:Timer_TBonuses(Handle:timer, any:clientSerial)
{
new client = GetClientFromSerial(clientSerial);
if(client)
{
PrintHintTextToAll("<font color='#ff0000'><b>%s is now Kage!</b></font>", clientname);
SetEntProp(lastManId, Prop_Send, "m_ArmorValue", 100, 4);
SetEntProp(lastManId, Prop_Send, "m_bHasHelmet", 1);
SetEntityGravity(lastManId, 0.3);
SetEntPropFloat(lastManId, Prop_Data, "m_flLaggedMovementValue", 2.5);
SetEntityHealth(lastManId, 500);
}
}
Public Action:Timer_CTBonuses(Handle:timer, any:clientSerial)
{
new client = GetClientFromSerial(clientSerial);
if(client)
{
PrintHintTextToAll("<font color='#00ffff'><b>%s is now Psycho!</b></font>", clientname);
SetEntityModel(lastManId, "models/player/custom_player/walkingdead/rickgrimes/rick_v2.mdl");
SetEntProp(lastManId, Prop_Send, "m_ArmorValue", 100, 4);
SetEntityGravity(lastManId, 0.6);
SetEntPropFloat(lastManId, Prop_Data, "m_flLaggedMovementValue", 1.6);
StripAllWeapons(lastManId);
GivePlayerItem(lastManId, "weapon_p90");
GivePlayerItem(lastManId, "weapon_knife");
SetEntityHealth(lastManId, 300);
CreateTimer(0.5, Timer_Weapon, _, TIMER_DATA_HNDL_CLOSE);
}
}