koeno100 Posted September 7, 2014 Posted September 7, 2014 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?
MIKI785 Posted September 7, 2014 Posted September 7, 2014 There might be setPlayerMoney somewhere clientsided setting it to 0 so whenever server updates it it shows correct value as if it's changed clientside it doesn't get synced.
koeno100 Posted September 7, 2014 Author Posted September 7, 2014 I disabled every setPlayerMoney but it still happens. It's like when a new map starts, the server resets the player's clientside money to 0, but when a player is given money, it does update the money...
koeno100 Posted September 7, 2014 Author Posted September 7, 2014 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()"?
Dimos7 Posted September 9, 2014 Posted September 9, 2014 That happends because you have put OnClientRenter
Et-win Posted September 16, 2014 Posted September 16, 2014 That happends because you have put OnClientRenter Why does this matter? ...
#DRAGON!FIRE Posted September 16, 2014 Posted September 16, 2014 bro if u use getPlayerMoney in Client Side it's Fake .. use 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
Anubhav Posted September 16, 2014 Posted September 16, 2014 bro if u use getPlayerMoney in Client Side it's Fake .. uset it in Server Sideor 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.
#DRAGON!FIRE Posted September 16, 2014 Posted September 16, 2014 bro if u use getPlayerMoney in Client Side it's Fake .. uset it in Server Sideor 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.
DeVo Posted September 18, 2014 Posted September 18, 2014 @# 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.
Anubhav Posted September 18, 2014 Posted September 18, 2014 @# 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 )
#DRAGON!FIRE Posted September 18, 2014 Posted September 18, 2014 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 .
Anubhav Posted September 18, 2014 Posted September 18, 2014 bro learn more .. if u use getPlayerMoney or setPlayerMoney or takePlayerMoneyit 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now