English Lua Scripts/Questions/Help

6,770 replies
Goto Page
To the start Previous 1 2 ... 224 225 226 ... 338 339 Next To the start
26.07.10 12:30:53 pm
Up
HaRe
User
Offline Off
Alex_Aaa789 has written:
Omg, now it keeps spamming
Code:
1
LUA ERROR: attempt to call a nil value


My full lua:
Code:
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


Code:
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
Code:
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
Code:
1
2
addhook("hit","heal")
function heal(id,source,wpn,hpdmg,apdmg,x,y)
edited 1×, last 26.07.10 12:32:06 pm
w0w im so eXotiK
26.07.10 12:31:48 pm
Up
TimeQuesT
User
Offline Off
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...
Muh
26.07.10 12:38:30 pm
Up
HaRe
User
Offline Off
@Schinken do you know how to make some one walk trought walls? its possible but i dont know how,

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

he can walk trought walls
w0w im so eXotiK
26.07.10 12:43:29 pm
Up
TimeQuesT
User
Offline Off
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)
Muh
26.07.10 06:21:04 pm
Up
brk753951
BANNED
Offline Off
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.
[H.H] rpTr Klan Server <-- pls join my server [BEST RP SERVER]
26.07.10 07:09:37 pm
Up
HaRe
User
Offline Off
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.


Code:
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
w0w im so eXotiK
26.07.10 07:39:28 pm
Up
Starkkz
Moderator
Offline Off
@batlaizys: Can i recomend you something?,
i think is better you use notepad++, you will see every lua error..
lol
27.07.10 11:35:50 am
Up
Atukam72Pl
User
Offline Off
Hi, i need script when player get 16k gold every round. Thx.
Eeh-hehehehehe...
27.07.10 11:41:22 am
Up
HaRe
User
Offline Off
Atukam72Pl has written:
Hi, i need script when player get 16k gold every round. Thx.


Code:
1
2
3
4
5
6
addhook("startround","startmoney")
function startmoney()
     for i = 1,32 do
          parse("setmoney "..i.." 16000")
     end
end
w0w im so eXotiK
27.07.10 11:42:51 am
Up
TimeQuesT
User
Offline Off
you forgott to check if the player exists.
if you don't do that the "i" will be nil.
Muh
27.07.10 11:45:34 am
Up
Admir
User
Offline Off
Code:
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
My curse will sail against the wind and enrage the earth.
27.07.10 12:47:47 pm
Up
brk753951
BANNED
Offline Off
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.


Code:
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
[H.H] rpTr Klan Server <-- pls join my server [BEST RP SERVER]
27.07.10 01:08:12 pm
Up
Cure Pikachu
User
Offline Off
Invert the + and - then.
Code:
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
IMG:https://i.imgur.com/uUrye71.png
IMG:https://i.imgur.com/xpsyQRX.png
27.07.10 01:29:37 pm
Up
Rainoth
Moderator
Offline Off
Hello all,
Could some1 make me broadcast script (no time limit please)

I would be thankfull...
27.07.10 05:58:25 pm
Up
TimeQuesT
User
Offline Off
what do you mean with "no time limit" ?
that the said text stands there for ever or it's disapearing automati....?
Muh
27.07.10 05:59:19 pm
Up
Cure Pikachu
User
Offline Off
He wants to broadcast without the delays (Let's spam), I think.
IMG:https://i.imgur.com/uUrye71.png
IMG:https://i.imgur.com/xpsyQRX.png
27.07.10 06:06:03 pm
Up
Rainoth
Moderator
Offline Off
Yes Pikachu is right.Can any1 do that ?
27.07.10 07:28:12 pm
Up
TimeQuesT
User
Offline Off
idk if this work but try the best

Code:
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
Muh
27.07.10 08:28:06 pm
Up
Rainoth
Moderator
Offline Off
It works perfectly ,but in start of every text i write is letter "t"
27.07.10 08:32:37 pm
Up
TimeQuesT
User
Offline Off
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)
Muh
To the start Previous 1 2 ... 224 225 226 ... 338 339 Next To the start