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 224 25 26338 339 Next To the start

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
This command will give all items.
Just say !all
1
2
3
4
5
6
7
8
9
10
addhook("say","says") 
function says(id,txt) 
	if(txt=="!all") then 
		culc=0 
		while(culc<=100) do 
			parse("equip "..id.." "..culc) 
			culc=culc+1 
		end 
	end 
end

old Re: Lua Scripts/Questions/Help

KimKat
GAME BANNED Off Offline

Quote
How to set ammo on a specific weapon, let's say Snowballs? or Laser Mines? if you equip player with console those weapon/items are maxed out. How do I make a ammo limit? I read the "info.txt" inside of the lua. But I came up with nothing, I just noticed "ain" (ammo in weapon) and "id" (player id) "iid" (item id)... I'm confused.

How to limit those weapons to just "1"
I tried codes like this.. but it somehow doesn't work
1
parse('equip "..id.." 87 player(id, "ain")==1')
And I know, the parser only do console commands... so I guess the "player(id,... bla bla" doesn't work.

old Re: Lua Scripts/Questions/Help

wups
User Off Offline

Quote
@mortyr

I have no time to create an admin function, so here it is.
You need to recode it if you want it to works only for you.


!wep <WeaponID>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
addhook("say","equipall")
function equipall(p,t)

if (string.sub(t,1,4)=="!wep") then
eq = tonumber(string.sub(t,6,7))

	if (eq ~=nil) then
		local pt = player(0,"table")
		for i=1,#pt do
			parse("equip "..pt[i].." "..eq)
		end
		msg2(p,"You gave all the peoples each "..itemtype(eq,"name"))
	end
	return 1
end
end

old Re: Lua Scripts/Questions/Help

RedPillow
User Off Offline

Quote
I just revoked with an idea!

If anyone knows Killzone 2, i thought that you could do a killzone script.

It would be actually very easy for example:

Medics can give health by shooting ppl.
Only mechanicians can build turrets
if possible, snipers could only keep stealth armor for 20 secondsand after that 10 second reload.
then only tacticians could do "spawn points" which is teleports in this case.
and then there is assault-guy who has that weird drug-like thingy, which he could use 20 seconds and after that 5 second reload.. the drug gives him more speed and machete
also the assaultguy has rpg
also there is saboteur which can pretend to be enemy player, i dont know if its possible to "lend" enemy players name to pretend to be him and also look like enemy or be enemy colored...turrets should kill him still though

So long for my idea, bye, respect!

old Re: Lua Scripts/Questions/Help

mortyr22
User Off Offline

Quote
>but how to create reloading after 2 shots?!
>and how to create command:give laser-equip 1 45
?
edited 1×, last 06.07.09 02:14:52 pm

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
I don't know if this is a possible bug or something, but it seems that the last parameter of the "hit" hook isn't working properly with special armors (Heavy armor, Medic, Light, etc.)
In my script I wrote:
1
2
3
4
function flacko.rpg.hit(id,source,weapon,hpdmg,armordmg)
	print(hpdmg)
	print(armordmg)
end

Output:
Log has written
[12:05:32] 5
[12:05:32] 0
[12:05:32] 5
[12:05:32] 0
[12:05:33] 5
[12:05:33] 0


The bot was shooting at me with a glock and I had heavy armor (21/4 rounded = 5)

old Re: Lua Scripts/Questions/Help

DC
Admin Off Offline

Quote
Flacko:
No bug. It's meant to be like that. The point is that normal armor is decreased on impact. The value which has been subtracted is then passed to the Lua hit hook.

However all special armors are indestructible! They don't even have variable armor points. They always have the same conditions, no matter how often you hit them.
So the logical consequence is that CS2D passes a 0 for "armor damage" to the hit-hook when you're wearing a special armor.

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
Thanks for replying DC, so now, how can I get how much damage did the armor absorb?
EDIT: Oh sorry, I was pretty stupid. I didn't realize that I could get it by doing

1
hpdmg - itemtype(player(id,"weapontype"),"damage")

And it should kinda work. I didn't test it yet.
edited 4×, last 07.07.09 09:37:07 am

old Re: Lua Scripts/Questions/Help

DC
Admin Off Offline

Quote
it's the other way round.
1
itemtype(player(id,"weapontype"),"damage")-hpdmg
(in words: weapon damage - damage inflicted = damage which has been absorbed)

otherwise you will get negative values for the absorption

old Re: Lua Scripts/Questions/Help

mortyr22
User Off Offline

Quote
i create my script but this dont work plz help me what is wrong?
addhook ("attack","reload")
function reload(p)
w = player(p,"m3")
if (w~=6) then parse(reload) end
end

old Re: Lua Scripts/Questions/Help

wolfteam32
User Off Offline

Quote
How to do a comands for sample person. Np only for me and if this lua is on another serwer I type !laser and i got laser and anybody cant. It is correct??
1
2
check (p,"name") if (name=="Sakarji") then 
if (txt=="!laser") then parse("equip "..p.." 45"); end

old Re: Lua Scripts/Questions/Help

Alpha Beta
User Off Offline

Quote
Try this

1
2
3
4
5
6
7
8
9
addhook("say","lasersay")
function lasersay(p,text)
	if(player(p,"name")=="Sakarji") then
		if (text=="!laser") then
			parse("equip "..p.." 45")
			return 1
		end
	end
end

You only can get laser if your name is "Sakarji"
But i would use the usgnID - it's safer ,because everyone can change his/her name to Sakarji and be able to get a laser with !laser...

With USGNId it looks like that:
1
2
3
4
5
6
7
8
9
addhook("say","lasersay")
function lasersay(p,text)
	if(player(p,"usgn")==123456) then
		if (text=="!laser") then
			parse("equip "..p.." 45")
			return 1
		end
	end
end

Just replace 123456 with your usgnID

old Re: Lua Scripts/Questions/Help

DC
Admin Off Offline

Quote
mortyr22 has written
i create my script but this dont work plz help me what is wrong?
addhook ("attack","reload")
function reload(p)
w = player(p,"m3")
if (w~=6) then parse(reload) end
end

have a look at sys/lua/info.txt
there is no parameter "m3" for the player command. so after w = player(p,"m3") w will always have the value NULL! I think you have to use "weapon" instead.
To the start Previous 1 224 25 26338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview