Forum

> > CS2D > Scripts > Lua Scripts/Questions/Help
Forums overviewCS2D overview Scripts overviewLog in to reply

English Lua Scripts/Questions/Help

6,770 replies
Page
To the start Previous 1 2327 328 329338 339 Next To the start

old Re: Lua Scripts/Questions/Help

RyceR
User Off Offline

Quote
why it dont work?
1
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
I need it to my deathrun.

old Re: Lua Scripts/Questions/Help

JONY
User Off Offline

Quote
@RyceR: try this:
1
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

old Re: Lua Scripts/Questions/Help

Chex
User Off Offline

Quote
trigger(trigger,source)
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.

old Re: Lua Scripts/Questions/Help

Yasday
User Off Offline

Quote
hook is attack, not attack1
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
txt = "! s 0 1"
txt = toTable(txt)
if txt[1] == "!" then
 if txt[2] == "s" then
  ...
 end
end

old Re: Lua Scripts/Questions/Help

wjcf1290
User Off Offline

Quote
@JONY
1
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

old Re: Lua Scripts/Questions/Help

Chex
User Off Offline

Quote
It doesnt even matter, yo.
I choose to do it with the parenthasese because it helps me organize my script. Stop trolling.

old Re: Lua Scripts/Questions/Help

Yasday
User Off Offline

Quote
pls and the totable func by lee:
1
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

old Re: Lua Scripts/Questions/Help

J4x
User Off Offline

Quote
@Jony if u want to make something when player shoots then use the attack hook. example :

1
2
3
4
addhook("attack","shake2")
function shake2(id)
parse("shake "..id.." 2")
end

old Re: Lua Scripts/Questions/Help

Blacko
User Off Offline

Quote
Hello all ! I search a script for a friend, the script is the "Broadcast" : if a player say !broadcast a text appear in green with (Broadcast) and can see by all players but i want a delay of 30second, I explain : a player can use this broadcast only every 30second... Please help me ! I hope you answer me ! Thanks you !

old Re: Lua Scripts/Questions/Help

Rainoth
Moderator Off Offline

Quote
iDios. I tell you what. Search the last 200 pages and you will 100% find it. Trust me there were about 5 of these requested and all been answered.

old Re: Lua Scripts/Questions/Help

Rainoth
Moderator Off Offline

Quote
Anybody help me ?

IMG:https://img193.imageshack.us/img193/8261/menu00000u.jpg


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
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
All three errors from menus, all 3 menus same, i will change em later.

old Re: Lua Scripts/Questions/Help

Lee
Moderator Off Offline

Quote
batlaizys has written
Anybody help me ?

IMG:https://img193.imageshack.us/img193/8261/menu00000u.jpg


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
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
All three errors from menus, all 3 menus same, i will change em later.


Search for menu = "..." and rename the menu variable to something else.

old Re: Lua Scripts/Questions/Help

JONY
User Off Offline

Quote
batlaizys has written
Anybody help me ?

IMG:https://img193.imageshack.us/img193/8261/menu00000u.jpg


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
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
All three errors from menus, all 3 menus same, i will change em later.


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
addhook("attack","shake2")
function shake2(id)
parse("shake "..id.." 2")
end


Ye, thanks man. I just had some other error. it works

old Re: Lua Scripts/Questions/Help

Jynxxx
User Off Offline

Quote
im trying to do this script so that when you die with a you can buy them back depending on the item
edited 1×, last 18.12.10 12:39:51 am

old Re: Lua Scripts/Questions/Help

SuLeeh
COMMUNITY BANNED Off Offline

Quote
transport to: sys/lua/<file>

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)
To the start Previous 1 2327 328 329338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview