SourceMod Donor
|
06-17-2012
, 12:14
Re: Attaching a circle to a player.
|
#3
|
Quote:
Originally Posted by blodia
first of all using ongameframe is not isn't simplicity, using OnPlayerRunCmd is as its called on every player every gameframe and is only called if they're in game, so you don't need a loop or check if they're in game.
you can use any entity that has a model aswell as brushes for the start/end entities, you're better of using a prop_dynamic that is invisible and non solid.
|
Thanks, i'll try it and report back
-------------------------------------------
With huge support from blodia, we got it working ;)
PHP Code:
AttachBeam(client) { decl String:beamindex[30],String:start[30],String:end[30],String:parentName[64]; Format(parentName, sizeof(parentName), "%i:%N", client, client); DispatchKeyValue(client, "targetname", parentName); new Float:vec[3]; GetClientAbsOrigin(client, vec); new startent = CreateEntityByName("prop_dynamic"); Format(start, sizeof(start), "start%i", startent); DispatchKeyValue(startent, "targetname", start); DispatchKeyValue(startent, "model", "models/advisor.mdl"); DispatchKeyValue(startent, "solid", "0"); DispatchKeyValue(startent, "rendermode", "10"); DispatchSpawn(startent); ActivateEntity(startent); vec[1] += 100; //add 100 to the y axis, so it's away from the player itself TeleportEntity(startent, vec, NULL_VECTOR, NULL_VECTOR); SetVariantString(parentName); AcceptEntityInput(startent, "SetParent"); SetVariantString("defusekit"); AcceptEntityInput(startent, "SetParentAttachmentMaintainOffset"); new endent = CreateEntityByName("prop_dynamic"); Format(end, sizeof(end), "end%i", endent); DispatchKeyValue(endent, "targetname", end); DispatchKeyValue(endent, "model", "models/advisor.mdl"); DispatchKeyValue(endent, "solid", "0"); DispatchKeyValue(endent, "rendermode", "10"); DispatchSpawn(endent); ActivateEntity(endent); vec[1] -= 200; // do the same here, only reverse TeleportEntity(endent, vec, NULL_VECTOR, NULL_VECTOR); SetVariantString(parentName); AcceptEntityInput(endent, "SetParent"); SetVariantString("defusekit"); AcceptEntityInput(endent, "SetParentAttachmentMaintainOffset"); new beament = CreateEntityByName("env_beam"); if (IsValidEdict(beament)) { Format(beamindex, sizeof(beamindex), "Beam%i", beament); // Set keyvalues on the beam. DispatchKeyValue(beament, "damage", "0"); DispatchKeyValue(beament, "framestart", "0"); DispatchKeyValue(beament, "BoltWidth", "10"); DispatchKeyValue(beament, "renderfx", "0"); DispatchKeyValue(beament, "TouchType", "3"); DispatchKeyValue(beament, "framerate", "0"); DispatchKeyValue(beament, "decalname", "Bigshot"); DispatchKeyValue(beament, "TextureScroll", "35"); DispatchKeyValue(beament, "HDRColorScale", "1.0"); DispatchKeyValue(beament, "texture", "materials/sprites/laserbeam.vmt"); DispatchKeyValue(beament, "life", "0"); DispatchKeyValue(beament, "targetname", beamindex); DispatchKeyValue(beament, "LightningStart", start); DispatchKeyValue(beament, "LightningEnd", end); DispatchKeyValue(beament, "StrikeTime", "1"); DispatchKeyValue(beament, "spawnflags", "8"); DispatchKeyValue(beament, "NoiseAmplitude", "0"); DispatchKeyValue(beament, "Radius", "256"); DispatchKeyValue(beament, "rendercolor", "255 255 255"); DispatchKeyValue(beament, "renderamt", "100"); DispatchSpawn(beament); ActivateEntity(beament); TeleportEntity(beament, vec, NULL_VECTOR, NULL_VECTOR); CreateTimer(0.5, beam_enable, beament); } }
public Action:beam_enable(Handle:timer, any:beam) { AcceptEntityInput(beam, "TurnOn"); }
Last edited by Zylius; 06-17-2012 at 15:51.
|
|