Forum

> > CS2D > Scripts > Lua Scripts/Questions/Help
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Lua Scripts/Questions/Help

6.770 Antworten
Seite
Zum Anfang Vorherige 1 2216 217 218338 339 Nächste Zum Anfang

alt Re: Lua Scripts/Questions/Help

TimeQuesT
User Off Offline

Zitieren
Oo you want also portal gun
to reverse the effect just write the word again

example : say laser
laser enabled -- you get a laser when you got hit by a usp

          say laser
laser disabled --you don't get any laser when you got hit.


try this :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
lazor = 0
portal = 0

addhook ("say","sages")
function sages(id,text)
if text=="laser" and lazor ==0 then
lazor = 1
msg ("laz0r gun enabled")
elseif text=="laser" and lazor ==1 then
lazor = 0
msg ("laz0r gun disabled")
end

if text=="portal" and portal ==0 then
portal = 1
msg ("p0rtal gun enabled")
elseif text=="portal" and portal ==1 then
portal = 0
msg ("p0rtal gun disabled")
end
end

addhook ("hit","ho")
function ho(id,source,we)
if we == 1 and lazor == 1 then
parse ("equip "..id.." 45")
end
if we == 1 and portal == 1 then
parse ("equip "..id.." 88")
end
end

alt Re: Lua Scripts/Questions/Help

archmage
User Off Offline

Zitieren
Snake_Eater hat geschrieben
I have a little question

I want if somebody have used the cmd="kill"
that this player does not die.
I need it for a prison
Can anybody help me?

You could just make the player spawn there.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
addhook ("parse", "parse_")
lastkill = 2
spawnp = {}
addhook("die", "death")
function death (id)
	lastkill = id
end

function parse_ (cmd)
	if ( cmd:sub(1, 4) == "kill" ) then
		--parse("spawnplayer " .. lastkill .. " " .. player(lastkill, "x") .. " " .. player(lastkill, "y"))
		spawnp[lastkill] = {player(lastkill, "x"),player(lastkill, "y")}
	end
end

addhook("spawn", "spwn")
function spwn (id)
	if ( spawnp[id] ~= nil and spawnp[id][1] > -1 and spawnp[id][2] > -1 ) then
		parse("setpos " .. id .. " " .. spawnp[id][1] .. " "..spawnp[id][2])
		spawnp[id][1] = -1
		spawnp[id][2] = -1
	end
end

I have NOT tested so not sure if it works...
Edit tested it it fails Lua thinks lastkill is a f***ing boolean I wish it were a strongly typed language
Edit
try that it might work
1× editiert, zuletzt 04.07.10 00:11:47

alt Re: Lua Scripts/Questions/Help

DC
Admin Off Offline

Zitieren
this is not going to work for clients. commands entered by client are never parsed as console commands at the server (unless you put an rcon in front of them [which would kill the player who is the server in this case]).

so the parse-hook stuff will only be executed when the server itself executes the kill command.

alt Re: Lua Scripts/Questions/Help

Ax3
User Off Offline

Zitieren
Question: Why AMX doesn't works at Linux? What need to do? that instruction on cs2d.org doesn't works! its a problem while calling "newmod" at help.lua (a nil value) Please help me!

alt Re: Lua Scripts/Questions/Help

ifrit723
User Off Offline

Zitieren
lol... im lost

can u give me a tutorial on how to make a basic Lua script? (role playing ones please) i really want to make a role play script T_T

alt Re: Lua Scripts/Questions/Help

RyceR
User Off Offline

Zitieren
i want make "kill HP" command. Why it doesn't work...?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
addhook("parse","hp_parse")
function hp_parse(cmd)
	if(string.sub(cmd,1,6)=="kill_hp") then
		local es_dmg=string.sub(cmd,8,string.len(cmd))
		k_hp=kill_hp
		print("©255255255HP is now: "..k_hp)
		return 1
	end
end



addhook("kill","player_kill")
function player_kill(killer,victim,wpn)
	if player_health_kill > 0 then
		parse("sethealth "..killer.." "..(player(killer,"health")+kill_hp))
		msg2(killer,"©000255000Health +"..kill_hp.."@C")
	end
end

alt Re: Lua Scripts/Questions/Help

TimeQuesT
User Off Offline

Zitieren
MSek hat geschrieben
i want make "kill HP" command. Why it doesn't work...?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
addhook("parse","hp_parse")
function hp_parse(cmd)
	if(string.sub(cmd,1,6)=="kill_hp") then
		local es_dmg=string.sub(cmd,8,string.len(cmd))
		k_hp=kill_hp
		print("©255255255HP is now: "..k_hp)
		return 1
	end
end



addhook("kill","player_kill")
function player_kill(killer,victim,wpn)
	if player_health_kill > 0 then
		parse("sethealth "..killer.." "..(player(killer,"health")+kill_hp))
		msg2(killer,"©000255000Health +"..kill_hp.."@C")
	end
end


is there any error in console?

alt HELP why dont working a1,a2,a3,a4 is trigger_once.

texnonikWP
User Off Offline

Zitieren
Why dont working ?

[ code ]addhook("startround","sample.ut.startround")
function sample.ut.startround()
     local game=math.random(1,4)
     if game==1 then
          parse("trigger a1")
          sample.trigger="a1"
     elseif game==2 then
          parse("trigger a2")
          sample.trigger="a2"
     elseif game==3 then
          parse("trigger a3")
          sample.trigger="a3"
     elseif game==4 then
          parse("trigger a4")
          sample.trigger="a4"
          end
     end
end[ /code ]

alt Re: Lua Scripts/Questions/Help

RyceR
User Off Offline

Zitieren
Schinken hat geschrieben
is there any error in console?


yeah, if i say command: kill_hp and number (kill_hp 20 or 30)

alt Re: Lua Scripts/Questions/Help

RyceR
User Off Offline

Zitieren
Search the "Mypos, command and hud" mod in lua scripts.
next if you say !mypos or !pos is text:

X Tiles: Y Tiles:
X Pixels: Y Pisels:
Zum Anfang Vorherige 1 2216 217 218338 339 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht