Forum

> > CS2D > Scripts > i am newbie, need advice!
Forums overviewCS2D overview Scripts overviewLog in to reply

English i am newbie, need advice!

12 replies
To the start Previous 1 Next To the start

old i am newbie, need advice!

unknown soldier
User Off Offline

Quote
Hi all.
I am a newbie in scripting. So I need help. So here it is:

-i need a healing system. +5 health point per second.
-i need a hurt message health at 30 show a message
"You are hurt, get to cover!"
-i need a kind of weapon selection (example)
-CT:
- PPS43
- mosin-nagnat
- SVT40
- scoped mosin-nagnat
- PPSH-42

-T
- MP40
- kar98k
- gewehr 43
- scoped kar98k
- MP44

Can anyone tell me how to do it?

If yes thank you
*will be nice if a professional script maker give me a advice

old Re: i am newbie, need advice!

Reaper
User Off Offline

Quote
You should just check the file archive, there you will find pretty much everything you need. Addionally you can search the internet for some lua basic tutorials:

Btw, if you would have spent 2 seconds for search you would have found http://www.unrealsoftware.de/files_show.php?file=8888 for sure. Also the other stuff is pretty basic, I think there are already some default lua scripts which come with the game, which fit your needs. Haven't installed the game at the moment, but I'm pretty damn sure about it, so just check the sys/lua folder.

old Re: i am newbie, need advice!

Gajosik
BANNED Off Offline

Quote
Health script:
1
2
3
4
5
addhook('second','gajospl_second')
function gajospl_second(id)
local heal=player(id,"health")
parse('sethealth '..id..' '..heal..'+5')
end
I'm user Gaios
I am writing from my brother's account.

I do not know if that works. I am writing from Android

old Re: i am newbie, need advice!

Avo
User Off Offline

Quote
1
2
3
4
5
addhook('second','gajospl_second')
function gajospl_second(id)
local heal=player(id,"health")
parse('sethealth '..id..' '..heal..'+5')
end
Fails. Hook "second" does not work with id argument. parse('sethealth '..id..' '..heal..'+5') won't work, becouse with cs2d console can't use math operations.
1
2
3
4
5
6
7
addhook('second','boltpl_second')
function boltpl_second()
	for _,id in pairs(player(0,"tableliving")) do 
		local hp=player(id,"health")+5
		parse('sethealth '..id..' '..hp)
	end
end

old Re: i am newbie, need advice!

ExecL
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
addhook('second','boltpl_second')
function boltpl_second()
     for _,id in pairs(player(0,"tableliving")) do 
          local hp=player(id,"health")+5
          parse('sethealth '..id..' '..hp)
     end
		for _,id in pairs(player(0,"tableliving")) do 
				local hp2=player(id,"health")
				if hp2 < 41 then
			msg2(id,"©255000000You are hurt, get to cover!")
		end
	end
end

Lol.

old Re: i am newbie, need advice!

unknown soldier
User Off Offline

Quote
Thank you for your all help sir.
I apologize for my rudeness. Because I am not good at english too.

@bolt_pl (no, sir I am not doing COD5 sir. I just want to test my scripting abilities, and I am about test in cod2 it lot easier.
lol
edited 1×, last 02.09.12 06:16:07 pm

old Re: i am newbie, need advice!

unknown soldier
User Off Offline

Quote
Addhook("spawn", "stalingrad")
Function stalingrad(Id)
If player(Id,"team") == 1 then
Menu(Id,"select weapon,scoped kar98k|get.")
Elseif player(I'd, "team") == 2 then
Menu(Id,"select weapon,scoped mosin-nagnat|get.")
End
End
Should script like this?

old Re: i am newbie, need advice!

Jynxxx
User Off Offline

Quote
Like this, learn how to not capitalize anything important like
addhook, function, end, if, elseif, else
1
2
3
4
5
6
7
8
addhook("spawn","stalingrad")
function stalingrad(id)
	if player(id,"team") == 1 then
		menu(id,"select weapon,scoped kar98k|get.")
	elseif player(id,"team") == 2 then
		Menu(id,"select weapon,scoped mosin-nagnat|get.")
	end
end
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview