Hello i have a panel and i need to add image.. Help me..
Client.lua
localPlayer = getLocalPlayer()
rootElement = getRootElement()
players = getElementsByType ( "player" )
playername = getPlayerName(localPlayer)
GUIEditor_TabPanel = {}
GUIEditor_Tab = {}
GUIEditor_Button = {}
GUIEditor_Label = {}
GUIEditor_Grid = {}
Mainwnd = guiCreateWindow(120,129,532,295,"Welcome ".. playername .." Stats Panel",false)
guiSetVisible(Mainwnd,false)
GUIEditor_TabPanel[1] = guiCreateTabPanel(9,19,408,267,false,Mainwnd)
GUIEditor_Tab[1] = guiCreateTab("User",GUIEditor_TabPanel[1])
GUIEditor_Label[1] = guiCreateLabel(0.0147,0.0412,0.9608,0.0658,"You have N/A cash.",true,GUIEditor_Tab[1])
GUIEditor_Label[2] = guiCreateLabel(0.0147,0.1317,0.9608,0.0658,"Finished N/A Wins N/A, is N/A%",true,GUIEditor_Tab[1])
GUIEditor_Label[3] = guiCreateLabel(0.0147,0.2305,0.9608,0.0658,"You have N/A points",true,GUIEditor_Tab[1])
GUIEditor_Label[4] = guiCreateLabel(0.0172,0.3169,0.9608,0.0658,"Time in server (HH:MM) N/A:N/A",true,GUIEditor_Tab[1])
GUIEditor_Tab[2] = guiCreateTab("Shop",GUIEditor_TabPanel[1])
GUIEditor_Label[5] = guiCreateLabel(10,9,384,24,"* use buttonts or command /buy [item]",false,GUIEditor_Tab[2])
GUIEditor_Label[7] = guiCreateLabel(105,51,86,17,"Nitro $50,000",false,GUIEditor_Tab[2])
GUIEditor_Label[8] = guiCreateLabel(105,84,86,17,"Fix $10,000",false,GUIEditor_Tab[2])
GUIEditor_Label[9] = guiCreateLabel(105,117,86,17,"God $800,000",false,GUIEditor_Tab[2])
GUIEditor_Label[10] = guiCreateLabel(105,150,95,17,"Ramp $500,000",false,GUIEditor_Tab[2])
GUIEditor_Label[11] = guiCreateLabel(298,51,107,17,"Flip $10,000",false,GUIEditor_Tab[2])
GUIEditor_Label[12] = guiCreateLabel(298,84,107,17,"Invis $100,000",false,GUIEditor_Tab[2])
GUIEditor_Label[13] = guiCreateLabel(298,117,107,17,"Mine $100,000",false,GUIEditor_Tab[2])
GUIEditor_Label[14] = guiCreateLabel(298,150,107,17,"Hay $100,000",false,GUIEditor_Tab[2])
Nitrobutton = guiCreateButton(9,49,92,22,"Nitro",false,GUIEditor_Tab[2])
Repairbutton = guiCreateButton(9,82,92,22,"Fix",false,GUIEditor_Tab[2])
Godbutton = guiCreateButton(9,115,92,22,"God",false,GUIEditor_Tab[2])
Rampbutton = guiCreateButton(9,148,92,22,"Ramp",false,GUIEditor_Tab[2])
Flipbutton = guiCreateButton(203,49,92,22,"Flip",false,GUIEditor_Tab[2])
Invbutton = guiCreateButton(203,82,92,22,"invicible",false,GUIEditor_Tab[2])
Minebutton = guiCreateButton(203,115,92,22,"Mine",false,GUIEditor_Tab[2])
Haybutton = guiCreateButton(203,148,92,22,"Hay",false,GUIEditor_Tab[2])
GUIEditor_Tab[3] = guiCreateTab("Config",GUIEditor_TabPanel[1])
GUIEditor_Label[6] = guiCreateLabel(9,11,153,15,"Name Color Chat Color",false,GUIEditor_Tab[3])
nColorEdit1 = guiCreateEdit(6,34,77,26,"",false,GUIEditor_Tab[3])
guiEditSetMaxLength ( nColorEdit1, 6 )
GUIEditor_Label[7] = guiCreateLabel(9,69,59,19,"Color Auto",false,GUIEditor_Tab[3])
carColoredit = guiCreateEdit(6,89,77,26,"",false,GUIEditor_Tab[3])
skinsGrid = guiCreateGridList(0.5564,0.2963,0.424,0.6749,true,GUIEditor_Tab[3])
guiGridListAddColumn(skinsGrid,"Name",0.70)
GUIEditor_Label[8] = guiCreateLabel(180,40,71,18," Skin",false,GUIEditor_Tab[3])
Skinedit = guiCreateEdit(253,37,77,26,"",false,GUIEditor_Tab[3])
nColorEdit2 = guiCreateEdit(87,34,77,26,"",false,GUIEditor_Tab[3])
guiEditSetMaxLength ( nColorEdit2, 6 )
ccbutton = guiCreateButton(87,89,75,26,"Color Car",false,GUIEditor_Tab[3])
GUIEditor_Label[9] = guiCreateLabel(10,122,92,20,"Login message",false,GUIEditor_Tab[3])
MessageEdit = guiCreateEdit(7,141,159,26,"",false,GUIEditor_Tab[3])
GUIEditor_Label[10] = guiCreateLabel(10,177,164,19,"Player Info Age/Sex",false,GUIEditor_Tab[3])
contactedit = guiCreateEdit(7,197,77,26,"",false,GUIEditor_Tab[3])
agesexedit = guiCreateEdit(88,197,77,26,"",false,GUIEditor_Tab[3])
GUIEditor_Button[2] = guiCreateButton(0.4191,0.6996,0.1152,0.107,"Update",true,GUIEditor_Tab[3])
GUIEditor_Button[3] = guiCreateButton(0.8309,0.1605,0.1373,0.0864,"Put",true,GUIEditor_Tab[3])
GUIEditor_Button[1] = guiCreateButton(425,253,98,33,"Close",false,Mainwnd)
carColorWindow = guiCreateWindow(0.2871,0.2083,0.5205,0.4128,"Colors",true)
guiWindowSetSizable(carColorWindow,false)
guiSetVisible(carColorWindow,false)
guiCreateStaticImage(0.0169,0.0694,0.9662,0.776,"images/Colors.png",true,carColorWindow)
closeCarColor = guiCreateButton(0.3977,0.9054,0.2795,0.0631,"close",true,carColorWindow)
function populateGridlist()
local rootnode = xmlLoadFile("skins.xml")
if rootnode then
for _,group in ipairs">ipairs">ipairs(xmlNodeGetChildren(rootnode)) do
local row = guiGridListAddRow(skinsGrid)
local name = xmlNodeGetAttribute(group,"type">type")
guiGridListSetItemText(skinsGrid,row,1,name,true,false)
for _,skin in ipairs">ipairs(xmlNodeGetChildren(group)) do
row = guiGridListAddRow(skinsGrid)
name = xmlNodeGetAttribute(skin,"name")
local id = xmlNodeGetAttribute(skin,"model")
guiGridListSetItemText(skinsGrid,row,1,name,false,false)
guiGridListSetItemData(skinsGrid,row,1,tostring">tostring">tostring(id))
end
end
xmlUnloadFile(rootnode)
end
end
function createSkinHandler(button,state)
if button == "left" and state == "up" then
local row,col = guiGridListGetSelectedItem(skinsGrid)
if row and col and row ~= -1 and col ~= -1 then
local selected = guiGridListGetItemData(skinsGrid,row,col)
skinid = tonumber">tonumber(selected)
triggerServerEvent("setSkinFromGUI",localPlayer,localPlayer,skinid)
outputChatBox ( "Skin changed to: ".. tostring">tostring">tostring ( skinid ) .. ".", 0,255,0 )
else
outputChatBox("Invalid arguments.",255,12,15)
end
end
end
function makeVisible()
get = guiGetVisible(Mainwnd)
if get == true then
guiSetVisible(Mainwnd,false)
showCursor(false)
guiGridListClear(skinsGrid)
removeEventHandler( "onClientGUIDoubleClick", skinsGrid, createSkinHandler, false );
else
guiSetVisible(Mainwnd,true)
showCursor(true)
populateGridlist()
addEventHandler( "onClientGUIDoubleClick", skinsGrid, createSkinHandler, false );
triggerServerEvent("getPlayerDetails",localPlayer,localPlayer)
contact = getElementData(localPlayer,"contact")
ageNsex = getElementData(localPlayer,"ageNsex")
message = getElementData(localPlayer,"message")
skin = getElementData(localPlayer,"skin")
nc = getElementData(localPlayer,"NC")
cc = getElementData(localPlayer,"CC")
carcolor = getElementData(localPlayer,"CarColor")
if contact and ageNsex and message and skin and nc and cc and carcolor then
guiSetText(contactedit,contact)
guiSetText(agesexedit,ageNsex)
guiSetText(MessageEdit,message)
guiSetText(Skinedit,skin)
guiSetText(nColorEdit1,nc)
guiSetText(nColorEdit2,cc)
guiSetText(carColoredit,carcolor)
money = getPlayerMoney(localPlayer)
guiSetText(GUIEditor_Label[1],"Currently you have ".. money .." in cash.")
end
end
end
bindKey("F1","down",makeVisible)
local KDR_DECIMAL_PLACES = 2
function round(num, idp)
local mult = 10^(idp or 0)
return math.floor(num * mult + 0.5) / mult
end
addEvent("returnPlayerDetails",true)
addEventHandler("returnPlayerDetails",root,
function (h,m,wins,attempts,points)
if h and m then
guiSetText(GUIEditor_Label[4],"Time spent on server (".. tostring">tostring(h) ..":".. tostring">tostring">tostring(m) ..")")
end
if points then
guiSetText(GUIEditor_Label[3],"You've earned ".. tostring">tostring(points) .." points")
end
if wins and attempts then
local kdr = round(wins) / attempts, KDR_DECIMAL_PLACES
guiSetText(GUIEditor_Label[2],"Played ".. tostring">tostring(attempts) .." matches and won ".. tostring">tostring(wins) .." which is ".. kdr .."%")
end
end)
function isColorCode(str)
if (string.find(str, "^[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]$")) then
return true
else
return false
end
end
addEventHandler("onClientGUIClick",rootElement,
function ()
if source == GUIEditor_Button[1] then
guiSetVisible(Mainwnd,false)
showCursor(false)
elseif source == GUIEditor_Button[2] then
contact = guiGetText(contactedit)
ageNsex = guiGetText(agesexedit)
loginMsg = guiGetText(MessageEdit)
NC = guiGetText(nColorEdit1)
CC = guiGetText(nColorEdit2)
color = guiGetText(carColoredit)
if isColorCode(NC) == true or isColorCode(CC) == true then
triggerServerEvent("setInfo",localPlayer,localPlayer,contact,ageNsex,loginMsg,NC,CC,color)
else
outputChatBox("Thats not a valid HEX color!",255,0,0)
end
elseif source == GUIEditor_Button[3] then
skin = guiGetText(Skinedit)
triggerServerEvent("setSkin",localPlayer,localPlayer,skin)
elseif source == ccbutton then
guiSetVisible(carColorWindow,true)
guiBringToFront(carColorWindow,true)
elseif source == closeCarColor then
guiSetVisible(carColorWindow,false)
end
end)
function onGuiClick (button, state, absoluteX, absoluteY)
if (source == Flipbutton) then
triggerServerEvent ("buyFlip", getLocalPlayer())
elseif (source == Minebutton) then
triggerServerEvent ("buymine", getLocalPlayer())
elseif (source == Haybutton) then
triggerServerEvent ("buyHay", getLocalPlayer())
elseif (source == Rampbutton) then
triggerServerEvent ("buyramp", getLocalPlayer())
elseif (source == Repairbutton) then
triggerServerEvent ("buyfix", getLocalPlayer())
elseif (source == Nitrobutton) then
triggerServerEvent ("buynitro", getLocalPlayer())
elseif (source == Godbutton) then
triggerServerEvent ("buygod", getLocalPlayer())
elseif (source == Invbutton) then
triggerServerEvent ("buyInvisible", getLocalPlayer())
end
end
addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick)