English I can`t find error, why

3 replies
Goto Page
To the start Previous 1 Next To the start
29.05.18 09:12:34 pm
Up
phalenkO
User
Offline Off
I created absurd a lua but it didn`t go will. Can find you error please

Code:
1
2
3
4
5
6
7
8
admin = {142925} --- 

if player(id,"usgn") == admin[id] then
if string.sub(txt, 1, 2) == "!hesoyam" then
local adam == string.sub(txt 3, 4) 
parse("sethealth ..admin.. 100")
end
end
IMG:https://media.giphy.com/media/1ymoA4quTygCABwIr9/giphy.gif
29.05.18 10:16:41 pm
Up
LoaderFRA
User
Offline Off
Need fonction for working and error line 4 (i think)
29.05.18 10:30:56 pm
Up
panteon00
User
Offline Off
missing hook and function

Code:
1
local adam == string.sub(txt 3, 4)

if you want to define a var, use one equal
i think you have missed a comma between 'txt' and '3'

and maybe you should look for that:
Spoiler >


Code:
1
parse("sethealth ..admin.. 100")

this syntax isn't correct, it has to be
Code:
1
parse("sethealth "..admin.." 100")

and this won't work because there is no var admin, there is only your array

if i guess right, you want a script, which heals the admin

Code:
1
2
3
4
5
6
7
8
9
10
11
12
admin = 142925

addhook("say","_say")
function say(id,txt)
     if player(id,"usgn") == admin then
          if string.sub(txt,0,7) == "!hesoyam" then
               parse("sethealth "..id.." 100")
          end
     end
end
--untested 
--and you aren't able to use more than one admin
loading...
30.05.18 08:09:05 am
Up
phalenkO
User
Offline Off
@user panteon00: Thank you
IMG:https://media.giphy.com/media/1ymoA4quTygCABwIr9/giphy.gif
To the start Previous 1 Next To the start