Jump to content

takePlayerMoney (Client Sided) has an error


Einheit-101

Recommended Posts

Hello People!

I dont know if anyone knows this or if this is a script error of my shop resource:

  
function bought3 ( button, state ) 
    local money = getPlayerMoney(getLocalPlayer()) 
    if (money > 999) then 
        takePlayerMoney (1000) 
        triggerServerEvent("predator2spawn", getRootElement()) 
        outputChatBox("You have bought a Predator for 1000$.", getLocalPlayer()) 
    else 
    outputChatBox("You have not enough $ for a Predator. You need 1000$.", getLocalPlayer()) 
end 
end 
addEventHandler( "onClientGUIClick", buyButton4, bought3, false ) 
  

BUT

if i go into the shop and buy my boat i lose 1000$ and 1 second later i have the 1000$ again!!!

Its just like anything has given me 1000 dollar back. Maybe its a glitch of the function takePlayerMoney().

EDIT::: Maybe i will try Server sided takePlayerMoney later.

EDIT #2:::

I found another glitch. onMarkerHit and onClientMarkerHit does not work correctly. If i hit a marker 100 meters above this event triggers, but i did not hit the marker. This Event does not check the Z Position of Player and Marker i think :?:

Link to comment

nope! why that? I will upload a Video in which you can see this problem! Its on my Admin Aircraft Carrier and on the first Floor is a shop. But if i walk on the second floor over the x,y Position of the Marker (15 meters above!) the shop opens.

I have Fixed this Problem with the following trick:

I use for those Shops now "Arrow" markers. Those arrows trigger correctly and everything is fine!

Link to comment
  • Discord Moderators

this is a known error, a workaround is to script a colshape and use that as hit detection, or an arrow as you said.

I think there must be somewhere in your code you reset the players money every second.

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