Hello,
So i have a server that i want to run a command (server side) on certain maps, but i do not know how to do so. I will give an example, lets say the server changed map to "mg_scary_course_v3" what i want it to do is if it loaded that map, i want the server to run this command: "dr_death_rate 0". Any ideas on how to do this? like what code and where i put it etc?
thanks, -sam :)
Something like this
[code]function MapDetect()
if game.GetMap == "mapname" then
RunConsoleCommand("dr_deathrate","0")
end
end
hook.Add( "Initialize", "MapDetect", MapDetect )[/code]
thanks, ill try it now :)
Put it in server side code BTW forgot to mention that :D
Iv'e put it in lua/autorun/scarycoursemap.lua
:)
[editline]28th February 2014[/editline]
[QUOTE=ZombieWizzard;44080497]Put it in server side code BTW forgot to mention that :D[/QUOTE]
Iv'e heard that RunConsoleCommand makes it run on Client side, ill try it with "say TEST"
[editline]28th February 2014[/editline]
[QUOTE=ZombieWizzard;44080497]Put it in server side code BTW forgot to mention that :D[/QUOTE]
It did not work, add me on skype we can do it quicker :)
weedevil9
The say won't work as it is before the chat even initializes.
Just try it with a convar like sv_cheats and see if the convar has changed after a map change
EDIT:
Dr_highlight_admins not sv_cheats
I cant do that, my server is going to public, i know it dont work anyways because the command i wanted did not work.
Is there no other way to get this to work? :P
The say command won't work and I gave it as an example, use a convar for testing...
[QUOTE=ZombieWizzard;44080854]The say command won't work and I gave it as an example, use a convar for testing...[/QUOTE]
i didn't use say after that, i used the command i wanted like i said lol, ill try it with sv_cheats 1 on anyways :P
[editline]28th February 2014[/editline]
[QUOTE=ZombieWizzard;44080854]The say command won't work and I gave it as an example, use a convar for testing...[/QUOTE]
It didn't work, :/
It should be in lua/autorun/server. Try this.
[lua]game.ConsoleCommand("dr_deathrate 0\n")[/lua]
Tried that, did not work :/
I do all things related to map manipulation in InitPostEntity - after the map has spawned it's own entities.
Are you sure that you're using game.ConsoleCommand correctly in a SERVER-side file? Show us your code, and inclusion methods please.
Sorry, you need to Log In to post a reply to this thread.