Forum
CS2D Scripts Lua Scripts/Questions/HelpEdit: I saw this question in some other your tread...
Just say !all
1
2
3
4
5
6
7
8
9
10
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
edited 1×, last 05.07.09 05:46:52 pm
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')
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
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
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!
and how to create command:give laser-equip 1 45
?
edited 1×, last 06.07.09 02:14:52 pm
In my script I wrote:
1
2
3
4
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
[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)
edited 1×, last 06.07.09 08:08:07 pm
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.
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
1
itemtype(player(id,"weapontype"),"damage")-hpdmg
otherwise you will get negative values for the absorption
addhook ("attack","reload")
function reload(p)
w = player(p,"m3")
if (w~=6) then parse(reload) end
end
1
2
2
check (p,"name") if (name=="Sakarji") then if (txt=="!laser") then parse("equip "..p.." 45"); end
1
2
3
4
5
6
7
8
9
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
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
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
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.