Forum
CS2D Scripts Lua Scripts/Questions/Help1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
addhook("trigger","lol") function lol(trigger) 	if trigger == "END" then 		for id = 1, 32 do 			if player(id,"exits") then 				if player(id,"team") == 1 then 					parse("setpos "..id.." 112 3120") 				end 			end 		end 	end end
-after restart everybody go to CT, but bots stop in TT
Plz help
1
If (trigger=='END') then
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
addhook("trigger","lol") function lol(trigger) 	if trigger == "END" then 		for id = 1, 32 do 			if (player(id,"exits")) then 				if (player(id,"team")) == 1 then 					parse("setpos "..id.." 112 3120") 				end 			end 		end 	end end
And a question to everyone: is there a hook on mousebutton1 ? I thought it was attack1, but didn't work. Because i wanna do something when player shoots (doesnt matter if he shoot a player or a wall).
J.
edited 1×, last 16.12.10 10:01:32 pm
Trigger has two parameters.
And yes, attack1 should work for that. Maybe you did something wrong.
Anyway, guys I'm working on a weaponmod script, and I want admin saycommands.
if string.sub(t, 1, 2)==!%s then
Would this be how to make it so its if the first characters are ! then space?
Oh, and hey starkkz. I'm the new TN'd scripter. I like your rp scripts.
if string.sub(txt,1,2) == "! " then
lol why not just ! and a space?
or with the totable func
1
2
3
4
5
6
7
2
3
4
5
6
7
txt = "! s 0 1" txt = toTable(txt) if txt[1] == "!" then if txt[2] == "s" then ... end end
Thanks yasday!
edited 1×, last 16.12.10 11:17:59 pm
1
2
3
4
5
2
3
4
5
addhook("trigger","lol") function lol(trigger) 	if trigger == "END" then 		for id = 1, 32 do 			if (player(id,"exits")) then -- <-- player(id,'exists')
edited 1×, last 17.12.10 09:46:52 am
I choose to do it with the parenthasese because it helps me organize my script. Stop trolling.
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
function toTable(t, b) local cmd = {} local match = "[^%s]+" if b then match = "%w+" end if type(b) == "string" then match = "[^"..b.."]+" end if not t then return cmd end for word in string.gmatch(t, match) do table.insert(cmd, word) end return cmd end
does this matter?
for id = 1, 32 do
or should it be like this?
for id = 1,32 do
don't rly know but everything looks right
1
2
3
4
2
3
4
addhook("attack","shake2") function shake2(id) parse("shake "..id.." 2") end
I get these errors and i dont know what to do. Script is normal size and all errors are same but from different menu selections.
1
2
3
2
3
if button==5 then menu(id,"Buy Credits,5 Credits|1000$,10 Credits|2000$,15 Credits|2750$,20 Credits|3500$,50 Credits|9000$,100 Credits|15000$,200 Credits|1 Mega Point") end
batlaizys has written
Anybody help me ?
I get these errors and i dont know what to do. Script is normal size and all errors are same but from different menu selections.
All three errors from menus, all 3 menus same, i will change em later.
I get these errors and i dont know what to do. Script is normal size and all errors are same but from different menu selections.
1
2
3
2
3
if button==5 then menu(id,"Buy Credits,5 Credits|1000$,10 Credits|2000$,15 Credits|2750$,20 Credits|3500$,50 Credits|9000$,100 Credits|15000$,200 Credits|1 Mega Point") end
Search for menu = "..." and rename the menu variable to something else.
batlaizys has written
Anybody help me ?
I get these errors and i dont know what to do. Script is normal size and all errors are same but from different menu selections.
All three errors from menus, all 3 menus same, i will change em later.
I get these errors and i dont know what to do. Script is normal size and all errors are same but from different menu selections.
1
2
3
2
3
if button==5 then menu(id,"Buy Credits,5 Credits|1000$,10 Credits|2000$,15 Credits|2750$,20 Credits|3500$,50 Credits|9000$,100 Credits|15000$,200 Credits|1 Mega Point") end
Didn't i tell you last time that you shouldn't name your variables same as functions ?:)
check your hook for "menu" and rename the second parameter to 'title' (or smth else):
addhook("menu","asd")
function asd(id,title,button)
FN_Nemesis has written
@Jony if u want to make something when player shoots then use the attack hook. example :
1
2
3
4
2
3
4
addhook("attack","shake2") function shake2(id) parse("shake "..id.." 2") end
Ye, thanks man. I just had some other error. it works
edited 1×, last 18.12.10 12:39:51 am
Code:
if button==5 then
menu(id,"Buy Credits,5 Credits|1000$,10 Credits|2000$,15 Credits|2750$,20 Credits|3500$,50 Credits|9000$,100 Credits|15000$,200 Credits|1 Mega Point")
end
(Batizalys)