Search the Community
Showing results for tags 'otimizar'.
-
function tpbloods(playerSource) if isObjectInACLGroup("user." ..getAccountName(getPlayerAccount(playerSource)), aclGetGroup("Staff")) then if getElementData(playerSource, "Expediente-STAFF") == "Sim" then if not Flying[playerSource] then Flying[playerSource] = true setElementAlpha(playerSource, 0) triggerClientEvent(playerSource, "onClientFlyToggle", playerSource) end setElementPosition(playerSource, 2219.984, -1143.273, 25.797) setElementRotation(playerSource, 0, 0, 353.328) showInfobox(playerSource, "Você teleportou na base Bloods", "success") else atendimento(playerSource) end end end addCommandHandler("tpbloods", tpbloods) function tpgrove(playerSource) if isObjectInACLGroup("user." ..getAccountName(getPlayerAccount(playerSource)), aclGetGroup("Staff")) then if getElementData(playerSource, "Expediente-STAFF") == "Sim" then if not Flying[playerSource] then Flying[playerSource] = true setElementAlpha(playerSource, 0) triggerClientEvent(playerSource, "onClientFlyToggle", playerSource) end setElementPosition(playerSource, 2463.633, -1659.423, 13.311) setElementRotation(playerSource, 0, 0, 88.373) showInfobox(playerSource, "Você teleportou na base da Grove", "success") else atendimento(playerSource) end end end addCommandHandler("tpgrove", tpgrove) function tpcrips(playerSource) if isObjectInACLGroup("user." ..getAccountName(getPlayerAccount(playerSource)), aclGetGroup("Staff")) then if getElementData(playerSource, "Expediente-STAFF") == "Sim" then if not Flying[playerSource] then Flying[playerSource] = true setElementAlpha(playerSource, 0) triggerClientEvent(playerSource, "onClientFlyToggle", playerSource) end setElementPosition(playerSource, 2183.58, -1761.268, 13.375) setElementRotation(playerSource, 0, 0, 359.602) showInfobox(playerSource, "Você teleportou na base Crips", "success") else atendimento(playerSource) end end end addCommandHandler("tpcrips", tpcrips) function tpsiliciana(playerSource) if isObjectInACLGroup("user." ..getAccountName(getPlayerAccount(playerSource)), aclGetGroup("Staff")) then if getElementData(playerSource, "Expediente-STAFF") == "Sim" then if not Flying[playerSource] then Flying[playerSource] = true setElementAlpha(playerSource, 0) triggerClientEvent(playerSource, "onClientFlyToggle", playerSource) end setElementPosition(playerSource, 2418.157, -2009.204, 13.396) setElementRotation(playerSource, 0, 0, 90.592) showInfobox(playerSource, "Você teleportou na base Siliciana", "success") else atendimento(playerSource) end end end addCommandHandler("tpsiliciana", tpsiliciana) ---------------------------------------------------------------------------------------------------------------------------- function showInfobox(element, message, tipo) exports["[HYPE]NOTIFY"]:addNotification(element, message, tipo) end atendimento = function (element) return triggerClientEvent(element, "HypeNotify", element, "Você não está em modo atendimento use /pro", "error") end Basicamente são vários comandos que executam basicamente a mesma função eu gostaria que fosse menor tipo executar o comando e o nome da base ai ele puxar a posição da base e teleportar pequeno exemplo abaixo bases = {{yakuza, 2418.157, -2009.204, 13.396 }, {bloods, 1234.09, -2029.24, 13.396 }}
-
Boa noite, fiz um script quase completo, queria perguntar se existe algumas trocas que eu poderia fazer para deixá-lo mais curto e/ou otimizado. SERVER-SIDE: entrada = createMarker(1411.7902832031, -1699.7880859375, 14.1, "arrow", 1, 255,255,0, 50) saida = createMarker(-2029.7740478516, -119.3343963623, 1035.7, "arrow", 1, 255,255,0, 50) cnh = createMarker(-2033.0969238281,-117.43886566162,1034.2, "cylinder", 1, 255,0,0, 50) etapas = { (createMarker(-868.33447265625,-1079.029296875,94.109962463379, "checkpoint", 0, 255,0,0, 20)), (createMarker(-798.85778808594,-1009.9039916992,81.114715576172, "checkpoint", 0, 255,0,0, 20)), (createMarker(-623.44805908203,-991.40704345703,66.213768005371, "checkpoint", 0, 255,0,0, 20)), (createMarker(-526.03784179688,-904.98547363281,55.71215057373, "checkpoint", 0, 255,0,0, 20)), (createMarker(-385.86874389648,-837.59167480469,47.206745147705, "checkpoint", 0, 255,0,0, 20)), (createMarker(-298.58383178711,-875.92852783203,46.712970733643, "checkpoint", 0, 255,0,0, 20)), (createMarker(-342.224609375,-780.23712158203,31.194166183472, "checkpoint", 0, 255,0,0, 20)) } carro = createVehicle(402, 0,0,0) function marker() setElementInterior(saida, 3) setElementInterior(cnh, 3) end marker() function mensagem(hitElement) if getElementData(hitElement, "cnh-carro") == false then outputChatBox("| DETRAN | digite #ff0000/cnh #ffffffpara fazer a sua.", hitElement, 255,255,255, true) else outputChatBox("| DETRAN | você já possui a carteira de habilitação.", hitElement, 255,255,255, true) end end addEventHandler("onMarkerHit", cnh, mensagem) function inicio(thePlayer) if isElementWithinMarker(thePlayer, cnh) and getElementData(thePlayer, "cnh-carro") == false then fadeCamera(thePlayer, false) setTimer ( function ( ... ) setElementInterior(thePlayer, 0) setElementPosition(thePlayer, -876.94409179688,-1112.4317626953,98.609375) setElementInterior(carro, 0) setElementPosition(carro, -876.94409179688,-1112.4317626953,98.609375) warpPedIntoVehicle(thePlayer, carro) setMarkerSize(etapas[1], 3) end, 1000, 1, thePlayer) setTimer ( function ( ... ) fadeCamera(thePlayer, true) end, 2000, 1, thePlayer) end end addCommandHandler("cnh", inicio) function etapa1(hitElement) setMarkerSize(etapas[1], 0) setMarkerSize(etapas[2], 3) end addEventHandler("onMarkerHit", etapas[1], etapa1) function etapa2(hitElement) setMarkerSize(etapas[2], 0) setMarkerSize(etapas[3], 3) end addEventHandler("onMarkerHit", etapas[2], etapa2) function etapa3(hitElement) setMarkerSize(etapas[3], 0) setMarkerSize(etapas[4], 3) end addEventHandler("onMarkerHit", etapas[3], etapa3) function etapa4(hitElement) setMarkerSize(etapas[4], 0) setMarkerSize(etapas[5], 3) end addEventHandler("onMarkerHit", etapas[4], etapa4) function etapa5(hitElement) setMarkerSize(etapas[5], 0) setMarkerSize(etapas[6], 3) end addEventHandler("onMarkerHit", etapas[5], etapa5) function etapa6(hitElement) setMarkerSize(etapas[6], 0) setMarkerSize(etapas[7], 3) end addEventHandler("onMarkerHit", etapas[6], etapa6) function etapa7(hitElement) setMarkerSize(etapas[7], 0) outputChatBox("| INSTRUTOR DIZ: você concluiu o teste camarada, pegue sua carteira de habilitação.", hitElement) destroyElement(carro) fadeCamera(hitElement, false) setTimer ( function () setElementInterior(hitElement, 3) setElementPosition(hitElement, -2029.2668457031,-116.76811218262,1035.171875) setElementData(hitElement,"cnh-carro", true) fadeCamera(hitElement, true) end, 2000, 1, hitElement) end addEventHandler("onMarkerHit", etapas[7], etapa7) function aoSair(thePlayer) setMarkerSize(etapas[1], 0) outputChatBox("| INSTRUTOR DIZ: você saiu do veículo e não terminou a prova.", thePlayer) destroyElement(carro) fadeCamera(thePlayer, false) setTimer ( function () setElementInterior(thePlayer, 3) setElementPosition(thePlayer, -2029.2668457031,-116.76811218262,1035.171875) fadeCamera(thePlayer, true) end, 2000, 1, thePlayer) end addEventHandler("onVehicleExit", getRootElement(), aoSair) Depois pretendo fazer o CLIENT-SIDE em CEGUI. Obrigado pela compreensão