Jump to content

CustomCJ Script not work


Cr!S

Recommended Posts

 

Hello, I would like to create a changing room for CJ, but I have a problem with putting on clothes "CustomCJ_C: 46: Bad argument @ 'addPedClothes' [Expacted string at argument 2, got table]".   Columns have been created, but "onClientGUIClick" doesn't work.

 
local Marker_CustomCJ = createMarker(2491.53833, -1667.44861, 12.25, "cylinder", 2, 0, 0, 255, 100)
--//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\
gridlist=guiCreateGridList(0.76, 0.31, 0.20, 0.53, true)
guiGridListAddColumn(gridlist, "Clothes", 0.9)
guiSetVisible(gridlist, false)
--//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\
local TshirtANDShirt= {
    --[[0-Head, 1-Hair, 2-Trousers, 3-Shoes, 4/12-Tattoo, 13-Necklaces, 14-Watches, 15-Glasses, 16-... on Hair, 17-Specials]]
    [1]={"player_torso", "torso", "0", "T-Shirt #1" },
    [2]={"vestblack", "vest", "0", "T-Shirt #2" },
    [3]={"tshirt2horiz", "tshirt2", "0", "T-Shirt #3" },
} 
local Texture_Name, Model_Name, Type = unpack(TshirtANDShirt)
--//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\
function CustomCJ_Start()
    guiGridListClear(gridlist)
    local row = guiGridListAddRow(gridlist)
    guiGridListSetItemText(gridlist, row, 1, "T-Shirt's  &  Shirt's", true, false)
    for i,in ipairs(TshirtANDShirt) do 
        local row = guiGridListAddRow(gridlist) 
        guiGridListSetItemText(gridlist, row, 1, v[4], false, false) 
    end
end
--//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\
addEventHandler("onClientMarkerHit", Marker_CustomCJ , function(el, md)
if el~=localPlayer then return end
    if getElementModel(el) == 0 then
        showCursor(true, false)
        guiSetVisible(gridlist,true)
        CustomCJ_Start()
        --addPedClothes(el, "tshirt2horiz", "tshirt2", 0) it's for a test
    else
        outputChatBox("#ffffffThis is only for #ff0000ID 0 (CJ)", 0, 0, 0, true)
    end
    
    addEventHandler("onClientMarkerLeave", Marker_CustomCJ , function()
        showCursor(false)
        guiSetVisible(gridlist,false)
        --removePedClothes(localPlayer, 0, "tshirt2horiz", "tshirt2") It's for a test
    end)
    
    addEventHandler("onClientGUIClick", gridlist, function()
        local selectedRow=guiGridListGetSelectedItem(gridlist)
        if selectedRow < 0 then return end
        local model=guiGridListGetItemText(gridlist, selectedRow, 1)
        addPedClothes ( localPlayer, Texture_Name, Model_Name, Type )- - - - - - 46 line  ! !! !  !! ! ! ! ! 
    end)
    
    addEventHandler("onClientGUIDoubleClick", gridlist, function()
        guiSetVisible(gridlist, false)
        showCursor(false)
    end)
    
end)

And sorry for my english :)

Edited by Cr!S
Link to comment
local Marker_CustomCJ = createMarker(2491.53833, -1667.44861, 12.25, "cylinder", 2, 0, 0, 255, 100)
--//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\
gridlist=guiCreateGridList(0.76, 0.31, 0.20, 0.53, true)
guiGridListAddColumn(gridlist, "Clothes", 0.9)
guiSetVisible(gridlist, false)
--//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\
local TshirtANDShirt= {
    --[[0-Head, 1-Hair, 2-Trousers, 3-Shoes, 4/12-Tattoo, 13-Necklaces, 14-Watches, 15-Glasses, 16-... on Hair, 17-Specials]]
    [1]={"player_torso", "torso", "0", "T-Shirt #1" },
    [2]={"vestblack", "vest", "0", "T-Shirt #2" },
    [3]={"tshirt2horiz", "tshirt2", "0", "T-Shirt #3" },
} 
--//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\
function CustomCJ_Start()
    guiGridListClear(gridlist)
    local row = guiGridListAddRow(gridlist)
    guiGridListSetItemText(gridlist, row, 1, "T-Shirt's  &  Shirt's", true, false)
    for i,v in ipairs(TshirtANDShirt) do 
        local row = guiGridListAddRow(gridlist) 
        guiGridListSetItemText(gridlist, row, 1, v[4], false, false) 
		guiGridListSetItemData( gridlist , row , 1 , {v[1] , v[2], v[4]} )
    end
end
--//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\
addEventHandler("onClientMarkerHit", Marker_CustomCJ , function(el, md)
if el~=localPlayer then return end
    if getElementModel(el) == 0 then
        showCursor(true, false)
        guiSetVisible(gridlist,true)
        CustomCJ_Start()
        --addPedClothes(el, "tshirt2horiz", "tshirt2", 0) it's for a test
    else
        outputChatBox("#ffffffThis is only for #ff0000ID 0 (CJ)", 0, 0, 0, true)
    end
    
    addEventHandler("onClientMarkerLeave", Marker_CustomCJ , function()
        showCursor(false)
        guiSetVisible(gridlist,false)
        --removePedClothes(localPlayer, 0, "tshirt2horiz", "tshirt2") It's for a test
    end)
    
    addEventHandler("onClientGUIClick", gridlist, function()
        local selectedRow=guiGridListGetSelectedItem(gridlist)
        if selectedRow < 0 then return end
        local model=guiGridListGetItemText(gridlist, selectedRow, 1)
		local Items = guiGridListGetItemData(source, guiGridListGetSelectedItem(source), 1)
        addPedClothes ( localPlayer, Items[1], Items[2], Items[3] )--- - - - - 46 line  ! !! !  !! ! ! ! ! 
    end)
    
    addEventHandler("onClientGUIDoubleClick", gridlist, function()
        guiSetVisible(gridlist, false)
        showCursor(false)
    end)
    
end)

I don't try it 

 

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...