Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sdktools>
- #include <sdkhooks>
- #pragma newdecls required
- #pragma semicolon 1
- #define iSound1 "player/charger/hit/charger_smash_02.wav"
- public void OnMapStart()
- {
- PrecacheParticle("boomer_explode");
- PrecacheSound(iSound1);
- }
- public void OnClientPutInServer(int client)
- {
- SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage);
- }
- public Action OnTakeDamage(int victim, int &attacker, int &inflictor, float &damage, int &damagetype)
- {
- if(bIsSurvivor(victim) && IsTank(attacker))
- {
- char classname[24];
- GetEdictClassname(inflictor, classname, sizeof(classname));
- if (strcmp(classname, "weapon_tank_claw") == 0)
- {
- CreateParticle(victim, "boomer_explode", false, 3.0);
- ForcePlayerSuicide(victim);
- EmitSoundToAll(iSound1, attacker, SNDCHAN_AUTO );
- }
- }
- }
- bool IsTank(int client)
- {
- if (client > 0 && client <= MaxClients && IsClientInGame(client))
- {
- char classname[32];
- GetEntityNetClass(client, classname, 32);
- if (StrEqual(classname, "Tank", false))
- {
- return true;
- }
- }
- return false;
- }
- public void PrecacheParticle(char[] particlename)
- {
- int particle = CreateEntityByName("info_particle_system");
- if (IsValidEntity(particle))
- {
- DispatchKeyValue(particle, "effect_name", particlename);
- DispatchKeyValue(particle, "targetname", "particle");
- DispatchSpawn(particle);
- ActivateEntity(particle);
- AcceptEntityInput(particle, "start", -1, -1, 0);
- CreateTimer(0.1, DeleteParticles, particle, 2);
- }
- }
- public Action DeleteParticles(Handle timer, any particle)
- {
- if (IsValidEntity(particle))
- {
- char classname[24];
- GetEdictClassname(particle, classname, sizeof(classname));
- if (StrEqual(classname, "info_particle_system"))
- {
- AcceptEntityInput(particle, "Kill");
- }
- }
- }
- stock void CreateParticle(int client, char[] Particle_Name, bool Parent, float duration)
- {
- float pos[3];
- char sName[64], sTargetName[64];
- int Particle = CreateEntityByName("info_particle_system");
- GetClientAbsOrigin(client, pos);
- TeleportEntity(Particle, pos, NULL_VECTOR, NULL_VECTOR);
- DispatchKeyValue(Particle, "effect_name", Particle_Name);
- if(Parent)
- {
- Format(sName, sizeof(sName), "%d", client+25);
- DispatchKeyValue(client, "targetname", sName);
- GetEntPropString(client, Prop_Data, "m_iName", sName, sizeof(sName));
- Format(sTargetName, sizeof(sTargetName), "%d", client+1000);
- DispatchKeyValue(Particle, "targetname", sTargetName);
- DispatchKeyValue(Particle, "parentname", sName);
- }
- DispatchSpawn(Particle);
- DispatchSpawn(Particle);
- if(Parent)
- {
- SetVariantString(sName);
- AcceptEntityInput(Particle, "SetParent", Particle, Particle);
- }
- ActivateEntity(Particle);
- AcceptEntityInput(Particle, "start");
- CreateTimer(duration, timerStopAndRemoveParticle, Particle, TIMER_FLAG_NO_MAPCHANGE);
- }
- public Action timerStopAndRemoveParticle(Handle timer, any entity)
- {
- if(entity > 0 && IsValidEntity(entity) && IsValidEdict(entity))
- {
- AcceptEntityInput(entity, "Kill");
- }
- }
- stock bool bIsSurvivor(int client)
- {
- return client > 0 && client <= MaxClients && IsClientInGame(client) && GetClientTeam(client) == 2 && !IsClientInKickQueue(client) && IsPlayerAlive(client);
- }
- stock void ForceDamageEntity(int causer, int damage, int victim) // thanks to 达斯*维达
- {
- float victim_origin[3];
- char rupture[32];
- char damage_victim[32];
- IntToString(damage, rupture, sizeof(rupture));
- Format(damage_victim, sizeof(damage_victim), "hurtme%d", victim);
- GetEntPropVector(victim, Prop_Send, "m_vecOrigin", victim_origin);
- int entity = CreateEntityByName("point_hurt");
- DispatchKeyValue(victim, "targetname", damage_victim);
- DispatchKeyValue(entity, "DamageTarget", damage_victim);
- DispatchKeyValue(entity, "Damage", rupture);
- DispatchSpawn(entity);
- TeleportEntity(entity, victim_origin, NULL_VECTOR, NULL_VECTOR);
- AcceptEntityInput(entity, "Hurt", (causer > 0 && causer <= MaxClients) ? causer : -1);
- DispatchKeyValue(entity, "classname", "point_hurt");
- DispatchKeyValue(victim, "targetname", "null");
- AcceptEntityInput(entity, "Kill");
- }
Advertisement
Add Comment
Please, Sign In to add comment