Jump to content

[Help] Button


Stranger

Recommended Posts

hello guys

there is a problem in this code:

function() 
    if (source == Select5) then 
       if isPedOnGround ( localPlayer ) then 
          local row9, col9 = guiGridListGetSelectedItem(AnimationGRID) 
            local SSS9 = guiGridListGetItemText(AnimationGRID, row9, col9) 
             if (SSS9) then 
                if (SSS9 == "dance 1") then 
                    triggerServerEvent("dance", localPlayer) 
                elseif (SSS9 == "dance 2") then 
                    triggerServerEvent("dance2", localPlayer) 
                elseif (SSS9 == "dance 3") then 
                    triggerServerEvent("dance3", localPlayer) 
                elseif (SSS9 == "dance 4") then 
                    triggerServerEvent("dance4", localPlayer) 
                elseif (SSS9 == "dance 5") then 
                    triggerServerEvent("dance5", localPlayer) 
                elseif (SSS9 == "dance 6") then 
                    triggerServerEvent("dance6", localPlayer) 
                elseif (SSS9 == "STOP") then 
                    triggerServerEvent("dance7", localPlayer) 
                elseif (SSS9 == "Sit 1") then 
                    triggerServerEvent("Sit1", localPlayer) 
                elseif (SSS9 == "Sit 2") then 
                    triggerServerEvent("Sit2", localPlayer) 
                elseif (SSS9 == "Sit 3") then 
                    triggerServerEvent("Sit3", localPlayer) 
                elseif (SSS9 == "Sit 4") then 
                    triggerServerEvent("Sit4", localPlayer) 
                    end 
                    else 
                    outputChatBox("You're Not On The Ground", 255, 255, 0) 
                   end 
                end 
            end 
        end 
) 
  

that when i select some thing in the gridlist i should click one time right ? but no i click twice to make it work, i want it one time, i try but nothing happend.

Link to comment

Instead of having all differant events, i'd recommend having something like this:

  
function fN ( ) 
    if ( source == Select5 and isPedOnGround ( localPlayer ) ) then 
        local row, col = guiGridListGetSelectedItem ( AnimationGRID ) 
        if ( row ~= -1 and col ~= 0 ) then 
            local t = guiGridListGetItemText ( row, 1 ) 
            local t2 = string.lower ( t:gsub ( " ", "" ) ) 
            triggerServerEvent ( "onClientChangeAnimation", localPlayer, t2 ) 
        end 
    end 
end  
  

Link to comment
function () 
    if (source == Select5) then 
        if isPedOnGround ( localPlayer ) then 
            local row9, col9 = guiGridListGetSelectedItem(AnimationGRID) 
            local SSS9 = guiGridListGetItemText(AnimationGRID, row9, col9) 
            if (SSS9) then 
                if (SSS9 == "dance 1") then 
                    triggerServerEvent("dance", localPlayer) 
                elseif (SSS9 == "dance 2") then 
                    triggerServerEvent("dance2", localPlayer) 
                elseif (SSS9 == "dance 3") then 
                    triggerServerEvent("dance3", localPlayer) 
                elseif (SSS9 == "dance 4") then 
                    triggerServerEvent("dance4", localPlayer) 
                elseif (SSS9 == "dance 5") then 
                    triggerServerEvent("dance5", localPlayer) 
                elseif (SSS9 == "dance 6") then 
                    triggerServerEvent("dance6", localPlayer) 
                elseif (SSS9 == "STOP") then 
                    triggerServerEvent("dance7", localPlayer) 
                elseif (SSS9 == "Sit 1") then 
                    triggerServerEvent("Sit1", localPlayer) 
                elseif (SSS9 == "Sit 2") then 
                    triggerServerEvent("Sit2", localPlayer) 
                elseif (SSS9 == "Sit 3") then 
                    triggerServerEvent("Sit3", localPlayer) 
                elseif (SSS9 == "Sit 4") then 
                    triggerServerEvent("Sit4", localPlayer) 
                end 
            end 
        else 
            outputChatBox("You're Not On The Ground", 255, 255, 0)    
        end 
    end 
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...