1. #include <sourcemod>
  2. #include <sdktools>
  3. #include <tf2>
  4. #include <tf2_stocks>
  5. #include <dukehacks>
  6.  
  7. #define SND_EXPLODE "weapons/explode2.wav"
  8. #define SND_LASER "weapons/teleporter_receive.wav"
  9.  
  10. #define LASER "sprites/laser.vmt"
  11.  
  12. #define TEAM_RED 2
  13. #define TEAM_BLUE 3
  14.  
  15. #define COLOR_RED "255 0 0"
  16. #define COLOR_BLUE "0 0 255"
  17.  
  18. new smoke, explosion;
  19.  
  20. new HammerTime[MAXPLAYERS + 1][5];
  21. new Hammers[MAXPLAYERS + 1][2];
  22. new bool:UsingControlBanHammer[MAXPLAYERS + 1];
  23. new bool:UsingLockOnBanHammer[MAXPLAYERS + 1];
  24. new bool:Hammered[MAXPLAYERS + 1];
  25. new bool:centered[MAXPLAYERS + 1];
  26. new bool:targetCount;
  27.  
  28. new m_vecEndPos;
  29.  
  30. new maxplayers, maxentities;
  31.  
  32. public Plugin:myinfo =
  33. {
  34. name = "Ban Hammer",
  35. author = "Goss",
  36. description = "Calls down the Orbitial Ban hammer on a player",
  37. version = "1.0",
  38. url = "http://www.bhslaughter.com/"
  39. }
  40. public OnPluginStart ( )
  41. {
  42. m_vecEndPos = FindSendPropInfo("CBeam", "m_vecEndPos");
  43.  
  44. LoadTranslations("common.phrases");
  45.  
  46. HookEvent("player_death", Events);
  47. HookEvent("player_spawn", Events);
  48. HookEvent("player_disconnect", Events);
  49.  
  50. RegAdminCmd("sm_hammer", Command_LockBanHammer, ADMFLAG_CUSTOM4, "");
  51. RegAdminCmd("sm_aimhammer", Command_ControlHammer, ADMFLAG_CUSTOM4, "");
  52. RegAdminCmd("sm_clear", Command_Clear, ADMFLAG_CUSTOM4, "");
  53. //RegAdminCmd("sm_bhammer", Command_BanHammer, ADMFLAG_CUSTOM4, "");
  54. }
  55. public OnMapStart ( )
  56. {
  57. maxplayers = GetMaxClients();
  58. maxentities = GetMaxEntities();
  59.  
  60. explosion = PrecacheModel("sprites/floorfire4_.vmt", true);
  61. smoke = PrecacheModel ("sprites/steam1.vmt");
  62.  
  63. PrecacheSound(SND_EXPLODE, true);
  64. PrecacheSound(SND_LASER, true);
  65.  
  66. PrecacheModel(LASER, true);
  67. }
  68. public OnEventShutdown()
  69. {
  70. UnhookEvent("player_death", Events);
  71. UnhookEvent("player_spawn", Events);
  72. UnhookEvent("player_disconnect", Events);
  73. }
  74. public OnGameFrame()
  75. {
  76. for(new i = 1; i <= maxplayers; i++)
  77. {
  78. if(IsClientInGame(i) && !IsClientObserver(i) && IsPlayerAlive(i))
  79. {
  80. if(centered[i] || targetCount)
  81. {
  82. if(UsingControlBanHammer[i])
  83. {
  84. new hammer = HammerTime[i][3];
  85. if(IsValidEntity(hammer))
  86. {
  87. new Float:position[3];
  88. GetEyePosition(i, position);
  89. TeleportEntity(hammer, position, NULL_VECTOR,NULL_VECTOR);
  90.  
  91. position[2] += 2000;
  92. SetEntDataVector(hammer, m_vecEndPos, position, true);
  93. }
  94. }
  95. if(Hammered[i])
  96. {
  97. new hammer = Hammers[i][1];
  98. if(IsValidEntity(hammer))
  99. {
  100. new Float:position[3];
  101. GetClientAbsOrigin(i, position);
  102. TeleportEntity(hammer, position, NULL_VECTOR,NULL_VECTOR);
  103.  
  104. position[2] += 2000;
  105. SetEntDataVector(hammer, m_vecEndPos, position, true);
  106. }
  107. }
  108. }
  109. }
  110. }
  111. }
  112. public Action:Events(Handle:event, const String:name[], bool:dontBroadcast)
  113. {
  114. new client = GetClientOfUserId(GetEventInt(event, "userid"));
  115. UsingControlBanHammer[client] = false;
  116. UsingLockOnBanHammer[client] = false;
  117. Hammered[client] = false;
  118. }
  119. public Action:Command_Clear(client, args)
  120. {
  121. for(new i = 0; i <= maxentities; i++)
  122. {
  123. if(IsValidEntity(i))
  124. {
  125. decl String:classname[32];
  126. GetEdictClassname(i, classname, sizeof(classname));
  127.  
  128. if(StrEqual(classname, "env_beam"))
  129. {
  130. AcceptEntityInput(i,"kill");
  131. PrintToChatAll("Deleted %s - %i", classname, i);
  132. }
  133. }
  134. }
  135. return Plugin_Handled;
  136. }
  137. public Action:Command_BanHammer(client, args)
  138. {
  139. decl String:s_Arg[32];
  140. decl String:reason[32];
  141. decl String:time[32];
  142.  
  143. GetCmdArg (1, s_Arg, sizeof(s_Arg));
  144. GetCmdArg (2, time, sizeof(time));
  145. GetCmdArg (3, reason, sizeof(reason));
  146.  
  147. new target = FindTarget ( client, s_Arg );
  148.  
  149. if (target == -1 || !IsPlayerAlive(target))
  150. {
  151. return Plugin_Handled;
  152. }
  153.  
  154. decl String:admin[32];
  155. decl String:player[32];
  156.  
  157. GetClientName(client, admin, sizeof(admin));
  158. GetClientName(target, player, sizeof(player));
  159.  
  160. ServerCommand("sm_freeze #%d", GetClientUserId(target));
  161.  
  162. UsingLockOnBanHammer[client] = true;
  163.  
  164. new Float:position[3];
  165. GetClientAbsOrigin(target, position);
  166. CreateBeams(client, position, target);
  167. CreateTimer(1.5, Explode, target);
  168. PrintToChatAll ("%s struck down %s with the Orbital Banned Hammer", admin, player );
  169.  
  170. new Handle:data = CreateDataPack();
  171. CreateTimer(5.0, Ban, data);
  172. WritePackCell(data, target);
  173. WritePackString(data, reason);
  174.  
  175. return Plugin_Handled;
  176. }
  177. public Action:Ban(Handle:timer, Handle:data)
  178. {
  179. ResetPack(data);
  180.  
  181. new target = ReadPackCell(data);
  182.  
  183. decl String:reason[32];
  184. ReadPackString(data, reason, sizeof(reason));
  185.  
  186. BanClient(target, 0, BANFLAG_AUTO, reason, reason, "Ban Hammer");
  187.  
  188. CloseHandle(data);
  189. }
  190. public Action:Command_LockBanHammer(client, args)
  191. {
  192. if(!UsingControlBanHammer[client] && !UsingLockOnBanHammer[client])
  193. {
  194. UsingLockOnBanHammer[client] = true;
  195. if (args < 1)
  196. {
  197. ReplyToCommand(client, "[SM] Usage: sm_hammer <#userid|name>");
  198. return Plugin_Handled;
  199. }
  200.  
  201. decl String:arg[65];
  202. GetCmdArg(1, arg, sizeof(arg));
  203.  
  204. decl String:target_name[MAX_TARGET_LENGTH];
  205. decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
  206.  
  207. if ((target_count = ProcessTargetString(arg, client, target_list, MAXPLAYERS, COMMAND_FILTER_ALIVE, target_name, sizeof(target_name), tn_is_ml)) <= 0)
  208. {
  209. ReplyToTargetError(client, target_count);
  210. return Plugin_Handled;
  211. }
  212.  
  213. if(target_count > 1)
  214. {
  215. targetCount = true;
  216. EmitSoundToAll(SND_LASER);
  217. }
  218. else
  219. {
  220. targetCount = false;
  221. }
  222. new targetIndex;
  223. for (new i = 0; i < target_count; i++)
  224. {
  225. new Float:position[3];
  226. targetIndex = target_list[i];
  227. GetClientAbsOrigin(targetIndex, position);
  228.  
  229. if(!Hammered[targetIndex])
  230. {
  231. if(IsClientInGame(targetIndex) && !IsClientObserver(targetIndex) && IsPlayerAlive(targetIndex))
  232. {
  233. Hammered[targetIndex] = true;
  234.  
  235. CreateBeams(client, position, targetIndex);
  236. CreateTimer(1.5, Explode, targetIndex);
  237.  
  238. decl String:target[32];
  239. decl String:admin[32];
  240.  
  241. GetClientName(targetIndex, target, sizeof(target));
  242. GetClientName(client, admin, sizeof(admin));
  243.  
  244. PrintToChatAll ("%s struck down %s with the Orbital Hammer", admin, target );
  245. }
  246. }
  247. }
  248. }
  249. return Plugin_Handled;
  250. }
  251. public Action:Command_ControlHammer (client, args)
  252. {
  253. if(IsClientInGame(client) && !IsClientObserver(client) && IsPlayerAlive(client))
  254. {
  255. if(!UsingControlBanHammer[client] && !UsingLockOnBanHammer[client])
  256. {
  257. UsingControlBanHammer[client] = true;
  258.  
  259. new Float:position[3];
  260. GetEyePosition(client, position);
  261.  
  262. CreateBeams(client, position, client);
  263. }
  264. }
  265. return Plugin_Handled;
  266. }
  267. public CreateBeams(any:client, Float:position[3], any:target)
  268. {
  269. if(!targetCount)
  270. {
  271. position[0] -= 100;
  272. Beam(client, position, 0, target);
  273.  
  274. position[0] += 200;
  275. Beam(client, position, 1, target);
  276.  
  277. position[0] -= 100;
  278. position[1] -= 100;
  279. Beam(client, position, 2, target);
  280.  
  281. position[1] += 200;
  282. Beam(client, position, 3, target);
  283. }
  284. else
  285. {
  286. Beam(client, position, 3, target);
  287.  
  288. centered[client] = true;
  289. }
  290.  
  291.  
  292. new Handle:data = CreateDataPack();
  293.  
  294. CreateTimer(3.5, TurnOffControl, data);
  295.  
  296. WritePackCell(data, client);
  297. WritePackCell(data, target);
  298. }
  299. public Beam(any:client, Float:position[3], array, any:target)
  300. {
  301. decl String:beam[3];
  302. Format(beam, sizeof(beam), "%d", array);
  303.  
  304. decl String:name[8];
  305. Format(name, sizeof(name), "%d", client);
  306.  
  307. new ent = CreateEntityByName("env_beam");
  308. TeleportEntity(ent, position, NULL_VECTOR, NULL_VECTOR);
  309.  
  310. HammerTime[client][array] = ent;
  311. SetEntityModel(ent, LASER);
  312.  
  313. if(UsingControlBanHammer[client])
  314. {
  315. TeleportEntity(ent, position, NULL_VECTOR, NULL_VECTOR);
  316. position[2] += 1000;
  317. SetEntPropVector(ent, Prop_Data, "m_vecEndPos", position);
  318. }
  319.  
  320. DispatchKeyValue(ent, "targetname", beam);
  321.  
  322. //DispatchKeyValue(client, "parentname", name);
  323. //DispatchKeyValue(ent, "parentname", name);
  324. //SetVariantString(name);
  325. //AcceptEntityInput(ent, "SetParent");
  326. //SetVariantString(name);
  327. //AcceptEntityInput(ent, "SetParentAttachment");
  328. //SetVariantString(name);
  329. //AcceptEntityInput(ent, "SetParentAttachmentMaintainOffset");
  330.  
  331.  
  332. DispatchKeyValue(ent, "TouchType", "3");
  333. DispatchKeyValue(ent, "damage", "50");
  334.  
  335. DispatchSpawn(ent);
  336.  
  337. SetEntPropEnt(ent, Prop_Data, "m_hOwnerEntity", target);
  338.  
  339. if(UsingControlBanHammer[client] && array == 3)
  340. {
  341. SetEntPropEnt(ent, Prop_Data, "m_hOwnerEntity", client);
  342. HookSingleEntityOutput(ent, "OnTouchedByEntity", BeamTouched, false);
  343. CreateTimer(0.4, TE_Explode, client);
  344. }
  345. if(!UsingControlBanHammer[client] && array == 3)
  346. {
  347. Hammers[target][1] = ent;
  348. }
  349.  
  350. if(targetCount)
  351. {
  352. SetEntPropFloat(ent, Prop_Data, "m_fWidth", 20.0);
  353. SetEntPropFloat(ent, Prop_Data, "m_fEndWidth", 20.0);
  354.  
  355.  
  356. CreateTimer(3.0, UnhookBeam, ent);
  357. }
  358. else
  359. {
  360. SetEntPropFloat(ent, Prop_Data, "m_fWidth", 4.0);
  361. SetEntPropFloat(ent, Prop_Data, "m_fEndWidth", 4.0);
  362. }
  363.  
  364. decl String:teamColor[32];
  365. if(GetClientTeam(client) == TEAM_RED)
  366. {
  367. teamColor = COLOR_RED;
  368. AttachParticle(ent, "player_recent_teleport_red", 3.0);
  369. }
  370. else
  371. {
  372. teamColor = COLOR_BLUE;
  373. AttachParticle(ent, "player_recent_teleport_blue", 3.0);
  374. }
  375. DispatchKeyValue(ent, "rendercolor", teamColor);
  376.  
  377. ActivateEntity(ent);
  378. AcceptEntityInput(ent, "TurnOn");
  379.  
  380. if(!targetCount)
  381. {
  382. EmitSoundToAll(SND_LASER, ent, SNDCHAN_AUTO, SNDLEVEL_NORMAL, SND_NOFLAGS, SNDVOL_NORMAL, 100, ent, position, NULL_VECTOR, true, 0.0);
  383. }
  384. }
  385. public Action:UnhookBeam(Handle:timer, any:entity)
  386. {
  387. if(IsValidEntity(entity))
  388. {
  389. UnhookSingleEntityOutput(entity, "OnBreak", BeamTouched);
  390. AcceptEntityInput(entity,"kill");
  391. }
  392. }
  393. public BeamTouched(const String:output[], caller, activator, Float:delay)
  394. {
  395. AcceptEntityInput(caller, "TurnOff");
  396. AcceptEntityInput(caller, "TurnOn");
  397.  
  398. //decl String:name[2];
  399. //GetEntPropString(caller, Prop_Data, "m_iName", name, sizeof(name));
  400.  
  401. ForcePlayerSuicide(activator);
  402.  
  403. new owner = GetEntPropEnt(caller, Prop_Data, "m_hOwnerEntity");
  404.  
  405. decl String:admin[32];
  406. decl String:player[32];
  407.  
  408. GetClientName(owner, admin, sizeof(admin));
  409. GetClientName(activator, player, sizeof(player));
  410.  
  411. PrintToChatAll ("%s struck down %s with the Orbital Hammer", admin, player );
  412. }
  413. //Timer for lockon explode
  414. public Action:Explode(Handle:timer, any:entity)
  415. {
  416. FakeClientCommand(entity, "explode");
  417. }
  418. public ResultType:dhOnEntitySpawned(edict)
  419. {
  420. if(IsValidEntity(edict))
  421. {
  422.  
  423. if(!targetCount)
  424. {
  425. decl String:classname[32];
  426. GetEdictClassname(edict, classname, sizeof(classname));
  427. if(StrEqual(classname, "env_beam"))
  428. {
  429. decl String:targetname[8];
  430. GetEntPropString(edict, Prop_Data, "m_iName", targetname, sizeof(targetname));
  431.  
  432. new Float:k = 0.0;
  433.  
  434. if(StrEqual(targetname, "0"))
  435. {
  436. for(new j = 0; j < 100; j++)
  437. {
  438. CreateTimer(0.0 + k, CenterBeam0, edict);
  439. k += 0.005;
  440. }
  441. }
  442. else if(StrEqual(targetname, "1"))
  443. {
  444. for(new j = 0; j < 100; j++)
  445. {
  446. CreateTimer(0.0 + k, CenterBeam1, edict);
  447. k += 0.005;
  448. }
  449. }
  450. else if(StrEqual(targetname, "2"))
  451. {
  452. for(new j = 0; j < 100; j++)
  453. {
  454. CreateTimer(0.0 + k, CenterBeam2, edict);
  455. k += 0.005;
  456. }
  457. }
  458. else if(StrEqual(targetname, "3"))
  459. {
  460. for(new j = 0; j < 100; j++)
  461. {
  462. CreateTimer(0.0 + k, CenterBeam3, edict);
  463. k += 0.005;
  464. }
  465. }
  466. }
  467. }
  468. }
  469. }
  470. public Action:TE_Explode(Handle:timer, any:client)
  471. {
  472. new Float:position[3];
  473. if(UsingControlBanHammer[client])
  474. {
  475. GetEyePosition(client, position);
  476. }
  477. else
  478. {
  479. GetClientAbsOrigin(client, position);
  480. }
  481. TE_SetupExplosion(position, explosion, 0.1, 1, 4, 0, 0);
  482. TE_SendToAll ( );
  483.  
  484. EmitSoundToAll(SND_EXPLODE, SOUND_FROM_WORLD, SNDCHAN_AUTO, SNDLEVEL_NORMAL, SND_NOFLAGS, SNDVOL_NORMAL, 100, -1, position, NULL_VECTOR, true, 0.0);
  485.  
  486. TE_SetupSmoke (position, smoke, 10.0, 10 );
  487. TE_SendToAll ( );
  488. }
  489. public Action:TurnOffControl(Handle:timer, Handle:data)
  490. {
  491. ResetPack(data);
  492. new client = ReadPackCell(data);
  493. new target = ReadPackCell(data);
  494.  
  495. UsingControlBanHammer[client] = false;
  496. UsingLockOnBanHammer[client] = false;
  497. Hammered[target] = false;
  498. centered[client] = false;
  499. targetCount = false;
  500. }
  501. public Action:CenterBeam0(Handle:timer, any:edict)
  502. {
  503. static rates[MAXPLAYERS + 1] = 0;
  504. if(IsValidEntity(edict))
  505. {
  506. new client = GetEntPropEnt(edict, Prop_Data, "m_hOwnerEntity");
  507.  
  508. if(IsValidEntity(client))
  509. {
  510. new Float:position[3];
  511. if(UsingControlBanHammer[client])
  512. {
  513. GetEyePosition(client, position);
  514. }
  515. else
  516. {
  517. GetClientAbsOrigin(client, position);
  518. }
  519. position[0] -= 100;
  520. position[0] += rates[client];
  521.  
  522. TeleportEntity(edict, position, NULL_VECTOR,NULL_VECTOR);
  523. position[2] += 2000;
  524. SetEntDataVector(edict, m_vecEndPos, position, true);
  525.  
  526. rates[client]++;
  527. if(rates[client] >= 100)
  528. {
  529. AcceptEntityInput(edict,"kill");
  530. rates[client] = 0;
  531. }
  532. }
  533. }
  534. }
  535. public Action:CenterBeam1(Handle:timer, any:edict)
  536. {
  537. static rates[MAXPLAYERS + 1] = 0;
  538. if(IsValidEntity(edict))
  539. {
  540. new client = GetEntPropEnt(edict, Prop_Data, "m_hOwnerEntity");
  541.  
  542. if(IsValidEntity(client))
  543. {
  544. new Float:position[3];
  545. if(UsingControlBanHammer[client])
  546. {
  547. GetEyePosition(client, position);
  548. }
  549. else
  550. {
  551. GetClientAbsOrigin(client, position);
  552. }
  553. position[0] += 100;
  554. position[0] -= rates[client];
  555.  
  556. TeleportEntity(edict, position, NULL_VECTOR,NULL_VECTOR);
  557. position[2] += 2000;
  558. SetEntDataVector(edict, m_vecEndPos, position, true);
  559.  
  560. rates[client]++;
  561. if(rates[client] >= 100)
  562. {
  563. AcceptEntityInput(edict,"kill");
  564. rates[client] = 0;
  565. }
  566. }
  567. }
  568. }
  569. public Action:CenterBeam2(Handle:timer, any:edict)
  570. {
  571. static rates[MAXPLAYERS + 1] = 0;
  572. if(IsValidEntity(edict))
  573. {
  574. new client = GetEntPropEnt(edict, Prop_Data, "m_hOwnerEntity");
  575.  
  576. if(IsValidEntity(client))
  577. {
  578. new Float:position[3];
  579. if(UsingControlBanHammer[client])
  580. {
  581. GetEyePosition(client, position);
  582. }
  583. else
  584. {
  585. GetClientAbsOrigin(client, position);
  586. }
  587. position[1] -= 100;
  588. position[1] += rates[client];
  589.  
  590. TeleportEntity(edict, position, NULL_VECTOR,NULL_VECTOR);
  591. position[2] += 2000;
  592. SetEntDataVector(edict, m_vecEndPos, position, true);
  593.  
  594. rates[client]++;
  595. if(rates[client] >= 100)
  596. {
  597. AcceptEntityInput(edict,"kill");
  598. rates[client] = 0;
  599. }
  600. }
  601. }
  602. }
  603. public Action:CenterBeam3(Handle:timer, any:edict)
  604. {
  605. static rates[MAXPLAYERS + 1] = 0;
  606. if(IsValidEntity(edict))
  607. {
  608. new client = GetEntPropEnt(edict, Prop_Data, "m_hOwnerEntity");
  609.  
  610. if(IsValidEntity(client))
  611. {
  612. new Float:position[3];
  613. if(UsingControlBanHammer[client])
  614. {
  615. GetEyePosition(client, position);
  616. }
  617. else
  618. {
  619. GetClientAbsOrigin(client, position);
  620. }
  621. position[1] += 100;
  622. position[1] -= rates[client];
  623.  
  624. TeleportEntity(edict, position, NULL_VECTOR,NULL_VECTOR);
  625. position[2] += 2000;
  626. SetEntDataVector(edict, m_vecEndPos, position, true);
  627.  
  628. rates[client]++;
  629. if(rates[client] >= 100)
  630. {
  631. centered[client] = true;
  632.  
  633. SetEntPropFloat(edict, Prop_Data, "m_fWidth", 20.0);
  634. SetEntPropFloat(edict, Prop_Data, "m_fEndWidth", 20.0);
  635.  
  636. rates[client] = 0;
  637.  
  638. CreateTimer(3.0, UnhookBeam, edict);
  639. }
  640. }
  641. }
  642. }
  643. public GetEyePosition(client, Float:array[3])
  644. {
  645. new Float:start[3], Float:end[3], Float:angle[3];
  646.  
  647. GetClientEyePosition(client, start);
  648. GetClientEyeAngles(client, angle);
  649. GetAngleVectors(angle, end, NULL_VECTOR, NULL_VECTOR);
  650.  
  651. NormalizeVector(end, end);
  652.  
  653. TR_TraceRayFilter(start, angle, MASK_PLAYERSOLID, RayType_Infinite, TraceRayDontHitSelf, client);
  654.  
  655. if (TR_DidHit(INVALID_HANDLE))
  656. {
  657. TR_GetEndPosition(end, INVALID_HANDLE);
  658.  
  659. array = end;
  660. }
  661. }
  662. public bool:TraceRayDontHitSelf(entity, mask, any:data)
  663. {
  664. decl String:classname[64];
  665. GetEdictClassname(entity, classname, sizeof(classname));
  666.  
  667. if(entity == data) // Check if the TraceRay hit the itself.
  668. {
  669. return false // Don't let the entity be hit
  670. }
  671. else if(StrEqual(classname, "player"))
  672. {
  673. return false;
  674. }
  675. return true // It didn't hit itself
  676. }
  677. public AttachParticle(entity, String:particleType[], Float:time)
  678. {
  679. new particle = CreateEntityByName("info_particle_system");
  680.  
  681. decl String:name[64];
  682. if (IsValidEntity(particle))
  683. {
  684. new Float:position[3];
  685. GetEntPropVector(entity, Prop_Send, "m_vecOrigin", position);
  686.  
  687. position[2] += 5;
  688. TeleportEntity(particle, position, NULL_VECTOR, NULL_VECTOR);
  689.  
  690. Format(name, sizeof(name), "target%i", entity);
  691.  
  692. DispatchKeyValue(entity, "targetname", name);
  693.  
  694. DispatchKeyValue(particle, "targetname", "tf2particle");
  695. DispatchKeyValue(particle, "parentname", name);
  696. DispatchKeyValue(particle, "effect_name", particleType);
  697. DispatchSpawn(particle);
  698.  
  699. SetVariantString(name);
  700. AcceptEntityInput(particle, "SetParent");
  701. SetVariantString("flag");
  702. AcceptEntityInput(particle, "SetParentAttachment");
  703.  
  704. ActivateEntity(particle);
  705. AcceptEntityInput(particle, "start");
  706.  
  707. CreateTimer(time, DeleteParticle, particle);
  708. }
  709. }
  710. public Action:DeleteParticle(Handle:timer, any:particle)
  711. {
  712. if (IsValidEntity(particle))
  713. {
  714. decl String:classname[64];
  715. GetEdictClassname(particle, classname, sizeof(classname));
  716. if (StrEqual(classname, "info_particle_system", false))
  717. {
  718. RemoveEdict(particle);
  719. }
  720. }
  721. }