Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma semicolon 1
- #pragma newdecls required
- #include sdktools
- #include sdkhooks
- #define MAX_LIST 18
- float Health[2048+1];
- static const char gWeapons[MAX_LIST][] =
- {
- "weapon_autoshotgun",
- "weapon_hunting_rifle",
- "weapon_pistol",
- "weapon_pistol_magnum",
- "weapon_pumpshotgun",
- "weapon_rifle",
- "weapon_rifle_ak47",
- "weapon_rifle_desert",
- "weapon_rifle_m60",
- "weapon_rifle_sg552",
- "weapon_shotgun_chrome",
- "weapon_shotgun_spas",
- "weapon_smg",
- "weapon_smg_mp5",
- "weapon_smg_silenced",
- "weapon_sniper_awp",
- "weapon_sniper_military",
- "weapon_sniper_scout"
- };
- static const float gDistance[MAX_LIST] =
- {
- 1650.0,
- 660.0,
- 880.0,
- 1980.0,
- 1650.0,
- 1100.0,
- 1100.0,
- 1100.0,
- 1320.0,
- 1100.0,
- 1540.0,
- 1540.0,
- 880.0,
- 880.0,
- 880.0,
- 1870.0,
- 1320.0,
- 1320.0
- };
- public void OnPluginStart()
- {
- HookEvent("round_start", EventFire, EventHookMode_PostNoCopy);
- }
- public Action EventFire(Handle event, const char[] name, bool dontbroadcast)
- {
- int entity = -1;
- while((entity = FindEntityByClassname(entity, "prop_door_rotating_checkpoint")) != INVALID_ENT_REFERENCE)
- {
- SDKHook(entity, SDKHook_OnTakeDamage, OnTakeDamage);
- Health[entity] = 50000.0;
- }
- }
- public Action OnTakeDamage(int victim, int &attacker, int &inflictor, float &damage, int &damagetype)
- {
- if(bIsSurvivor(attacker) && IsValidEntity(victim))
- {
- char m_flModelName[128];
- int weapon = GetEntPropEnt(attacker, Prop_Send, "m_hActiveWeapon");
- if(IsValidEntity(weapon))
- {
- char weaponname[36];
- GetEntityClassname(weapon, weaponname, sizeof(weaponname));
- for( int i = 0; i < MAX_LIST; i++ )
- {
- if(strcmp(weaponname, gWeapons[i]) == 0)
- {
- PrintToChatAll("Damage = %.2f", gDistance[i]);
- PrintToChatAll("Health = %.2f", Health[victim]);
- if((Health[victim] - gDistance[i]) > 0)
- {
- Health[victim] -= gDistance[i];
- }
- else
- {
- Health[victim] = 0.0;
- float vPos[3], vAng[3];
- GetEntPropVector(victim, Prop_Send, "m_vecOrigin", vPos);
- GetEntPropVector(victim, Prop_Send, "m_angRotation", vAng);
- GetEntPropString(victim, Prop_Data, "m_ModelName", m_flModelName, sizeof(m_flModelName));
- int physics = CreateEntityByName("prop_physics");
- SetEntityModel(physics, m_flModelName);
- DispatchSpawn(physics);
- TeleportEntity(physics, vPos, vAng, NULL_VECTOR);
- SetEntityMoveType(physics, MOVETYPE_VPHYSICS);
- AcceptEntityInput(victim, "kill");
- }
- }
- }
- }
- }
- }
- stock bool bIsSurvivor(int client)
- {
- return client > 0 && client <= MaxClients && IsClientInGame(client) && GetClientTeam(client) == 2 && !IsClientInKickQueue(client) && IsPlayerAlive(client);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement