English Server message

3 replies
Goto Page
To the start Previous 1 Next To the start
05.05.19 06:58:40 pm
Up
kewixasd
User
Offline Off
Hi

how can i make a server message
which to give you tips
while playing

Thank you in advance for your help
N@
05.05.19 07:32:42 pm
Up
Bowlinghead
User
Offline Off
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
msgs = {
"R for Reload",
"B for Buymenu",
"Leftclick to shoot",
-- add/change more with same pattern
}

local counter = 0

addhook("minute","minhook")
function minhook()
     msg(msgs[counter])
     counter = counter + 1
end


Every minute the server will display a predefined message to everyone
Share time limited free games here
07.05.19 05:01:03 am
Up
Cure Pikachu
User
Offline Off
@user Bowlinghead: I can like, see 2 problems with yours. First, it will try to cs2d lua cmd msg
msgs[0]
which doesn't exist. Second, since the counter keeps going up, eventually there will be nothing to show because those entries don't exist either.
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
msgs = {
     "R for Reload",
     "B for Buy menu",
     "Left click to shoot",
     -- add/change more with same pattern
}

counter = 0

addhook("minute","minhook")
function minhook()
     counter = counter + 1
     if counter > #msgs then
          counter = 1
     end
     msg(msgs[counter])
end
IMG:https://i.imgur.com/uUrye71.png
IMG:https://i.imgur.com/xpsyQRX.png
07.05.19 12:42:07 pm
Up
deletemyacc
User
Offline Off
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
msgs = {
     "R for Reload",
     "B for Buy menu",
     "Left click to shoot",
     -- add/change more with same pattern
}

counter = 0

addhook("minute","minhook")
function minhook()
     counter = counter + 1
     if counter > #msgs then
          counter = 1
     end
     if (msgs[counter] ~= nil) then
      msg(msgs[counter])
     end
end
To the start Previous 1 Next To the start