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.
[url]https://docs.google.com/document/d/1khSuIYrAMkqXu7wlH5YRJNwz6hOH6Xqi5lqBhE3x6gA/edit[/url]
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.
[QUOTE=kaos2100;38803455]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.
[url]https://docs.google.com/document/d/1khSuIYrAMkqXu7wlH5YRJNwz6hOH6Xqi5lqBhE3x6gA/edit[/url]
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.[/QUOTE]Thanks, Should I just change The blahadvert?
[QUOTE=RockstarC;38803993]Thanks, Should I just change The blahadvert?[/QUOTE]
No you would change blahblah within ply:ChatPrint("blahblag")
[QUOTE=centran;38804066]No you would change blahblah within ply:ChatPrint("blahblag")[/QUOTE]
Thanks, Could you do an example if I wanted 3 adverts. I'm new at LUA cheers.
[code]
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)
[/code]
Thanks, But I wan't to find out how to make them on the right side of the screen and with the bulb.
[QUOTE=RockstarC;38804578]Thanks, But I wan't to find out how to make them on the right side of the screen and with the bulb.[/QUOTE]
Those would be notifications using the NOTIFY_GENERIC enum
[QUOTE=S W;38805613]Those would be notifications using the NOTIFY_GENERIC enum[/QUOTE]Could you link me to a tutorial or a page for research on the Notify?
I recommend using this as a reference.
[url]http://wiki.garrysmod.com/?title=Lua[/url]
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:
[CODE]
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
[/CODE]
That aught to do it. If not lemme know. It will print colored adverts.
Sorry, you need to Log In to post a reply to this thread.