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 210 11 12338 339 Next To the start

old Re: Lua Scripts/Questions/Help

Admir
User Off Offline

Quote
Wirtualnosc has written
So my question is:
How to make laser heal anyone who will be hurt with it?


1
2
3
4
5
6
addhook("hit","laser_heal")
function laser_heal(id,source,weapon,hpdmg,apdmg)
     if(weapon == 45) then
     parse ("sethealth "..id.." "..player(id,"health")+10)
     end
end

make sure friendlyfire off

old Re: Lua Scripts/Questions/Help

lol93
User Off Offline

Quote
i have a new prob:
i wanne make a lua for a RP
it looks like this:

addhook("spawn","jb.superhero.spawn")
if jb==nil then jb={} end
jb.sayfuncs={}
addhook("say","jb.sayfuncs.say")
function jb.superhero.spawn(id)
end
--hotelmannager--


function jb.sayfuncs.say(p,txt)
     if (jb.superhero.class[id]<=1) then
          parse ("setmaxhealth "..id.." 150")
          parse ("speedmod "..id.." 10")
          if (txt=="!hotel") then
          parse ("trigger hotel") end
end

But wen i start a server and select this class, and say !hotel.
a error comes and say:
attempt to compare nil with number.
wat can i do?

old Re: Lua Scripts/Questions/Help

phihung940
User Off Offline

Quote
Hello Everyone ! My name is phihung , i live in Vietnam , i and my friend has a idear to mod the CS2D came from CF2D (Cross Fire 2D - i hope you know that game http://crossfire.subagames.com/) but...we have a problems and some Question.
1) We need you guys help or teach we how to creat the Guns in to the games (This is a 2D game, so we could be created the model/skin of guns)
2) Programmer game CS2D can help me change the source code of the game ?
3) How to make a new "Game Mode" , can you help me for this (The Game Mode we need is a "Ghost Mode", the T use only Knife , they can stealth but not wear the stealth suit, when they move they could be see , but when they stand nobody can see them , CT use Gun)
4) How to edit home menu ?
You can contact me vie email : - Email address (only visible with login) -

Thank for all the support.

old Re: Lua Scripts/Questions/Help

DC
Admin Off Offline

Quote
CS2D is closed source (if you are talking about the current version) and not a game which is made for modding.

this means that all your points are not possible or only partially possible (by using Lua).

real modding of everything is only possible with the old version (0.1.0.0.) which is open source. but you need blitz3d (which is no freeware) + good blitz3d programming skills.

old Re: Lua Scripts/Questions/Help

ohaz
User Off Offline

Quote
Quote
1) We need you guys help or teach we how to creat the Guns in to the games (This is a 2D game, so we could be created the model/skin of guns)
You can only change the skins. You can't create new ones
Quote
2) Programmer game CS2D can help me change the source code of the game ?
The new CS2D is not open source! Only the versions til 0.1.1.0 afaik
Quote
3) How to make a new "Game Mode" , can you help me for this (The Game Mode we need is a "Ghost Mode", the T use only Knife , they can stealth but not wear the stealth suit, when they move they could be see , but when they stand nobody can see them , CT use Gun)
You can make this with Lua, an easy to learn scripting language. But only using stealth suite, sry
edit: DC was a bit faster

old Re: Lua Scripts/Questions/Help

horus
User Off Offline

Quote
omfg LUA must hate me... xP
My problem is that one team [t] have classes with weapons. The other [ct] doesn't. When I switch from t to ct, I somehow keep the weapons, which isn't supposed to [or at least I don't want it to] happen. Plus, when a ct bot dies and it just happened to have picked up a weapon, it spawns with it. So how am I supposed to keep one t's weapons to that team and make the ct lose their weapon[s] and other stuff after death?

old Re: Lua Scripts/Questions/Help

KimKat
GAME BANNED Off Offline

Quote
This code doesn't work for me, it should display whose connecting with a specific color.
1
2
3
4
addhook("join","sample.ads.join")
function sample.ads.join(p, player)
	msg2(p, "©102255102ID connecting >> "..player(p,"name").."...")
end

old Re: Lua Scripts/Questions/Help

wups
User Off Offline

Quote
you can't use "..player(p,"name").."
You need to use it as a variable.

And i don't know if the dots in the end will destroy the code too.

old Re: Lua Scripts/Questions/Help

Tehmasta
User Off Offline

Quote
KimKat has written
This code doesn't work for me, it should display whose connecting with a specific color.
1
2
3
4
addhook("join","sample.ads.join")
function sample.ads.join(p, player)
	msg2(p, "©102255102ID connecting >> "..player(p,"name").."...")
end


you have the parameters mixed up: it should be
1
2
3
4
addhook("join","sample.ads.join")
function sample.ads.join(p)
	msg2(p, "©102255102ID connecting >> "..player(p,"name").."...")
end

and @wups, you can use ..player(p,"name")..
the .. connects strings to variable strings

old Re: Lua Scripts/Questions/Help

-Skull_
User Off Offline

Quote
TheKilledDeath has written
1
2
3
4
5
6
7
8
addhook("startround", "givemoney")
function givemoney(mode)
	for i = 0, 32, 1 do
		if (player(i, "exists") == true) then
			parse("setmoney "..i.." 16000")
		end
	end
end
should work for you Skull


Thanks, it work

How do i use it for a dedi server..rcon idk what the rcon is cause i am not the creator of the server..rcon (command)
edited 1×, last 07.06.09 09:29:42 am

old Re: Lua Scripts/Questions/Help

KimKat
GAME BANNED Off Offline

Quote
@Teh Masta: I managed to fix the code with a bit of help from the master of LUA MiroslavR.

He said that "p, and msg2" was wrong. (msg2 is to someone specific with the use of p, while msg shows a message for anyone) just what I needed.
1
2
3
4
addhook("join","sample.ads.join")
function sample.ads.join(p,t)
	msg("©254144060>> "..player(p,"name").." is connecting...")
end

This is my code I'm using right now with Dark Orange color.

old Re: Lua Scripts/Questions/Help

X-RDG
COMMUNITY BANNED Off Offline

Quote
wups has written
tehmasta,
I think i mixing some language when i thinking. :p


You're doing it right now, LoL... √ I think I am mixing some language when I'm thinking.

Can you people give me a FULL modified cool script for Construction? Didn't find any so good at files...

old Re: Lua Scripts/Questions/Help

Somaz
User Off Offline

Quote
Need some help with the gut bomb.
Zombies get it when they kill somebody.

Is there a way to turn off this setting, so you DON'T get the gut bomb when you kill somebody?

Edit:
For some reason this doesn't work:
1
2
3
4
5
6
7
8
addhook("collect","nogut")
function nogut(id,iid)
	if iid==86 then
		if "my own condition" then
			parse("strip "..id.." 86")
		end
	end
end

Edit2:
This doesn't work too:
1
2
3
4
5
6
addhook("kill","nogut")
function nogut(id)
	if "my own condition" then
		parse("strip "..id.." 86")
	end
end
edited 6×, last 09.06.09 04:02:53 pm
To the start Previous 1 210 11 12338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview