شوف انا سويت
Shop Clothes and Skin
تمام ؟
المود شغال 100%
فقط المشكلة ان الملابس ما تظهر عند الاشخاص
مثال يظهر عندو ان هو حاطط Shirt او Shoes
و مو ظاهر عندهم .
ملف client كامل
ملحوظة انا مو مستعمل server غير مسوي فيه الماركر و تريقر عشان يفتح اللوحة
-- Client
clothesshopStartWindow = guiCreateWindow(0.2862,0.0867,0.4175,0.3133,"",true)
guiSetVisible (clothesshopStartWindow,false)
guiWindowSetMovable(clothesshopStartWindow,false)
guiWindowSetSizable(clothesshopStartWindow,false)
clothesshopStartWindowLabel = guiCreateLabel(0.0299,0.133,0.9311,0.1277,"What do you want to change?",true,clothesshopStartWindow)
guiLabelSetColor(clothesshopStartWindowLabel,255,255,255)
guiLabelSetVerticalAlign(clothesshopStartWindowLabel,"center")
guiLabelSetHorizontalAlign(clothesshopStartWindowLabel,"center",false)
clothesshopStartWindowCJbutton = guiCreateButton(0.0778,0.3511,0.3653,0.3085,"CJ clothes",true,clothesshopStartWindow)
clothesshopStartWindowSkinButton = guiCreateButton(0.5389,0.3511,0.3653,0.3085,"Another skin",true,clothesshopStartWindow)
clothesshopStartWindowCloseButton = guiCreateButton(0.0808,0.7128,0.8204,0.1489,"Nothing, I'm just a noob.",true,clothesshopStartWindow)
clothesshopSkinWindow = guiCreateWindow(0.32,0.815,0.3613,0.1833,"Skin Selector",true)
guiSetVisible (clothesshopSkinWindow,false)
clothesshopSkinWindowManualEdit = guiCreateEdit(0.3322,0.6636,0.1799,0.2545,"",true,clothesshopSkinWindow)
guiEditSetMaxLength(clothesshopSkinWindowManualEdit,3)
clothesshopSkinWindowLabel = guiCreateLabel(0.0381,0.6909,0.2595,0.2,"Manual",true,clothesshopSkinWindow)
guiLabelSetColor(clothesshopSkinWindowLabel,255,255,255)
guiLabelSetVerticalAlign(clothesshopSkinWindowLabel,"center")
guiLabelSetHorizontalAlign(clothesshopSkinWindowLabel,"right",false)
guiSetFont(clothesshopSkinWindowLabel,"default-bold-small")
clothesshopSkinWindowLeft = guiCreateButton(0.0484,0.2364,0.4256,0.3545,"Previous skin",true,clothesshopSkinWindow)
clothesshopSkinWindowRight = guiCreateButton(0.5294,0.2364,0.4221,0.3545,"Next skin",true,clothesshopSkinWindow)
clothesshopSkinWindowButtonOK = guiCreateButton(0.5398,0.6727,0.1972,0.2364,"Ok!",true,clothesshopSkinWindow)
clothesshopSkinWindowButtonCancel = guiCreateButton(0.7543,0.6727,0.1972,0.2364,"Cancel",true,clothesshopSkinWindow)
clothesshopCJwindow = guiCreateWindow(0.0012,0.1867,0.2675,0.625,"Clothes Shop",true)
guiWindowSetSizable(clothesshopCJwindow,false)
guiWindowSetMovable(clothesshopCJwindow,false)
guiSetVisible (clothesshopCJwindow,false)
clothesshopCJwindowLabel = guiCreateLabel(0.0421,0.0693,0.8972,0.0827,"Use the buttons to \nchange your clothes",true,clothesshopCJwindow)
guiLabelSetColor(clothesshopCJwindowLabel,255,255,255)
guiLabelSetVerticalAlign(clothesshopCJwindowLabel,"center")
guiLabelSetHorizontalAlign(clothesshopCJwindowLabel,"center",false)
clothesshopCJwindowClothesGridlist = guiCreateGridList (0.0421,0.1813,0.9579,0.6167,true,clothesshopCJwindow)
guiGridListSetSelectionMode (clothesshopCJwindowClothesGridlist,0)
guiGridListAddColumn (clothesshopCJwindowClothesGridlist,"#",0.3)
guiGridListAddColumn (clothesshopCJwindowClothesGridlist,"Type",0.6)
for i,v in pairs ({{0,"Shirt"},{1,"Hair"},{2,"Trousers"},{3,"Shoes"},{13,"Necklaces"},{14,"Watches"},{15,"Glasses"},{16,"Hats"},{17,"Suits"}}) do
local row = guiGridListAddRow (clothesshopCJwindowClothesGridlist)
guiGridListSetItemText (clothesshopCJwindowClothesGridlist,row,1,tostring(v[1]),false,true)
guiGridListSetItemText (clothesshopCJwindowClothesGridlist,row,2,tostring(v[2]),false,false)
end
clothesshopCJwindowButtonOK = guiCreateButton(0.0421,0.904,0.4159,0.072,"Ok",true,clothesshopCJwindow)
clothesshopCJwindowLabel = guiCreateLabel(0.0421,0.8187,0.3411,0.064,"Edit button",true,clothesshopCJwindow)
guiLabelSetColor(clothesshopCJwindowLabel,255,255,255)
guiLabelSetVerticalAlign(clothesshopCJwindowLabel,"center")
guiLabelSetHorizontalAlign(clothesshopCJwindowLabel,"right",false)
clothesshopCJwindowButtonLeft = guiCreateButton(0.4112,0.8213,0.1542,0.0667,"<-",true,clothesshopCJwindow)
clothesshopCJwindowButtonRight = guiCreateButton(0.5888,0.8213,0.1542,0.0667,"->",true,clothesshopCJwindow)
addEventHandler ("onClientGUIChanged",getRootElement(),
function(theElement)
if (source == clothesshopSkinWindowManualEdit) then
if (tonumber (guiGetText (clothesshopSkinWindowManualEdit))) then
setElementModel (getLocalPlayer (),tonumber (guiGetText (clothesshopSkinWindowManualEdit)))
end
elseif (source == theNametagShopWindowRedEdit) or (source == theNametagShopWindowGreenEdit) or (source == theNametagShopWindowBlueEdit) then
guiLabelSetColor (theNametagShopWindowExampleTextLabel,tonumber(guiGetText (theNametagShopWindowRedEdit)),tonumber(guiGetText (theNametagShopWindowGreenEdit)),tonumber(guiGetText(theNametagShopWindowBlueEdit)))
end
end)
addEventHandler ("onClientGUIClick",getRootElement(),
function(button,state,absoluteX,absoluteY)
if (button == "left") then
if (source == clothesshopStartWindowCJbutton) then
cjTempTable = nil
cjTempTable = {}
for i=0,17 do
local tstr,mstr = getPedClothes
local tempTab = {i,tstr,mstr}
table.insert (cjTempTable,tempTab)
end
guiSetVisible (clothesshopStartWindow,false)
guiSetVisible (clothesshopCJwindow,true)
elseif (source == clothesshopStartWindowSkinButton) then
guiSetVisible (clothesshopStartWindow,false)
guiSetVisible (clothesshopCJwindow,false)
guiSetVisible (clothesshopSkinWindow,true)
elseif (source == clothesshopStartWindowCloseButton) then
guiSetVisible (clothesshopStartWindow,false)
guiSetVisible (clothesshopCJwindow,false)
showCursor (false,false)
guiSetInputEnabled (false)
elseif (source == clothesshopSkinWindowButtonOK) then
guiSetVisible (clothesshopStartWindow,false)
guiSetVisible (clothesshopSkinWindow,false)
guiSetVisible (clothesshopCJwindow,false)
showCursor (false,false)
guiSetInputEnabled (false)
elseif (source == clothesshopSkinWindowButtonCancel) then
guiSetVisible (clothesshopStartWindow,false)
guiSetVisible (clothesshopSkinWindow,false)
guiSetVisible (clothesshopCJwindow,false)
showCursor (false,false)
guiSetInputEnabled (false)
triggerServerEvent ("clothesShopClose",getLocalPlayer(),"skin-cancel")
elseif (source == clothesshopCJwindowButtonOK) then
local clothes = {}
for i=0,17 do
local t,m = getPedClothes (getLocalPlayer(),i)
if t and m then
table.insert (clothes,i .. "," .. t .. "," .. m)
end
end
guiSetVisible (clothesshopStartWindow,false)
guiSetVisible (clothesshopSkinWindow,false)
guiSetVisible (clothesshopCJwindow,false)
showCursor (false,false)
guiSetInputEnabled (false)
triggerServerEvent ("clothesShopClose",getLocalPlayer(),"save-cj",clothes)
elseif (source == EmploymentAgencyWindowCloseButton) then
guiSetVisible (EmploymentAgencyWindow,false)
showCursor (false,false)
guiSetInputEnabled (false)
elseif (source == clothesshopSkinWindowLeft) then
local skin = getElementModel (getLocalPlayer())
if (skin == 0) then setElementModel (getLocalPlayer(),312)
elseif (skin == 7) then setElementModel (getLocalPlayer(),2)
elseif (skin == 9) then setElementModel (getLocalPlayer(),7)
elseif (skin == 43) then setElementModel (getLocalPlayer(),41)
elseif (skin == 66) then setElementModel (getLocalPlayer(),64)
elseif (skin == 75) then setElementModel (getLocalPlayer(),73)
elseif (skin == 87) then setElementModel (getLocalPlayer(),85)
elseif (skin == 148) then setElementModel (getLocalPlayer(),118)
elseif (skin == 150) then setElementModel (getLocalPlayer(),148)
elseif (skin == 209) then setElementModel (getLocalPlayer(),207)
elseif (skin == 290) then setElementModel (getLocalPlayer(),288)
elseif (skin == 274) then setElementModel (getLocalPlayer(),272)
else setElementModel (getLocalPlayer(),skin -1)
end
elseif (source == clothesshopSkinWindowRight) then
local skin = getElementModel (getLocalPlayer())
if (skin == 312) then setElementModel (getLocalPlayer(),0)
elseif (skin == 2) then setElementModel (getLocalPlayer(),7)
elseif (skin == 7) then setElementModel (getLocalPlayer(),9)
elseif (skin == 41) then setElementModel (getLocalPlayer(),43)
elseif (skin == 64) then setElementModel (getLocalPlayer(),66)
elseif (skin == 73) then setElementModel (getLocalPlayer(),75)
elseif (skin == 85) then setElementModel (getLocalPlayer(),87)
elseif (skin == 118) then setElementModel (getLocalPlayer(),148)
elseif (skin == 148) then setElementModel (getLocalPlayer(),150)
elseif (skin == 207) then setElementModel (getLocalPlayer(),209)
elseif (skin == 288) then setElementModel (getLocalPlayer(),290)
elseif (skin == 272) then setElementModel (getLocalPlayer(),274)
else setElementModel (getLocalPlayer(),skin +1)
end
elseif (source == clothesshopCJwindowButtonLeft) then
if (getElementModel (getLocalPlayer()) == 0) then
local r,c = guiGridListGetSelectedItem (clothesshopCJwindowClothesGridlist)
if (r) then
local type = tonumber(guiGridListGetItemText (clothesshopCJwindowClothesGridlist,r,1))
if (type) then
local type,id = getPedIndexClothes (getLocalPlayer(),type)
setPedIndexClothes (getLocalPlayer(),type,id-1)
end
else
exports.js_infowindow:showInfoWindow ("Select the clothes you want to change!")
end
else
exports.js_infowindow:showInfoWindow ("You haven't got the CJ skin!\nGet that first before you go to get clothes!")
end
elseif (source == clothesshopCJwindowButtonRight) then
if (getElementModel (getLocalPlayer()) == 0) then
local r,c = guiGridListGetSelectedItem (clothesshopCJwindowClothesGridlist)
if (r) then
local type = tonumber(guiGridListGetItemText (clothesshopCJwindowClothesGridlist,r,1))
if (type) then
local type,id = getPedIndexClothes (getLocalPlayer(),type)
setPedIndexClothes (getLocalPlayer(),type,id+1)
end
else
exports.js_infowindow:showInfoWindow ("Select the clothes you want to change!")
end
else
exports.js_infowindow:showInfoWindow ("You haven't got the CJ skin!\nGet that first before you go to get clothes!")
end
end
end
end)
addEvent ("openClothesShop",true)
addEventHandler ("openClothesShop",getRootElement(),
function()
guiSetVisible (clothesshopStartWindow,true)
showCursor (true,true)
end)
function getPedIndexClothes (player,type)
local tstr,mstr = getPedClothes (player,type)
if (tstr) then
local type,index = getTypeIndexFromClothes (tstr,mstr)
return type,index
else
return type,0
end
end
function setPedIndexClothes (player,type,index)
if (index > 0) then
local tstr,mstr = getClothesByTypeIndex (type,index)
if tstr and mstr then
addPedClothes (root,tstr,mstr,type)
end
else
removePedClothes (player,type)
end
end