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 2314 315 316338 339 Nächste Zum Anfang

alt Re: Lua Scripts/Questions/Help

Anders4000
User Off Offline

Zitieren
Yasday hat geschrieben
Spoiler >


From now on, i will not say anything on this LUA forum, till i'm sure about what i say.

You spelled "health" wrong in the code (:
Should be:
1
parse([[sethealth ]]..id..[[ ]]..player(id,"health")-hpdmg*str[source]/def[id])

- Anders4000

alt Re: Lua Scripts/Questions/Help

Yasday
User Off Offline

Zitieren
@Anders4000 omg my spelling mistakes

@topic lul could s1 help me?

Spoiler >

alt Re: Lua Scripts/Questions/Help

CmDark
User Off Offline

Zitieren
@Yasday, well in two lines before you write fart into a file, you screwed up the opening of it.
assert(io.open("sys/lua/tempvips/all.txt"),"w")

and i think would be better if you could tell us what kind of errors appear if there are

alt Re: Lua Scripts/Questions/Help

Anders4000
User Off Offline

Zitieren
kNedLiik hat geschrieben
Spoiler >


I would put the code in the second function into the leave and join 1s, for less lag.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
players_online = 0

addhook("join","add_player")
function add_player(id)
	players_online = players_online + 1
	for id = 1,32 do
		if player(id,"exists") then
			display_player_hud(id)
		end
	end
end

addhook("leave","remove_player")
function remove_player(id,reason)
	players_online = players_online - 1
	for id = 1,32 do
		if player(id,"exists") then
			display_player_hud(id)
		end
	end
end

function display_player_hud(id)
text = ("©000255000| Players online : "..players_online.." |")
y = 50
x = 100
align = 1
parse('hudtxt2 1 '..id..' "'..text..'" '..x..' '..y)
end

Think about it (:
- Anders4000

alt Re: Lua Scripts/Questions/Help

kNedLiik
User Off Offline

Zitieren
Lol i don't want anyone to fix it i posted it here for free use .. (if upload gimme thanks)
It is what i learned by reading lua.org/pil 1-5

alt Re: Lua Scripts/Questions/Help

kNedLiik
User Off Offline

Zitieren
Flacko hat geschrieben
Just use #player(0,"table") to get the current number of players.
You can even use #player(0,"tableliving") and so on.


Oh .. I'm not understanding this right now as i sayed im studying the lua and This was only to show what i learned for now

alt knockback

Jake-rus
User Off Offline

Zitieren
I need a nostucking knockback like this type :
1
2
3
4
5
6
7
8
9
10
11
12
addhook("hit","knockback")
function knockback(id,source,weapontype)
if player(id,"team")==1 and player(id,"team")~=player(source,"team") then
local DMG = (itemtype(weapontype,"dmg") / 2)
local ROT = math.rad(player(source,"rot") - 90)
local NX = player(id,"x") + (math.cos(ROT) * DMG)
local NY = player(id,"y") + (math.sin(ROT) * DMG)
if tile(NX / 32 - 1,NY / 32 - 1,"walkable") then
parse(string.format("setpos %s %s %s",id,NX,NY))
end
end
end

but i always stuck in wall ! Plz help me with it

alt Re: Lua Scripts/Questions/Help

Infinite Rain
Reviewer Off Offline

Zitieren
Guys i need script:
Players Cant join to terrorists ONLY BOTS CAN!
Bots join to the first scin (or skin i forgot how to right it on english)
And when pass 4 minutes then bots got 250 hp and join to scin number 2
when pass 5 minutes bots got 500 hp and join scin 3

alt Re: Lua Scripts/Questions/Help

Anders4000
User Off Offline

Zitieren
kNedLiik hat geschrieben
Lol i don't want anyone to fix it i posted it here for free use .. (if upload gimme thanks)
It is what i learned by reading lua.org/pil 1-5


I just wanted to teach you some more.. (:

alt Re: Lua Scripts/Questions/Help

Infinite Rain
Reviewer Off Offline

Zitieren
U can give me a script?

Spoiler >

alt Re: Lua Scripts/Questions/Help

Anders4000
User Off Offline

Zitieren
kNedLiik hat geschrieben
yeah but u made mistake cause u made it without second refreshing


That's the good thing about what i made. It refreshes when some1 leaves or joins. Instead of using "second" the refresh will be at the millisec he joins!
And the game will not have to look through an if-statement every second.
- Anders4000

alt Re: Lua Scripts/Questions/Help

CmDark
User Off Offline

Zitieren
1
2
3
4
5
6
7
8
9
10
11
addhook('attack2','spkn') 
spkn=function(i)
	if player(i,'weapontype')==50 then
		parse('speedmod '..i..' 6')
	timer(5000,'nsp',i,1)
	end
end
nsp=function(i)
	parse('speedmod '..i..' 0')
	freetimer('nsp',i)
end

Would this be how you could make temporary speedboost?

alt Re: Lua Scripts/Questions/Help

Chex
User Off Offline

Zitieren
Have you been hacking my computer??
I'm making a sprint script lol.
AND my script was gonna be activated by a right click with a knife.

I don't know if thats how you would do it lol.
How do you use timers? ZI don't get it.

alt Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Zitieren
timer(miliseconds,"functionname","parameter",calls)
Can't be any simpler than that.
It will simply call the function "functionname" and pass "parameter" to it when 'miliseconds' miliseconds have passed since you called timer().
the 'calls' parameter can be used to set how many times will the function be called (if calls is less or equal to 0 then the function will be called until you call freetimer())

alt Re: Lua Scripts/Questions/Help

DannyDeth
User Off Offline

Zitieren
U aren't very bright are you? You are supposed to use the dedicated Lua script help thread. It is there for a reason. Have you ever bothered to read the rules?

EDIT: OMG, *facepalm* I just realised that this is the Lua help thread, my deepest apologies!
1× editiert, zuletzt 23.11.10 18:20:02
Zum Anfang Vorherige 1 2314 315 316338 339 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht