Cadu12 Posted September 13, 2011 Share Posted September 13, 2011 Solidsnake14, If im right we change getRootElement() to getLocalPlayer() in trigger? Link to comment
Castillo Posted September 13, 2011 Share Posted September 13, 2011 Yes, I would do that, because If I'm right, you are triggering it to all this way. Link to comment
Cadu12 Posted September 13, 2011 Share Posted September 13, 2011 Done, thank you for it. @Jaysds1 getRootElement = all players. getLocalPlayer = client local player. Link to comment
Jaysds1 Posted September 13, 2011 Author Share Posted September 13, 2011 (edited) Done, thank you for it.@Jaysds1 getRootElement = all players. getLocalPlayer = client local player. thanks EDIT: I was going to ask him another question but I solved it. and thanks Castillo Edited September 13, 2011 by Guest Link to comment
Cadu12 Posted September 13, 2011 Share Posted September 13, 2011 No problem, thanks to Castillo, he helped you too. Link to comment
Castillo Posted September 13, 2011 Share Posted September 13, 2011 You welcome. He forgot about me . Link to comment
Jaysds1 Posted September 15, 2011 Author Share Posted September 15, 2011 HI again, I want to know how to play a radio station from the internet and not coming from my computer Link to comment
Castillo Posted September 15, 2011 Share Posted September 15, 2011 It's the same way but you need to put the URL and not the file path. ex: playSound("google.com") Link to comment
Jaysds1 Posted September 15, 2011 Author Share Posted September 15, 2011 ohhhhhhhhh, ok thanks Link to comment
Jaysds1 Posted September 15, 2011 Author Share Posted September 15, 2011 I'm having a problem with this script, When the player presses b it opens a Window but if the Window is already open it's suppose to close, here's my script: dummy= guiCreateWindow(179,102,448,361,"J Dummy",false) if (guiGetVisible(dummy) == false) then guiSetVisible(dummy,true) else guiSetVisible(dummy,false) end Link to comment
Castillo Posted September 15, 2011 Share Posted September 15, 2011 dummy= guiCreateWindow(179,102,448,361,"J Dummy",false) bindKey("b","down",function () guiSetVisible(dummy,not guiGetVisible(dummy)) end) Link to comment
Jaysds1 Posted September 17, 2011 Author Share Posted September 17, 2011 Hi again everyone, Today I'm having problem with a button, When the person selects the radio channel and press play, it's suppose to (OF COURSE) Play here's my script: -- CLIENT-SIDE ONLY function radioSt() guiSetVisible(radio, not guiGetVisible(radio)) showCursor(not isCursorShowing()) addEventHandler("onClientGUIClick",background,function() guiMoveToBack(background) end,false) addEventHandler("onClientGUIClick",play, function() if (guiGridListGetSelectedItem(stations) == guiGridListGetItemText(stations,1,1)) then playSound("http://www.flow935.com/live/") end end,false) end Link to comment
JR10 Posted September 17, 2011 Share Posted September 17, 2011 This function returns the row and colum indexes of the selected item in a grid list. -- CLIENT-SIDE ONLY function radioSt() guiSetVisible(radio, not guiGetVisible(radio)) showCursor(not isCursorShowing()) addEventHandler("onClientGUIClick",background,function() guiMoveToBack(background) end,false) addEventHandler("onClientGUIClick",play, function() if (guiGridListGetItemText (stations, guiGridListGetSelectedItem(stations)) == guiGridListGetItemText(stations,1,1)) then playSound("http://www.flow935.com/live/") end end,false) end You better outputDebugString because the URL might not work. Link to comment
Jaysds1 Posted September 17, 2011 Author Share Posted September 17, 2011 thanks for helping, I'll edited the url Link to comment
JR10 Posted September 17, 2011 Share Posted September 17, 2011 I said might not, I don't know whether it will work or not. Link to comment
Jaysds1 Posted September 18, 2011 Author Share Posted September 18, 2011 @JR10 I've edit it, and it worked Hi everyone again (saying this is starting to get boring), Today, I have a problem with this DX Draw Text, When a player joins, it's suppose to create a DX Text with the player name and after another player join it goes on and on, after when 3 player joins it's suppose to destroy the first text and resets all the timers here: addEventHandler("onClientPlayerJoin",getLocalPlayer(), function() myName = getPlayerName(getLocalPlayer()) triggerEvent("create",getRootElement(),myName) end) addEvent("create",true) addEventHandler("create",getRootElement(),function() addEventHandler("onClientRender",getRootElement(),createDX) end) function createDX(myName) drawn = dxDrawText(myName,540.0,563.0,709.0,580.0,tocolor(255,0,0,255),1.0,"default","left","top",false,false,false) timer = setTimer(destroyElement,10000,1,drawn) if (drawn) then timer1 = setTimer(destroyElement,7000,1,drawn) drawn1 = dxDrawText(myName,363.0,564.0,532.0,581.0,tocolor(255,0,0,255),1.0,"default","left","top",false,false,false) elseif (drawn1) then timer2 = setTimer(destroyElement,7000,1,drawn1) drawn2 = dxDrawText(myName,196.0,565.0,365.0,582.0,tocolor(255,0,0,255),1.0,"default","left","top",false,false,false) elseif (drawn2) then timer3 = setTimer(destroyElement,7000,1,drawn2) drawn3 = dxDrawText(myName,25.0,564.0,194.0,581.0,tocolor(255,0,0,255),1.0,"default","left","top",false,false,false) elseif (drawn3) then killTimer(timer) destroyElement(drawn1) end end Link to comment
BinSlayer1 Posted September 18, 2011 Share Posted September 18, 2011 well first of all, you're getting the name of the local player instead of 'source' secondly, your 'create' event simply fires up an onClientRender and the function attached to it will not get any 'myName' argument I suggest rewrite everything define a table of players onClientPlayerJoin, add the source's name to the table if table length > 3 then empty the whole table onClientRender should run at all times in the script (i.e fired when the resource starts) inside onClientRender, loop through the table of players and make as many drawTexts as the length of the table Link to comment
Cadu12 Posted September 18, 2011 Share Posted September 18, 2011 @Jaysds1: Your code are wrong =/ Well, I have this using dxDrawText, Colored and Alpha... table.insert(yourtable, {"string", 255, false}) -- [1] string - text, [2] alpha - you can set alpha when times up , [3] boolean - you cant set some, add tables if #yourtable > 5 then table.remove(yourtable, 1) end -- it will remove at 1st every table. create function with onClientRender for i, v in ipairs(yourtable) do if v[2] <= 255 and v[3] == false then if v[2] <= 0 then v[3] = true else v[2] = v[2] - 0.50 end end end dxDrawText(v[1], 500, 500) PS: If you want soure code, I can give you in PM and not give to anyone my scripts. Link to comment
Jaysds1 Posted September 23, 2011 Author Share Posted September 23, 2011 (edited) Hi all, I want to know how to disable a button., If I use the same GUI I want to disable the button for the other time it comes up Example: When I use the button for houses, if it's the players house enable the button else disable and tell player buy this house or get lost. Edited September 23, 2011 by Guest Link to comment
Cadu12 Posted September 23, 2011 Share Posted September 23, 2011 https://wiki.multitheftauto.com/wiki/GuiSetEnabled Link to comment
Jaysds1 Posted September 23, 2011 Author Share Posted September 23, 2011 thanks u guyz, is this a new function? Link to comment
Cadu12 Posted September 23, 2011 Share Posted September 23, 2011 Not problem and I dont tinhk so. JR10, sorry you're slow too . Link to comment
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