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 2155 156 157338 339 Nächste Zum Anfang

alt Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Zitieren
Ok, this is how your code looks like when it's tabbed and commented.
1
2
3
4
5
6
7
8
9
10
11
12
addhook("team","Team1")
function Team1(id,team)
	for index, value in ipairs(ADMINS.S) do --We loop before we even check
		if (team == 1) then --We check if the team the player has chosen is T once for every index in the table
			print(player(id,"usgn")) --Print the usgn
			if (player(id,"usgn") == value) then --If this is one of the usgns we are looking for..
				--Do nothing, maybe you want to return 0?
			end
		end
	end
	return 0 --Change the team regardless of what happened before.
end
You were talking about nil errors, so I'd like you to specify about that.
Also... I understand you "need" the solution for this, but I'm just helping, because you (and I mean YOU (yes, with bolded and capital letters)) have to find the solution, otherwise, you wouldn't have learned anything and not learning isn't good.
1× editiert, zuletzt 01.02.10 02:00:11

alt Re: Lua Scripts/Questions/Help

Homer
User Off Offline

Zitieren
Oh this is gay how I fixed it.. To lua, I think this thing needs to be thought through kinda. Since, I had to do a weird thing to get it to work. And @flacko. Sorry dude, Just, I wanna play my server and I don't want to do it till I have the script Sorry.
3× editiert, zuletzt 01.02.10 02:01:07

alt Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Zitieren
Ok, stop behaving like a girl.
I told you about 2 days ago why you shouldn't put an end after the fucking if:
Me hat geschrieben
Your problem is that you return 1 if the first item in the table isn't equal to your USGN

That's why you shouldn't put a return just after the first (or second) if.
Instead of printing the player's usgn you could be more interested in printing the index variable to see where does the loop get.

alt Re: Lua Scripts/Questions/Help

Homer
User Off Offline

Zitieren
And, @flacko printing the index, I did, I printed every value, and the index turned up. It wasn't the nil value. And the nil value doesn't matter to me since I am only going to see one of them. And who says I'm not a girl O.o Dude, Thanks dude for the help, Sorry I was being a "girl" Thank, and sorry
1× editiert, zuletzt 01.02.10 02:56:50

alt Re: Lua Scripts/Questions/Help

Anders4000
User Off Offline

Zitieren
Can anyone please help me with a "knife-kills"-script?
Someone told me to do something with "global tables" i think. Can you explain?

...This is the code i got for now (:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
-- AKD Knife-kill

addhook("join","akd_hud_join_kk")
function akd_hud_join_kk(id)
	KK = {}
end

addhook("kill","akd_hud_kill")
function akd_hud_kill(killer,weapon)

	-- Knife-Kills
	if (weapon==50) then
		KK = KK + 1
	end

end

addhook("always","akd_hud_always")
function akd_hud_always()

parse([[hudtxt2 ]]..id..[[ 5 "©000255000Knife-kills: ]]..KK..[[" 5 170]])

end
1× editiert, zuletzt 02.02.10 14:33:43

alt Re: Lua Scripts/Questions/Help

Anders4000
User Off Offline

Zitieren
Wow.. That is a lot..
I only learned that a boolean is a "true/false" value.. "KK" is a table in my case, right?.. And that i only have to say:
KK = {}
to make a new "table" s:
4× editiert, zuletzt 02.02.10 14:42:06

alt Re: Lua Scripts/Questions/Help

Redefinder
User Off Offline

Zitieren
DRoNe hat geschrieben
How i add bots with lua? pls help ...

There`s no need for lua scripting if you want bots.
You can add bots in three ways:
1.Define bot starting number when creating a server.
2.Ingame from the bot menu(this only works if you are the server)
3.You can do it from console with console commands.
Like this:
1
2
[b]bot_add_t[/b] --For Terrorist bot
[b]bot_add_ct[/b] --For Counter-Terrorist bot

Ofcourse if you are using a dedicated server then you need to add the word rcon in front of your commands.

alt can i make commands that make you admin

GINO
BANNED Off Offline

Zitieren
all of you can you help me making commands scripts
i cant make this script it always error so i decide to find a help i want a command that if you say !make_me_admin
you will be automatically admin]
____________________________
can you tell me its possible √
or not×

alt Re: Lua Scripts/Questions/Help

Redefinder
User Off Offline

Zitieren
GINO hat geschrieben
all of you can you help me making commands scripts
i cant make this script it always error so i decide to find a help i want a command that if you say !make_me_admin
you will be automatically admin

As far as I know it`s impossible.
Why do you need that?

alt Re: Lua Scripts/Questions/Help

GINO
BANNED Off Offline

Zitieren
!make_me_admin=parse(rcon_pw pokemon123)end
!make_me_admin=parse(rcon equip 45)end
end
end
end


can you correct that

alt Re: Lua Scripts/Questions/Help

Anders4000
User Off Offline

Zitieren
GINO hat geschrieben
!make_me_admin=parse(rcon_pw pokemon123)end
!make_me_admin=parse(rcon equip 45)end
end
end
end


can you correct that


Haha, omg
Is that the full code? (: Cause' then i think we are gonna make it from scratch :p

DRoNe hat geschrieben
How i add bots with lua? pls help ...
Zitat
This is the code for adding them in lua:
1
2
parse("bot_add_t")		-- Adds a Terrorist.
parse("bot_add_ct")	-- Adds a Counter-Terrorist.

alt Re: Lua Scripts/Questions/Help

Vectarrio
User Off Offline

Zitieren
GINO hat geschrieben
!make_me_admin=parse(rcon_pw pokemon123)end
!make_me_admin=parse(rcon equip 45)end
end
end
end


can you correct that

1
2
3
4
5
6
7
addhook("say","makeadmin")
function makeadmin(id,text)
if(text=="!make_me_admin") then
parse("rcon_pw pokemon123")
parse("rcon equip "..id.." 45")
end
end

alt Re: Lua Scripts/Questions/Help

leoska
User Off Offline

Zitieren
Vectar666 hat geschrieben
     GINO has written:
!make_me_admin=parse(rcon_pw pokemon123)end
!make_me_admin=parse(rcon equip 45)end
end
end
end


can you correct that

Code:
addhook("say","makeadmin")
function makeadmin(id,text)
if(text=="!make_me_admin") then
parse("rcon_pw pokemon123")
parse("rcon equip "..id.." 45")
end
end


addhook("say","makeadmin")
function makeadmin(id,text)
if(text=="!make_me_admin") then
parse("rcon_pw pokemon123")
parse("rcon equip "..id.." 45")
return 1 // people will not see that he wrote
end
end

alt Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Zitieren
• 1st.
Why do you use "rcon" in parse?
Lua parsing is server side and it doesn't require "rcon" input.
That means:
1
2
:notok: parse("rcon equip "..id.." 45")
:ok: parse("equip "..id.." 45") -- I prefer this way
• 2nd.
Parse like "rcon_pw blabla" doesn't works for client.
Why? I said it already, because parse command work as server side.

• 3rd.
Please use clean tabbing (spaces).
1
2
3
if 1 > 0 then
	...
end

alt Re: Lua Scripts/Questions/Help

memo
COMMUNITY BANNED Off Offline

Zitieren
Hi Guys, i start with making a script have both classes for Tt and Ct , i add all the things to make it work but it don't work i don't know why.

here is the script line if any one see the error on it please tells me what is it ?

Spoiler >


Thanks for listening

ANY HELP PLEASE !!
1× editiert, zuletzt 04.02.10 19:47:38
Zum Anfang Vorherige 1 2155 156 157338 339 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht