Kenix Posted April 11, 2011 Author Posted April 11, 2011 I KNOW !!! This !!! addEventHandler( "onClientResourceStart", getResourceRootElement(getThisResource()), function() startShowingShopLevelMenu() bindKey ( "F2", "down", function( ) if (guiGetVisible(MainWindowLevel) == false) then guiSetVisible(MainWindowLevel,true) elseif (guiGetVisible(MainWindowLevel) == true) then guiSetVisible(MainWindowLevel,false) showCursor(false) end end ) end) AND THIS ! function startShowingShopLevelMenu() showCursor(true) GUIEditor_Window = {} GUIEditor_Grid = {} MainWindowLevel = guiCreateWindow(0.2234,0.0586,0.5969,0.9102,"New Skills Shop",true) MainButton = guiCreateButton(0.1289,0.9418,0.6974,0.0370,"Buy Skill",true,MainWindowLevel) MainGrid = guiCreateGridList(0.0419,0.0354,0.9058,0.8970,true,MainWindowLevel) guiGridListSetSelectionMode(MainGrid,1) guiGridListAddColumn(MainGrid,"ID",0.2) guiGridListAddColumn(MainGrid,"Name",0.2) guiGridListAddColumn(MainGrid,"$",0.2) guiGridListAddColumn(MainGrid,"Level",0.2) guiGridListAddColumn(MainGrid,"Status",0.2) if ( skillsID ) then if getElementData(getLocalPlayer(),"SkillBuy") == tonumber(skillsID) then outputChatBox("get element data") local textAddSkill = guiGridListSetItemText(MainGrid,tonumber(skillsID),5,"purchased",false,false) local textAddSkill2 = guiGridListSetItemColor (MainGrid,tonumber(skillsID),5,0,255,0) outputChatBox("text add "..tostring(textAddSkill).." , "..tostring(textAddSkill2)) end end guiSetVisible(MainWindowLevel, false ) addEventHandler ("onClientGUIClick", MainButton, onClientPlayerSkillBuy) for i,v in ipairs (skillsLevelsTable) do local row21 = guiGridListAddRow (MainGrid) guiGridListSetItemText (MainGrid, row21, 1, v[1], false, true) guiGridListSetItemText (MainGrid, row21, 2, v[2], false, true) guiGridListSetItemText (MainGrid, row21, 3, v[3], false, true) guiGridListSetItemText (MainGrid, row21, 4, v[4], false, true) guiGridListSetItemText (MainGrid, row21, 5, v[5], false, true) guiGridListSetItemText (MainGrid, row21, 6, v[6], false, true) end guiSetVisible( MainWindowLevel , false ) end Sorry for SHIFT but I already answered to your question 2 times. This code create the gui and hide it at the start and then just use F2 All thanks dude I just do not quite understand =) it works.
Kenix Posted April 16, 2011 Author Posted April 16, 2011 So this question is solved but I need to make this text is saved but not added at the entrance to gridList. for save function ShopLevelSystemLogin() local account = getPlayerAccount(source) if (account) then local GetDataSkills = getAccountData( account, "SkillBuy1" ) if (GetDataSkills) then setElementData ( source, "SkillBuy", GetDataSkills ) outputDebugString("set shop level : " ..tostring(GetDataSkills)) end end end addEventHandler("onPlayerLogin", getRootElement(), ShopLevelSystemLogin) function ShopLevelSystemQuit() local account = getPlayerAccount(source) if (account) then local SaveShopLevel = getElementData(source,"SkillBuy") setAccountData (account,"SkillBuy1",SaveShopLevel) outputDebugString("save shop level : " ..tostring(SaveShopLevel)) end end addEventHandler("onPlayerQuit", getRootElement(),ShopLevelSystemQuit) client if ( skillsID ) then if getElementData(getLocalPlayer(),"SkillBuy") == tonumber(skillsID) then outputChatBox("get element data") local textAddSkill = guiGridListSetItemText(MainGrid,tonumber(skillsID),5,"purchased",false,false) local textAddSkill2 = guiGridListSetItemColor (MainGrid,tonumber(skillsID),5,0,255,0) outputChatBox("text add "..tostring(textAddSkill).." , "..tostring(textAddSkill2).." , "..tostring(getElementData(getLocalPlayer(),"SkillBuy"))) end end Actually, I need to add text to GridList at login
Moderators Citizen Posted April 19, 2011 Moderators Posted April 19, 2011 Can you give us the full client-side please ? Because there are a lot of parts everywhere. Thanks in advance
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