Forum

> > CS2D > General > make functions for GameMode
Forums overviewCS2D overviewGeneral overviewLog in to reply

English make functions for GameMode

4 replies
To the start Previous 1 Next To the start

old make functions for GameMode

DarkBooy
User Off Offline

Quote
Heloo,i need functions for GameMode:
• can do change game mode
• The game mode is : standard,dm,t dm,con,z
• only for admin
• and can use in my server and my script .

old Re: make functions for GameMode

sheeL
User Off Offline

Quote
user DarkBooy has written
Heloo,i need functions for GameMode:
• can do change game mode
• The game mode is : standard,dm,t dm,con,z
• only for admin
• and can use in my server and my script .



Area wrong to post this
you use RCon or this script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
adminlist = {1,xxxxx} -- usgn of administrators

function isAdmin(id)
	for _, usgn in ipairs(adminlist) do
		if player(id,'usgn')== usgn then
			return true
		end
	end
	return false
end

addhook("serveraction","OnAction")
function OnAction(id,action)
if action == 1 then
 if isAdmin(id) then
  menu(id,"GameModes,Standard,Zombie,Deathmath,Construction,Team Deathmath")
  end
 end
end

addhook("menu","OnMenu")
function OnMenu(id,t,b)
if t == "GameModes" then
 if b == 1 then
  parse("sv_gm 0")
   msg("©255255255Administrator "..player(id,'name').." Changed GameMode to Standard")
   elseif b == 2 then
    parse("sv_gm 4")
     msg("©255255255Administrator "..player(id,'name').." Changed GameMode to Zombie")
     elseif b == 3 then
      parse("sv_gm 1")
       msg("©255255255Administrator "..player(id,'name').." Changed GameMode to DeathMath")
       elseif b == 4 then
        parse("sv_gm 3")
        msg("©255255255Administrator "..player(id,'name').." Changed GameMode to Construction")
       elseif b == 5 then
      parse("sv_gm 2")
     msg("©255255255Administrator "..player(id,'name').." Changed GameMode to Team Deathmath")
    end
  end
end

If you need help, send me a message to me !

old Re: make functions for GameMode

Suprise
BANNED Off Offline

Quote
1
2
3
4
5
6
7
8
9
addhook("say","_say")
function _say(id,txt)
	if player(id,"usgn") == 89037 then --(or continue with 'or player(id,"usgn") == 1', in this case put 'then' to the end.
		if txt:lower():sub(1, 2) == "!g" then
			local gto = tonumber(txt:sub(3))
			parse("sv_gm "..gto)
		end
	end
end
Should work.
To the start Previous 1 Next To the start
Log in to replyGeneral overviewCS2D overviewForums overview