Jump to content

Userpanel Help me !


XeRo

Recommended Posts

Hi Can You Help Me. :( I want Somebody with money such as Nitro Userpanel

My Nitro Code (Server-side)

    addEvent("nitroPickup", true)  
    addEventHandler("nitroPickup", getRootElement(),  
      function(player) 
        if isPedInVehicle(source) then 
                addVehicleUpgrade(getPedOccupiedVehicle(source),1010) 
        end 
      end   
) 

My Client Code (Client-side)

addEventHandler("onClientGUIClick",root, 
    function() 
        if source == Nitro then 
                        triggerServerEvent("nitroPickup", getLocalPlayer()) 
                            local sound = playSound("pickup.mp3") 
    setSoundVolume(sound, 0.5)  
            end 
            end 
            ) 

Link to comment
any error in debugscript 3?

No, There's No Problem. I want the user Panel as well as take money with Nitro

I have DD server. Custom Panel I did but I want to take with the benefit of the user panel Nitro?

Link to comment

really i didn't get you but i think you need to buy nitro by money?

so then use it

addEvent("nitroPickup", true) 
    addEventHandler("nitroPickup", getRootElement(), 
      function(player) 
        if isPedInVehicle(source) then 
                addVehicleUpgrade(getPedOccupiedVehicle(source),1010) 
                takePlayerMoney ( player, 1000 ) 
             outputChatBox ( "You Bought a Nitro", getRootElement(), 0, 0, 0, true ) 
else 
           outputChatBox ( "You need 1000 to buy nitro", getRootElement(), 0, 0, 0, true ) 
 end 
      end   
) 

Link to comment
really i didn't get you but i think you need to buy nitro by money?

so then use it

addEvent("nitroPickup", true) 
    addEventHandler("nitroPickup", getRootElement(), 
      function(player) 
        if isPedInVehicle(source) then 
                addVehicleUpgrade(getPedOccupiedVehicle(source),1010) 
                takePlayerMoney ( player, 1000 ) 
             outputChatBox ( "You Bought a Nitro", getRootElement(), 0, 0, 0, true ) 
else 
           outputChatBox ( "You need 1000 to buy nitro", getRootElement(), 0, 0, 0, true ) 
 end 
      end   
) 

User Panel of Own It creates money with Purchased take Nitro ?

Pİcture ScreenShot Upload ?

Link to comment
addEvent("nitroPickup", true) 
    addEventHandler("nitroPickup", getRootElement(), 
      function(player) 
        if isPedInVehicle(source) then 
                addVehicleUpgrade(getPedOccupiedVehicle(source),1010) 
                takePlayerMoney ( player, 1000 ) 
             outputChatBox ( "You Bought a Nitro", getRootElement(), 0, 0, 0, true ) 
else 
           outputChatBox ( "You need 1000 to buy nitro", getRootElement(), 0, 0, 0, true ) 
 end 
      end   
) 

Link to comment
addEvent("nitroPickup", true) 
addEventHandler("nitroPickup", getRootElement(), 
function(player) 
    if isPedInVehicle(source) then 
        local account = getPlayerAccount(player) 
        if account then 
            if getAccountData(account,"cash") >= 1000 then  --- change the string "cash" to what the money data is saved (cash,money) 
                addVehicleUpgrade(getPedOccupiedVehicle(source),1010) 
                setAccountData(account,"cash",-1000)  --- change the string "cash" to what the money data is saved (cash,money) 
                outputChatBox ( "You Bought a Nitro", player, 0, 0, 0, true ) 
            else 
                outputChatBox ( "You need 1000 to buy nitro", getRootElement(), 0, 0, 0, true ) 
            end 
        end 
    end 
end 
) 

Link to comment
-- Client 
addEventHandler("onClientGUIClick",root, 
    function() 
        if source == Nitro then 
           triggerServerEvent("nitroPickup", localPlayer) 
           local sound = playSound("pickup.mp3") 
           setSoundVolume(sound, 0.5) 
    end 
end ) 

--Server 
addEvent("nitroPickup", true) 
    addEventHandler("nitroPickup", root, 
    function (  ) 
        if getPlayerMoney(source) >= 1000 then 
            if isPedInVehicle(source) then 
                addVehicleUpgrade(getPedOccupiedVehicle(source),1010) 
                takePlayerMoney(source,1000) 
            else 
            outputChatBox ("You're poor m8",source,255,0,0) 
        end 
    end 
end ) 

Link to comment

Error Please Help Me.

zV2OOj.png

server.lua Code

    addEvent("nitroPickup", true) 
    addEventHandler("nitroPickup", getRootElement(), 
    function(player) 
        if isPedInVehicle(source) then 
            local account = getPlayerAccount(player) 
            if account then 
                if getAccountData(account,"cash") >= 1000 then  --- change the string "cash" to what the money data is saved (cash,money) 
                    addVehicleUpgrade(getPedOccupiedVehicle(source),1010) 
                    setAccountData(account,"cash",-1000)  --- change the string "cash" to what the money data is saved (cash,money) 
                    outputChatBox ( "Buy Nitro [$1000 ]", player, 0, 0, 0, true ) 
                else 
                    outputChatBox ( "You enough to money", getRootElement(), 0, 0, 0, true ) 
                end 
            end 
        end 
    end 
    ) 

Edited by Guest
Link to comment
addEvent("nitroPickup", true) 
    addEventHandler("nitroPickup", getRootElement(), 
    function() 
        if isPedInVehicle(source) then 
            local account = getPlayerAccount(source) 
            if account then 
                if getAccountData(account,"cash") >= 1000 then  --- change the string "cash" to what the money data is saved (cash,money) 
                    addVehicleUpgrade(getPedOccupiedVehicle(source),1010) 
                    setAccountData(account,"cash",(getAccountData(account,"cash") or 0)-1000)  --- change the string "cash" to what the money data is saved (cash,money) 
                    outputChatBox ( "Buy Nitro [$1000 ]", source, 0, 0, 0, true ) 
                else 
                    outputChatBox ( "You enough to money", source, 0, 0, 0, true ) 
                end 
            end 
        end 
    end 
    ) 

Link to comment
addEvent("nitroPickup", true) 
    addEventHandler("nitroPickup", getRootElement(), 
    function() 
        if isPedInVehicle(source) then 
            local account = getPlayerAccount(source) 
            if account then 
                if getAccountData(account,"cash") >= 1000 then  --- change the string "cash" to what the money data is saved (cash,money) 
                    addVehicleUpgrade(getPedOccupiedVehicle(source),1010) 
                    setAccountData(account,"cash",(getAccountData(account,"cash") or 0)-1000)  --- change the string "cash" to what the money data is saved (cash,money) 
                    outputChatBox ( "Buy Nitro [$1000 ]", source, 0, 0, 0, true ) 
                else 
                    outputChatBox ( "You enough to money", source, 0, 0, 0, true ) 
                end 
            end 
        end 
    end 
    ) 

Error Please Fix .

gA4pL3.png

Link to comment
Don't spam lel ... Post the server-side of the userpanel.

BTW thanks GTX for editing the code I wrote (made it for 1-2 minutes cuz I had no time) and forgot to get the data and then remove the value ...

Please Fix I'm Bad :(

Link to comment

No problem, toni :P

And XeRo, don't spam!

addEvent("nitroPickup", true) 
    addEventHandler("nitroPickup", getRootElement(), 
    function() 
        if isPedInVehicle(source) then 
            local account = getPlayerAccount(source) 
            if account then 
                if tonumber(getAccountData(account,"cash")) >= 1000 then  --- change the string "cash" to what the money data is saved (cash,money) 
                    addVehicleUpgrade(getPedOccupiedVehicle(source),1010) 
                    setAccountData(account,"cash",(tonumber(getAccountData(account,"cash")) or 0)-1000)  --- change the string "cash" to what the money data is saved (cash,money) 
                    outputChatBox ( "Buy Nitro [$1000 ]", source, 0, 0, 0, true ) 
                else 
                    outputChatBox ( "You enough to money", source, 0, 0, 0, true ) 
                end 
            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...