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 234 35 36338 339 Next To the start

old Re: Lua Scripts/Questions/Help

RedPillow
User Off Offline

Quote
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

old Re: Lua Scripts/Questions/Help

playa slaya
COMMUNITY BANNED Off Offline

Quote
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
edited 2×, last 01.08.09 03:06:45 am

old Re: Lua Scripts/Questions/Help

ohaz
User Off Offline

Quote
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

old Re: Lua Scripts/Questions/Help

saladface27
User Off Offline

Quote
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

old Re: Lua Scripts/Questions/Help

mortyr22
User Off Offline

Quote
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 ")"

old Re: Lua Scripts/Questions/Help

DC
Admin Off Offline

Quote
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
edited 1×, last 01.08.09 01:39:22 pm

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

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

old Re: Lua Scripts/Questions/Help

DC
Admin Off Offline

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

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
DC has written
lol. no way.

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

old Re: Lua Scripts/Questions/Help

saladface27
User Off Offline

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

old Re: Lua Scripts/Questions/Help

playa slaya
COMMUNITY BANNED Off Offline

Quote
TheKilledDeath has written
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
edited 1×, last 01.08.09 09:59:49 pm

old Re: Lua Scripts/Questions/Help

playa slaya
COMMUNITY BANNED Off Offline

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

old Re: Lua Scripts/Questions/Help

Vectarrio
User Off Offline

Quote
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)?
To the start Previous 1 234 35 36338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview