Forum
![>](img/i_next.png)
![>](img/icons/cs2d.png)
![>](img/i_next.png)
![>](img/i_next.png)
Script Addhook and Function
10 replies![To the start](img/i_first.png)
![Previous](img/i_prev.png)
![Next](img/i_next.png)
![To the start](img/i_last.png)
http://www.cs2d.com/help.php
Admin/mod comment
![Rules](img/v_illegal.png)
There are several hooks. Check this page for it: http://www.cs2d.com/help.php?hookcat=all
Let's start with an easy.
1
2
2
addhook("spawn","_spawn") function _spawn(id)
addhook --add a hook to the game.
spawn --Hook name
_spawn --function name of our hook
Here is an example with spawn hook
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
addhook("spawn","_spawn") function _spawn(id) 	if player(id,"team") == 1 then --If the spawned player team is Terrorists 		parse("equip "..id.." 30")	 --He/she get Ak-47 	elseif player(id,"team") == 2 then --If the spawned player team is Counter Terrorist 		parse("equip "..id.." 32") --He/She get M4A1 	end --Close the first if. end --Close the function.
I might helped, might not.
![](img/smiles/smile.gif)
lua-users.org/wiki/LuaTutorial
http://www.unrealsoftware.de/forum_posts.php?post=226033
if you need help with hooks
http://www.cs2d.com/help.php?hookcat=all
1
2
3
4
2
3
4
addhook("HookName","HookFunction") function HookFunction (value) ... end -- Function
Look this example :
1
2
3
4
5
6
2
3
4
5
6
addhook("serveraction","MyAction") function MyAction(id,ActionButton) if ActionButton == 1 then -- F2 msg2(id,"Your Message Here") -- Your Message when you press F2 end -- close function end -- close if
other example
1
2
3
4
5
6
7
2
3
4
5
6
7
addhook("say","_say') function _say(id,text) if text == "MyText" then -- Text msg2(id,"Your Message") return 1 -- don't appears in chat - return 0 appears end -- close function end -- close if
if you need help or other examples, send PM to me
#45813
edited 1×, last 10.12.12 12:48:22 am
![user](img/i_friend.png)
![user](img/i_friend.png)
![user](img/i_friend.png)
@
Jynxxx : This is just your fault, never expect something good(helpful) from Brazilian kids
![user](img/i_friend.png)
@
![user](img/i_friend.png)
I do it my way, @
![user](img/i_friend.png)
P.S = i am not a child, you say
teens ...
@
![user](img/i_friend.png)
![](img/smiles/halfhead.gif)
There are only 2Algerian users here ( am inculded )
Admin/mod comment
![Rules](img/v_illegal.png)
![To the start](img/i_first.png)
![Previous](img/i_prev.png)
![Next](img/i_next.png)
![To the start](img/i_last.png)