English I have make unseen hat script

4 replies
Goto Page
To the start Previous 1 Next To the start
05.09.19 02:14:53 pm
Up
phalenkO
User
Offline Off
Hi everyone! Im come with strange topic, maybe. I have make a hat script and I think it, isn't there is a seen problem for me. Im put a lua at spoiler, I have look this and get a few logic. I guess I make mistake on that logic but I think I haven't see any problem in "hatincident" function. Please you write If there is a problem in script. I have make later menu and serveraction things but other script isn't there is problem in game. Just there is problem in hat incidents.
Im can be brind xd
Spoiler >


Who make this lua?

Code:
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
tazehat = {
    {path = "gfx/burunpack/cowboy.png"},
     {path = "gfx/burunpack/king.png"},
     {path = "gfx/burunpack/backpacker.png"},
     {path = "gfx/burunpack/spear.png"},
     {path = "gfx/burunpack/skull.png"},
     }

hatstable = {}

function initArray(m)
     local array={}
     for i=1, m do
          array[i]=0
     end
     return array
end

burun = initArray(32)

addhook("serveraction","actionn")
function actionn(id,act)
     if act == 1 then 
          menu(id,"Menu,Hats")
     return 1 
end
end

addhook("menu","mmenu")
function mmenu(id,title,button)
     if title == "Menu" then 
          if button == 1 then 
               menu(id,"hats,cowboy,king,backpacker,spear,skull,nohat")
          end
     return 1
end
if title == "hats" then 
     hatincident(id,title,button) ---i guess i make mistake here
return 1
end
end

function hatincident(id,baslik,buton)
     local pages = math.ceil(#tazehat/5)
     if buton >=1 and 5<= buton then 
          local idd = buton 
          if burun[id] ~= idd then 
               if hatstable[id] then 
                   freeimage(tazehat[id]) 
               end 

          burun[id] = idd 
          hatstable[id] = image(tazehat[idd].path,1,1,200+id)
     end
     if buton == 6 then 
          if hatstable[id] then 
               freeimage(hatstable[id])
          end
          hatstable[id] = nil
          burun[id] = 0
     end
end
end
05.09.19 03:20:00 pm
Up
Gaios
Security Supporter
Offline Off
05.09.19 03:33:21 pm
Up
phalenkO
User
Offline Off
@user Gaios: Thanks for link but I want to will make script myself. You had see any problem in codes?
05.09.19 05:51:31 pm
Up
TrialAndError
User
Offline Off
Code:
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
tazehat = {
    {path = "gfx/burunpack/cowboy.png"},
    {path = "gfx/burunpack/king.png"},
    {path = "gfx/burunpack/backpacker.png"},
    {path = "gfx/burunpack/spear.png"},
    {path = "gfx/burunpack/skull.png"}
}

hatstable = {}

function initArray(m)
    local array={}
    for i=1, m do
        array[i]=0
    end
    return array
end

burun = initArray(32)

addhook("serveraction","actionn")
function actionn(id,act)
    if act == 1 then
        menu(id,"Menu,Hats")
        return 1
    end
end

addhook("menu","mmenu")
function mmenu(id,title,button)
    if title == "Menu" then
        if button == 1 then
            menu(id,"hats,cowboy,king,backpacker,spear,skull,nohat")
        end
        return 1
    end
    if title == "hats" then
        hatincident(id,title,button)
        return 1
    end
end

function hatincident(id,baslik,button)
    local pages = math.ceil(#tazehat/5)
    if button >= 1 and button <= 5 then --Fixed Mistake 1
        local idd = button 
        if burun[id] ~= idd then
            if hatstable[id] then
                freeimage(hatstable[id]) --Fixed Mistake 2
            end 
            burun[id] = idd
            hatstable[id] = image(tazehat[idd].path,1,1,200+id)
        end
    end
    if button == 6 then --Mistake 3
        if hatstable[id] then 
            freeimage(hatstable[id])
        end
        hatstable[id] = nil
        burun[id] = 0
    end
end
05.09.19 10:38:58 pm
Up
phalenkO
User
Offline Off
@user TrialAndError: thanks for fixed mistake
To the start Previous 1 Next To the start