Jump to content

BrastaSauce

Members
  • Posts

    13
  • Joined

  • Last visited

BrastaSauce's Achievements

Square

Square (6/54)

0

Reputation

  1. if timeLeft >=1 then for x=1, smmm, 1 do --add difference as minutes x + timeLeft = totalTimeLeft end Why is it giving me this error? timeLeft by default is set to 0. I have an equal sign in the equation.
  2. I thought about it, but wouldn't that result in the alarm being slightly off? Possibly even by 50 seconds?
  3. I know. But would I continue looping a check to see if it's the set time?
  4. Well, the player sets an alarm in 24 hour time. I want it so when local time (aka getRealTime) reaches that time, it plays a sound. Right now I have it so if the time set = current time, it plays the sound. Just as a test though, and it works flawlessly.
  5. So, I'm creating an alarm system, and I need help since I'm fairly new to this. So I've already got most stuff down, except the main part, calling the alarm sound when the set time comes. Could someone just give me a few tips on how I would go about this? And please, don't just give me a script that will work, cause I won't learn that way
  6. Thank you! Any chance you could tell me what I did wrong for that to happen?
  7. So, I have this script I'm starting and so far I only have the GUI, it's to an alarm system. Well, here's my script. local time = getRealTime() local hour = time.hour local minute = time.minute function setAlarmGUI() winSetAlarm = guiCreateWindow(804, 306, 313, 187, "Set Alarm", false) guiWindowSetSizeable(winSetAlarm, false) lblHour = guiCreateEdit(117, 61, 30, 23, hour, false, winSetAlarm) guiCreateLabel(153, 64, 15, 20, ":", false, winSetAlarm) lblMin = guiCreateEdit(163, 61, 30, 23, minute, false, winSetAlarm) guiCreateLabel(126, 44, 21, 17, "hh", false, winSetAlarm) guiCreateLabel(168, 44, 21, 17, "mm", false, winSetAlarm) btnCloseAlarm = guiCreateButton(23, 56, 62, 28, "Close", false, winSetAlarm) btnSetAlarm = guiCreateButton(231, 56, 62, 28, "Set", false, winSetAlarm) winSetAlarmGrid = guiCreateGridList(13, 91, 290, 86, false, winSetAlarm) guiGridListAddColumn(winSetAlarmGrid, "Alarm", 0.9) guiCreateLabel(7, 32, 273, 44, "This alarm uses 24-hour times. Set it according to\nlocal time.", false, winSetAlarmGrid) guiEditSetMaxLength(lblHour, 2) guiEditSetMaxLength(lblMin, 2) end addCommandHandler("setalarm", setAlarmGUI) function onSetClick(button) if button == left then guiGetText(lblHour) guiGetText(lblMin) destroyElement(winSetAlarm) outputChatBox("Alarm set!", thePlayer, 0, 255, 0) end end Alright, and here is my meta.xml to prove that this is set to Client Side. <meta> <info author="Brasta" type="script" description="Alarm System"/> <script src="s_alarm.lua" type="server"/> <script src="c_alarm.lua" type="client"/> </meta> Here's my problem. It is giving me three errors. 2 of which happen immediately and are "Line 14: addEventHandler Bad Argument at 2, expected Element" and "Line 21: addEventHandler Bad Argument at 2, expected Element". That's the gist of that. The problem? Line 14 and line 21 on my client file aren't even addEventHandlers. In fact, I don't have a single one in that entire script. Then when I do /setalarm, it only loads the window and says "Line 7: attempted to call global "guiWindowSetSizable" " Which isn't even true, since it loads the window before it easily, and since this file is set to Clientside. What's going on?
  8. Alright, so every example I see of it is used to click on an element in the GTA world. How would I make one that would simply create a window once clicked on a certain part of the screen?
  9. Alright, so my problem is that I need to make my dxDrawText clickable, to open a new window. For this I am using.. addEventHandler("onClientGUIClick", , clickOnMessage) The second argument is empty because it calls for an element, and sadly, dxDrawText is a boolean. So is there anyways I can make dxDrawText an element to fit the second argument? Or is there a completely different way to making it clickable.
  10. addEventHandler("onClientRender", root, function() local screenx, screeny, worldx, worldy, worldz = getCursorPosition() if (isCursorShowing() ) then if (screenx >= 924 and screenx <= 977) and (screeny >= 375 and screeny <=390) then redMessage = dxDrawText("Message", 924, 375, 977, 390, tocolor(255, 0, 0, 255), 1.00, "default-bold", "left", "top", false, false, true, false, false) else dxDrawText("Message", 924, 375, 977, 390, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, true, false, false) end else dxDrawText("Message", 924, 375, 977, 390, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, true, false, false) end addEventHandler("onClientGUIClick", redMessage, clickOnMessage) end ) So this is the command I have. It's nowhere near perfect, but I just want to know how to set a bind that would toggle the function on and off. Thanks.
  11. Screenx gave me a boolean, while screeny gave me nil for some reason.
  12. I get an error for attempting to compare a number with a boolean on line 4. addEventHandler("onClientRender", root, function() local screenx, screeny, worldx, worldy, worldz = getCursorPosition() if (screenx >= 924 and screenx <= 983) and (screeny <= 375 and screeny >=360) then redMessage = dxDrawText("Message", 924, 375, 977, 390, tocolor(255, 0, 0, 255), 1.00, "default-bold", "left", "top", false, false, true, false, false) else dxDrawText("Message", 924, 375, 977, 390, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, true, false, false) end addEventHandler("onClientGUIClick", redMessage, clickOnMessage) end )
×
×
  • Create New...