Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sourcemod>
- #include <sdktools>
- new g_TankHealth = 65000;
- public OnPluginStart()
- {
- HookEvent("tank_spawn", Event_TankSpawn);
- }
- public OnPluginEnd()
- {
- UnhookEvent("tank_spawn", Event_TankSpawn);
- }
- public Event_TankSpawn(Handle:event, const String:name[], bool:dontBroadcast)
- {
- CreateTimer(0.5, TankSpawn, GetEventInt(event, "userid"));
- }
- public Action:TankSpawn(Handle:timer, any:userid)
- {
- new client = GetClientOfUserId(userid);
- if (client == 0)
- return;
- SetClientHP(client, GetTankHealth());
- }
- public GetTankHealth()
- {
- new survivors = GetSurvivorCount();
- if (survivors >= 14)
- {
- if (g_TankHealth != 65000)
- {
- g_TankHealth = 65000;
- }
- }
- else if (survivors >= 11 && survivors < 14)
- {
- if (g_TankHealth != 40000)
- {
- g_TankHealth = 40000;
- }
- }
- else if (survivors >= 8 && survivors < 11)
- {
- if (g_TankHealth != 25000)
- {
- g_TankHealth = 25000;
- }
- }
- else if (survivors >= 5 && survivors < 8)
- {
- if (g_TankHealth != 12000)
- {
- g_TankHealth = 12000;
- }
- }
- else if (survivors >= 1 && survivors < 5)
- {
- if (g_TankHealth != 5000)
- {
- g_TankHealth = 5000;
- }
- }
- return g_TankHealth;
- }
- stock SetClientHP(client, hp)
- {
- SetEntProp(client, Prop_Send, "m_iHealth", hp);
- SetEntProp(client, Prop_Send, "m_iMaxHealth", hp);
- }
- stock GetSurvivorCount()
- {
- new result = 0;
- for (new i = 1; i <= MaxClients; i++)
- {
- if (IsClientInGame(i) && GetClientTeam(i) == 2 && !IsFakeClient(i))
- {
- result++;
- }
- }
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment