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 2224 225 226338 339 Next To the start

old Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Quote
Alex_Aaa789 has written
Omg, now it keeps spamming
1
LUA ERROR: attempt to call a nil value

My full lua:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
addhook("hit","heal")
function healgun(id,source,wpn,hpdmg,apdmg,x,y)
local x, y
x = player( id, "x")
y = player( id, "y")
     if wpn == 2 then
          parse("sethealth "..id.." "..player(id,"health")+10)
          parse('effect "colorsmoke" ' ..x.. ' ' ..y.. ' 140 96 255 192 203')
          parse('effect "colorsmoke" ' ..x.. ' ' ..y.. ' 140 96 128 0 128')
		  msg2(id,"You got healed by "..player(p,"name").."")
          return 1
     end
     if wpn == 1 then
          parse("setpos "..id.." 544 1888")
          parse('effect "colorsmoke" ' ..x.. ' ' ..y.. ' 140 96 0 0 0')
          parse('effect "colorsmoke" ' ..x.. ' ' ..y.. ' 140 96 0 0 139')
		  msg2(id,"You got jailed by "..player(p,"name").."")
		  return 1
     end
end

I should add what to stop that calling nil value?


idk what u did wrong but use this


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
addhook("hit","healgun")
function healgun( id, source, weapon, hpdmg, apdmg)
	if (weapon == 1) then
		local x, y
		x = player( id, "x")
		y = player( id, "y")
		parse("sethealth "..id.." "..player( id, "health") + 10)
		parse('effect "colorsmoke" ' ..x.. ' ' ..y.. ' 140 96 255 192 203')
		parse('effect "colorsmoke" ' ..x.. ' ' ..y.. ' 140 96 128 0 128')
		msg2( id, "©000500000You got healed by "..player(source,"name").."")
		return 1
	elseif (weapon == 2) then
		local x, y
		x = player( id, "x")
		y = player( id, "y")
		parse("setpos "..id.." 544 1888")
		parse('effect "fire" ' ..x.. ' ' ..y.. ' 1 1 0 0 0')
		parse('effect "colorsmoke" ' ..x.. ' ' ..y.. ' 140 96 0 0 0')
		parse('effect "colorsmoke" ' ..x.. ' ' ..y.. ' 140 96 0 0 139')
		msg2( id, "©000500000You got jailed by "..player(source,"name").."")
		return 1
	end
end
that one works

/edit

This is yours
1
2
addhook("hit","heal")
function healgun(id,source,wpn,hpdmg,apdmg,x,y)
Look closely you see the error? you didnt use the function heal, You use the function healgun wich dont exist, So it should look like this
1
2
addhook("hit","heal")
function heal(id,source,wpn,hpdmg,apdmg,x,y)
edited 1×, last 26.07.10 12:32:06 pm

old Re: Lua Scripts/Questions/Help

TimeQuesT
User Off Offline

Quote
x and y are unknown parameters of the "hit" hook.
so remove them there.

that's why x and y are nil values!

you must define them.

example:

x = player(id,"x")
y = player(id,"y")

edit: to late

but i think vesa-omar works...

old Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Quote
@Schinken do you know how to make some one walk trought walls? its possible but i dont know how,

well im trying to do
1
if walktrough[id]==1 then

he can walk trought walls

old Re: Lua Scripts/Questions/Help

TimeQuesT
User Off Offline

Quote
just use the ms100 or always hook (always cause lags), to check if the variable is "1".

than get the position in front of the player and set his pos to this location.(Starkkz[i think] can help you he made one script that looks like this you want)

old Re: Lua Scripts/Questions/Help

brk753951
BANNED Off Offline

Quote
hi all i need help

i want this

if man hit other man

shoter give 10 dollar
and who give damage he lost money
make this???

make this on claw pls admin helpp

SORRY FOR MY ENG.

old Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Quote
brk753951 has written
hi all i need help

i want this

if man hit other man

shoter give 10 dollar
and who give damage he lost money
make this???

make this on claw pls admin helpp

SORRY FOR MY ENG.


1
2
3
4
5
6
7
addhook("hit","losemoney_hit")
function losemoney_hit(id,src,wpn)
	if wpn==78 then
		parse("setmoney "..id.." "..player(id,"money") + 10)
		parse("setmoney "..src.." "..player(src,"money") - 10)
	end
end

old Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Quote
Atukam72Pl has written
Hi, i need script when player get 16k gold every round. Thx.


1
2
3
4
5
6
addhook("startround","startmoney")
function startmoney()
	for i = 1,32 do
		parse("setmoney "..i.." 16000")
	end
end

old Re: Lua Scripts/Questions/Help

Admir
User Off Offline

Quote
1
2
3
4
5
6
7
8
addhook("startround","startmoney")
function startmoney()
	for i = 1,32 do
		if (player(i,"exists")) then
			parse("setmoney "..i.." 16000")
		end
	end
end

old Re: Lua Scripts/Questions/Help

brk753951
BANNED Off Offline

Quote
vesa-omar has written
brk753951 has written
hi all i need help

i want this

if man hit other man

shoter give 10 dollar
and who give damage he lost money
make this???

make this on claw pls admin helpp

SORRY FOR MY ENG.


1
2
3
4
5
6
7
addhook("hit","losemoney_hit")
function losemoney_hit(id,src,wpn)
	if wpn==78 then
		parse("setmoney "..id.." "..player(id,"money") + 10)
		parse("setmoney "..src.." "..player(src,"money") - 10)
	end
end


this is dont work shotter lose money and damage givver give money. pls help me

old Re: Lua Scripts/Questions/Help

Cure Pikachu
User Off Offline

Quote
Invert the + and - then.
1
2
3
4
5
6
7
addhook("hit","losemoney_hit")
function losemoney_hit(id,src,wpn)
	if wpn==78 then
        		parse("setmoney "..id.." "..player(id,"money") - 10)
         		parse("setmoney "..src.." "..player(src,"money") + 10)
     	end
end

old Broadcast

Rainoth
Moderator Off Offline

Quote
Hello all,
Could some1 make me broadcast script (no time limit please)

I would be thankfull...

old Re: Lua Scripts/Questions/Help

TimeQuesT
User Off Offline

Quote
idk if this work but try the best

1
2
3
4
5
6
7
8
addhook ("say","sages")
function sages(id,txt)
if string.find(txt,"!broadcast") then
local tox=string.sub(txt,10,string.len(txt))
msg ("©000255255"..player(id,"name").."(broadcasts):"..tox)
return 1;
end
end

old Re: Lua Scripts/Questions/Help

TimeQuesT
User Off Offline

Quote
change this : (txt,10,string.len(txt))

to this:

(txt,11,string.len(txt))

(and there is one creepy bug i don't want to tell you xD)
To the start Previous 1 2224 225 226338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview