Jump to content

[Solved] takePlayerMoney Problem


justn

Recommended Posts

Posted (edited)

When the player clicks the button, the money does not reduce.

ERROR: Airport_Transportation\client.lua:73: Bad Argument @ 'takePlayerMoney' [Expected number at argument 1, got player]

addEventHandler ( "onClientGUIClick", AirportWindow, 
    function ( b ) 
        if isElementWithinMarker ( localPlayer, LasVenturasMarker ) then 
            if ( b == "left" ) then 
                if ( source == LosSantos ) then 
                    local money = getPlayerMoney(localPlayer)                       
                    if (money > 499) then 
                    setElementPosition(localPlayer, 1642.41553, -2241.73169, 13.49343) 
                    guiSetVisible(AirportWindow,false) 
                    showCursor(false) 
                    takePlayerMoney ( localPlayer, 500 ) 
                else 
                    outputChatBox("You must have at least $500 to go to Los Santos !", localPlayer, 255, 0, 0) 
                end 
            end 
        end 
    end 
end) 

Edited by Guest

Datastore - Store data to a database quickly. (Useful for saving scripted tables)

Posted

takePlayerMoney client side has only one argument, the amount.

But, if you take the player client side, then it won't be synchronized with the server, which means is not really taking it.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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