General > Developers Corner

Admin sounds, tools and other code chat.

<< < (14/31) > >>

jay209015:
Lol, wow. I see that now. All this effort just to get stuck back where I started lol. Oh well this was very educational for me anyways :D

jay209015:
Ok, Now back to the Ajoin script.
How do I make slow pulsing ring like effect at admins feet?
here is my current script.


--- Code: ---
local function MakeEffect( ply )
                        EFFECT.Mat = Material( "effects/select_dot" )
local effectdata = EffectData()
effectdata:SetOrigin( ply:GetPos() )
effectdata:SetNormal( ply:GetPos() )
effectdata:SetMagnitude( 3 )
effectdata:SetScale( 2 )
effectdata:SetRadius( 5 )
util.Effect( "Sparks", effectdata, true, true )
end

function AdminJoin( ply)

         if ( !ply:IsAdmin() ) then return end

                             timer.Simple( 3, game.ConsoleCommand, "ulx playsound admin.mp3 \n")
                             timer.Simple( 5, game.ConsoleCommand, "ulx csay admin " ..ply:Nick().. " has connected \n")
                             timer.Create(math.random( 10000000, 99999999 ), 1, 0, MakeEffect, ply )

end
hook.Add( "PlayerInitialSpawn", "AdminJoin", AdminJoin );



--- End code ---

JamminR:
I've not dealt with effects much. You might take a look at Mr.President's explode release script for the various vector functions he used.

I would suggest using the actual ULib library functions for all the ulx console commands you're using though.
This will prevent having to run console commands, bypasses the ULX middleman (which, basically just calls ULib for the commands you're doing)

Library docs can be found at http://www.ulyssesmod.net/docs/index/Functions.html
You'll most likely want csay - http://www.ulyssesmod.net/docs/files/lua/ULib/shared/messages-lua.html#csay
and - Sound - http://www.ulyssesmod.net/docs/files/lua/ULib/server/util-lua.html#play3DSound


jay209015:
I tried using the ULib library functions, but didn't get them to work. I did however get my effects to work with sparks, but if an admin leaves the server I get spammed with this in the server console:


--- Code: ---Timer Error: autorun/Ajoin.lua:6: Tried to use a NULL entity!
--- End code ---

Here's my code:


--- Code: ---function AdminJoin( ply)
local function MakeEffect( ply )
if ( !ply:IsAdmin() ) then return end
local effectdata = EffectData()
effectdata:SetOrigin( ply:GetPos() )
effectdata:SetNormal( ply:GetPos() )
effectdata:SetMagnitude( 3 )
effectdata:SetScale( 2 )
effectdata:SetRadius( 5 )
util.Effect( "Sparks", effectdata, true, true )
end
if ( !ply:IsAdmin() ) then return end
timer.Simple( 3, game.ConsoleCommand, "ulx playsound admin.mp3 \n")
timer.Simple( 5, game.ConsoleCommand, "ulx csay admin " ..ply:Nick().. " has connected \n")
timer.Create(math.random( 10000000, 99999999 ), 1, 0, MakeEffect, ply )
end
hook.Add( "PlayerInitialSpawn", "AdminJoin", AdminJoin );

--- End code ---

JamminR:

--- Quote from: jay209015 on April 27, 2008, 08:06:27 PM ---
--- Code: ---Timer Error: autorun/Ajoin.lua:6: Tried to use a NULL entity!
--- End code ---

--- End quote ---

I'll let you tinker with the ULib functions on your own for now. Best practice would be to use them though. :)
As for a tip for how to fix the error, you need to find a way to stop it when they leave. (this you know I'm sure)
You can't kill a simple timer (directly anyway) because they aren't named.
Perhaps an advanced timer, or a think hook self created timer that always checks IsValid().

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version