Jump to content

Search the Community

Showing results for tags 'settimer'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Multi Theft Auto: San Andreas 1.x
    • Support for MTA:SA 1.x
    • User Guides
    • Open Source Contributors
    • Suggestions
    • Ban appeals
  • General MTA
    • News
    • Media
    • Site/Forum/Discord/Mantis/Wiki related
    • MTA Chat
    • Other languages
  • MTA Community
    • Scripting
    • Maps
    • Resources
    • Other Creations & GTA modding
    • Competitive gameplay
    • Servers
  • Other
    • General
    • Multi Theft Auto 0.5r2
    • Third party GTA mods
  • Archive
    • Archived Items
    • Trash

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


About Me


Member Title


Gang


Location


Occupation


Interests

Found 16 results

  1. Ola tudo bem? eu estava programando e veio a ideia de usar o setTimer ao invez do onClientRender porque notei diferença no ipb quando eu usava onClientRender o ipb dava x, ao usar setTimer o ipb dava metade do x so queria saber se existe algum problema fazer deste modo
  2. Estou meio confuso com isso, alguém poderia me ajudar? setTimer ( fadeCameraDelayed, 5000, 1, source ) setCameraTarget (source, source) AVISO:respawn/server.lua:80: Argumento inválido @ 'setTimer' [função esperada no argumento 1, obtido nulo]
  3. addEventHandler ("onResourceStart", getRootElement(), function() setTimer ( moneyZoneTimerFunction, 2500, 0) local allGreenzones = getElementsByType ("radararea") for i,v in ipairs (allGreenzones) do local r,g,b,a = getRadarAreaColor (v) if (r == 0) and (g == 255) and (b == 0) and (a == 127) then local x,y = getElementPosition (v) local sx,sy = getRadarAreaSize (v) local col = createColCuboid (x,y, -50, sx,sy, 7500) setElementID (col, "greenzoneColshape") end end end) addEventHandler ("onColShapeHit", getRootElement(), function(hitElement, matchingDimension) if (getElementType (hitElement) == "player") and (getElementID (source) == "greenzoneColshape") then outputChatBox ("", hitElement, 255, 0, 0, true) toggleControl (hitElement, "fire", false) toggleControl (hitElement, "next_weapon", false) toggleControl (hitElement, "previous_weapon", false) toggleControl (hitElement, "sprint", true) toggleControl (hitElement, "aim_weapon", false) toggleControl (hitElement, "vehicle_fire", false) setPlayerHudComponentVisible (hitElement, "ammo", false) setPlayerHudComponentVisible (hitElement, "weapon", false) triggerClientEvent (hitElement, "enableGodMode", hitElement) end if (source == moneyZoneCol) and (getElementType (hitElement) == "vehicle") then setElementVelocity (hitElement, 0, 0, 0) setElementPosition (hitElement, 2018.33, 1534.77, 12.37) setVehicleRotation (hitElement, 0,0,270) if (getVehicleOccupant (hitElement, 0)) then outputChatBox ("", getVehicleOccupant (hitElement, 0), 255, 0, 0, false) end end end) addEventHandler ("onColShapeLeave", getRootElement(), function(leaveElement, matchingDimension) if (getElementType (leaveElement) == "player") and (getElementID (source) == "greenzoneColshape") then outputChatBox ("", leaveElement, 255, 0, 0, false) toggleControl (leaveElement, "fire", true) toggleControl (leaveElement, "next_weapon", true) toggleControl (leaveElement, "previous_weapon", true) toggleControl (leaveElement, "sprint", true) toggleControl (leaveElement, "aim_weapon", true) toggleControl (leaveElement, "vehicle_fire", true) setPlayerHudComponentVisible (leaveElement, "ammo", false) setPlayerHudComponentVisible (leaveElement, "weapon", false) triggerClientEvent (leaveElement, "disableGodMode", leaveElement) end end) --money zone col moneyZoneCol = createColCuboid (1993.12, 1519.14, -100, 17.43, 54.24, 117) --stop moneyzone col -- marker bij hospital createMarker (1607.36, 1814.24, -10, "cylinder", 24, 0, 255, 0, 190, getRootElement()) Boa noite, estou usando um script de Zona Verde e continuo recebendo warnings sobre um setTimer para uma função que não existe supostamente, queria saber se alguém pode me indicar um modo de retirar esse warning e se eu preciso manter esse setTimer, não programo em Lua porém consigo entender algumas coisas e até alterar outras, porém essa está difícil de entender para mim. Mensagem:
  4. function enableAccount ( accountJ ) if not isGuestAccount ( accountJ ) then if accountJ then local source = getAccountPlayer ( accountJ ) local XP = getAccountData ( accountJ, "XP" ) or 0 setElementData ( source, "XP", XP ) local Level = getAccountData ( accountJ, "Level" ) or 0 setElementData ( source, "Level", Level ) end end end function saveAccount ( accountJ ) if accountJ then local source = getAccountPlayer ( accountJ ) local XP = getElementData(source, "XP" ) or 0 setAccountData ( accountJ, "XP", XP ) local Level = getElementData(source, "Level" ) or 0 setAccountData ( accountJ, "Level", Level ) end end ---- function restartScript ( res ) if res == getThisResource ( ) then for i, player in ipairs ( getElementsByType ( "player" ) ) do local acc = getPlayerAccount ( player ) if not isGuestAccount ( acc ) then enableAccount ( acc ) end end end end addEventHandler ( "onResourceStart", getRootElement ( ), restartScript ) addEventHandler("onPlayerLogin", root, function( _, acc ) enableAccount ( acc ) end ) function stopScript (res) if res == getThisResource ( ) then for i, player in ipairs ( getElementsByType ( "player" ) ) do local acc = getPlayerAccount ( player ) if not isGuestAccount ( acc ) then saveAccount ( acc ) end end end end addEventHandler ( "onResourceStop", getRootElement ( ), stopScript ) function playerQuit ( quitType ) local acc = getPlayerAccount ( source ) if not isGuestAccount ( acc ) then if acc then saveAccount ( acc ) end end end addEventHandler ( "onPlayerQuit", getRootElement ( ), playerQuit ) function uparLevel(source) local exp = getElementData(source, "XP") local exps = tonumber(getElementData(source, "XP")) local lvls = tonumber(getElementData(source, "Level")) if lvls and exps then local needexp = 1000 if not exp then setElementData(source, "Level", 0) setElementData(source, "XP", 0) else if exps >= needexp then setElementData(source, "Level", lvls + 1) setElementData(source, "XP", 0) end end end end setTimer(uparLevel, 60, 1) Esse é meu código de level, mas está com três erros, esse level será exibido em uma hud, já estou ciente que não é possível usar source em um setTimer(), ja coloquei um for i, v in pair(getElementByType), mas quando eu coloco ele generaliza e seta o elementdata para todos os players.
  5. Iae rapaziada, bom estou com um certo problema em um painel q estou criado basicamente o Painel funciona da seguinte forma: O Player ao passar por uma determinada Marker, abre-se o painel onde ele terá uma quantidade de opções dentre elas "Armamentos, Uniformes e a parte de iniciar/finalizar seu expediente (painel voltado mais para corporações!). O problema esta na parte do Expediente o mesmo funciona da seguinte forma: Tem dois Ícones (print abaixo), o Painel Menor contém dois ícones, sendo o Primeiro ( soldado prestando Continência) o Inicio do Expediente e o Segundo o termino Ao iniciar o trabalho o Player receberá uma mensagem e 1 hora após o Inicio receberá seu salario no valor X (não decidi ainda) --> Esta primeira parte eu consegui fazer porém A segunda parte que seria Terminar o trabalho é onde esta o Problema. Ao Iniciar ele recebe este valor porém ao terminar o intuito é que o valor X pare de ser dado ao Player... tentei diversos jeitos porém não tive exito -->> Script logo Abaixo do Print!! Script Client-Side o Problema se encontra Próximo as linhas 280/310 local screenW,screenH = guiGetScreenSize() local resW, resH = 1360,768 local x, y = (screenW/resW), (screenH/resH) local pPrin = false local pPatru = false local pAcao = false local pPcolete = false local pParmas = false local pJob = false function painelPrincipal() dxDrawRectangle(x*43, y*167, x*235, y*25, tocolor(215, 0, 0, 254), false) dxDrawRectangle(x*43, y*191, x*235, y*314, tocolor(0, 0, 0, 194), false) dxDrawText("EQUIPAMENTOS", x*106, 169, x*243, y*191, tocolor(255, 255, 255, 255), 1.00, "sans", "left", "top", false, false, false, false, false) dxDrawRectangle(x*53, y*216, x*100, y*25, tocolor(0, 0, 0, 217), false) dxDrawText("Patrulhamento", x*63, y*220, x*132, y*237, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false) dxDrawRectangle(x*168, y*216, x*100, y*25, tocolor(0, 0, 0, 217), false) dxDrawText("Ação", x*203, y*220, x*278, y*241, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false) dxDrawRectangle(x*252, y*167, x*26, y*25, tocolor(0, 0, 0, 217), false) dxDrawText("X", x*262, y*170, x*269, y*192, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) end function painelPatrulhamento() -- Painel Patru dxDrawImage(x*69, y*267, x*63, y*59, ":[PainelArmas]/imgs/coleteLogo.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(x*184, y*267, x*62, y*58, ":[PainelArmas]/imgs/ia2Logo.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(x*74, y*363, x*58, y*56, ":[PainelArmas]/imgs/jobLogo.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(x*188, y*367, x*48, y*47, ":[PainelArmas]/imgs/uniformLogo.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) end function painelPtColete() -- Patru Colete dxDrawRectangle(x*288, y*167, x*145, y*25, tocolor(215, 0, 0, 254), false) dxDrawRectangle(x*288, y*192, x*145, y*59, tocolor(0, 0, 0, 187), false) dxDrawImage(x*298, y*199, x*54, y*52, ":[PainelArmas]/imgs/coleteLogo.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(x*375, y*202, x*48, y*46, ":[PainelArmas]/imgs/vidaLogo.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) end function painelPtArmas() -- Patru Armas dxDrawRectangle(x*288, y*167, x*192, y*25, tocolor(215, 0, 0, 254), false) dxDrawRectangle(x*288, y*192, x*192, y*215, tocolor(0, 0, 0, 187), false) dxDrawImage(x*298, y*202, x*62, y*58, ":[PainelArmas]/imgs/ia2Logo.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) -- ptarma1 dxDrawImage(x*398, y*201, x*68, y*65, ":[PainelArmas]/imgs/taserLogo.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) -- ptarma2 dxDrawImage(x*304, y*281, x*50, y*48, ":[PainelArmas]/imgs/shotLogo.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) -- ptarma3 dxDrawImage(x*406, y*281, x*50, y*49, ":[PainelArmas]/imgs/sprayLogo.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) -- ptarma4 dxDrawImage(x*304, y*345, x*53, y*52, ":[PainelArmas]/imgs/caceteteLogo.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) -- ptarma5 end function painelJob() dxDrawRectangle(x*288, y*167, x*143, y*25, tocolor(215, 0, 0, 254), false) dxDrawRectangle(288, y*192, x*143, y*65, tocolor(0, 0, 0, 187), false) dxDrawImage(x*298, y*200, x*48, y*47, ":[PainelArmas]/imgs/jobLogo.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(x*370, y*201, x*47, y*47, ":[PainelArmas]/imgs/exitLogo.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) end function painelAcao() end ----- Abrir-Fechar Painel Principal ---------- function abrir (_,state) if pPrin == false then showCursor(true) addEventHandler("onClientRender", root, painelPrincipal) pPrin = true if not fontScale then fontScale = screenW/225 end tick1 = getTickCount() else showCursor(false) removeEventHandler("onClientRender", root, painelPrincipal) pPrin = false end end addEvent("PArmas", true) addEventHandler("PArmas", root , abrir) function fechar (_,state) if pPrin == true then if state == "down" then if isCursorOnElement(x*252, y*167, x*26, y*25 ) then showCursor(false) removeEventHandler("onClientRender", root, painelPrincipal) removeEventHandler("onClientRender", root, painelAcao) -- Painel Ação removeEventHandler("onClientRender", root, painelPatrulhamento) -- Painel Patru removeEventHandler("onClientRender", root, painelPtColete) -- Patru Colete removeEventHandler("onClientRender", root, painelPtArmas) -- Patru Armas removeEventHandler("onClientRender", root, painelJob) -- Patru Job pPrin = false pAcao = false pPatru = false pPcolete = false pParmas = false pJob = false end end end end addEventHandler ("onClientClick", root, fechar) function AbrirPatru(_,state) if pPrin == true then if pPatru == false then if state == "down" then if isCursorOnElement(x*53, y*216, x*100, y*25 ) then addEventHandler("onClientRender", root, painelPatrulhamento) -- Painel Patru removeEventHandler("onClientRender", root, painelAcao) -- Painel Ação pPatru = true pAcao = false end end end end end addEventHandler ("onClientClick", root, AbrirPatru) function AbPtColete(_,state) if pPatru == true then if pPcolete == false then if state == "down" then if isCursorOnElement(x*69, y*267, x*63, y*59 ) then addEventHandler("onClientRender", root, painelPtColete) -- Patru Colete removeEventHandler("onClientRender", root, painelPtArmas) -- Patru Armas removeEventHandler("onClientRender", root, painelJob) -- Patru Job pPcolete = true pParmas = false pJob = false end end end end end addEventHandler ("onClientClick", root, AbPtColete) function PgPtColete(_,state) if pPcolete == true then if state == "down" then if isCursorOnElement(x*298, y*199, x*54, y*52 ) then triggerServerEvent("colete", localPlayer) end end end end addEventHandler ("onClientClick", root, PgPtColete) function PgPtVida(_,state) if pPcolete == true then if state == "down" then if isCursorOnElement(x*375, y*202, x*48, y*46 ) then triggerServerEvent("vida", localPlayer) end end end end addEventHandler ("onClientClick", root, PgPtVida) ------------------------------------------------------------------------------------------------------------ function AbPtArmas(_,state) if pPatru == true then if pParmas == false then if state == "down" then if isCursorOnElement(x*184, y*267, x*62, y*58 ) then addEventHandler("onClientRender", root, painelPtArmas) -- Patru Armas removeEventHandler("onClientRender", root, painelPtColete) -- Patru Colete removeEventHandler("onClientRender", root, painelJob) -- Patru Job pParmas = true pPcolete = false pJob = false end end end end end addEventHandler ("onClientClick", root, AbPtArmas) function PgPtArma1(_,state) -- ptarma1 if pParmas == true then if state == "down" then if isCursorOnElement(x*298, y*202, x*62, y*58 ) then triggerServerEvent("M4", localPlayer) end end end end addEventHandler ("onClientClick", root, PgPtArma1) function PgPtArma2(_,state) -- ptarma2 if pParmas == true then if state == "down" then if isCursorOnElement(x*398, y*201, x*68, y*65 ) then triggerServerEvent("taser", localPlayer) end end end end addEventHandler ("onClientClick", root, PgPtArma2) function PgPtArma3(_,state) -- ptarma3 if pParmas == true then if state == "down" then if isCursorOnElement(x*304, y*281, x*50, y*48 ) then triggerServerEvent("shot", localPlayer) end end end end addEventHandler ("onClientClick", root, PgPtArma3) function PgPtArma4(_,state) -- ptarma4 if pParmas == true then if state == "down" then if isCursorOnElement(x*406, y*281, x*50, y*49 ) then triggerServerEvent("spray", localPlayer) end end end end addEventHandler ("onClientClick", root, PgPtArma4) function PgPtArma5(_,state) -- ptarma5 if pParmas == true then if state == "down" then if isCursorOnElement(x*304, y*345, x*53, y*52 ) then triggerServerEvent("stick", localPlayer) end end end end addEventHandler ("onClientClick", root, PgPtArma5) ------------------------------------------------------------------------------------------------------------ function AbJob(_,state) if pPatru == true then if pJob == false then if state == "down" then if isCursorOnElement(x*74, y*363, x*58, y*56 ) then addEventHandler("onClientRender", root, painelJob) -- Patru Job removeEventHandler("onClientRender", root, painelPtColete) -- Patru Colete removeEventHandler("onClientRender", root, painelPtArmas) -- Patru Armas pJob = true pPcolete = false pParmas = false end end end end end addEventHandler ("onClientClick", root, AbJob) function IniJobCl(_,state) -- IniJob if pJob == true then if state == "down" then if isCursorOnElement(x*298, y*200, x*48, y*47 ) then outputChatBox("Iniciou", 0, 255, 0) local tempo = setTimer ( function() givePlayerMoney(500) outputChatBox("Salario", 255, 0, 0) end, 10000, 5 ) end end end end addEventHandler ("onClientClick", root, IniJobCl) function ExitJob(_,state) -- ExitJob if pJob == true then if state == "down" then if isCursorOnElement(x*370, y*201, x*47, y*47 ) then outputChatBox("Terminou", 0, 255, 0) if isTimer ( tempo ) then killTimer ( tempo ) end end end end end addEventHandler ("onClientClick", root, ExitJob) function AbrirAcao(_,state) if pPrin == true then if pAcao == false then if state == "down" then if isCursorOnElement(x*168, y*216, x*100, y*25 ) then addEventHandler("onClientRender", root, painelAcao) -- Painel Ação removeEventHandler("onClientRender", root, painelPatrulhamento) -- Painel Patru pAcao = true pPatru = false end end end end end addEventHandler ("onClientClick", root, AbrirAcao) function isCursorOnElement(x,y,w,h) local mx,my = getCursorPosition () local fullx,fully = guiGetScreenSize() cursorx,cursory = mx*fullx,my*fully if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then return true else return false end end Decidi fazer no Cliente pelo fato de que no Server-side não estava tendo exito até que percebi que setTimer e GivePlayerMoney são funções Shared's adendo: estou usando setTimer pois ainda não compreendi a função getTickCount (estou tentando aprender )
  6. Hola a todos , soy nuevo tengo un resource que necesito reiniciar siempre al entrar al servidor , no se porqué , lo que quiero es que se reinicie despues de 2 minutos , pero que se reinicie esa unica vez lo de hacer que se reinicie ya me quedó con settimer pero no se como hacer para que lo haga una sola vez sería con killtimer? ya lo intenté y nada setTimer( function() --restarting this resource 2 min restartResource(getThisResource()) end, 120000, 0)
  7. Con el CommandHandler "Sube" funciona, pero con el Pe, ¿Que hace? Crea el objeto, pero no lo redirecciona con el SetElementPosition y attach, es como si lo ignorara... ¿Alguna solución? function SubenPasajeros () if CantidadDeAsientos >= 0 then if Asiento1 == 0 then Asiento1 = 1 local vehicle = getPedOccupiedVehicle( client ) x1, y1, z1 = getElementPosition ( client ) Asiento1 = createObject (2035, 1421.958984375, 2624.4677734375, 11.392612457275) setElementPosition ( Asiento1, x1, y1, z1) attachElements( Asiento1, vehicle, 0.95, 0.6, 0, 0, 0, 0 ) --Fila 1 A outputChatBox ("Asiento1") else if Asiento2 == 0 then Asiento2 = 1 outputChatBox ("Asiento2") local vehicle = getPedOccupiedVehicle( client ) x1, y1, z1 = getElementPosition ( client ) Asiento2 = createObject (2035, 1421.958984375, 2624.4677734375, 11.392612457275) setElementPosition ( Asiento2, x1, y1, z1) attachElements( Asiento2, vehicle, 0.5, -0.2, 0, 0, 0, 0 ) --Fila 2 B end end end addCommandHandler("sube",SubenPasajeros) function PrenderFuncSubenPasajeros () outputChatBox ("JEJE") setTimer ( SubenPasajeros, 500, 1) end addCommandHandler("pe",PrenderFuncSubenPasajeros)
  8. السلام عليكم شباب ابي مساعدة في عمل حركة للاعب لمدة بضع ثواني وبعد انتهاء الثواني يقوم بالغاء الحركة واسترجاع الحركة العادية الي هيا المشي
  9. السلام عليكم ورحمة الله وبركاته .... مب لاقي شي اسويه ولا اي افكار فقلت خلني اشرح بعض الاشياء .... شرحي رح يكون عن setTimer .... والـ هو مؤقت يسوي شي كل وقت او يسوي شي بعد فترة محددة .... طيب خلنا نبدأ على بكرة الله .... المثال الاول رح اشرح فيه طريقة انشاء شي معين كل فترة معينة -- server function theFunctionName ( ) exports["guimessages"]:outputServer(root,"message from server file.",0,255,0,root) -- YourCode end setTimer ( theFunctionName, 5000, 0 ) -- لاحظ الرقم 0 -- client function theFunctionName ( ) exports["guimessages"]:outputClient("message from client file.",0,255,0) -- YourCode end setTimer ( theFunctionName, 5000, 0 ) -- لاحظ الرقم 0 المثال الثاني رح اشرح فيه طريقة انشاء شيء معين بعد فترة معينة -- server function theFunctionName ( ) exports["guimessages"]:outputServer(root,"message from server file.",0,255,0,root) -- YourCode end setTimer ( theFunctionName, 5000, 1 ) -- لاحظ الرقم 1 -- client function theFunctionName ( ) exports["guimessages"]:outputClient("message from client file.",0,255,0) -- YourCode end setTimer ( theFunctionName, 5000, 1 ) -- لاحظ الرقم 1 اذا لاحظتوا الفرق بين المثال الاول والمثال الثاني وهو شي واحد وهو الرقم 0 و الرقم 1 وهم يتحكمون في نوع المؤقت المؤقت مع الرقم 0 يسوي شي معين كل فترة معينة المؤقت مع الرقم 1 يسوي شي معين بعد فترة معينة المثال الثالث رح اشرح فيه كيفية تحديد وقت المؤقت .... واللي ما يعرف هذا الشي علامة الضرب [ * ] علامة القسمة [ / ] علامة الطرح [ - ] علامة الجمع [ + ] رح تقولولي وش فائدتهم بقولكم تقدرون تستفيدون منهم في البرمجة .... وقت المؤقت يكون عبارة عن 1000 جزء من الثانية بمعنى 1000 ميلي ثانية = ثانية .... طيب بنشوف مثال -- server -- guimessages ( outputServer ) function theFunctionName ( ) exports["guimessages"]:outputServer(root,"message from server file.",0,255,0) end setTimer ( theFunctionName, 5000, 0 ) -- رقم 5000 = 5 ثواني -- يمكن كتابته بصورة مختلفة مثل setTimer ( theFunctionName, 5*1000, 0 ) -- 1000 * 5 = 5000 وهذه فائدة الضرب -- طيب اذا ابي اسوي مؤقت يخرج رسالة كل 5 دقائق مثلاً وش اسوي ؟ -- هذا المثال يوضح كيف function Timer5 ( ) -- Timer5 = اسم الامر ويمكن كتابته اي شيء تريده exports["guimessages"]:outputServer(root,"مرحباً بك في السيرفر",0,255,0) end setTimer ( Timer5, (5*60*1000), 0 ) -- 5*60*1000 = 5 دقائق هذا الـ عندي اتمنى انكم استفدتم اذا ما فهمت الكود اكتب تعليق وبساعدك بإذن الله اذا قصرت في الشرح فأنا آسف هذا اول شرح لي والقادم افضل بإذن الله ... ... والسلام عليكم ورحمة الله وبركاته ...
  10. Hello. I want create a dx timer which when the player disconnect, and connect again to the server then not reset the timer. Sorry for my bad english :c
  11. ZuKi|R

    Help SetTimer

    Hello, they help me with this problem no as him aria but help need a hand, which is that I want to do is that each true time example each 1 minute repeat this funcion, but I do this and does not do it only repeats once. Already it try of some ways but only repeats once, some suggestion or an error that have ? ------------------- ---Off Element Data setTimer ( function() setElementData(bossDeady[ID][12],"boss",false)end,5000,1) setTimer ( function()removeElementData(bossDeady[ID][12],"boss.name") end,5000,1) setTimer ( function()removeElementData(bossDeady[ID][12],"health") end,5000,1) setTimer ( function()setElementAlpha(bossDeady[ID][12],4) end,5000,1) setTimer ( function() setPedOnFire(bossDeady[ID][12], true) end,5000,1) --- On Element Data setTimer ( function()setElementData(bossDeady[ID][12],"boss",true) end,9000,1) setTimer ( function()setElementAlpha(bossDeady[ID][12],255)end,9000,1) setTimer ( function()setElementData(bossDeady[ID][12],"boss.name",name) end,9000,1) setTimer ( function()setElementData(bossDeady[ID][12],"health",health)end,9000,1) setTimer ( function()setPedOnFire(bossDeady[ID][12], false)end,9000,1)
  12. Ayuda por favor, al matar al "hades" salga por un cierto tiempo el segundo "crazy" sin que respawnee de nuevo al boss "hades" hasta matar al boss "crazy", no logro hacerlo sin que me salga bien solo cuando mato al primero sale los 2 al mismo tiempo que le puse (60 segundos). Server side: function boss0 ( ) hades = exports [ "slothBot" ]:spawnBot ( 1184.654, -2038.601, 69.008, 90, math.random ( 300, 303 ), 0, 0, Nemesis, 38, "hunting", true ) exports.extra_health:setElementExtraHealth(hades, 1000) setElementModel ( hades, 38 ) setElementData (hades, "boss", true) outputChatBox ("#9E0000Boss Hades!!",getRootElement(), 255, 255, 255, true ) end addEventHandler("onResourceStart", resourceRoot, boss0) --Boss1 function Boss1 ( ) crazy = exports [ "slothBot" ]:spawnBot ( 1262.77, -2029.756, 59.341, 90, math.random ( 300, 303 ), 0, 0, Nemesis, 38, "hunting", true ) exports.extra_health:setElementExtraHealth(crazy, 1000) setElementModel ( crazy, 312 ) setElementData (crazy, "boss", true) end function money (theKiller) if getElementData(source,"boss")==true then local premio = math.random(1000,5000) givePlayerMoney(theKiller,premio) outputChatBox ( getPlayerName ( theKiller ) .. " #081DBFMato al Boss!, Ha Ganado $".. premio .." platica :v",getRootElement(), 255, 255, 255, true ) if source == hades then setTimer(boss0, 60000, 1) end if (not isElement(crazy)) then setTimer(Boss1, 60000, 1) end end end addEvent("onBotWasted", true) addEventHandler("onBotWasted", getRootElement(), money)
  13. English: Hello friends, I have a problem with this script posted below, I am a beginner in the moon language, and I would like to know how I can use the setTimer function to give a 2 second delay in the outputChatBox. Portuguese: Olá amigos,Estou com um problema nesse script postado a baixo,sou iniciante na linguagem lua,e gostaria de saber como posso usufruir da função setTimer,para dar um delay de 2 segundos no outputChatBox. function HandlerWasted() valor = math.random( 170, 500 ) outputChatBox("#FFFFFFForam cobrados #FBFF00 $"..tostring ( valor )..",00 #FFFFFFpelos seus gastos no hospital",source,255,255,255,true) valor = takePlayerMoney(source, valor) end addEventHandler("onPlayerWasted",getRootElement(), HandlerWasted)
  14. Hello! I don't understand the setTimer wiki, can you please teach me how it works? I would do this if it would work: function hello() local timer = setTimer (60000) -- sets timer to a minute if timer == 0 then -- checks if timer is 0 outputChatBox ("0") -- outputs, that timer is null else return nil end end addEventHandler ("onClientResourceStart", getRootElement(), hello) This is a not working script, can you help me to make it work? Thank you!
  15. I was making a new script with classes for mta, and i need to set a timer inside a method like this. function WorldGrid:updatePlayerZone(player) -- DOING NON RELEVANT SHI T HERE outputChatBox("worldGrid: " .. tostring(worldGrid) .. " player: " .. tostring(player)) setTimer(self:updatePlayerZone, 4000, 1, player) end end This couldnt even compile, because self:updatePlayerZone is not recognized as a function. So.. i checked setTimer mta wiki page. it says: theFunction: The function you wish the timer to call. (Notice: Do not use a 'local' function, it must be global!) So, i need to call a global function on setTimer. I tryed out this: function updatePlayerZoneWrapper(worldGrid, player) outputChatBox("worldGrid " .. tostring(worldGrid) .. " player: " .. tostring(player)) worldGrid:updatePlayerZone(player) end function WorldGrid:updatePlayerZone(player) outputChatBox("worldGrid before: " .. tostring(self) .. " player before: " .. tostring(player) setTimer(updatePlayerZoneWrapper, 4000, 1, self, player) end end But it didnt work neither.. I get: Attempt to call method 'updatePlayerZone' (a nil value) I continued reading setTimer wiki page, and i found this: arguments: Any arguments you wish to pass to the function can be listed after the timesToExecute argument. Note that any tables you want to pass will get cloned, whereas metatables and functions/function references in that passed table will get lost. Also changes you make in the original table before the function gets called won't get transferred. So, im coming to you guys, hoping you have a possible solution for this. Thanks for your time
  16. I need some help on: dxDrawText Code: local screenWidth, screenHeight = guiGetScreenSize () local playerRadioChannel = getRadioChannelName(getRadioChannel()) function stationDraw(station) dxDrawText ( playerRadioChannel, screenWidth, screenHeight - 155, screenWidth - 66, screenHeight, tocolor ( 135, 96, 45, 255 ), 1.5, "bankgothic", "right" ) end addEventHandler("onClientPlayerRadioSwitch", getLocalPlayer(), stationDraw) I want the text having border, and staying uppercase, how? I do not know. How can I make it stay on screen for a few seconds and then disappear? I think we should use this: setTimer Thanks for everything!
×
×
  • Create New...