Jump to content

getPlayerMoney problem in clientside script


koeno100

Recommended Posts

Hello!

I've made a clientside script with the "onClientRender"event and the "getPlayerMoney" function to display a player's money. (It's in a race server) Whenever the map changes, the player's money turns 0, untill the player's money gets updated. Does anyone know how to fix this?

Link to comment

Okay so I've done a test with just this clientside script:

function showPlayerMoney() 
    theMoney = getPlayerMoney() 
    outputChatBox(theMoney) 
end 
addEventHandler("onClientRender", getRootElement(), showPlayerMoney) 

If I give myself by example $100 it will spam "100" in the chatbox, UNTIL a new map starts, then it will spam 0 again. Could I fix this by choosing something else than "getRootElement()"?

Link to comment
bro if u use getPlayerMoney in Client Side it's Fake .. uset it in Server Side

or if u need get Money in Client .. setElementData with player Money in Server side .. and get the data in Client Side

What nounsense are you talking? getPlayerMoney is not fake.

bro u don't understand me

i mean if u use getPlayerMoney in Client Side .. the function don't give u the correct number

Note: The amount may vary between the server and client, you shouldn't trust the client side value to always be accurate.

Link to comment

@# ZA7F =

Don't write crap, getPlayerMoney isn't fake at both sides.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

if you took money in one side ( like server ) it won't take from client side.

So you need to use all money functions in same side.

You may using money functions at server side, I recomend you using "triggerServerEvent" and "triggerClientEvent" for call back value.

Link to comment
@# ZA7F =

Don't write crap, getPlayerMoney isn't fake at both sides.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

if you took money in one side ( like server ) it won't take from client side.

So you need to use all money functions in same side.

You may using money functions at server side, I recomend you using "triggerServerEvent" and "triggerClientEvent" for call back value.

1. getPlayerMoney is synced from server side as far as I know so don't talk.

2. If he has then sure.

3. I support you, #ZA7F is writing something bullshit.

It will spam because you are using onClientRender event!

When a new map starts you can stop the script by using table methods.

client:

  
lp = getPlayerMoney(localPlayer) 
addEventHandler("onClientMapStopping", resourceRoot, function() 
     setPlayerMoney(localPlayer, lp) 
end 
) 
  

Link to comment

bro learn more .. if u use getPlayerMoney or setPlayerMoney or takePlayerMoney

it will not give you the correct number

wiki : Note: The amount may vary between the server and client, you shouldn't trust the client side value to always be accurate.

wiki ( takePlayerMoney )

Note: Using this function client side (not recommended) will not change a players money server side.

and ( setPlayerMoney ) same

i hope u understand .

Link to comment
bro learn more .. if u use getPlayerMoney or setPlayerMoney or takePlayerMoney

it will not give you the correct number

wiki : Note: The amount may vary between the server and client, you shouldn't trust the client side value to always be accurate.

wiki ( takePlayerMoney )

Note: Using this function client side (not recommended) will not change a players money server side.

and ( setPlayerMoney ) same

i hope u understand .

Oh I got it what you were trying to mean by telling it fake.

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