Jump to content

Douple click problem


Tete omar

Recommended Posts

Posted

Hey guys

client side

  
addEventHandler("onClientGUIClick",root, 
function( ) 
    if source == Done or source == Done1 then 
        guiSetProperty(Start,"Disabled","false") 
    elseif source == Exit then 
        guiSetProperty(Start,"Disabled","true") 
        guiSetVisible(policeWindow,false) 
        guiSetInputEnabled(false) 
        showCursor(false) 
        triggerServerEvent("getData",localPlayer) 
    end 
end) 
  
local skins = {["Tenpenny"] = 265,["Pulaski"] = 266,["Hern"] = 267,["Cop 1"] = 280,["Cop 2"] = 281,["Cop 3"] = 282,["Cop 4"] = 283,["Cop 5"] = 284} 
  
function douple( ) 
    local skin = guiGridListGetItemText(Gridlist,guiGridListGetSelectedItem(Gridlist),1) 
    if skin and skin ~= "" and skins[skin] then 
        triggerServerEvent("setData",localPlayer,skins[skin]) 
    end 
end 
addEventHandler("onClientGUIDoubleClick", Gridlist, douple) 

server side

addEvent("setData", true) 
addEventHandler("setData", root, 
    function( mod ) 
        local account = getPlayerAccount(client) 
        if account and not isGuestAccount(account) then 
            local skae = getElementModel(client) 
            setAccountData(account,"skin",skae) 
        end 
        setElementModel(client,mod) 
end) 
  
addEvent("getData", true) 
addEventHandler("getData", root, 
function() 
    local account = getPlayerAccount( client ) 
    if ( account ) then 
        local playerskin = getAccountData( account, "skin" ) 
        if ( playerskin ) then 
            setPedSkin( client, playerskin ) 
        end 
    end 
end) 
  

my problem here is about the ' double click ' , i've saved the skin before the player choose another skin in that gridlist , so if he exited by ' Exit ' button as we can see client side upper , then get his previous skin back , '

now my problem is , if i clicked on an row in that gridlist more than ' double click ' then set this skin as his previous skin , so if he exited the window, his skin will be a cop as we can see the list of the cops into the ' skins ' table,

i'm actually trying to make a police job , so the player pick his skin and press ' start ' button then start the job , so i'll make an guessed code to make it logical understanding.

server side

addEvent("setData", true) 
addEventHandler("setData", root, 
    function( mod ) 
        local account = getPlayerAccount(client) 
        if account and not isGuestAccount(account) then 
            local skae = getElementModel(client) 
            setAccountData(account,"skin",skae) 
        end 
        setElementModel(client,mod) 
        skae = nil -- i think it will get the element model for 1 time only , so if the player clicked on an row more than double click then stop getting the gridlist models and just get his previous model. 
end) 

hope you understand me , and please if you know the solution don't hesitate to help me , and thanks for each reply.

Posted

Simply, save the current skin as elementData WHEN you open the skin selector window, and get it whenever you need.

Posted
Simply, save the current skin as elementData WHEN you open the skin selector window, and get it whenever you need.

THAT WAS A F , GREAT IDEA TAPL !!!!!! Thanks :)

that worked

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