Jump to content

TAPL

Retired Staff
  • Posts

    7,337
  • Joined

  • Days Won

    11

Everything posted by TAPL

  1. TAPL

    [Question]

    Brackets missing at line 1 for tonumber.
  2. TAPL

    [Question]

    edit1 = guiCreateEdit(...) edit2 = guiCreateEdit(...) --- local Min = guiGetText(edit1) local Hour = guiGetText(edit2) setTime(Hour, Min)
  3. TAPL

    [Question]

    You want set the time or get the time?
  4. You're welcome.
  5. TAPL

    [Question]

    You want the real time or the game time? The game time doesn't have seconds, only hours and minutes. You may notice that the game minute is a second in real time and game hour is a minute in real time. setTime
  6. TAPL

    [Question]

    No, they are two edit.
  7. TAPL

    [Question]

    What is this? It's looks like a window and two edit with one label and there is a time on it. guiCreateWindow guiCreateEdit guiCreateLabel guiSetText Real time? getRealTime Game time? getTime
  8. local myMarker = createMarker(2841, -1725, 10, 'cylinder', 2.0, 255, 0, 0, 150) local screenX, screenY = guiGetScreenSize() function MarkerHit(player) if player == localPlayer then if not isTimer(timer) then second = 60 timer = setTimer(function() second = second-1 end, 1000, 0) addEventHandler("onClientRender", root, display) end end end addEventHandler("onClientMarkerHit", myMarker, MarkerHit) function MarkerLeave(player) if player == localPlayer then removeEventHandler("onClientRender", root, display) if isTimer(timer) then killTimer(timer) end end end addEventHandler("onClientMarkerLeave", myMarker, MarkerLeave) function display() dxDrawRectangle(screenX * 0.40, screenY * 0.09, 250, 50, tocolor(0,0,0,150)) dxDrawText(second, screenX * 0.48, screenY * 0.1, screenX, screenY, tocolor(255,255,255), 2) end
  9. I don't see anything wrong, it might be the client file have another code which contains error and it lead to failure in loading the client side OR maybe there is something wrong with the meta.
  10. The limit for setAccountData is 128, that's why you have trouble with toJSON and fromJSON. You need to find other way to store the string, like SQLite or XML or even a file.
  11. Window ~> window
  12. oh i got it, you used event onClientResourceStart for create the gui window, button.. Move this line and put it inside event onClientResourceStart below the guiCreateButton. addEventHandler ("onClientGUIClick", CloseButton, CloseShop)
  13. You're welcome.
  14. TAPL

    route

    function centerWindow(center_window) local screenW,screenH=guiGetScreenSize() local windowW,windowH=guiGetSize(center_window,false) local x,y = (screenW-windowW)/2,(screenH-windowH)/2 guiSetPosition(center_window,x,y,false) end jobWdw = guiCreateWindow(638, 266, 597, 655, "SANGSweeper", false) guiWindowSetSizable(jobWdw, false) centerWindow(jobWdw) takejobBtn = guiCreateButton(378, 131, 190, 78, "Take Job", false, jobWdw) closeBtn = guiCreateButton(378, 524, 190, 78, "Close", false, jobWdw) guiSetVisible(jobWdw, false) local jobMarker = createMarker(10, 10, 3, "cylinder", 1, 0, 255, 0, 255) local jobBlip = createBlipAttachedTo(jobMarker, 41) function GetSweeperJob(hitElement) if hitElement == localPlayer then if getElementData(hitElement, "Occupation") ~= "Sweeper" then guiSetVisible(jobWdw, true) guiSetInputEnabled(true) showCursor(true) centerWindow(jobWdw) else outputChatBox("You already are a sweeper!", 255, 0, 0) end end end addEventHandler("onClientMarkerHit", jobMarker, GetSweeperJob) function clickJobWindow(button,state) if (source == takejobBtn) then triggerServerEvent("GiveSweeperJob", localPlayer) guiSetVisible(jobWdw, false) guiSetInputEnabled(false) showCursor(false) elseif (source == closeBtn) then guiSetVisible(jobWdw, false) guiSetInputEnabled(false) showCursor(false) end end addEventHandler("onClientGUIClick", guiRoot, clickJobWindow) local route = { { 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 2 }, { 0, 0, 3 }, { 0, 0, 4 } } function SweepEnter(theVehicle, seat, jacked) local id = getElementModel(theVehicle) if id == 574 then if getElementData(source, "Occupation") == "Sweeper" then outputChatBox("You are now sweeping!", 255, 0, 0) if not isElement(marker) then currentIndex = ((currentIndex or 0) < #route) and ((currentIndex or 0) + 1) or 1 marker = createMarker(unpack(route[currentIndex])) end else if isElement(marker) then destroyElement(marker) end end end end addEventHandler("onClientPlayerVehicleEnter", localPlayer, SweepEnter) function SweepExit(theVehicle, seat, jacked) local id = getElementModel(theVehicle) if id == 574 and isElement(marker) then destroyElement(marker) end end addEventHandler("onClientPlayerVehicleExit", localPlayer, SweepExit) addEventHandler("onClientMarkerHit", root, function(player) if (source == marker) then if player == localPlayer and getElementData(player, "Occupation") == "Sweeper" then local vehicle = getPedOccupiedVehicle(player) if vehicle and getElementModel(vehicle) == 574 then outputChatBox("You hit the marker!", 255, 255, 0) destroyElement(marker) currentIndex = ((currentIndex or 0) < #route) and ((currentIndex or 0) + 1) or 1 marker = createMarker(unpack(route[currentIndex])) end end end end) addEvent("ResignSweeperJob", true) addEventHandler("ResignSweeperJob", root, function() if isElement(marker) then destroyElement(marker) end end)
  15. If your code looks like: function CloseShop() if guiGetVisible (GUIEditor.Window[1]) then guiSetVisible (GuiEditor.Window[1], false) showCursor (false) end end addEventHandler ("onClientGUIClick", CloseButton, CloseShop) CloseButton = guiCreateButton(432, 298, 108, 43, "Close", false, GUIEditor.staticimage[1]) guiSetProperty(CloseButton, "NormalTextColour", "FFEF0000") Then it will show the error bad argument. So you have to correct it like this: CloseButton = guiCreateButton(432, 298, 108, 43, "Close", false, GUIEditor.staticimage[1]) guiSetProperty(CloseButton, "NormalTextColour", "FFEF0000") function CloseShop() if guiGetVisible (GUIEditor.Window[1]) then guiSetVisible (GuiEditor.Window[1], false) showCursor (false) end end addEventHandler ("onClientGUIClick", CloseButton, CloseShop)
  16. Then how you want to see it? By default it doesn't show your own. Go to the meta setting and change HideOwn from true to false.
  17. TAPL

    route

    Repeat again: Use event onClientPlayerVehicleExit and destroy the marker.
  18. TAPL

    Diving

    policeVehicles = { [ 598 ] = true, [ 596 ] = true, [ 597 ] = true, [ 599 ] = true } function enterVehicle ( player, seat, jacked ) local kon = getPlayerAccount ( player ) if ( policeVehicles [ getElementModel ( source ) ] ) then if (getAccountData ( kon, "prawko2" ) ~= "zajety" ) then cancelEvent ( ) outputChatBox ( "Only if you have a licence car", player ) end end end addEventHandler ( "onVehicleStartEnter", root, enterVehicle )
  19. Did you tried it with others player?
  20. What kind of information? Save it where and why? it already saved in (internal.db).
  21. TAPL

    route

    Client Side: function centerWindow(center_window) local screenW,screenH=guiGetScreenSize() local windowW,windowH=guiGetSize(center_window,false) local x,y = (screenW-windowW)/2,(screenH-windowH)/2 guiSetPosition(center_window,x,y,false) end jobWdw = guiCreateWindow(638, 266, 597, 655, "SANGSweeper", false) guiWindowSetSizable(jobWdw, false) centerWindow(jobWdw) takejobBtn = guiCreateButton(378, 131, 190, 78, "Take Job", false, jobWdw) closeBtn = guiCreateButton(378, 524, 190, 78, "Close", false, jobWdw) guiSetVisible(jobWdw, false) local jobMarker = createMarker(10, 10, 3, "cylinder", 1, 0, 255, 0, 255) local jobBlip = createBlipAttachedTo(jobMarker, 41) function GetSweeperJob(hitElement) if hitElement == localPlayer then if getElementData(hitElement, "Occupation") ~= "Sweeper" then guiSetVisible(jobWdw, true) guiSetInputEnabled(true) showCursor(true) centerWindow(jobWdw) else outputChatBox("You already are a sweeper!", 255, 0, 0) end end end addEventHandler("onClientMarkerHit", jobMarker, GetSweeperJob) function clickJobWindow(button,state) if (source == takejobBtn) then triggerServerEvent("GiveSweeperJob", localPlayer) guiSetVisible(jobWdw, false) guiSetInputEnabled(false) showCursor(false) elseif (source == closeBtn) then guiSetVisible(jobWdw, false) guiSetInputEnabled(false) showCursor(false) end end addEventHandler("onClientGUIClick", guiRoot, clickJobWindow) local route = { { 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 2 }, { 0, 0, 3 }, { 0, 0, 4 } } function SweepEnter(theVehicle, seat, jacked) local id = getElementModel(theVehicle) if id == 574 then if getElementData(source, "Occupation") == "Sweeper" then outputChatBox("You are now sweeping!", 255, 0, 0) if not marker then currentIndex = ((currentIndex or 0) < #route) and ((currentIndex or 0) + 1) or 1 marker = createMarker(unpack(route[currentIndex])) end else if marker then destroyElement(marker) end end end end addEventHandler("onClientPlayerVehicleEnter", root, SweepEnter) addEventHandler("onClientMarkerHit", root, function(player) if (source == marker) then if player == localPlayer and getElementData(player, "Occupation") == "Sweeper" then local vehicle = getPedOccupiedVehicle(player) if vehicle and getElementModel(vehicle) == 574 then outputChatBox("You hit the marker!", 255, 255, 0) destroyElement(marker) currentIndex = ((currentIndex or 0) < #route) and ((currentIndex or 0) + 1) or 1 marker = createMarker(unpack(route[currentIndex])) end end end end) addEvent("ResignSweeperJob", true) addEventHandler("ResignSweeperJob", root, function() if marker then destroyElement(marker) end end) Server Side: local sweeperTeam = createTeam("Sweeper", 255, 0, 0) local joblessTeam = createTeam("Unemployed", 123, 123, 123) function GiveSweeperJob() setElementModel(source, 264) setPlayerTeam(source, sweeperTeam) setElementData(source, "Occupation", "Sweeper") outputChatBox("You are now a sweeper!", source, 255, 0, 0) end addEvent("GiveSweeperJob", true) addEventHandler("GiveSweeperJob", root, GiveSweeperJob) function resignSweeperJob(player) if (getElementData(player, "Occupation") == "Sweeper") then setElementModel(player, math.random(1,287)) setPlayerTeam(player, joblessTeam) setElementData(player, "Occupation", "Unemployed") triggerClientEvent(player, "ResignSweeperJob",player) outputChatBox("You resigned as sweeper!", player, 255, 0, 0) elseif getElementData(player, "Occupation") == "Unemployed" then outputChatBox("You are already Unemployed!", player, 255, 0, 0) end end addCommandHandler("resign", resignSweeperJob)
  22. I can't give you an example while i don't know what you trying to do.
  23. No problem.
  24. I don't see anything wrong in the code.
  25. label table is not defined then. OR You maybe used guiSetText before the label created. guiSetText (label[1] , getPlayerName(localPlayer)) label[1] = guiCreateLabel(20, 97, 224, 33, "Name : ", false, window[1]) guiSetFont(label[1], "default-bold-small") Should be label[1] = guiCreateLabel(20, 97, 224, 33, "Name : ", false, window[1]) guiSetFont(label[1], "default-bold-small") guiSetText (label[1] , getPlayerName(localPlayer))
×
×
  • Create New...