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 234 35 36338 339 Nächste Zum Anfang

alt Re: Lua Scripts/Questions/Help

RedPillow
User Off Offline

Zitieren
Might this work as "Stripper"


1
2
3
4
5
6
addhook("hit","stripper")
	function stripper(id,source,weapon,hpdmg,apdmg)
	if(weapon == 30) then
		parse ("strip "..id..")
	end
end

alt Re: Lua Scripts/Questions/Help

playa slaya
COMMUNITY BANNED Off Offline

Zitieren
I need help i was trying to create a mod with new gfx&maps but the lua file doesnt work.im try to create a lua that subtracts money every second.pls gimme the code if u know.
this is what ive tried,but did not work:


addhook (\"sec\",\"mon\")
function sec()
if (player(id,\"exists\")) then
parse (\"setmoney \"..id..\" \"..(player(id,\"money\")-5))
end
end
2× editiert, zuletzt 01.08.09 03:06:45

alt Re: Lua Scripts/Questions/Help

ohaz
User Off Offline

Zitieren
1
2
3
4
5
6
7
8
addhook (\\\"sec\\\",\\\"mon\\\")
function mon()
for (id=0,32,1) do
if (player(id,\\\"exists\\\")) then
parse (\\\"setmoney \\\"..id..\\\" \\\"..(player(id,\\\"money\\\")-5))
end
end
end
Forget about the \\ , seems like DC messed up some code in the forum software

alt Re: Lua Scripts/Questions/Help

saladface27
User Off Offline

Zitieren
I know
But I want to change it using a script. Does this have anything to do with it?:

[ENTITY]
- entity(x,y,\"value\")          Return a value of an entity:
                    exists, typename, type, name,
                    trigger, state, int0, int1, int2,
                    int3, int4, int5, int6, int7,
                    int8, int9, str0, str1, str2,
                    str3, str4, str5, str6, str7,
                    str8, str9

alt Re: Lua Scripts/Questions/Help

mortyr22
User Off Offline

Zitieren
addhook("hit","stripper")
function stripper(id,source,weapon,hpdmg,apdmg)
if(weapon == 30) then
parse ("strip "..id..")
end
end
its not work sorry expect near ")"

alt Re: Lua Scripts/Questions/Help

DC
Admin Off Offline

Zitieren
saladface27: you can't change env_sprite with Lua. you can only trigger it on and off. the entity command can just be used to GET the values of a sprite entity but not to set them.

it will later be possible to place your own graphics on maps using cs2d commands/Lua
1× editiert, zuletzt 01.08.09 13:39:22

alt Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Zitieren
Jonzku777 hat geschrieben
What will this changing graphics with lua make possible then?

Dont forget that lua not done, its only first few versions on cs2d. I think DC will improve that later.

alt Re: Lua Scripts/Questions/Help

DC
Admin Off Offline

Zitieren
Jonzku777 hat geschrieben
What will this changing graphics with lua make possible then?
be patient. don't ask. just wait.
and it will NOT be CHANGING graphics but adding graphics.

mortyr22:
1
parse ("strip "..id..")
the .." is nonsense. you try to attach a single quote. that doesn't work this way because Lua thinks that you use the quote to start an additional string + you don't even need the quote. so just remove the .." at the end

alt Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Zitieren
DC hat geschrieben
lol. no way.

Moddable...
But then we should back with 0.1.0.4 version.
Back in the past (3 years)

alt Re: Lua Scripts/Questions/Help

saladface27
User Off Offline

Zitieren
I get this message when I run my code in cs2d:

LUA ERROR: sys/lua/server.lua:53: '<eof>' expected near 'end'

any way to fix?

edit: whoops, problem caused by an extra end.

alt Re: Lua Scripts/Questions/Help

playa slaya
COMMUNITY BANNED Off Offline

Zitieren
TheKilledDeath hat geschrieben
1
2
3
4
5
6
7
8
addhook ("sec","mon")
function mon()
for (id=0,32,1) do
if (player(id,"exists")) then
parse ("setmoney "..id.." "..(player(id,"money")-5))
end
end
end
Forget about the \\ , seems like DC messed up some code in the forum software

it says LUA ERROR:sys/lua/mod '<name>' expexted near'('
with that pls
1× editiert, zuletzt 01.08.09 21:59:49

alt Re: Lua Scripts/Questions/Help

playa slaya
COMMUNITY BANNED Off Offline

Zitieren
I typed exactly what you said and it still fails to work and i still get that same message. if not much trouble could you pls upload the file pls?

alt Re: Lua Scripts/Questions/Help

Vectarrio
User Off Offline

Zitieren
WeaponID and WeaponType is for weapon in hands only.
How to know if player has, for example, M3(If player is currently using smth else)?
Zum Anfang Vorherige 1 234 35 36338 339 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht