[code]
function PhoenixTimerStop( ply )
if ply:isSuperAdmin() then
timer.Destroy("PhoenixTimerCreate")
for k, v in pairs(player.getAll()) do
v:EmitSound("ambient/alarms/klaxon1.wav", 500, 200)
v:ChatPrint("[Phoenix's Tools] The Timer has ended.")
end
end
end
function PhoenixTimerStart( ply, arg )
if ply:isSuperAdmin() then
timer.Create("PhoenixTimerCreate", arg, 1, PhoenixTimerStop())
for k, v in pairs(player.getAll()) do
v:EmitSound("ambient/alarms/klaxon1.wav", 500, 200)
v:ChatPrint("[Phoenix's Tools] A Timer has been set to go off in "..arg.." seconds.")
end
end
end
conCommand.add("Phoenix_TimerStop", PhoenixTimerStop())
conCommand.add("Phoenix_TimerStart", PhoenixTimerStart())
[/code]
I'm new to LUA Coding, but I just can't figure out why this doesn't work.
Constructive Criticism please, and if you do know why it doesn't work, can you point it out for me.
Thanks.
conCommand.add
Needs to be lower-case.
There are a lot of mistakes in your code, don't you look at the error messages at all?
I'm probably stupid, but I run the script on a dedicated server thus I don't see any error messages from my client. Not to mention I never check.
[QUOTE=Shockcom;36900328]I'm probably stupid, but I run the script on a dedicated server thus I don't see any error messages from my client. Not to mention I never check.[/QUOTE]
Yeah, you are stupid. Check the error messages from the server console or console log.
[code]
function PhoenixTimerStop( ply )
if [highlight]ply:IsSuperAdmin()[/highlight] then
timer.Destroy("PhoenixTimerCreate")
for k, v in pairs([highlight]player.GetAll()[/highlight]) do
v:EmitSound("ambient/alarms/klaxon1.wav", 500, 200)
v:ChatPrint("[Phoenix's Tools] The Timer has ended.")
end
end
end
function PhoenixTimerStart( ply, cmd, arg )
if [highlight]ply:IsSuperAdmin()[/highlight] then
timer.Create("PhoenixTimerCreate", [highlight]tonumber([/highlight]arg[highlight])[/highlight], 1, [highlight]function() PhoenixTimerStop(ply) end[/highlight])
for k, v in pairs([highlight]player.GetAll()[/highlight]) do
v:EmitSound("ambient/alarms/klaxon1.wav", 500, 200)
v:ChatPrint("[Phoenix's Tools] A Timer has been set to go off in "..arg.." seconds.")
end
end
end
[highlight]concommand.Add[/highlight]("Phoenix_TimerStop", PhoenixTimerStop)
[highlight]concommand.Add[/highlight]("Phoenix_TimerStart", PhoenixTimerStart)[/code]
You can check out all the functions and syntax here: [url]http://glua.me/search/[/url]
One thing though, you're emitting the sound from the player server-side. Everyone will hear the klaxon emitting from each player.
Sorry, you need to Log In to post a reply to this thread.