GM13 Adverts

Does anyone know how to make adverts with some lua, That comes on the right side of the screen with the bulb. I’ve looked into it and can only see some gm12/10 advert and they don’t work. I would maybe chuck in a few $$$ if someone helps me.

Cheers,
Luke

You could do a timer.Create chatprint?

I guess you could use the “PlayerInitialSpawn” hook to achieve this. Just make a infinite looping timer with a set amount of seconds you want to set to run it.

https://docs.google.com/document/d/1khSuIYrAMkqXu7wlH5YRJNwz6hOH6Xqi5lqBhE3x6gA/edit
You can check that link to see what changes were made from GM12 to GM13
timer calls no longer take var args to pass to callback

So a
[lua]
hook.Add(“PlayerInitialSpawn”, “Advert”, function(ply)
timer.Create(“blahadvert” … ply:UniqueID(), 60, 0, function()
ply:ChatPrint(“blahblah”)
end)
end)
[/lua]

Idk but this is something really simple. You can make an advanced one with all the little neat features, but this will work. This would print blahblah for the user every 60 seconds. Or just edit the ones from GM12 to make it compatible with GM13. It’s really up to you.

On the other hand, I suggest using ULX/ULIB or Evolve. I’m currently using ULX/ULIB and adverts work fine.

Thanks, Should I just change The blahadvert?

No you would change blahblah within ply:ChatPrint(“blahblag”)

Thanks, Could you do an example if I wanted 3 adverts. I’m new at LUA cheers.



hook.Add("PlayerInitialSpawn", "Advert", function(ply)
timer.Create("Advert1" .. ply:UniqueID(), 60, 0, function()
 ply:ChatPrint("Welcome to the server")
end)
timer.Create("Advert2" .. ply:UniqueID(), 90, 0, function()
 ply:ChatPrint("Hope you enjoy your stay")
end)
timer.Create("Advert3" .. ply:UniqueID(), 145, 0, function()
 ply:ChatPrint("Remember to favorite this server")
end)
end)


Thanks, But I wan’t to find out how to make them on the right side of the screen and with the bulb.

Those would be notifications using the NOTIFY_GENERIC enum

Could you link me to a tutorial or a page for research on the Notify?

I recommend using this as a reference.

Please actually take your time and read through the documentation and theres a neat search function for whatever you are looking for as well.

try this script which might look a bit nicer etc:



if(SERVER)then
  AddCSLuaFile("autorun/<name of file this is in>.lua")
else
  local advertz = {
    {Color(0,255,255),"Hello World! This is a message in cyan color."},
    {Color(0,255,0),"THIS IS GREEN!"}
  }
  local c = 1
  timer.Create("Advertz",60,0,function()
    chat.AddText( unpack( advertz[ c % #advertz + 1 ] ) )
  end)
end


That aught to do it. If not lemme know. It will print colored adverts.