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 2146 147 148338 339 Nächste Zum Anfang

alt Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Zitieren
When you join T it prints your usgn twice because you have instructed your script to do so.
Maybe tabbing your code will save you from some headache.
Here I tabbed it for you:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
ADMIN={}
ADMIN.SuperAdmins={1,2}--Just for example

addhook("team","Team")
function Team(p,team)
	for index, value in ipairs(ADMIN.SuperAdmins) do
		if team == 1 then
			if player(p,"usgn") == value then
				return 0
			else
				return 1
			end
		end
	end
end
Your problem is that you return 1 if the first item in the table isn't equal to your USGN, returning cuts the execution of a function.
So you might want to move the return 1 right before the last end. This way it will only return 1 if the USGN hasn't been found in your table after your loop.

alt Re: Lua Scripts/Questions/Help

Homer
User Off Offline

Zitieren
Yea, The script is working, but here's the thing, its not that it's printing value's twice, it's that it's printing different value's based on my team that confuses me.
Eh, nevermind, I fixed it I missed something... Didn't show you the entire script apparetnly
Thanks flacko, The return value also helped

alt Re: Lua Scripts/Questions/Help

Homer
User Off Offline

Zitieren
I suppose you could make your own version of standard? But, I think you can't, I don't know for sure, that's a DC question.

alt Re: Lua Scripts/Questions/Help

Zeik
User Off Offline

Zitieren
redefinder hat geschrieben
1
parse ("mp_wpndmg \"Gut Bomb\" 100000")


Thanks it works (the other one not works)

alt Re: Lua Scripts/Questions/Help

BrunoRZ
User Off Offline

Zitieren
Here I am once again

addhook("use","weaponshopentry")
function weaponshopentry(id,event,data,x,y)
           if (event==100) then
           if (x==91) and (y==40) then
            parse("setname "..id.." Medic")
      end
     end


~~~~~What is wrong this time? ~~~~~~~~~
I want the guy press a button, then gets another name (Medic)

alt Re: Lua Scripts/Questions/Help

BrunoRZ
User Off Offline

Zitieren
TheKilledDeath hat geschrieben
end missing @ the end



addhook("use","weaponshopentry")
function weaponshopentry(id,event,data,x,y)
if (event==100) then
if (x==91) and (y==40) then
parse("setname "..id.." Medic")
end
end
end


------------------------ Still not working

alt Re: Lua Scripts/Questions/Help

LV
BANNED Off Offline

Zitieren
@BrunoRZ
.
WORKS!
.
You forgot put the if (event==100) inside lol

.
1
2
3
4
5
6
7
8
addhook("use","weaponshopentry")
function weaponshopentry(id,event,data,x,y)
if (x==91) and (y==40) then
if (event==100) then
parse("setname "..id.." Medic")
end
end
end
2× editiert, zuletzt 25.01.10 18:31:00

alt Re: Lua Scripts/Questions/Help

Redefinder
User Off Offline

Zitieren
Mod-_er_- hat geschrieben
how to make a small menu?

1
2
3
4
addhook("menu",smallmenu")
function smallmenu(id)
menu(id,"[b]Put stuff you like here[/b]") --Must be separated with comma
[b]<--Put other stuff here[/b]

alt Re: Lua Scripts/Questions/Help

memo
COMMUNITY BANNED Off Offline

Zitieren
this F**** massage keep coming i mean WITH OUT A STOP on console what that mean ... I hate this nil thing


1
LUA ERROE:attempt to call a nil value

i try hard to fix this but i canot i even try to see the Lua manual , but its have a hard English words for me (I am Arabic).

i think the mistake is here :-
Spoiler >

alt Re: Lua Scripts/Questions/Help

Homer
User Off Offline

Zitieren
Umm, Look for an undeclared variable or a variable or table that doesn't match in that big hulk of a script, Yea, Try and find it, is it just showing up at the beginning?

alt Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Zitieren

Ok memo, I'm coming from my pool and as soon as I've seen your post, I felt like I wanted to kill somebody.
But I'll try to control that.

We have discussed what does nil mean, what does that error mean, and how to solve problems regarding nil, but I think we didn't discuss how to use the search button. Maybe because you might find needless stuff that waste your time.
So you can better search by yourself on the previous pages of this thread.

Thank you.

alt Re: Lua Scripts/Questions/Help

Lee
Moderator Off Offline

Zitieren
The following variables

dh4.classes.classmenu(id)
level(id)

are not declared. Please check to make sure that these are actually declared.

alt Re: Lua Scripts/Questions/Help

memo
COMMUNITY BANNED Off Offline

Zitieren
@Leegao
yes that's the problem thanks you .

@flacko
Sorry this is my first program language so its hard on me

alt Re: Lua Scripts/Questions/Help

Homer
User Off Offline

Zitieren
1
2
3
4
5
6
7
8
9
10
11
addhook("projectile","FlareTele")
function FlareTele(id,weapon,x,y)
if (player(id,"usgn") == 38115) then
if (weapon == 54) then
parse ("setpos "..id..""..x..""..y.."")
print(""..x.." "..y.."")
print(""..w.."")
print(""..id.."")
end
end
end
I've tryed to find out what the heck is wrong with this thing, but it still gives me nil values, I've checked the info.txt and I'm using the right tags.. I just don't really know what's wrong.. So can someone help me with this. Since, I can't figure out what's nil.

alt Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Zitieren
@Homer,

1st, better don't use "" (empty strings)
So instead print(""..id.."") write this:
1
print(id)
2nd, You should add spaces in setpos parsing.
1
parse("setpos "..id.." "..x.." "..y)
print(""..w.."") -- w is nil valuable.

I don't see more nil conditions in your function.

memo hat geschrieben
Hmmm.. How to make a table value for E.g (test.classes.classmenu) ??

1
test.classes.classmenu = {}
Zum Anfang Vorherige 1 2146 147 148338 339 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht