English double twice

8 replies
Goto Page
To the start Previous 1 Next To the start
10.07.15 11:18:58 am
Up
lennon
User
Offline Off
Well i tried to make script but u know me im tottaly brainless, so i need to press double E key for open console menu and then 5 options like
"i kill you"
"Die"
"You are noob"
"I love you lennon"
"Im idiot"
When player choose one hes saying this by himself like command in console "say im idiot"
The game of year - CS2D
10.07.15 11:47:55 am
Up
The Gajos
BANNED
Offline Off
I'm not sure if it will work /just edit it if won't work
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
user = {}

function _join(id)
     user[id] = {}
     user[id].lastActionTime = os.time()
end

function _leave(id)
     user[id] = nil
end

function _use(id)
     user[id].actionTime = os.time()
     if user[id].actionTime - user[id].lastActionTime <= 2 then -- I hope it's in seconds, otherwise go use 200
          menu(id,'Poland the best,The Gajos,mafia_man,Avobolt')
     end
     user[id].lastActionTime = os.time()
end

-- you have to code menu hook --

addhook('join','_join')
addhook('leave','_leave')
addhook('use','_use')
10.07.15 11:53:14 am
Up
muxarus
User
Offline Off
@user lennon: I dont know how to use button E for opening lua menu.

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
addhook("serveraction" , "_serveraction")
function _serveraction(id,action)
     if action==1 then 
          menu(id,"Console,i kill you,Die,You are noob,I love you lennon,Im idiot")
     end
end

addhook("menu","_menu")
function _menu(id,title,button)
     if title=="Console" then
          if button==1 then parse('say "i kill you"') end
          if button==2 then parse('say "Die"') end
          if button==3 then parse('say "You are noob"') end
          if button==4 then parse('say "I love you lennon"') end
          if button==5 then parse('say "Im idiot"') end
     end
end
IMG:http://steamsignature.com/status/german/76561198081961553.png
IMG:http://steamsignature.com/AddFriend.png
11.07.15 04:46:33 pm
Up
BcY
Reviewer
Offline Off
addhook("use","whateveryoutype")
Kgb2d Community - Since 2012
11.07.15 08:24:48 pm
Up
lennon
User
Offline Off
user muxarus Could u add there function only for team==2 ?
The game of year - CS2D
11.07.15 08:37:13 pm
Up
BcY
Reviewer
Offline Off
@user lennon:

Here you go man:

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
addhook("serveraction" , "_serveraction")
function _serveraction(id,action)
     if action==1 then 
      if (player(id,"team")==2) then
          menu(id,"Console,i kill you,Die,You are noob,I love you lennon,Im idiot")
     end
end
end

addhook("menu","_menu")
function _menu(id,title,button)
     if title=="Console" then
          if button==1 then parse('say "i kill you"') end
          if button==2 then parse('say "Die"') end
          if button==3 then parse('say "You are noob"') end
          if button==4 then parse('say "I love you lennon"') end
          if button==5 then parse('say "Im idiot"') end
     end
end
Kgb2d Community - Since 2012

Admin/mod comment:

Don't quote the user's post which is above you. Plus, next time choose the "Code" tag for codes instead of Spoiler. /user GeoB99
12.07.15 08:02:03 pm
Up
lennon
User
Offline Off
Ye its working but why its so strange I mean when I test in New Game server its ok, but on dedicated server its working like this
Its saying commands "i killu" but dosnt indicate who wrote it ? why ?
The game of year - CS2D
12.07.15 08:37:52 pm
Up
BcY
Reviewer
Offline Off
So it would be better to use with "msg"
Kgb2d Community - Since 2012
12.07.15 10:09:01 pm
Up
The Gajos
BANNED
Offline Off
Code:
msg('©050148252'..player(id,'name')..': ©255220000That's my message from Poland')
To the start Previous 1 Next To the start