undefined Posted May 4, 2014 Posted May 4, 2014 (edited) Hi Guys. I have a problem. Im made a mission system. I want to show this task gui system. Im make this but it's only say "asd". Im how to fix it? Client-Side-Part if (allMissions[1]) then outputChatBox ("You take the Mission I") elseif (allMissions[2]) then outputChatBox ("You take the Mission II") end All Code local allMissions = { [1]={ ["name"] = "Mission I", ["info"] = "asefafasf asd asgd asd aysda shgd asd sdjf fs fh" }, [2]={ ["name"] = "Mission II", ["info"] = "asDFsdf sdsD Fasdfas fdfH:SD dfG sdfg" } } addEventHandler("onClientResourceStart", resourceRoot, function() missionWindow = guiCreateWindow(238, 190, 402, 264, "Mission Panel", false) guiSetVisible(missionWindow, false) guiWindowSetSizable(missionWindow, false) guiSetAlpha(missionWindow, 0.65) nameGrid = guiCreateGridList(10, 26, 122, 228, false, missionWindow) guiGridListAddColumn(nameGrid, "Missions", 0.7) local mrow = guiGridListAddRow(nameGrid) guiGridListSetItemText(nameGrid,mrow,1,"Missions",true,false) myFont = guiCreateFont( "font.otf", 12 ) --guiSetProperty (nameGrid, "#Font", "default-bold-small" ) infoGrid = guiCreateGridList(142, 26, 250, 180, false, missionWindow) infoLab = guiCreateLabel(10, 40, 230, 130, "", false, infoGrid) guiSetFont(infoLab, "default-bold-small") guiLabelSetHorizontalAlign(infoLab, "center", true) yesnoGrid = guiCreateGridList(0, 10, 230, 120, false, infoLab) guiSetVisible(yesnoGrid, false) yesnoLab = guiCreateLabel(10, 10, 210, 66, "Do you want to be continue?", false, yesnoGrid) guiSetFont(yesnoLab, myFont) guiLabelSetHorizontalAlign(yesnoLab, "center", true) guiLabelSetVerticalAlign(yesnoLab, "center") yes = guiCreateButton(20, 86, 66, 24, "Yes", false, yesnoGrid) guiSetFont(yes, "default-bold-small") no = guiCreateButton(144, 86, 66, 24, "No", false, yesnoGrid) guiSetFont(no, "default-bold-small") infoNameLab = guiCreateLabel(10, 9, 230, 21, "", false, infoGrid) guiSetFont(infoNameLab, myFont) guiLabelSetHorizontalAlign(infoNameLab, "center", true) for i=1,#allMissions do local row = guiGridListAddRow(nameGrid) guiGridListSetItemText(nameGrid,row,1,allMissions[i].name,false,false) end addEventHandler("onClientGUIClick",nameGrid,function() local row = guiGridListGetSelectedItem(nameGrid) if(row > 0) then local name = guiGridListGetItemText(nameGrid,row,1) guiSetText(infoLab,allMissions[row].info) guiSetText(infoNameLab,allMissions[row].name) end end, false) take = guiCreateButton(142, 223, 98, 31, "Take Mission", false, missionWindow) guiSetFont(take, "default-bold-small") close = guiCreateButton(294, 223, 98, 31, "Close", false, missionWindow) guiSetFont(close, "default-bold-small") end ) function select() if (source == close) then guiSetVisible(missionWindow,false) guiSetVisible (yesnoGrid, false) showCursor(false) elseif (source == take) then guiSetVisible (yesnoGrid, true) elseif (source == no) then guiSetVisible (yesnoGrid, false) elseif (source == yes) then guiSetVisible (missionWindow, false) guiSetVisible (yesnoGrid, false) showCursor(false) if (allMissions[1]) then outputChatBox ("You take the Mission I") elseif (allMissions[2]) then outputChatBox ("You take the Mission II") end end end addEventHandler("onClientGUIClick", root, select) function open() if (guiGetVisible (missionWindow) == true) then guiSetVisible(missionWindow, false) showCursor(false) elseif (guiGetVisible (missionWindow) == false) then guiSetVisible(missionWindow, true) showCursor(true) end end bindKey ("R", "down", open) Help Pls... Edited May 5, 2014 by Guest
undefined Posted May 4, 2014 Author Posted May 4, 2014 Im chose the "Mission I". It's say "You take the Mission I". And im chose the "Mission II". It's say again "You take the Mission I". But it must say "You take the Mission II". My Code local allMissions = { [1]={ ["name"] = "Mission I", ["info"] = "asefafasf asd asgd asd aysda shgd asd sdjf fs fh" }, [2]={ ["name"] = "Mission II", ["info"] = "asDFsdf sdsD Fasdfas fdfH:SD dfG sdfg" } } ... ... ... if (allMissions[1]) then outputChatBox ("You take the Mission I") elseif (allMissions[2]) then outputChatBox ("You take the Mission II") end Help me!!!
undefined Posted May 5, 2014 Author Posted May 5, 2014 Now this is my all code. outputchatbox will use instead triggerServerEvent. My problem is this; "1" is selected, say "You take the Mission I". "2" is selected, say "You take the Mission I". But it must say "You take the Mission II" If i fix these problems, I'm going to write other codes. Help pls
codeluaeveryday Posted May 6, 2014 Posted May 6, 2014 Sorry that Castillo couldn't help you. I have to admit your code makes it hard to understand, please try to clean it up next time. local allMissions = { [1]={ ["name"] = "Mission I", ["info"] = "asefafasf asd asgd asd aysda shgd asd sdjf fs fh" }, [2]={ ["name"] = "Mission II", ["info"] = "asDFsdf sdsD Fasdfas fdfH:SD dfG sdfg" } } addEventHandler("onClientResourceStart", resourceRoot, function() missionWindow = guiCreateWindow(238, 190, 402, 264, "Mission Panel", false) guiSetVisible(missionWindow, false) guiWindowSetSizable(missionWindow, false) guiSetAlpha(missionWindow, 0.65) nameGrid = guiCreateGridList(10, 26, 122, 228, false, missionWindow) guiGridListAddColumn(nameGrid, "Missions", 0.7) local mrow = guiGridListAddRow(nameGrid) guiGridListSetItemText(nameGrid,mrow,1,"Missions",true,false) myFont = guiCreateFont( "font.otf", 12 ) --guiSetProperty (nameGrid, "#Font", "default-bold-small" ) infoGrid = guiCreateGridList(142, 26, 250, 180, false, missionWindow) infoLab = guiCreateLabel(10, 40, 230, 130, "", false, infoGrid) guiSetFont(infoLab, "default-bold-small") guiLabelSetHorizontalAlign(infoLab, "center", true) yesnoGrid = guiCreateGridList(0, 10, 230, 120, false, infoLab) guiSetVisible(yesnoGrid, false) yesnoLab = guiCreateLabel(10, 10, 210, 66, "Do you want to be continue?", false, yesnoGrid) guiSetFont(yesnoLab, myFont) guiLabelSetHorizontalAlign(yesnoLab, "center", true) guiLabelSetVerticalAlign(yesnoLab, "center") yes = guiCreateButton(20, 86, 66, 24, "Yes", false, yesnoGrid) guiSetFont(yes, "default-bold-small") no = guiCreateButton(144, 86, 66, 24, "No", false, yesnoGrid) guiSetFont(no, "default-bold-small") infoNameLab = guiCreateLabel(10, 9, 230, 21, "", false, infoGrid) guiSetFont(infoNameLab, myFont) guiLabelSetHorizontalAlign(infoNameLab, "center", true) for i=1,#allMissions do local row = guiGridListAddRow(nameGrid) guiGridListSetItemText(nameGrid,row,1,allMissions[i].name,false,false) end addEventHandler("onClientGUIClick",nameGrid,function() local row = guiGridListGetSelectedItem(nameGrid) if(row > 0) then local name = guiGridListGetItemText(nameGrid,row,1) guiSetText(infoLab,allMissions[row].info) guiSetText(infoNameLab,allMissions[row].name) end end, false) take = guiCreateButton(142, 223, 98, 31, "Take Mission", false, missionWindow) guiSetFont(take, "default-bold-small") close = guiCreateButton(294, 223, 98, 31, "Close", false, missionWindow) guiSetFont(close, "default-bold-small") end ) function select() if (source == close) then guiSetVisible(missionWindow,false) guiSetVisible (yesnoGrid, false) showCursor(false) elseif (source == take) then guiSetVisible (yesnoGrid, true) elseif (source == no) then guiSetVisible (yesnoGrid, false) elseif (source == yes) then guiSetVisible (missionWindow, false) guiSetVisible (yesnoGrid, false) showCursor(false) local row = guiGridListGetSelectedItem(nameGrid) if (allMissions[row]) then outputChatBox ("You have taken "..allMissions[row]["name"]) end end end addEventHandler("onClientGUIClick", root, select) function open() if (guiGetVisible (missionWindow) == true) then guiSetVisible(missionWindow, false) showCursor(false) elseif (guiGetVisible (missionWindow) == false) then guiSetVisible(missionWindow, true) showCursor(true) end end bindKey ("R", "down", open) you had: if (allMissions[1]) then outputChatBox ("You take the Mission I") elseif (allMissions[2]) then outputChatBox ("You take the Mission II") end I changed: local row = guiGridListGetSelectedItem(nameGrid) if (allMissions[row]) then outputChatBox ("You have taken "..allMissions[row]["name"]) end
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now