Jump to content

Problems


Jaysds1

Recommended Posts

  • Replies 365
  • Created
  • Last Reply

Top Posters In This Topic

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

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

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

@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

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

@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

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