Jump to content

clothes Xml


Dolinho

Recommended Posts

i want to use xml to avoid adding clothes to stay on the panel.

only I know not use xml someone help me? :oops:

Client:

function replaceTXD() 
txd = engineLoadTXD("bbjackrim.txd") 
engineImportTXD( txd, 30239) 
end 
addEventHandler("onClientResourceStart", resourceRoot, replaceTXD) 
  
  
local marker = createMarker( 662.257, -1864.015, 4.461, "Cylinder", 1.5, 0, 255, 0, 150) 
  
function guiMyCwindow(w,h,t) 
      local x,y = guiGetScreenSize() 
      return guiCreateWindow((x-w)/1,(y-h)/2,w,h,t,false) 
end 
      
    Clothers = guiMyCwindow(470,490,"Roupa para o CJ") 
    guiSetAlpha(Clothers, 1) 
    guiSetVisible(Clothers, false) 
     
     
  
     
     
     
    air = guiCreateButton(255,455,305,25,"Sair",false,Clothers) 
    guiSetProperty(air, "NormalTextColour", "FFFF0000") 
    guiSetFont(air,"default-bold-small") 
     
    aire = guiCreateButton(255,420,305,25,"Colocar esta item",false,Clothers) 
    guiSetFont(aire,"default-bold-small") 
     
     
    --clothes 
    Drawclothes = guiCreateGridList(10, 22, 240, 500, false, Clothers) 
    players = guiGridListAddColumn(Drawclothes,"Roupas personalizadas para cj",0.85)   
     
for i = 1, 90 do 
    guiGridListAddRow(Drawclothes) 
end  
guiGridListSetItemText(Drawclothes,0,1,"Shirt player_torso (sem camisa)",false,false)    
guiGridListSetItemText(Drawclothes,1,1,"Shirt vestblack (Regata Preta)",false,false)         
guiGridListSetItemText(Drawclothes,2,1,"Shirt vest (Regata Branca)",false,false)     
guiGridListSetItemText(Drawclothes,3,1,"Shirt tshirt2horiz (Camisa Listrada)",false,false)   
guiGridListSetItemText(Drawclothes,4,1,"Shirt tshirtwhite (Camisa Branca)",false,false)  
guiGridListSetItemText(Drawclothes,5,1,"Shirt tshirtilovels (Camisa I Love LS)",false,false)     
guiGridListSetItemText(Drawclothes,6,1,"Shirt tshirtblunts (Camisa da Homies)",false,false)  
guiGridListSetItemText(Drawclothes,7,1,"Shirt shirtbplaid (Camisa Chadrez Red)",false,false)     
guiGridListSetItemText(Drawclothes,8,1,"Shirt shirtbcheck (Camisa C.. Azul)",false,false)    
guiGridListSetItemText(Drawclothes,9,1,"Shirt field (Camisa de Campo)",false,false)  
guiGridListSetItemText(Drawclothes,10,1,"Shirt tshirterisyell (Camisa Verde)",false,false)   
guiGridListSetItemText(Drawclothes,11,1,"Shirt tshirterisorn (Camisa Laranja)",false,false)  
guiGridListSetItemText(Drawclothes,12,1,"Shirt trackytop2eris (Camisa Style)",false,false)   
guiGridListSetItemText(Drawclothes,13,1,"Shirt bbjackrim (Blusa Red)",false,false)   
guiGridListSetItemText(Drawclothes,14,1,"Shirt bballjackrstar (Blusa RS)",false,false)   
guiGridListSetItemText(Drawclothes,15,1,"Shirt baskballdrib (baskball Red)",false,false) 
guiGridListSetItemText(Drawclothes,16,1,"Shirt baskballrim (baskball Branca)",false,false) 
guiGridListSetItemText(Drawclothes,17,1,"Shirt sixtyniners (Camisa Azul)",false,false) 
guiGridListSetItemText(Drawclothes,18,1,"Shirt bandits (Camisa de baseball)",false,false) 
guiGridListSetItemText(Drawclothes,19,1,"Shirt tshirtprored (Camisa Pro Red)",false,false) 
guiGridListSetItemText(Drawclothes,20,1,"Shirt trackytop1pro (Camisa Pro Blk)",false,false) 
guiGridListSetItemText(Drawclothes,21,1,"Shirt tshirtproblk (Camisa Pro 1)",false,false) 
guiGridListSetItemText(Drawclothes,22,1,"Shirt hockeytop (Camisa de hockey)",false,false) 
guiGridListSetItemText(Drawclothes,23,1,"Shirt bbjersey (Camisa de Pro Verde)",false,false) 
guiGridListSetItemText(Drawclothes,24,1,"Shirt shellsuit (Camisa Baitola)",false,false) 
guiGridListSetItemText(Drawclothes,25,1,"Shirt tshirtheatwht (Camisa Branca)",false,false) 
guiGridListSetItemText(Drawclothes,26,1,"Shirt tshirtbobomonk (Camisa Monk)",false,false) 
guiGridListSetItemText(Drawclothes,27,1,"Shirt tshirtbobored (Camisa Red 80)",false,false) 
guiGridListSetItemText(Drawclothes,28,1,"Shirt tshirtbase5 (Camisa Branca 5)",false,false) 
guiGridListSetItemText(Drawclothes,29,1,"Shirt tshirtsuburb (Camisa SubUrban)",false,false) 
guiGridListSetItemText(Drawclothes,30,1,"Shirt hoodyamerc (Camisa Amerc)",false,false) 
guiGridListSetItemText(Drawclothes,31,1,"Shirt hoodyabase5 (Camisa Base 5)",false,false) 
guiGridListSetItemText(Drawclothes,32,1,"Shirt hoodyarockstar (Camisa RS Branca)",false,false) 
guiGridListSetItemText(Drawclothes,33,1,"Shirt wcoatblue (Camisa Coat Blue)",false,false) 
  
function click1() 
local row,col = guiGridListGetSelectedItem ( Drawclothes ) 
if source == aire then 
if ( row == 0 ) and ( col == 1 ) then 
triggerServerEvent("helmetCapacete",localPlayer) 
elseif ( row == 1 ) and ( col == 1 ) then 
triggerServerEvent("helmetCapacete1",localPlayer) 
elseif ( row == 2 ) and ( col == 1 ) then 
triggerServerEvent("helmetCapacete2",localPlayer) 
elseif ( row == 3 ) and ( col == 1 ) then 
triggerServerEvent("helmetCapacete3",localPlayer) 
elseif ( row == 4 ) and ( col == 1 ) then 
triggerServerEvent("helmetCapacete4",localPlayer) 
elseif ( row == 5 ) and ( col == 1 ) then 
triggerServerEvent("helmetCapacete5",localPlayer) 
elseif ( row == 6 ) and ( col == 1 ) then 
triggerServerEvent("helmetCapacete6",localPlayer) 
elseif ( row == 7 ) and ( col == 1 ) then 
triggerServerEvent("helmetCapacete7",localPlayer) 
elseif ( row == 8 ) and ( col == 1 ) then 
triggerServerEvent("helmetCapacete8",localPlayer) 
elseif ( row == 9 ) and ( col == 1 ) then 
triggerServerEvent("helmetCapacete9",localPlayer) 
elseif ( row == 10 ) and ( col == 1 ) then 
triggerServerEvent("helmetCapacete10",localPlayer) 
elseif ( row == 11 ) and ( col == 1 ) then 
triggerServerEvent("helmetCapacete11",localPlayer) 
elseif ( row == 12 ) and ( col == 1 ) then 
triggerServerEvent("helmetCapacete12",localPlayer) 
elseif ( row == 13 ) and ( col == 1 ) then 
triggerServerEvent("helmetCapacete13",localPlayer) 
elseif ( row == 14 ) and ( col == 1 ) then 
triggerServerEvent("helmetCapacete14",localPlayer) 
elseif ( row == 15 ) and ( col == 1 ) then 
triggerServerEvent("helmetCapacete15",localPlayer) 
elseif ( row == 16 ) and ( col == 1 ) then 
triggerServerEvent("helmetCapacete16",localPlayer) 
elseif ( row == 17 ) and ( col == 1 ) then 
triggerServerEvent("helmetCapacete17",localPlayer) 
elseif ( row == 18 ) and ( col == 1 ) then 
triggerServerEvent("helmetCapacete18",localPlayer) 
elseif ( row == 19 ) and ( col == 1 ) then 
triggerServerEvent("helmetCapacete19",localPlayer) 
elseif ( row == 20 ) and ( col == 1 ) then 
triggerServerEvent("helmetCapacete20",localPlayer) 
elseif ( row == 21 ) and ( col == 1 ) then 
triggerServerEvent("helmetCapacete21",localPlayer) 
elseif ( row == 22 ) and ( col == 1 ) then 
triggerServerEvent("helmetCapacete22",localPlayer) 
elseif ( row == 23 ) and ( col == 1 ) then 
triggerServerEvent("helmetCapacete23",localPlayer) 
elseif ( row == 24 ) and ( col == 1 ) then 
triggerServerEvent("helmetCapacete24",localPlayer) 
elseif ( row == 25 ) and ( col == 1 ) then 
triggerServerEvent("helmetCapacete25",localPlayer) 
elseif ( row == 26 ) and ( col == 1 ) then 
triggerServerEvent("helmetCapacete26",localPlayer) 
elseif ( row == 27 ) and ( col == 1 ) then 
triggerServerEvent("helmetCapacete27",localPlayer) 
elseif ( row == 28 ) and ( col == 1 ) then 
triggerServerEvent("helmetCapacete28",localPlayer) 
elseif ( row == 29 ) and ( col == 1 ) then 
triggerServerEvent("helmetCapacete29",localPlayer) 
elseif ( row == 30 ) and ( col == 1 ) then 
triggerServerEvent("helmetCapacete30",localPlayer) 
elseif ( row == 31 ) and ( col == 1 ) then 
triggerServerEvent("helmetCapacete31",localPlayer) 
elseif ( row == 32 ) and ( col == 1 ) then 
triggerServerEvent("helmetCapacete32",localPlayer) 
elseif ( row == 33 ) and ( col == 1 ) then 
triggerServerEvent("helmetCapacete33",localPlayer) 
end 
   end 
end  
addEventHandler('onClientGUIClick', root, click1) 
  
     
  
     
     
     
     
     
     
     
 function Battles(hitElement) 
         if getElementType(hitElement) == "player" and (hitElement == localPlayer) then 
              if not guiGetVisible(Clothers) then 
                   guiSetVisible(Clothers, true) 
                   showCursor(true) 
                   guiGridListClear(gridecvermelho) 
                   guiGridListClear(gridec) 
        end 
    end 
end 
addEventHandler("onClientMarkerHit", marker, Battles) 
function Battle() 
guiSetVisible(Clothers, false) 
showCursor(false) 
end 
addEventHandler("onClientGUIClick", air , Battle, false) 

Server:

function joinPilot() 
        addPedClothes ( source, "player_torso", "torso", 0 )
end
addEvent("helmetCapacete", true)
addEventHandler("helmetCapacete",root,joinPilot)
 
function joinPilot()
        addPedClothes ( source, "vestblack", "vest", 0 )
end
addEvent("helmetCapacete1", true)
addEventHandler("helmetCapacete1",root,joinPilot)
 
function joinPilot()
        addPedClothes ( source, "vest", "vest", 0 )
end
addEvent("helmetCapacete2", true)
addEventHandler("helmetCapacete2",root,joinPilot)
 
function joinPilot()
        addPedClothes ( source, "tshirt2horiz", "tshirt2", 0 )
end
addEvent("helmetCapacete3", true)
addEventHandler("helmetCapacete3",root,joinPilot)
 
function joinPilot()
        addPedClothes ( source, "tshirtwhite", "tshirt", 0 )
end
addEvent("helmetCapacete4", true)
addEventHandler("helmetCapacete4",root,joinPilot)
 
function joinPilot()
        addPedClothes ( source, "tshirtilovels", "tshirt", 0 )
end
addEvent("helmetCapacete5", true)
addEventHandler("helmetCapacete5",root,joinPilot)
 
function joinPilot()
        addPedClothes ( source, "tshirtblunts", "tshirt", 0 )
end
addEvent("helmetCapacete6", true)
addEventHandler("helmetCapacete6",root,joinPilot)
 
function joinPilot()
        addPedClothes ( source, "shirtbplaid", "shirtb", 0 )
end
addEvent("helmetCapacete7", true)
addEventHandler("helmetCapacete7",root,joinPilot)
 
function joinPilot()
        addPedClothes ( source, "shirtbcheck", "shirtb", 0 )
end
addEvent("helmetCapacete8", true)
addEventHandler("helmetCapacete8",root,joinPilot)
 
function joinPilot()
        addPedClothes ( source, "field", "field", 0 )
end
addEvent("helmetCapacete9", true)
addEventHandler("helmetCapacete9",root,joinPilot)
 
function joinPilot()
        addPedClothes ( source, "tshirterisyell", "tshirt", 0 )
end
addEvent("helmetCapacete10", true)
addEventHandler("helmetCapacete10",root,joinPilot)
 
function joinPilot()
        addPedClothes ( source, "tshirterisorn", "tshirt", 0 )
end
addEvent("helmetCapacete11", true)
addEventHandler("helmetCapacete11",root,joinPilot)
 
function joinPilot()
        addPedClothes ( source, "trackytop2eris", "trackytop1", 0 )
end
addEvent("helmetCapacete12", true)
addEventHandler("helmetCapacete12",root,joinPilot)
 
function joinPilot()
        addPedClothes ( source, "bbjackrim", "bbjack", 0 )
end
addEvent("helmetCapacete13", true)
addEventHandler("helmetCapacete13",root,joinPilot)
 
function joinPilot()
        addPedClothes ( source, "bballjackrstar", "bbjack", 0 )
end
addEvent("helmetCapacete14", true)
addEventHandler("helmetCapacete14",root,joinPilot)
 
function joinPilot()
        addPedClothes ( source, "baskballdrib", "baskball", 0 )
end
addEvent("helmetCapacete15", true)
addEventHandler("helmetCapacete15",root,joinPilot)
 
function joinPilot()
        addPedClothes ( source, "baskballrim", "baskball", 0 )
end
addEvent("helmetCapacete16", true)
addEventHandler("helmetCapacete16",root,joinPilot)
 
function joinPilot()
        addPedClothes ( source, "sixtyniners", "tshirt", 0 )
end
addEvent("helmetCapacete17", true)
addEventHandler("helmetCapacete17",root,joinPilot)
 
function joinPilot()
        addPedClothes ( source, "bandits", "baseball", 0 )
end
addEvent("helmetCapacete18", true)
addEventHandler("helmetCapacete18",root,joinPilot)
 
function joinPilot()
        addPedClothes ( source, "tshirtprored", "tshirt", 0 )
end
addEvent("helmetCapacete19", true)
addEventHandler("helmetCapacete19",root,joinPilot)
 
function joinPilot()
        addPedClothes ( source, "tshirtproblk", "tshirt", 0 )
end
addEvent("helmetCapacete20", true)
addEventHandler("helmetCapacete20",root,joinPilot)
 
function joinPilot()
        addPedClothes ( source, "trackytop1pro", "trackytop1", 0 )
end
addEvent("helmetCapacete21", true)
addEventHandler("helmetCapacete21",root,joinPilot)
 
function joinPilot()
        addPedClothes ( source, "hockeytop", "sweat", 0 )
end
addEvent("helmetCapacete22", true)
addEventHandler("helmetCapacete22",root,joinPilot)
 
function joinPilot()
        addPedClothes ( source, "bbjersey", "sleevt", 0 )
end
addEvent("helmetCapacete23", true)
addEventHandler("helmetCapacete23",root,joinPilot)
 
function joinPilot()
        addPedClothes ( source, "shellsuit", "trackytop1", 0 )
end
addEvent("helmetCapacete24", true)
addEventHandler("helmetCapacete24",root,joinPilot)
 
function joinPilot()
        addPedClothes ( source, "tshirtheatwht", "tshirt", 0 )
end
addEvent("helmetCapacete25", true)
addEventHandler("helmetCapacete25",root,joinPilot)
 
function joinPilot()
        addPedClothes ( source, "tshirtbobomonk", "tshirt", 0 )
end
addEvent("helmetCapacete26", true)
addEventHandler("helmetCapacete26",root,joinPilot)
 
function joinPilot()
        addPedClothes ( source, "tshirtbobored", "tshirt", 0 )
end
addEvent("helmetCapacete27", true)
addEventHandler("helmetCapacete27",root,joinPilot)
 
function joinPilot()
        addPedClothes ( source, "tshirtbase5", "tshirt", 0 )
end
addEvent("helmetCapacete28", true)
addEventHandler("helmetCapacete28",root,joinPilot)
 
function joinPilot()
        addPedClothes ( source, "tshirtsuburb", "tshirt", 0 )
end
addEvent("helmetCapacete29", true)
addEventHandler("helmetCapacete29",root,joinPilot)
 
function joinPilot()
        addPedClothes ( source, "hoodyamerc", "hoodya", 0 )
end
addEvent("helmetCapacete30", true)
addEventHandler("helmetCapacete30",root,joinPilot)
 
function joinPilot()
        addPedClothes ( source, "hoodyabase5", "hoodya", 0 )
end
addEvent("helmetCapacete31", true)
addEventHandler("helmetCapacete31",root,joinPilot)
 
function joinPilot()
        addPedClothes ( source, "hoodyarockstar", "hoodya", 0 )
end
addEvent("helmetCapacete32", true)
addEventHandler("helmetCapacete32",root,joinPilot)
 
function joinPilot()
        addPedClothes ( source, "wcoatblue", "wcoat", 0 )
end
addEvent("helmetCapacete33", true)
addEventHandler("helmetCapacete33",root,joinPilot)
 
 
 
 
 
 
 
 
 
 
 
 
addEventHandler("onPlayerQuit",root,    
function()
    local account = getPlayerAccount(source)  
    if account and not isGuestAccount(account) then
        local cTable = {}
        for i = 0, 17 do
            local texture, model = getPedClothes(source, i)
            if texture and model then
                table.insert(cTable, {texture, model, i})
            end
        end
        setAccountData(account, "Clothes", toJSON(cTable))
    end
end)  
 
addEventHandler("onPlayerLogin", root,
function()
    if not isPedDead(source) then
        givePlayerClothes()
    else
        addEventHandler("onPlayerSpawn", source, givePlayerClothes)
    end
end)
 
function givePlayerClothes()
    local account = getPlayerAccount(source)  
    if account and not isGuestAccount(account) then
        local data = getAccountData(account, "Clothes")
        if (data) then
            local cTable = fromJSON(data)
            if cTable and type(cTable) == "table" then
                local cSkin = getElementModel(source)
                setElementModel(source, 0)
                for _, value in ipairs(cTable) do
                    addPedClothes(source, value[1], value[2], value[3])
                end
               
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...