Advertisement
Guest User

Untitled

a guest
Feb 15th, 2013
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.33 KB | None | 0 0
  1. include <sourcemod>
  2. #include <sdktools>
  3.  
  4. new LaserSprite, Halosprite;
  5.  
  6. new bool:g_bTouchedIt[MAXPLAYERS+1];
  7. new Float:g_FlameTime = 5.0;
  8.  
  9. public Plugin:MyInfo =
  10. {
  11.     name = "CBase entity?",
  12.     author = "Sky-High",
  13.     description = "My first SM entity plugin",
  14.     version = "1.0",
  15.     url = "** AM Spam-Blocker V3.6 **"
  16. };
  17.  
  18.  
  19.  
  20. public OnPluginStart()
  21. {
  22.    
  23.     LoadTranslations("common.phrases");
  24.    
  25.     HookEvent("player_death", Event_PlayerDeath);
  26.    
  27.     //AutoExecConfig(true, "plugin_testplugin"); //autoexec a cfg file if there isnt already one
  28. }
  29.  
  30. public OnMapStart()
  31. {
  32.         //Precache
  33.     LaserSprite = PrecacheModel("materials/sprites/bluelaser1.vmt");
  34.     Halosprite  = PrecacheModel("materials/sprites/halo01.vmt");
  35. }
  36.  
  37. public Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
  38. {
  39.     new victim_id = GetEventInt(event, "userid");
  40.     //new attacker_id = GetEventInt(event, "attacker");
  41.  
  42.     new victim = GetClientOfUserId(victim_id);
  43.     //new attacker = GetClientOfUserId(attacker_id);
  44.     new Float:Origin[3];
  45.    
  46.     GetClientAbsOrigin(victim, Float:Origin);
  47.    
  48.     CreateSomeEntity(victim, Float:Origin);
  49.    
  50. }
  51.  
  52. stock CreateSomeEntity(client, Float:Origin[3])
  53. {
  54.     new entity = CreateEntityByName("my_entity");
  55.     //new EntData[3];
  56.    
  57.     if (entity != -1)
  58.     {
  59.         SetEntPropVector(entity, Prop_Data, "m_vecOrigin", Origin); // you can use sm_dump_datamaps / sm_dump_netprops server command got all offsets.
  60.             //SetEntityModel(
  61.         SetEntityRenderMode(entity, RENDER_TRANSCOLOR);
  62.         SetEntityRenderFx(entity, RENDERFX_PULSE_SLOW);
  63.         SetEntityRenderColor(entity, 31, 191, 36, 160);
  64.        
  65.         new Float:SplashStartOrigin[3]/*, Float:SplashEndOrigin[3]*/, Float:BeamStartOrigin[3], Float:BeamEndOrigin[3];
  66.         new BeamColor[4];
  67.         SplashStartOrigin = Origin;
  68.         //SplashEndOrigin = Origin;
  69.         BeamStartOrigin = Origin;
  70.         BeamEndOrigin = Origin;
  71.    
  72.         SplashStartOrigin[2] = (Origin[2] - 5);
  73.         //SplashEndOrigin[3] = (Origin[3] + 5);
  74.         BeamStartOrigin[2] = (Origin[2] + 40);
  75.         BeamEndOrigin[2] = (Origin[2] - 5);
  76.        
  77.         BeamColor[0] = 173; //r
  78.         BeamColor[1] = 156; //g
  79.         BeamColor[2] = 28; //b
  80.         BeamColor[3] = 210;//A
  81.        
  82.         TE_SetupEnergySplash(Float:SplashStartOrigin, Float:Origin, bool:false);
  83.  
  84.        
  85.         TE_SetupBeamPoints(BeamStartOrigin, BeamEndOrigin,
  86.                             LaserSprite, Halosprite,
  87.                             0, 10, Float:0.8,
  88.                             Float:25, Float:20, 3,
  89.                             Float:5.0, BeamColor, 185);
  90.        
  91.        
  92.         CreateTimer(Float:0.8, Timer:SpawnEntity, any:entity);
  93.        
  94.     }
  95. }
  96.  
  97. public SpawnEntity(entity)
  98. {
  99.     if( IsValidEntity(entity) )
  100.     {
  101.  
  102.         if (DispatchSpawn(entity))
  103.         {
  104.         // if you can't find OnStartTouch output, using SDKHooks
  105.         // http://hg.alliedmods.net/sourcemod-central/file/tip/plugins/include/sdkhooks.inc
  106.         //SDKHook(entity, SDKHook_StartTouch, Entity_OnStartTouch);
  107.             HookSingleEntityOutput(entity, "OnStartTouch", Entity_OnStartTouch);
  108.        
  109.         // Set the entity on fire as a last effect
  110.             IgniteEntity(entity, Float:g_FlameTime, bool:1);
  111.         }
  112.     }
  113. }
  114.  
  115. public Entity_OnStartTouch(const String:output[], caller, activator, Float:delay)
  116. {
  117.     if( IsPlayerAlive(activator) )
  118.     {
  119.     //Can i use this to store in the clientindex of the player touched it?
  120.         //SetEntProp(entity, Prop_Data, "PropField_Integer", client);
  121.         g_bTouchedIt[activator] = true;
  122.        
  123.         if( !AcceptEntityInput(caller, "kill") )
  124.             RemoveEdict(caller);
  125.     }
  126.    
  127. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement