Jump to content

Need help


sckatchof

Recommended Posts

OK show how you trigger event buySkin.
addEventHandler("onClientGUIClick", root, 
    function () 
        if (source == Buttonbuyskin) then 
            local row,col = guiGridListGetSelectedItem(Sgrid) 
            if (row and col and row ~= -1 and col ~= -1) then 
                local finalskin = guiGridListGetItemText(Sgrid, row, 1 ) 
                triggerServerEvent ( "buySkin", localPlayer, tonumber ( finalskin ) ) 
            else 
                if isTimer ( timer ) then 
                    killTimer ( timer ) 
                end 
                guiSetText ( LabelTNS, "Error: Please select a skin from the list." ) 
                timer = setTimer ( guiSetText, 3000, 1, LabelTNS, skinmsglabel ) 
            end 
        end 
    end 
) 

but i change to finaskin

Link to comment
  
  
addEventHandler( 'onClientGUIClick', root, 
    function( ) 
        if source == Buttonbuyskin then 
            assert( Sgrid, 'Grid list not exists' ) 
            local nRow = guiGridListGetSelectedItem( Sgrid ) 
            if nRow and nRow ~= -1 then 
                local finalskin = guiGridListGetItemText( Sgrid, nRow, 1 ) 
                assert( finalskin, 'Variable finalskin is false or nil.' ) 
                triggerServerEvent ( 'buySkin', localPlayer, tonumber ( finalskin ) ) 
            else 
                if isTimer ( timer ) then 
                    killTimer ( timer ) 
                end 
                guiSetText ( LabelTNS, 'Error: Please select a skin from the list.' ) 
                timer = setTimer ( guiSetText, 3000, 1, LabelTNS, skinmsglabel ) 
            end 
        end 
    end 
) 
  
  

Test it and show output debug messages.

Link to comment
  
  
addEventHandler( 'onClientGUIClick', root, 
    function( ) 
        if source == Buttonbuyskin then 
            assert( Sgrid, 'Grid list not exists' ) 
            local nRow = guiGridListGetSelectedItem( Sgrid ) 
            if nRow and nRow ~= -1 then 
                local finalskin = guiGridListGetItemText( Sgrid, nRow, 1 ) 
                assert( finalskin, 'Variable finalskin is false or nil.' ) 
                triggerServerEvent ( 'buySkin', localPlayer, tonumber ( finalskin ) ) 
            else 
                if isTimer ( timer ) then 
                    killTimer ( timer ) 
                end 
                guiSetText ( LabelTNS, 'Error: Please select a skin from the list.' ) 
                timer = setTimer ( guiSetText, 3000, 1, LabelTNS, skinmsglabel ) 
            end 
        end 
    end 
) 
  
  

Test it and show output debug messages.

thanx keni for help but nothing it show and when i click buy skin nothing it chnage

Link to comment
Try check all conditions with functions :
outputChatBox  
outputDebugString 

Client side work but i have proble in server side in line 5 ==> setElementModel( source, finalskin )

client side :

addEventHandler( 'onClientGUIClick', root, 
    function( ) 
        if source == Buttonbuyskin then 
            assert( Sgrid, 'Grid list not exists' ) 
            local nRow = guiGridListGetSelectedItem( Sgrid ) 
            if nRow and nRow ~= -1 then 
                local finalskin = guiGridListGetItemText( Sgrid, nRow, 1 ) 
                assert( finalskin, 'Variable finalskin is false or nil.' ) 
                triggerServerEvent ( 'buySkin', localPlayer, tonumber ( finalskin ) ) 
                outputChatBox("You have successfully bought the skin!",source,225,255,255) 
            else 
                if isTimer ( timer ) then 
                    killTimer ( timer ) 
                end 
                guiSetText ( LabelTNS, 'Error: Please select a skin from the list.' ) 
                timer = setTimer ( guiSetText, 3000, 1, LabelTNS, skinmsglabel ) 
            end 
        end 
    end 
) 
  

addEvent("buySkin", true) 
addEventHandler("buySkin", root, 
function(finalskin) 
if source then 
     if (getPlayerMoney(source) >= 350) then 
          setElementModel( source, finalskin ) 
          setElementData ( source, "clothesSkin", finalskin, true ) 
          outputChatBox("You have successfully bought the skin!",source,225,255,255) 
  
     else 
          outputChatBox("You dont have enough money!",source,225,0,0) 
     end 
end 
end 
) 

Link to comment

Client-side:

addEventHandler( 'onClientGUIClick', root, 
    function( ) 
        if ( source == Buttonbuyskin ) then 
            assert( Sgrid, 'Grid list not exists' ) 
            local nRow = guiGridListGetSelectedItem( Sgrid ) 
            if ( nRow and nRow ~= -1 ) then 
                local finalskin = guiGridListGetItemText( Sgrid, nRow, 1 ) 
                assert( finalskin, 'Variable finalskin is false or nil.' ) 
                triggerServerEvent ( 'buySkin', localPlayer, tonumber ( finalskin ) ) 
                outputChatBox("You have successfully bought the skin!",source,225,255,255) 
            else 
                if isTimer ( timer ) then 
                    killTimer ( timer ) 
                end 
                guiSetText ( LabelTNS, 'Error: Please select a skin from the list.' ) 
                timer = setTimer ( guiSetText, 3000, 1, LabelTNS, skinmsglabel ) 
            end 
        end 
    end 
) 

Server-side:

addEvent("buySkin", true) 
addEventHandler("buySkin", root, 
function ( skin ) 
     if ( getPlayerMoney ( source ) >= 350 ) then 
          setElementModel ( source, tonumber ( skin ) ) 
          setElementData ( source, "clothesSkin", skin, true ) 
          outputChatBox ( "You have successfully bought the skin!", source, 225, 255, 255 ) 
  
     else 
          outputChatBox("You dont have enough money!",source,225,0,0) 
     end 
end 
) 

Link to comment
Show Server-side.
addEvent("buySkin", true) 
addEventHandler("buySkin", root, 
function(finalskin) 
if source then 
     if (getPlayerMoney(source) >= 350) then 
     outputChatBox ( type ( finalskin ) ..": ".. tostring ( finalskin ) ) 
          setElementModel ( source, tonumber ( finalskin ) ) 
          setElementData ( source, "clothesSkin", finalskin, true ) 
          outputChatBox("You have successfully bought the skin!",source,225,255,255) 
     else 
          outputChatBox("You dont have enough money!",source,225,0,0) 
     end 
end 
end 
) 

Link to comment

Fuuuuu!

Are you kidding me???????

I posted the correct code here and you've not used it!

addEvent ( "buySkin", true ) 
  
addEventHandler ( "buySkin", root, 
    function ( fSkin ) 
        if ( getPlayerMoney ( source ) >= 350 ) then 
            setElementModel ( source, fSkin ) 
            setElementData ( source, "clothesSkin", fSkin, true ) 
            outputChatBox ( "You have sucessfully bought the skin!", source, 255, 255, 255, false ) 
        else 
            outputChatBox ( "You don't have enough money!", source, 225, 0, 0, false ) 
        end 
    end 
) 

Link to comment
Fuuuuu!

Are you kidding me???????

I posted the correct code here and you've not used it!

addEvent ( "buySkin", true ) 
  
addEventHandler ( "buySkin", root, 
    function ( fSkin ) 
        if ( getPlayerMoney ( source ) >= 350 ) then 
            setElementModel ( source, fSkin ) 
            setElementData ( source, "clothesSkin", fSkin, true ) 
            outputChatBox ( "You have sucessfully bought the skin!", source, 255, 255, 255, false ) 
        else 
            outputChatBox ( "You don't have enough money!", source, 225, 0, 0, false ) 
        end 
    end 
) 

no im not kidding with you and i use your code thnx again but still show WARNIG

Link to comment
Show client and server code ( the updated code ).

server side :

addEvent ( "buySkin", true ) 
  
addEventHandler ( "buySkin", root, 
    function ( fSkin ) 
        if ( getPlayerMoney ( source ) >= 350 ) then 
            setElementModel ( source, fSkin ) 
            setElementData ( source, "clothesSkin", fSkin, true ) 
            outputChatBox ( "You have sucessfully bought the skin!", source, 255, 255, 255, false ) 
        else 
            outputChatBox ( "You don't have enough money!", source, 225, 0, 0, false ) 
        end 
    end 
) 

client :

  
... 
.. 
Sgrid = guiCreateGridList(12,59,345,439,false,SkinWindow) 
.. 
Buttonbuyskin = guiCreateButton(12,503,122,29,"Buy skin (350$)",false,SkinWindow) 
.. 
  
addEventHandler( 'onClientGUIClick', root, 
    function( ) 
        if ( source == Buttonbuyskin ) then 
            assert( Sgrid, 'Grid list not exists' ) 
            local nRow = guiGridListGetSelectedItem( Sgrid ) 
            if ( nRow and nRow ~= -1 ) then 
                local finalskin = guiGridListGetItemText( Sgrid, nRow, 1 ) 
                triggerServerEvent ( 'buySkin', localPlayer, tonumber ( finalskin ) ) 
                outputChatBox("You have successfully bought the skin!",source,225,255,255) 
            else 
                if isTimer ( timer ) then 
                    killTimer ( timer ) 
                end 
                guiSetText ( LabelTNS, 'Error: Please select a skin from the list.' ) 
                timer = setTimer ( guiSetText, 3000, 1, skinmsgla, LabelTNS ) 
            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...