Forum

> > CS2D > Scripts > Lua Scripts/Questions/Help
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Lua Scripts/Questions/Help

6.770 Antworten
Seite
Zum Anfang Vorherige 1 2327 328 329338 339 Nächste Zum Anfang

alt Re: Lua Scripts/Questions/Help

RyceR
User Off Offline

Zitieren
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.

alt Re: Lua Scripts/Questions/Help

JONY
User Off Offline

Zitieren
@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.
1× editiert, zuletzt 16.12.10 22:01:32

alt Re: Lua Scripts/Questions/Help

Chex
User Off Offline

Zitieren
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.

alt Re: Lua Scripts/Questions/Help

Yasday
User Off Offline

Zitieren
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

alt Re: Lua Scripts/Questions/Help

wjcf1290
User Off Offline

Zitieren
@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')
1× editiert, zuletzt 17.12.10 09:46:52

alt Re: Lua Scripts/Questions/Help

Chex
User Off Offline

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

alt Re: Lua Scripts/Questions/Help

Yasday
User Off Offline

Zitieren
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

alt Re: Lua Scripts/Questions/Help

J4x
User Off Offline

Zitieren
@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

alt Re: Lua Scripts/Questions/Help

Blacko
User Off Offline

Zitieren
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 !

alt Re: Lua Scripts/Questions/Help

Rainoth
Moderator Off Offline

Zitieren
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.

alt Re: Lua Scripts/Questions/Help

Rainoth
Moderator Off Offline

Zitieren
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.

alt Re: Lua Scripts/Questions/Help

Lee
Moderator Off Offline

Zitieren
batlaizys hat geschrieben
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.

alt Re: Lua Scripts/Questions/Help

JONY
User Off Offline

Zitieren
batlaizys hat geschrieben
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 hat geschrieben
@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

alt Re: Lua Scripts/Questions/Help

Jynxxx
User Off Offline

Zitieren
im trying to do this script so that when you die with a you can buy them back depending on the item
1× editiert, zuletzt 18.12.10 00:39:51

alt Re: Lua Scripts/Questions/Help

SuLeeh
COMMUNITY BANNED Off Offline

Zitieren
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)
Zum Anfang Vorherige 1 2327 328 329338 339 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht