Jump to content

Skins !!


Mark0

Recommended Posts

No skins and no cursor

local marker = createMarker (1543.0826416016,-1678.3455810547,12.5,"cylinder",2,0,255,0,255) 
local marker2 = createMarker (1543.0826416016,-1678.3455810547,12.5,"cylinder",2,0,255,0,255) 
  
local skins = {"police 1", "police 2", "police 3", "police 4", "police 5", "police 6"} 
  
function createskinGui () 
window = guiCreateWindow(0.29,0.2117,0.3512,0.675,"police skins",true) 
skinsgrid = guiCreateGridList(0.0391,0.0938,0.9217,0.6222,true,window) 
guiGridListSetSelectionMode(skinsgrid,2) 
  
_skins = guiGridListAddColumn(skinsgrid,"Skins",0.2) 
skibtn = guiCreateButton(0.242,0.7432,0.5338,0.0617,"take skin",true,window) 
closebtn = guiCreateButton(0.2456,0.8519,0.5302,0.0568,"Close",true,window) 
for index, skin in ipairs(vehicles) do 
        local row = guiGridListAddRow (skinsgrid) 
        guiGridListSetItemText ( skinsgrid, row, _skins, tostring(skin), false, false ) 
    end 
end  
  
addEventHandler ( "onClientMarkerHit", marker, 
    function ( hitElement ) 
        if ( hitElement == localPlayer ) then 
                createskinGui ( hitElement ) 
                if ( window ~= nil ) then 
                    guiSetVisible ( window, true ) 
                    showCursor ( true ) 
                    guiSetInputEnabled ( true ) 
                end 
        end 
    end 
) 
  
addEventHandler ( "onClientMarkerHit", marker2, 
    function ( hitElement ) 
        if ( hitElement == localPlayer ) then 
                createskinGui ( hitElement ) 
                if ( window ~= nil ) then 
                    guiSetVisible ( window, true ) 
                    showCursor ( true ) 
                    guiSetInputEnabled ( true ) 
                end 
        end 
    end 
) 
  
addEventHandler("onClientGUIClick", root,  
function () 
        if (source == skibtn) then 
            local row,col = guiGridListGetSelectedItem(skinsgrid) 
            if (row and col and row ~= -1 and col ~= -1) then 
                local vehicleName = guiGridListGetItemText(skinsgrid, row, 1) 
                if skinName == "police 1" then 
                    setElementModel(getLocalPlayer(), 280) 
                elseif skinName == "police 2" then 
                    setElementModel(getLocalPlayer(),281) 
                    elseif skinName == "police 3" then 
                        setElementModel(getLocalPlayer(), 282) 
                        elseif skinName == "police 4" then 
                            setElementModel(getLocalPlayer(), 283) 
                            elseif skinName == "police 5" then 
                                setElementModel(getLocalPlayer(),284) 
                                elseif skinName == "police 6" then 
                                 setElementModel(getLocalPlayer(), 288)                              
                    end 
                         
            else 
                outputChatBox("Please,select a skin of the list.",255,0,0) 
            end 
            elseif (source == closebtn) then 
                triggerEvent("closeWindow", root ) 
        end 
end 
) 
  
  
addEventHandler("onClientMarkerLeave", marker, 
function () 
        triggerEvent("closeWindow", root ) 
end 
) 
  
addEventHandler("onClientMarkerLeave", marker2, 
function () 
        triggerEvent("closeWindow", root ) 
end 
) 
  
  
addEvent("closeWindow", true) 
addEventHandler("closeWindow", root,  
function () 
            guiSetVisible(windows, false) 
            showCursor(false) 
            guiSetInputEnabled(false) 
end 
) 

Link to comment

new problem when i take the skin the windows hide but the cursor no and when i press close only the cursor hide

local marker = createMarker (1543.0826416016,-1678.3455810547,12.5,"cylinder",2,0,255,0,255) 
local marker2 = createMarker (1543.0826416016,-1678.3455810547,12.5,"cylinder",2,0,255,0,255) 
  
local skins = {"police 1", "police 2", "police 3", "police 4", "police 5", "police 6"} 
  
function createskinGui () 
window = guiCreateWindow(0.29,0.2117,0.3512,0.675,"police skins",true) 
skinsgrid = guiCreateGridList(0.0391,0.0938,0.9217,0.6222,true,window) 
guiGridListSetSelectionMode(skinsgrid,2) 
  
_skins = guiGridListAddColumn(skinsgrid,"Skins",0.-- s8) -->
skibtn = guiCreateButton(0.242,0.7432,0.5338,0.0617,"take skin",true,window) 
closebtn = guiCreateButton(0.2456,0.8519,0.5302,0.0568,"Close",true,window) 
for index, skin in ipairs(skins) do 
        local row = guiGridListAddRow (skinsgrid) 
        guiGridListSetItemText ( skinsgrid, row, _skins, tostring(skin), false, false ) 
    end 
end  
  
addEventHandler ( "onClientMarkerHit", marker, 
    function ( hitElement ) 
        if ( hitElement == localPlayer ) then 
                createskinGui ( hitElement ) 
                if ( window ~= nil ) then 
                    guiSetVisible ( window, true ) 
                    showCursor ( true ) 
                    guiSetInputEnabled ( true ) 
                end 
        end 
    end 
) 
  
addEventHandler("onClientGUIClick", root,  
function () 
        if (source == skibtn) then 
            local row,col = guiGridListGetSelectedItem(skinsgrid) 
            if (row and col and row ~= -1 and col ~= -1) then 
                local skinName = guiGridListGetItemText(skinsgrid, row, 1) 
                if skinName == "police 1" then 
                    setElementModel(getLocalPlayer(), 280) 
                elseif skinName == "police 2" then 
                    setElementModel(getLocalPlayer(),281) 
                    elseif skinName == "police 3" then 
                        setElementModel(getLocalPlayer(), 282) 
                        elseif skinName == "police 4" then 
                            setElementModel(getLocalPlayer(), 283) 
                            elseif skinName == "police 5" then 
                                setElementModel(getLocalPlayer(),284) 
                                elseif skinName == "police 6" then 
                                 setElementModel(getLocalPlayer(), 288)                              
                    end 
                     
guiSetVisible(window, false) 
showCursor(false) 
                         
            else 
                outputChatBox("Please,select a skin of the list.",255,0,0) 
            end 
            elseif (source == closebtn) then 
                triggerEvent("closeWindow", root ) 
        end 
end 
) 
  
  
addEventHandler("onClientMarkerLeave", marker, 
function () 
        triggerEvent("closeWindow", root ) 
end 
) 
  
addEvent("closeWindow", true) 
addEventHandler("closeWindow", root,  
function () 
            guiSetVisible(windows, false) 
            showCursor(false) 
            guiSetInputEnabled(false) 
end 
) 

Link to comment
local marker = createMarker (1543.0826416016,-1678.3455810547,12.5,"cylinder",2,0,255,0,255) 
local marker2 = createMarker (1543.0826416016,-1678.3455810547,12.5,"cylinder",2,0,255,0,255) 
  
local skins = {"police 1", "police 2", "police 3", "police 4", "police 5", "police 6"} 
  
function createskinGui () 
window = guiCreateWindow(0.29,0.2117,0.3512,0.675,"police skins",true) 
skinsgrid = guiCreateGridList(0.0391,0.0938,0.9217,0.6222,true,window) 
guiGridListSetSelectionMode(skinsgrid,2) 
  
_skins = guiGridListAddColumn(skinsgrid,"Skins",0.-- s8) -->
skibtn = guiCreateButton(0.242,0.7432,0.5338,0.0617,"take skin",true,window) 
closebtn = guiCreateButton(0.2456,0.8519,0.5302,0.0568,"Close",true,window) 
for index, skin in ipairs(skins) do 
        local row = guiGridListAddRow (skinsgrid) 
        guiGridListSetItemText ( skinsgrid, row, _skins, tostring(skin), false, false ) 
    end 
end  
  
addEventHandler ( "onClientMarkerHit", marker, 
    function ( hitElement ) 
        if ( hitElement == localPlayer ) then 
                createskinGui ( hitElement ) 
                if ( window ~= nil ) then 
                    guiSetVisible ( window, true ) 
                    showCursor ( true ) 
                    guiSetInputEnabled ( true ) 
                end 
        end 
    end 
) 
  
addEventHandler("onClientGUIClick", root, 
function () 
        if (source == skibtn) then 
            local row,col = guiGridListGetSelectedItem(skinsgrid) 
            if (row and col and row ~= -1 and col ~= -1) then 
                local skinName = guiGridListGetItemText(skinsgrid, row, 1) 
                if skinName == "police 1" then 
                    setElementModel(getLocalPlayer(), 280) 
                elseif skinName == "police 2" then 
                    setElementModel(getLocalPlayer(),281) 
                    elseif skinName == "police 3" then 
                        setElementModel(getLocalPlayer(), 282) 
                        elseif skinName == "police 4" then 
                            setElementModel(getLocalPlayer(), 283) 
                            elseif skinName == "police 5" then 
                                setElementModel(getLocalPlayer(),284) 
                                elseif skinName == "police 6" then 
                                 setElementModel(getLocalPlayer(), 288)                             
                    end 
             triggerEvent("closeWindow", localPlayer ) 
            else 
                outputChatBox("Please,select a skin of the list.",255,0,0) 
            end 
            elseif (source == closebtn) then 
             triggerEvent("closeWindow", localPlayer ) 
        end 
end 
) 
  
  
addEventHandler("onClientMarkerLeave", marker, 
function ( leaveElement ) 
        if ( leaveElement == localPlayer ) then 
             triggerEvent("closeWindow", localPlayer ) 
        end 
end 
) 
  
addEvent("closeWindow", true) 
addEventHandler("closeWindow", root, 
function () 
            guiSetVisible(window, false) 
            showCursor(false) 
            guiSetInputEnabled(false) 
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...