• Hostname changing script
    13 replies, posted
I've seen alot of servers around with these so I decided to quickly write one up and release it. Btw , its untested . I might test it later. [lua] /* Made by Matt W, I think I saw the original idea on the beloved SDB Servers :< */ // Configuration local TPS_NAMETIME = 5 // The time (In seconds) that the name changes local TPS_PREFIX = "Hostname Prefix" // The names itself local TPS_NAMES = {"Yeah I'm hard too", "Luv you garry <3","Add more. Remove the old ones.","Fuck you seth."} local function ChangeName() local name = table.Random(TPS_NAMES) RunConsoleCommand("hostname", TPS_PREFIX.." | "..name) timer.Simple(TPS_NAMETIME, ChangeName) end ChangeName() [/lua] Oh yeah : Place in a file in autorun. Or in a gamemode if you like.
Why? I'm going to edit this so it changed every second. To some other racist slur.
[lua]timer.Create( "whatever", TPS_NAMETIME, 0, ChangeName )[/lua]
[QUOTE=DrJenkins;35538384] I'm going to edit this so it changed every second. To some other racist slur.[/QUOTE] Glad to see its being put to good use :v: [QUOTE=DrJenkins;35538384] Why? [/QUOTE] I honestly have no idea. I'm just bored until my dedi stops being ddosed by buthurts.
Damn, PM me.
[lua]local name = TPS_NAMES[math.random(1,table.Count(TPS_NAMES))][/lua] Why not table.Random? ... And why is everything (aside from that) global?
[QUOTE=.\\Shadow};35540934][lua]local name = TPS_NAMES[math.random(1,table.Count(TPS_NAMES))][/lua] Why not table.Random? ... And why is everything (aside from that) global?[/QUOTE] Didn't realise table.Random existed. Have changed to your reccomendations.
[LUA] /* Made by Matt W, I think I saw the original idea on the beloved SDB Servers :< */ // Configuration local TPS_NAMETIME = 0.1 // The time (In seconds) that the name changes local TPS_PREFIX = "Hostname Prefix" // The names itself local TPS_NAMES = {"NO JEWS", "MEXICANS ARE NOT WELCOME","BLACK PEOPLE ARE FAT","Fuck you Lincoln."} local function ChangeName() local name = table.Random(TPS_NAMES) RunConsoleCommand("hostname", TPS_PREFIX.." | "..name) timer.Simple(TPS_NAMETIME, ChangeName) end ChangeName() [/LUA] [highlight](User was banned for this post ("Racism isn't funny." - Craptasket))[/highlight]
and by the way, I stole the whole host name changing idea from CapsAdmin/Python on their Lua God server, and used it on SDB (and now PGS) [editline]13th April 2012[/editline] so if you want to credit anyone, credit them
[QUOTE=Matt W;35545093]Didn't realise table.Random existed. Have changed to your reccomendations.[/QUOTE] You shouldn't use table.Random on integer index tables as it is significantly slower and as it is integer index table[math.random(1,#table)] works fine.
Why do you bother to define ChangeName? Just have the code you need ran run, don't define it as a local function then run it.
Is it possible to have a suffix rather than a prefix?
[QUOTE=nick_9_8;35579271]Is it possible to have a suffix rather than a prefix?[/QUOTE] Sure , just swap it around [lua] /* Made by Matt W, I think I saw the original idea on the beloved SDB Servers :< */ // Configuration local TPS_NAMETIME = 5 // The time (In seconds) that the name changes local TPS_PREFIX = "Hostname Prefix" // The names itself local TPS_NAMES = {"Yeah I'm hard too", "Luv you garry <3","Add more. Remove the old ones.","Fuck you seth."} local function ChangeName() local name = table.Random(TPS_NAMES) RunConsoleCommand("hostname", name.." | "..TPS_PREFIX) // This is the line I swapped around :) timer.Simple(TPS_NAMETIME, ChangeName) end ChangeName() [/lua]
Love you <3
Sorry, you need to Log In to post a reply to this thread.