Forum

> > CS2D > Scripts > how to use [Str] (starkkz strider.lua)
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch how to use [Str] (starkkz strider.lua)

8 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt how to use [Str] (starkkz strider.lua)

kalis
User Off Offline

Zitieren
i see in strider.lua from starkkz
how to use [Str]?
                              Strider[str].x = Strider[str].x + math.sin(angle) * 18
                              Strider[str].y = Strider[str].y - math.cos(angle) * 18
and :
Need array ?
local ? some things? !
help!

Admin/Mod Kommentar

"help lua" = retarded title. fixed.

alt Re: how to use [Str] (starkkz strider.lua)

TimeQuesT
User Off Offline

Zitieren
tables are variables that can hold more than 1 value at time.(they are nearly the same as arrays)
strider is a table so "str" is the index number for example:


example = {}
example[1] = 5 -- "1" is the indexnumber.

or

example = {}
local str = 4 -- i give the variable "str" the value "4".
example[str] = 20 --the 4th place of the variable is given the value "20"
print (example[str]) -- this will put in the console a message out that displays "20". (the 4th place of the table)
1× editiert, zuletzt 08.03.11 14:34:59

alt Re: how to use [Str] (starkkz strider.lua)

DannyDeth
User Off Offline

Zitieren
Lol. Actually lmfao!

Strider is an array and you are trying to access it with the variable 'str'. If str equals "lol", then it would be the same as:
1
Strider["lol"]

Learn some programming basics. Srsly.

alt Re: how to use [Str] (starkkz strider.lua)

Starkkz
Moderator Off Offline

Zitieren
STR is a value for count.

1
2
3
4
for str = count_from_start, count_to_end do
	-- This block will be called (count_to_end-count_from_start) Times.
	-- And the str value will be set to the current count
end -- end our count

I used that to call each strider in game

alt Re: how to use [Str] (starkkz strider.lua)

kalis
User Off Offline

Zitieren
ok thanks
i need help more :
closest = random players near strider
example : local hpdmg = 10
                                             
                                             local closest = nil
                                             parse("sethealth "..closest[1].." "..player(closest[1],"health")-hpdmg)

alt Re: how to use [Str] (starkkz strider.lua)

EngiN33R
Moderator Off Offline

Zitieren
To define a table called closest do this:
1
closest={}
To give a table a value,
1
closest={"foo","bar"}
Thus,
1
2
closest[1]=="foo"
closest[2]=="bar"
And that's all. But it won't work for that script.

Look, if you don't understand what 'call a value' or 'table' means - you shouldn't edit complicated (for you) scripts like Starkkz's. First learn, then edit.
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht