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 2155 156 157338 339 Next To the start

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
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.
edited 1×, last 01.02.10 02:00:11 am

old Re: Lua Scripts/Questions/Help

Homer
User Off Offline

Quote
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.
edited 3×, last 01.02.10 02:01:07 am

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
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 has written
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.

old Re: Lua Scripts/Questions/Help

Homer
User Off Offline

Quote
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
edited 1×, last 01.02.10 02:56:50 am

old Re: Lua Scripts/Questions/Help

Anders4000
User Off Offline

Quote
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
edited 1×, last 02.02.10 02:33:43 pm

old Re: Lua Scripts/Questions/Help

Anders4000
User Off Offline

Quote
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:
edited 4×, last 02.02.10 02:42:06 pm

old Re: Lua Scripts/Questions/Help

Redefinder
User Off Offline

Quote
DRoNe has written
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.

old can i make commands that make you admin

GINO
BANNED Off Offline

Quote
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×

old Re: Lua Scripts/Questions/Help

Redefinder
User Off Offline

Quote
GINO has written
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?

old Re: Lua Scripts/Questions/Help

GINO
BANNED Off Offline

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


can you correct that

old Re: Lua Scripts/Questions/Help

Anders4000
User Off Offline

Quote
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


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

DRoNe has written
How i add bots with lua? pls help ...
Quote
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.

old Re: Lua Scripts/Questions/Help

Vectarrio
User Off Offline

Quote
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

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

old Re: Lua Scripts/Questions/Help

leoska
User Off Offline

Quote
Vectar666 has written
     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

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
• 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

old Re: Lua Scripts/Questions/Help

memo
COMMUNITY BANNED Off Offline

Quote
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 !!
edited 1×, last 04.02.10 07:47:38 pm
To the start Previous 1 2155 156 157338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview