Jump to content

how can I give money?


w3rt1x

Recommended Posts

I need to give money on server

client code:
 

local marker = createMarker(-699.07342529297, 955.33538818359, 11, "cylinder", 2, 255, 255, 0, 170)

function giveMoney(hitPlayer, matchingDimension)
    if hitPlayer == localPlayer then
        outputChatBox("Okey it's your money")
    end
end

addEventHandler("onClientMarkerHit", marker, giveMoney)
Link to comment
9 minutes ago, w3rt1x said:

I need to give money on server

client code:
 

local marker = createMarker(-699.07342529297, 955.33538818359, 11, "cylinder", 2, 255, 255, 0, 170)

function giveMoney(hitPlayer, matchingDimension)
    if hitPlayer == localPlayer then
        outputChatBox("Okey it's your money")
    end
end

addEventHandler("onClientMarkerHit", marker, giveMoney)

welcome to the forum, i made a code for you, i didn't test it, you should try this
--client

function giveMoney(hitPlayer, matchingDimension)
    if hitPlayer == localPlayer then
        outputChatBox("Okey it's your money")
        triggerServerEvent("giveMoney", hitPlayer, 1000)  --enter amount here
    end
end

addEventHandler("onClientMarkerHit", marker, giveMoney)

--server
 

addEvent("giveMoney", true)
addEventHandler("giveMoney", root,
    function(amount)
       givePlayerMoney(client, amount)
    end
)


 

Edited by Shady1
  • Like 1
Link to comment

thank you!

4 minutes ago, Shady1 said:

welcome to the forum, i made a code for you, i didn't test it, you should try this
--client

function giveMoney(hitPlayer, matchingDimension)
    if hitPlayer == localPlayer then
        outputChatBox("Okey it's your money")
        triggerServerEvent("giveMoney", hitPlayer , 1000) --enter amount here
    end
end

addEventHandler("onClientMarkerHit", marker, giveMoney)

--server
 

addEvent("giveMoney", true)
addEventHandler("giveMoney", root,
    function(amount)
       givePlayerMoney(client, amount)
    end
)


 

it's working

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