UAEpro Posted February 17, 2011 Posted February 17, 2011 hii in my race script Money = getPlayerMoney ( getLocalPlayer() ) i got a label called " Money : ~{ " .. Money .. " }~ " but in the server when i set money i can see the money in the label .. but when next map came .. i see the value " 0 " but when i write /cash it give me the right value ? Why ?? تيم سبيك بروجيمر ts3server://ts.pg.sa
Castillo Posted February 17, 2011 Posted February 17, 2011 Post your code, we can't help you if you don't show us how does your script work. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
UAEpro Posted February 17, 2011 Author Posted February 17, 2011 ok cside local playerMoney = getPlayerMoney(source) Cashlbl = guiCreateLabel(12,54,203,20,"Cash : ~{ " .. playerMoney .. " }~",false,Tab1) guiLabelSetColor(Cashlbl,255,255,255) guiLabelSetVerticalAlign(Cashlbl,"top") guiLabelSetHorizontalAlign(Cashlbl,"left",false) i just did that to show the money amount edit : if i buy flip or repair from the shop tab i can see the value of the money تيم سبيك بروجيمر ts3server://ts.pg.sa
Castillo Posted February 17, 2011 Posted February 17, 2011 where you got that "source" from? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
UAEpro Posted February 17, 2011 Author Posted February 17, 2011 where you got that "source" from? source = getLocalPlayer() edit :: when i started to learn you helped me with my old race script .. thank you but know .. i got this weird problem !! تيم سبيك بروجيمر ts3server://ts.pg.sa
Aibo Posted February 17, 2011 Posted February 17, 2011 as it was discussed here a million times already: dont use source for anything you can think of, it causes confusion. source is a hidden variable that contains source of the event, passed to handler function. even if you do something like «source = getLocalPlayer()» in the start of your script, in your handler function (and i bet this code runs in some event handler) source will still be the source of the event in that function. because your global source gets replaced with source local to the function. ?
eAi Posted February 17, 2011 Posted February 17, 2011 Actually, variables like 'source' are globals in Lua, so if you did source = getLocalPlayer() at the top of your script, that variable would get overwritten by the source variable the first time an event it triggered.
UAEpro Posted February 18, 2011 Author Posted February 18, 2011 problem fixed by small trick ^^ close the topic تيم سبيك بروجيمر ts3server://ts.pg.sa
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