Moderators IIYAMA Posted November 28, 2015 Moderators Posted November 28, 2015 That has at the moment nothing to do with this. You are using addCommandHandler and not the company resource to trigger this function. What? i want to with addCommandHandler send $ to company.. But i don't want to player i have firm system. Then you should not have said that, because it has nothing to do with the problem. And you know now how to solve it...
1LoL1 Posted November 28, 2015 Author Posted November 28, 2015 That has at the moment nothing to do with this. You are using addCommandHandler and not the company resource to trigger this function. What? i want to with addCommandHandler send $ to company.. But i don't want to player i have firm system. Then you should not have said that, because it has nothing to do with the problem. And you know now how to solve it... No i don't know.. i want only give player to element or i don't know what.. not player.
Moderators IIYAMA Posted November 28, 2015 Moderators Posted November 28, 2015 What don't you understand about our explanations? We gave you two solutions, where for one already copy past ready is... -_-"
1LoL1 Posted November 28, 2015 Author Posted November 28, 2015 What don't you understand about our explanations? We gave you two solutions, where for one already copy past ready is... -_-" But not work.
Moderators IIYAMA Posted November 28, 2015 Moderators Posted November 28, 2015 And why don't you show us the code then? Do you really think we can see through your eyes? !
1LoL1 Posted November 28, 2015 Author Posted November 28, 2015 And why don't you show us the code then? Do you really think we can see through your eyes? ! Here: work but i don't know how i can show how many $ is in in client-side (window) mean: local www = getElementData(test, "Data") local label = guiCreateLabel(...) guiSetText(www, ""..www.."") money i know --> getPlayerMoney(localPlayer) test = createElement("TEST") function w (source) local ddd = (getElementData(test, "Data") or 0) outputChatBox(""..ddd.."", source, 255, 255, 255, true) end addCommandHandler("data", w) function ww (source,command,amount) local money = getPlayerMoney(source) local amount = tonumber(math.floor(amount)) if (amount) then if tonumber(money) >= amount and amount > 0 then setElementData(test, "Data", (getElementData(test, "Data") or 0) + amount) takePlayerMoney(source, amount) outputChatBox("Player "..string.gsub(getPlayerName(source), "#%x%x%x%x%x%x", "").." --> "..convertNumber(amount).."$", getRootElement(), 255, 0, 0, true) else outputChatBox("test", source, 255, 0, 0, true) end end end addCommandHandler("ddr", ww)
Moderators IIYAMA Posted November 28, 2015 Moderators Posted November 28, 2015 1) You haven't added the fixes, this is still the same code as before. 2) Wtf is elementdata "data" ? Give it a good name. local www = tonumber(getElementData(test, "Data")) or 0 local label = guiCreateLabel(...) [strike]guiSetText(www, ""..www.."")[/strike] guiSetText(label,www) 3) Wtf is www? 4) Where are your tabs?
1LoL1 Posted November 28, 2015 Author Posted November 28, 2015 1) You haven't added the fixes, this is still the same code as before.2) Wtf is elementdata "data" ? Give it a good name. local www = tonumber(getElementData(test, "Data")) or 0 local label = guiCreateLabel(...) [strike]guiSetText(www, ""..www.."")[/strike] guiSetText(label,www) 3) Wtf is www? 4) Where are your tabs? All work normally.. but how i can show getElementData this data in window? 3) = look again.. guiSetText(label,www) and if i have there text? so guiSetText(label, "Money: "..www.."")
Moderators IIYAMA Posted November 28, 2015 Moderators Posted November 28, 2015 All work normally.. but how i can show getElementData this data in window? The same way as with the label. Using guiSetText. 3) = look again..guiSetText(label,www) and if i have there text? so guiSetText(label, "Money: "..www.."") I understand what a variable is, I only don't understand why you call it:www The name is just too hazy.
1LoL1 Posted November 28, 2015 Author Posted November 28, 2015 All work normally.. but how i can show getElementData this data in window? The same way as with the label. Using guiSetText. 3) = look again..guiSetText(label,www) and if i have there text? so guiSetText(label, "Money: "..www.."") I understand what a variable is, I only don't understand why you call it:www The name is just too hazy. Server-Side work normally. and this too: function Money (source) local money = (getElementData(test, "Data") or 0) outputChatBox("Money: "..convertNumber(money).."$!", source, 255, 255, 255, true) end addCommandHandler("money", Money) and here is Client-Side but not work.. function CreateShopWindow() Window = guiCreateWindow(350,225,200,200,"TEST",false) guiSetAlpha ( Window, 5.00 ) guiWindowSetMovable ( Window, false ) local money = (getElementData(test, "Data") or 0) local C1 = guiCreateLabel(10,100,500,500,"",false,Window) guiSetText (C1, "TEST: "..convertNumber(money).."$") guiSetFont(C1, "default-bold-small") guiWindowSetSizable(Window,false) end function convertNumber ( number ) local formatted = number while true do formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2') if ( k==0 ) then break end end return formatted end function ShowGUI ( ) CreateShopWindow () showCursor (true) local screenW,screenH = guiGetScreenSize() local windowW,windowH = guiGetSize(Window,false) local x,y = (screenW-windowW)/2,(screenH-windowH)/2 guiSetPosition(Window,x,y,false) end function window () if isElement(Window) then HideGUI() else ShowGUI() end end bindKey ( "F5","down", window) function HideGUI () destroyElement (Window) showCursor(false) end
Moderators IIYAMA Posted November 28, 2015 Moderators Posted November 28, 2015 There are no debug lines in this code. Add them, test it and then come back and tell me where it stops working.
1LoL1 Posted November 29, 2015 Author Posted November 29, 2015 There are no debug lines in this code. Add them, test it and then come back and tell me where it stops working. What add? my question is what i must add or how i can add to client-side of server-side getElementData(test, "Data") or 0
Moderators IIYAMA Posted November 29, 2015 Moderators Posted November 29, 2015 This is what you must add: https://wiki.multitheftauto.com/wiki/OutputDebugString Why would we look for an unknown mistake all the way down the code, while you can locate circa the location for us?
1LoL1 Posted November 29, 2015 Author Posted November 29, 2015 This is what you must add: https://wiki.multitheftauto.com/wiki/OutputDebugStringWhy would we look for an unknown mistake all the way down the code, while you can locate circa the location for us? Wtf? i want only of SERVER-SIDE Money to show in Client-Side [WINDOW]..... Server-Side: test = createElement("TEST") function Money (source) local money = (getElementData(test, "Data") or 0) outputChatBox("Money: "..convertNumber(money).."$!", source, 255, 255, 255, true) end addCommandHandler("money", Money) Client-Side: function CreateShopWindow() Window = guiCreateWindow(350,225,200,200,"TEST",false) guiSetAlpha ( Window, 5.00 ) guiWindowSetMovable ( Window, false ) local money = (getElementData(test, "Data") or 0) local C1 = guiCreateLabel(10,100,500,500,"",false,Window) guiSetText (C1, "TEST: "..convertNumber(money).."$") guiSetFont(C1, "default-bold-small") guiWindowSetSizable(Window,false) end function convertNumber ( number ) local formatted = number while true do formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2') if ( k==0 ) then break end end return formatted end function ShowGUI ( ) CreateShopWindow () showCursor (true) local screenW,screenH = guiGetScreenSize() local windowW,windowH = guiGetSize(Window,false) local x,y = (screenW-windowW)/2,(screenH-windowH)/2 guiSetPosition(Window,x,y,false) end function window () if isElement(Window) then HideGUI() else ShowGUI() end end bindKey ( "F5","down", window) function HideGUI () destroyElement (Window) showCursor(false) end
Moderators IIYAMA Posted November 29, 2015 Moderators Posted November 29, 2015 Sorry, but you are very hard to help and only interested in the end product. I can't help you any further now, you should try to find somebody else who doesn't care about the debug process unlike me. Good luck!
1LoL1 Posted November 29, 2015 Author Posted November 29, 2015 Sorry, but you are very hard to help and only interested in the end product. I can't help you any further now, you should try to find somebody else who doesn't care about the debug process unlike me. Good luck! Why hard?.. i said server-side work normally i want only client-side fix.
Moderators IIYAMA Posted November 29, 2015 Moderators Posted November 29, 2015 Sorry, but you are very hard to help and only interested in the end product. I can't help you any further now, you should try to find somebody else who doesn't care about the debug process unlike me. Good luck! Why hard?.. i said server-side work normally i want only client-side fix. Because I am trying to teach you something so you can find your problem, but you are with your head somewhere else. I can take a look at your code, spending 20 min looking for the mistake or I can let you debug it and you will learn something from it. And it will only cost 5 min of my time. The last methode is a standard of the scripting section, which is the one I prefer. It is a learning section after all.
Addlibs Posted December 6, 2015 Posted December 6, 2015 Can you show your most recent code and re-state your exact problem?
1LoL1 Posted December 6, 2015 Author Posted December 6, 2015 Can you show your most recent code and re-state your exact problem? server: test = createElement("TEST") function Money (source) local money = (getElementData(test, "Data") or 0) outputChatBox("Money: "..convertNumber(money).."$!", source, 255, 255, 255, true) end addCommandHandler("money", Money) client: function CreateShopWindow() Window = guiCreateWindow(350,225,200,200,"TEST",false) guiSetAlpha ( Window, 5.00 ) guiWindowSetMovable ( Window, false ) local money = (getElementData(test, "Data") or 0) local C1 = guiCreateLabel(10,100,500,500,"",false,Window) guiSetText (C1, "TEST: "..convertNumber(money).."$") guiSetFont(C1, "default-bold-small") guiWindowSetSizable(Window,false) end function convertNumber ( number ) local formatted = number while true do formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2') if ( k==0 ) then break end end return formatted end function ShowGUI ( ) CreateShopWindow () showCursor (true) local screenW,screenH = guiGetScreenSize() local windowW,windowH = guiGetSize(Window,false) local x,y = (screenW-windowW)/2,(screenH-windowH)/2 guiSetPosition(Window,x,y,false) end function window () if isElement(Window) then HideGUI() else ShowGUI() end end bindKey ( "F5","down", window) function HideGUI () destroyElement (Window) showCursor(false) end And in server side works normally but how i can show money of server-side to client-side in label.
iPrestege Posted December 6, 2015 Posted December 6, 2015 test is nil in the client side getElementData*
1LoL1 Posted December 6, 2015 Author Posted December 6, 2015 test is nil in the client side getElementData* I know so my question is how i can fix this?
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