Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sourcemod>
- #include <sdktools>
- new Handle:g_hTankHealth;
- new g_iTankCount;
- #define MAX_TANKS 2
- public OnPluginStart()
- {
- g_iTankCount = 0;
- HookEvent("tank_spawn", tank_spawn);
- g_hTankHealth = CreateConVar("tank_health", "7500");
- CreateTimer(60.0, CheckPlayers, _, TIMER_REPEAT);
- }
- public Action:CheckPlayers(Handle:timer)
- {
- new GetSurvivors = GetSurvivorCount();
- if (GetSurvivors >= 15)
- {
- if (GetConVarInt(g_hTankHealth) != 65000)
- {
- SetConVarInt(g_hTankHealth, 65000);
- }
- }
- else if (GetSurvivors >= 13 && GetSurvivors < 15)
- {
- if (GetConVarInt(g_hTankHealth) != 60000)
- {
- SetConVarInt(g_hTankHealth, 60000);
- }
- }
- else if (GetSurvivors >= 11 && GetSurvivors < 13)
- {
- if (GetConVarInt(g_hTankHealth) != 50000)
- {
- SetConVarInt(g_hTankHealth, 50000);
- }
- }
- else if (GetSurvivors >= 9 && GetSurvivors < 11)
- {
- if (GetConVarInt(g_hTankHealth) != 40000)
- {
- SetConVarInt(g_hTankHealth, 40000);
- }
- }
- else if (GetSurvivors >= 5 && GetSurvivors < 9)
- {
- if (GetConVarInt(g_hTankHealth) != 20000)
- {
- SetConVarInt(g_hTankHealth, 20000);
- }
- }
- else
- {
- if (GetConVarInt(g_hTankHealth) != 7500)
- {
- SetConVarInt(g_hTankHealth, 7500);
- }
- }
- return Plugin_Continue;
- }
- stock GetSurvivorCount()
- {
- new hsurvivors = 0;
- for (new i = 1; i <= MaxClients; i++)
- {
- if (IsClientInGame(i) && !IsFakeClient(i))
- {
- hsurvivors++;
- }
- }
- return hsurvivors;
- }
- stock SpawnTank()
- {
- new flags = GetCommandFlags("z_spawn_old");
- SetCommandFlags("z_spawn_old", flags & ~FCVAR_CHEAT);
- ServerCommand("z_spawn_old tank auto")
- SetCommandFlags("z_spawn_old", flags);
- }
- public tank_spawn(Handle:event, const String:name[], bool:dontBroadcast)
- {
- g_iTankCount++;
- new userid = GetEventInt(event, "userid");
- new TankHP = GetConVarInt(g_hTankHealth);
- CreateTimer(0.1, tmrHealth, userid);
- PrintToChatAll("\x04[TANK] \x01Um Tank Acabou de Nascer (\x03%i HP\x01)", TankHP);
- if (g_iTankCount < MAX_TANKS)
- SpawnTank();
- }
- public Action:tmrHealth(Handle:timer, any:userid)
- {
- new client = GetClientOfUserId(userid)
- if (client && IsClientInGame(client))
- {
- SetEntityHealth(client, GetConVarInt(g_hTankHealth));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment