Jump to content

[Help] Positions


Stranger

Recommended Posts

hello guys

i have problem with this code, i don't know what the problem but the debug says :

" ERROR: Loading script failed: spawn\client.lua:58: unexpected symbol near ')' "

the code :

  
 addEvent("open", true) 
  
local Manster = { 
    "spawn", 
    "bank", 
} 
  
local screX, screY = guiGetScreenSize() 
Wind = guiCreateWindow(screX / 2 - 100, screY / 2 - 150, 200, 350, "By Manster", false) 
guiWindowSetSizable(Wind, false) 
guiSetVisible(Wind, false) 
  
GRID = guiCreateGridList(0, 0.07, 1, 0.66, true, Wind) 
guiGridListAddColumn(GRID, "spawn :", 0.9) 
for i = 1, 15 do 
    guiGridListAddRow(GRID) 
end 
guiGridListSetItemText(GRID, 1, 1, "spawn", false, false) 
guiGridListSetItemText(GRID, 2, 1, "bank", false, false) 
Select = guiCreateButton(0.05, 0.75, 1, 0.1, "Select!", true, Wind) 
guiSetProperty(Select, "NormalTextColour", "FFAAAAAA") 
Close = guiCreateButton(0.05, 0.86, 1, 0.1, "Close", true, Wind) 
guiSetProperty(Close, "NormalTextColour", "FFAAAAAA") 
  
addEventHandler("onClientGUIClick", root, 
function () 
if(source == Select)then 
local row, col = guiGridListGetSelectedItem(GRID) 
local SS = guiGridListGetItemText(GRID, row, col) 
if (SS) then 
guiSetVisible(Wind, false) 
guiSetInputEnabled(false) 
if(SS == "spawn")then 
triggerServerEvent("spawn", localPlayer, "spawns") 
elseif(SS == "bank")then 
triggerServerEvent("spawn2", localPlayer, "spawns2") 
elseif(source == Close)then 
guiSetVisible(Wind, false) 
guiSetInputEnabled(false) 
end 
end 
end 
) 
  
function showGui () 
guiSetVisible (Wind, true) 
showCursor (true) 
end 
bindKey ( "F2", "down", showGui ) 
  
addEventHandler("open", root, 
    function(state) 
        if(state == "true")then 
            guiSetVisible(Wind, true) 
            guiSetInputEnabled(true) 
        elseif(state == "false")then 
            guiSetVisible(Wind, false) 
            guiSetInputEnabled(false) 
        end 
    end 
) 

Link to comment

You were missing an end in the onClientGUIClick event.

local Manster = { 
    "spawn", 
    "bank", 
} 
  
local screX, screY = guiGetScreenSize() 
Wind = guiCreateWindow(screX / 2 - 100, screY / 2 - 150, 200, 350, "By Manster", false) 
guiWindowSetSizable(Wind, false) 
guiSetVisible(Wind, false) 
  
GRID = guiCreateGridList(0, 0.07, 1, 0.66, true, Wind) 
guiGridListAddColumn(GRID, "spawn :", 0.9) 
  
for i=1,15 do 
    guiGridListAddRow(GRID) 
end 
  
guiGridListSetItemText(GRID, 1, 1, "spawn", false, false) 
guiGridListSetItemText(GRID, 2, 1, "bank", false, false) 
  
Select = guiCreateButton(0.05, 0.75, 1, 0.1, "Select!", true, Wind) 
Close = guiCreateButton(0.05, 0.86, 1, 0.1, "Close", true, Wind) 
  
addEventHandler("onClientGUIClick", root, 
    function() 
        if (source == Select) then 
            local row, col = guiGridListGetSelectedItem(GRID) 
            local SS = guiGridListGetItemText(GRID, row, col) 
            if (SS) then 
                guiSetVisible(Wind, false) 
                guiSetInputEnabled(false) 
                if (SS == "spawn") then 
                    triggerServerEvent("spawn", localPlayer, "spawns") 
                elseif (SS == "bank") then 
                    triggerServerEvent("spawn2", localPlayer, "spawns2") 
                elseif (source == Close) then 
                    guiSetVisible(Wind, false) 
                    guiSetInputEnabled(false) 
                end 
            end 
        end 
    end, false 
) 
  
function showGui() 
    guiSetVisible (Wind, true) 
    showCursor (true) 
end 
bindKey("F2", "down", showGui) 
  
addEvent("open", true) 
addEventHandler("open", root, 
    function(state) 
        if (state == "true") then 
            guiSetVisible(Wind, true) 
            guiSetInputEnabled(true) 
        elseif (state == "false") then 
            guiSetVisible(Wind, false) 
            guiSetInputEnabled(false) 
        end 
    end 
) 

Works just fine on Lua demo as well (link »)

local Manster = { 
    "spawn", 
    "bank", 
} 
  
local function runScript() 
    local screX, screY = guiGetScreenSize() 
    Wind = guiCreateWindow(screX / 2 - 100, screY / 2 - 150, 200, 350, "By Manster", false) 
    guiWindowSetSizable(Wind, false) 
    guiSetVisible(Wind, false) 
      
    GRID = guiCreateGridList(0, 0.07, 1, 0.66, true, Wind) 
    guiGridListAddColumn(GRID, "spawn :", 0.9) 
      
    for i=1,15 do 
        guiGridListAddRow(GRID) 
    end 
      
    guiGridListSetItemText(GRID, 1, 1, "spawn", false, false) 
    guiGridListSetItemText(GRID, 2, 1, "bank", false, false) 
      
    Select = guiCreateButton(0.05, 0.75, 1, 0.1, "Select!", true, Wind) 
    Close = guiCreateButton(0.05, 0.86, 1, 0.1, "Close", true, Wind) 
      
    addEventHandler("onClientGUIClick", root, 
        function() 
            if (source == Select) then 
                local row, col = guiGridListGetSelectedItem(GRID) 
                local SS = guiGridListGetItemText(GRID, row, col) 
                if (SS) then 
                    guiSetVisible(Wind, false) 
                    guiSetInputEnabled(false) 
                    if (SS == "spawn") then 
                        triggerServerEvent("spawn", localPlayer, "spawns") 
                    elseif (SS == "bank") then 
                        triggerServerEvent("spawn2", localPlayer, "spawns2") 
                    elseif (source == Close) then 
                        guiSetVisible(Wind, false) 
                        guiSetInputEnabled(false) 
                    end 
                end 
            end 
        end, false 
    ) 
      
    function showGui() 
        guiSetVisible (Wind, true) 
        showCursor (true) 
    end 
    bindKey("F2", "down", showGui) 
      
    addEvent("open", true) 
    addEventHandler("open", root, 
        function(state) 
            if (state == "true") then 
                guiSetVisible(Wind, true) 
                guiSetInputEnabled(true) 
            elseif (state == "false") then 
                guiSetVisible(Wind, false) 
                guiSetInputEnabled(false) 
            end 
        end 
    ) 
     
    print("Works!") 
end 
  
function addEvent() 
    return true 
end 
  
function guiGetScreenSize() 
    return 1920, 1080 
end 
  
function guiCreateWindow() 
    return true 
end 
  
function guiWindowSetSizable() 
    return true 
end 
  
function guiSetVisible() 
    return true 
end 
  
function guiCreateGridList() 
    return true 
end 
  
function guiGridListAddColumn() 
    return true 
end 
  
function guiGridListAddRow() 
    return true 
end 
  
function guiGridListSetItemText() 
    return true 
end 
  
function guiCreateButton() 
    return true 
end 
  
function guiSetProperty() 
    return true 
end 
  
function addEventHandler() 
    return true 
end 
  
function guiGridListGetSelectedItem() 
    return true 
end 
  
function guiGridListGetItemText() 
    return true 
end 
  
function guiSetInputEnabled() 
    return true 
end 
  
function triggerServerEvent() 
    return true 
end 
  
function showCursor() 
    return true 
end 
  
function bindKey() 
    return true 
end 
  
runScript() 

Link to comment
You were missing an end in the onClientGUIClick event.
local Manster = { 
    "spawn", 
    "bank", 
} 
  
local screX, screY = guiGetScreenSize() 
Wind = guiCreateWindow(screX / 2 - 100, screY / 2 - 150, 200, 350, "By Manster", false) 
guiWindowSetSizable(Wind, false) 
guiSetVisible(Wind, false) 
  
GRID = guiCreateGridList(0, 0.07, 1, 0.66, true, Wind) 
guiGridListAddColumn(GRID, "spawn :", 0.9) 
  
for i=1,15 do 
    guiGridListAddRow(GRID) 
end 
  
guiGridListSetItemText(GRID, 1, 1, "spawn", false, false) 
guiGridListSetItemText(GRID, 2, 1, "bank", false, false) 
  
Select = guiCreateButton(0.05, 0.75, 1, 0.1, "Select!", true, Wind) 
Close = guiCreateButton(0.05, 0.86, 1, 0.1, "Close", true, Wind) 
  
addEventHandler("onClientGUIClick", root, 
    function() 
        if (source == Select) then 
            local row, col = guiGridListGetSelectedItem(GRID) 
            local SS = guiGridListGetItemText(GRID, row, col) 
            if (SS) then 
                guiSetVisible(Wind, false) 
                guiSetInputEnabled(false) 
                if (SS == "spawn") then 
                    triggerServerEvent("spawn", localPlayer, "spawns") 
                elseif (SS == "bank") then 
                    triggerServerEvent("spawn2", localPlayer, "spawns2") 
                elseif (source == Close) then 
                    guiSetVisible(Wind, false) 
                    guiSetInputEnabled(false) 
                end 
            end 
        end 
    end, false 
) 
  
function showGui() 
    guiSetVisible (Wind, true) 
    showCursor (true) 
end 
bindKey("F2", "down", showGui) 
  
addEvent("open", true) 
addEventHandler("open", root, 
    function(state) 
        if (state == "true") then 
            guiSetVisible(Wind, true) 
            guiSetInputEnabled(true) 
        elseif (state == "false") then 
            guiSetVisible(Wind, false) 
            guiSetInputEnabled(false) 
        end 
    end 
) 

Works just fine on Lua demo as well (link »)

local Manster = { 
    "spawn", 
    "bank", 
} 
  
local function runScript() 
    local screX, screY = guiGetScreenSize() 
    Wind = guiCreateWindow(screX / 2 - 100, screY / 2 - 150, 200, 350, "By Manster", false) 
    guiWindowSetSizable(Wind, false) 
    guiSetVisible(Wind, false) 
      
    GRID = guiCreateGridList(0, 0.07, 1, 0.66, true, Wind) 
    guiGridListAddColumn(GRID, "spawn :", 0.9) 
      
    for i=1,15 do 
        guiGridListAddRow(GRID) 
    end 
      
    guiGridListSetItemText(GRID, 1, 1, "spawn", false, false) 
    guiGridListSetItemText(GRID, 2, 1, "bank", false, false) 
      
    Select = guiCreateButton(0.05, 0.75, 1, 0.1, "Select!", true, Wind) 
    Close = guiCreateButton(0.05, 0.86, 1, 0.1, "Close", true, Wind) 
      
    addEventHandler("onClientGUIClick", root, 
        function() 
            if (source == Select) then 
                local row, col = guiGridListGetSelectedItem(GRID) 
                local SS = guiGridListGetItemText(GRID, row, col) 
                if (SS) then 
                    guiSetVisible(Wind, false) 
                    guiSetInputEnabled(false) 
                    if (SS == "spawn") then 
                        triggerServerEvent("spawn", localPlayer, "spawns") 
                    elseif (SS == "bank") then 
                        triggerServerEvent("spawn2", localPlayer, "spawns2") 
                    elseif (source == Close) then 
                        guiSetVisible(Wind, false) 
                        guiSetInputEnabled(false) 
                    end 
                end 
            end 
        end, false 
    ) 
      
    function showGui() 
        guiSetVisible (Wind, true) 
        showCursor (true) 
    end 
    bindKey("F2", "down", showGui) 
      
    addEvent("open", true) 
    addEventHandler("open", root, 
        function(state) 
            if (state == "true") then 
                guiSetVisible(Wind, true) 
                guiSetInputEnabled(true) 
            elseif (state == "false") then 
                guiSetVisible(Wind, false) 
                guiSetInputEnabled(false) 
            end 
        end 
    ) 
     
    print("Works!") 
end 
  
function addEvent() 
    return true 
end 
  
function guiGetScreenSize() 
    return 1920, 1080 
end 
  
function guiCreateWindow() 
    return true 
end 
  
function guiWindowSetSizable() 
    return true 
end 
  
function guiSetVisible() 
    return true 
end 
  
function guiCreateGridList() 
    return true 
end 
  
function guiGridListAddColumn() 
    return true 
end 
  
function guiGridListAddRow() 
    return true 
end 
  
function guiGridListSetItemText() 
    return true 
end 
  
function guiCreateButton() 
    return true 
end 
  
function guiSetProperty() 
    return true 
end 
  
function addEventHandler() 
    return true 
end 
  
function guiGridListGetSelectedItem() 
    return true 
end 
  
function guiGridListGetItemText() 
    return true 
end 
  
function guiSetInputEnabled() 
    return true 
end 
  
function triggerServerEvent() 
    return true 
end 
  
function showCursor() 
    return true 
end 
  
function bindKey() 
    return true 
end 
  
runScript() 

thank you so much

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...