• Server Owner In-Server - Is This Right?
    12 replies, posted
What I want to do is make a script that sends a message to the clients on my server telling them if I'm in the server or not (I know that they can just press the tab key). I got stuck after this started looking wrong. [code]if player("PlayerNameHere") = false then Msg("PlayerNameHere is gone.") else Msg("PlayerNameHere is here." end[/code] If it is right then how would I make it resend the message again and again with intervals of 120 seconds between each message?
[lua] local ID = "STEAM_0:0:16636723" for _, v in ipairs( player.GetAll() ) do if v:SteamID() == ID then Msg(v:GetName().." is here.\n") else Msg(v:GetName().." is gone.\n") end end [/lua]
Dave, you missed a ) near the last end. And you aren't even concat'ing his name. [editline]11:00AM[/editline] And, chatprint doesn't take tables.
Thank you, I'm going to add that code now.
It won't work by the way.
[QUOTE=decyg;23298738]It won't work by the way.[/QUOTE] Then I'll attempt to tweak it to make it work.
[lua] local mySteamID = "your steamid here" timer.Create("NotifyPlayersOfMe", 120, 0, function() local found local name for _,v in ipairs(player.GetAll()) do if(v:SteamID() == mySteamID) then found = true name = v:Nick() end end if(found) then for _,v in ipairs(player.GetAll()) do v:ChatPrint(name.." is on the server!") end else for _,v in ipairs(player.GetAll()) do v:ChatPrint(name.." is not on the server!") end end end) [/lua] Fixed it.
[QUOTE=decyg;23298811][lua] local mySteamID = "your steamid here" timer.Create("NotifyPlayersOfMe", 120, 0, function() local found local name for _,v in ipairs(player.GetAll()) do if(v:SteamID() == mySteamID) then found = true name = v:Nick() end end if(found) then for _,v in ipairs(player.GetAll()) do v:ChatPrint(name.." is on the server!) end else for _,v in ipairs(player.GetAll()) do v:ChatPrint(name.." is not on the server!) end end end) [/lua] Fixed it.[/QUOTE] Thank you.
Oshit, i forgot something [editline]11:19AM[/editline] Fixed
Really? News to me.
If Dave is correct I learned something new, thanks!
Sorry, you need to Log In to post a reply to this thread.