English Change Map then Change Script

5 replies
Goto Page
To the start Previous 1 Next To the start
05.07.14 10:10:16 am
Up
M0BSTAZ
User
Offline Off
Hello! everyone

I'am looking for the map change then the script will be change! someone help me :x
Like this file --» file File does not exist (14802) file cs2d AWP2D MOD 4.0 [English Version] (4) file cs2d zm_Tower Defense v.1.3 (0) «--
05.07.14 10:25:25 am
Up
SpriNG
User
Offline Off
MOBSTAZ has written:
Hello! everyone

I'am looking for the map change then the script will be change! someone help me :x


So,you mean if you change a map the script should also change right? :x

Well,i think this too needs a script xD!
05.07.14 10:29:24 am
Up
XoOt
Super User
Offline Off
Can be done by checking the mapname
05.07.14 01:51:06 pm
Up
Rainoth
Moderator
Offline Off
Method A :
Code:
1
2
de_dust.map
de_dust.lua

Just rename lua file into your map file and put it in maps folder. Be sure that running map luas is allowed in server settings.

Method B :
Code:
1
2
3
4
5
6
7
AnyNameYouLikeOrWhatever.lua
-----
if map("name")=="de_dust" then
     msg("You're playing on de_dust")
elseif map("name")=="cs_office" then
     msg("You're playing on cs_office")
end
MAL • DeviantArt • For Wallpaper Engine users • Check YT for playlists... •
05.07.14 02:21:43 pm
Up
TimeQuesT
User
Offline Off
Replace "msg" in user Rainoth's script with "dofile" to execute separated files.

Here's a small example
Code:
1
2
3
4
5
if ((string.len(map("name") > 2) and (string.substr(map("name"), 2) == "gg")) then
     dofile("Gungame.lua"); --whenver the map prefix is gg a gungame script will be executed.
else
     dofile("Default.lua"); 
end
Muh
14.07.14 12:12:14 pm
Up
M0BSTAZ
User
Offline Off
thank you!
Like this file --» file File does not exist (14802) file cs2d AWP2D MOD 4.0 [English Version] (4) file cs2d zm_Tower Defense v.1.3 (0) «--
To the start Previous 1 Next To the start