how can i fix it? my first time on lua coding im learning to code
Forum
CS2D Scripts It Shows Everyone!It Shows Everyone!
14 replies 1
how can i fix it? my first time on lua coding im learning to code
If so, you should use
msg2(id,"<message>")
edited 4×, last 12.07.17 10:44:04 am
1
2
3
4
5
6
2
3
4
5
6
addhook("die","firstlua") function firstlua() msg2(id,"©255000000You Died!") msg2(id,"©255000000Wait For Next Round.") end ----END----
function firstlua(id)
victimas die hook doesn't pass such arguments like
idnatively, unless you manually retrieve that value by iterating over living players. Therefore id must be replaced with victim inside the two
msg2()functions as well.
So u hooked the msg2 with the event "death".
death will always occur to a single specific person nd hence it got a single parameter. Contrary to what @ GeoB99 said,We can use any term to refer those parameters for any hooks.
1
2
3
4
2
3
4
addhook("die","death") function death(asshole) msg2(asshole,"Rest in peace") end
Kill event can specify many persons like killer,victim.
Moreover the specific weapon used in killing also comes with this hook.
So better to understand those things just read the lua help page in cs2d official site.
i never tried this...
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
-- Start -- addhook("die","player_dieMsg") function player_dieMsg(victim,killer) 	msg2(victim,"Get rekt noob!!!") 	msg2(victim,"You got owned by "..killer.."!!!") end -- End --
beware:I havent tested this yet...
"..killer.."will display the ID instead of the name.
1
msg2(victim,"You got owned by "..killer(id,"name").."!!!")
player(id, value)
In our case, the id should be that of the
killerand the value we want to retrieve is
name:
player(killer, "name")
1