How do you change Server Properties depending on Map

Basically the title.

I’m not sure about how going about this. I’ve looked at a rtv system to try figure something out about calling maps (not loading them). But as an example,

[lua]
–One map loads this for the server
sv_gravity 800

–Another map load this one
sv_gravity 600
[/lua]

It may be stupid simple but I’m stuck so that’s why I’m here.
Thanks for the help!

You can only do so with a custom Lua script.

[editline]10th May 2016[/editline]

and

SERVERSIDE

Yea forgot to say that, that’s what I was looking for thanks :slight_smile:

[editline]10th May 2016[/editline]

Also, print. I’m not sure how to check what was printed and do something if say “gm_flatgras” was printed.

Could you give me an example in Lua? That would be greatly appreciated!

if (game.GetMap() == mapname) then

?

I tried that with this…
[lua]
if (game.GetMap() == “the_map” or “the_map2”) then
ply:GiveAmmo( 100000, “pistol”)
ply:GiveAmmo( 100000, “357”)
end
[/lua]
And it doesnt work, so not sure whats going on.

Logic error. Valid, but not what you intend.


if ( game.GetMap() == "the_map" or game.GetMap() == "the_map2" ) then
    ...
end

I recommend using tables anyways.

Ahhh im retarded xD Thanks :slight_smile:

Did you put it in a hook, like PlayerLoadout?
And yeah, syntax is invalid.

The syntax is fine, the problem is machines are literal so it’ll be evaluated as (“if the map is the_map”) OR (“if the_map2”) THEN do whatever.

The second part isn’t a comparison here, it’s basically checking that it’s not nil.

I cannot seem to get it to work. Any idea on the way its supposed to be for something like that?

Where are you running this? What hook? What is your updated code?

He’s saying if you need to add game.GetMap() == beford the second string in the if statement

And make sure it’s in a proper hook. Like PlayerLoadout