• Would this work? (Timers)
    4 replies, posted
[LUA]timer.Create( "Adverts", 10, 0, adverttable ) local adverttable = { GAMEMODE:AddNotify("This is a simple test (1)", NOTIFY_GENERIC, 10); GAMEMODE:AddNotify("Hello, "..LocalPlayer():GetName(), NOTIFY_GENERIC, 10); GAMEMODE:AddNotify("This is a simple test (3)", NOTIFY_GENERIC, 10); } [/LUA] I've been bored at work so i thought i'd find something to do. I haven't tested this, but will it work? Edit: [CODE]function welcomeMSG() GAMEMODE:AddNotify("Welcome to the server!", NOTIFY_GENERIC, 10); end hook.Add("PlayerSpawn", "welcomeMSG", tittysprinkles)[/CODE] Had a mess around with this too.
timer.Create takes a function, not a table. But other than that it should be fine. Make sure it's clientside. PlayerSpawn runs on every spawn so PlayerInitialSpawn is better but these two hooks are serverside and GAMEMODE:AddNotify is clientside. You would either have to network it or use a clientside hook (even loosely in a clientside file could work).
Why even ask "will it work", launch the game and try it yourself, if it doesn't work, either seek help here or try to solve it yourself.
[QUOTE=Robotboy655;45454768]Why even ask "will it work", launch the game and try it yourself, if it doesn't work, either seek help here or try to solve it yourself.[/QUOTE] Well, pretty much to see if i'm on the right track to what i'm doing. I thought [QUOTE] I've been bored at work so i thought i'd find something to do [/QUOTE] Would have been a massive giveaway.
[QUOTE=Lemmie;45454237] Edit: [CODE]function welcomeMSG() GAMEMODE:AddNotify("Welcome to the server!", NOTIFY_GENERIC, 10); end hook.Add("PlayerSpawn", "welcomeMSG", tittysprinkles)[/CODE] Had a mess around with this too.[/QUOTE] This won't work, hook.Add's second parameter is the unique name and the third one is the function: [lua] hook.Add( "PlayerInitialSpawn", "tittysprinkles", welcomeMSG ) [/lua]
Sorry, you need to Log In to post a reply to this thread.