DarkAnubys
Members-
Posts
6 -
Joined
-
Last visited
DarkAnubys's Achievements
Vic (3/54)
0
Reputation
-
Verificar quantidade mínima de usuário na ACL
DarkAnubys replied to DarkAnubys's topic in Programação em Lua
Eu estou tentando encaixar no script, porém não estou conseguindo encontrar o lugar certo. -
Verificar quantidade mínima de usuário na ACL
DarkAnubys replied to DarkAnubys's topic in Programação em Lua
Alguém pode me ajudar? -
Boa noite, eu achei encontrei um script pra estudar, porém não estou conseguindo fazer uma coisa, que seria uma verificação pra saber se a ACL "Policia" tem no mínimo 2 pessoas para iniciar o assalto a lojinha, alguém poderia me ajudar? function Roubar_SuperMercadoLS ( thePlayer, matchingDimension ) if isElementWithinMarker ( thePlayer, Dentro_Assalto_SuperMercadoLS ) then local wl = getPlayerWantedLevel ( thePlayer ) local arma = getPedWeapon ( thePlayer ) unbindKey ( thePlayer, LetraParaMarkers, "down", Roubar_SuperMercadoLS ) -- Remover Bind do Assalto exports.Scripts_OnMarkerMsgs_:delete (thePlayer) -- Deletar Mensagem no Meio da Tela if getElementData ( thePlayer, "Policia" ) == true then return exports.Scripts_Textos:createNewDxMessage ( 'Você é um Policial e não Pode Assaltar Lojas', thePlayer, 255, 255, 255) end if arma == 0 or arma == 1 or arma == 2 or arma == 3 or arma == 4 or arma == 5 or arma == 6 or arma == 7 or arma == 8 or arma == 9 or arma == 16 or arma == 17 or arma == 18 or arma == 39 or arma == 41 or arma == 42 or arma == 43 or arma == 10 or arma == 11 or arma == 12 or arma == 14 or arma == 15 or arma == 44 or arma == 45 or arma == 46 or arma == 40 then return exports.Scripts_Textos:createNewDxMessage ( 'Você Precisa de uma Arma de Fogo para Assaltar Essa Loja!', thePlayer, 255, 255, 255) end if Roubo_Recente_SuperMercadoLS == false then setElementRotation ( thePlayer, 0, 0, Rot_z_Roubo ) setPedAnimation ( thePlayer, "SHOP", "SHP_Gun_Aim", -1, true, false, true ) -- Fazer a Animação de Assalto ( Jogador ) setPedAnimation ( Atendente_SuperMercadoLS, "SHOP", "SHP_Rob_GiveCash", -1, true, false, true ) -- Fazer a Animação de Se Render ( BOT ) setTimer(function() setPedAnimation ( thePlayer ) setPedAnimation ( Atendente_SuperMercadoLS, "SHOP", "SHP_Rob_HandsUp", -1, true, false, true ) -- Entregar o Dinheiro ( BOT ) end,40000,1,thePlayer) if wl < 6 then setPlayerWantedLevel ( thePlayer, wl+1 ) -- Setar +1 Level de Procurado ( Jogador ) end triggerClientEvent ( root, "AirNew>LigarAlarme1", root, thePlayer ) -- Disparar o Alarme exports.Scripts_Textos:createNewDxMessage ( 'Aguarde 60 Segundos & Você podera Sair da Loja. A Policia Foi Notificada Sobre o Assalto!', thePlayer, 255, 255, 255) setElementData ( thePlayer, "AirNewSCR_Roubo_SuperMercadoLS", true ) -- setElementData "RouboEmAndamento" ( Jogador ) True Roubo_Recente_SuperMercadoLS = true -- Roubo_Recente_SuperMercadoLS = true setTimer(function() setElementData ( thePlayer, "AirNewSCR_Roubo_SuperMercadoLS", false ) -- setElementData "RouboEmAndamento" ( Jogador ) False setPedAnimation ( Atendente_SuperMercadoLS ) -- Remover a Animação ( BOT ) givePlayerMoney ( thePlayer, ValorDoRoubo1 ) -- Dar Dinheiro ( Jogador ) end,TempoDoAssalto,1,thePlayer) for i, player in ipairs(getElementsByType("player")) do local uj = getElementData(player,"Policia") or false if type(uj) == "boolean" then if uj == true then NickName = string.gsub(getPlayerName(thePlayer), "#%x%x%x%x%x%x", "") exports.Scripts_Textos:createNewDxMessage ( "O Jogador "..NickName.." Esta Assaltando uma Loja em Los Santos, Siga o Icone Vermelho no Mapa", player, 255, 255, 255) setElementVisibleTo ( EmAssaltoBlip_SuperMercadoLS, player, true ) setTimer ( function() setElementVisibleTo ( EmAssaltoBlip_SuperMercadoLS, player, false ) end, 120000, 1, thePlayer ) end end end else exports.Scripts_Textos:createNewDxMessage ( 'Essa Loja ja foi Roubada Recentemente!', thePlayer, 255, 255, 255) setTimer(function() Roubo_Recente_SuperMercadoLS = false end,TempoDoAssalto+60000,1,thePlayer) end end end
-
Boa tarde, queria fazer com que esse script funcionasse apenas em alguns veículos. g_VehicleList = {522} local radioStreams = 0 local defaultRadio = "https://live.hunter.fm/pop_high" local defaultRadio = "https://live.hunter.fm/pop_high" addEventHandler("onResourceStart", resourceRoot, function() for i,veh in ipairs(getElementsByType("vehicle")) do g_VehicleList[veh] = { } g_VehicleList[veh].radio = false g_VehicleList[veh].radioStation = defaultRadio g_VehicleList[veh].volume = 1.0 end end ) addEventHandler("onPlayerJoin", root, function() for i,veh in ipairs(getElementsByType("vehicle")) do if g_VehicleList[veh] ~= nil then if g_VehicleList[veh].radio == true then triggerClientEvent(source, "onServerToggleRadio", root, true, g_VehicleList[veh].radioStation, veh, g_VehicleList[veh].volume) end end end end ) addEventHandler("onVehicleExplode", root, function() if g_VehicleList[source] ~= nil then if g_VehicleList[source].radio == true then triggerClientEvent("onServerToggleRadio", root, false, nil, source) g_VehicleList[source].radio = false destroyElement(g_VehicleList[source].radioMarker) killTimer(g_VehicleList[source].idleTimer) if radioStreams ~= 0 then radioStreams = radioStreams - 1 end end end end ) addEventHandler("onElementDestroy", root, function() if g_VehicleList[source] ~= nil then if g_VehicleList[source].radio == true then triggerClientEvent("onServerToggleRadio", root, false, nil, source) g_VehicleList[source].radio = false destroyElement(g_VehicleList[source].radioMarker) killTimer(g_VehicleList[source].idleTimer) if radioStreams ~= 0 then radioStreams = radioStreams - 1 end end end end ) addEvent("onPlayerToggleRadio", true) addEventHandler("onPlayerToggleRadio", root, function() if source and getElementType(source) == "player" then toggleRadio(source) end end ) function toggleRadio(player) local veh = getPedOccupiedVehicle(player) if veh then local occupants = getVehicleOccupants(veh) local seats = getVehicleMaxPassengers(veh) local playerSeat = getPedOccupiedVehicleSeat(player) if playerSeat ~= 0 and playerSeat ~= 1 then outputChatBox("INFO: Você nao pode mudar a rádio.", player, 255, 255, 255) return end if g_VehicleList[veh] == nil then g_VehicleList[veh] = { } g_VehicleList[veh].radio = false g_VehicleList[veh].radioStation = defaultRadio g_VehicleList[veh].volume = 0.6 end if g_VehicleList[veh].radio == false then if not get("toggleAntifloodTick") or not get("streamLimit") or not get("radioEnabledIdleTime") then return end local settingToggleAntifloodTick = get("toggleAntifloodTick") local settingStreamLimit = get("streamLimit") local idleTime = get("radioEnabledIdleTime") if g_VehicleList[veh].lastTick and (getTickCount() - g_VehicleList[veh].lastTick) <= settingToggleAntifloodTick then return end if radioStreams >= settingStreamLimit then outputChatBox("Limite de ouvintes chegou ao maximo (" .. settingStreamLimit .. ")", player, 255, 255, 255) return end local x, y, z = getElementPosition(veh) g_VehicleList[veh].radio = true g_VehicleList[veh].lastTick = getTickCount() g_VehicleList[veh].turnedOnBy = getPlayerName(player) --g_VehicleList[veh].radioMarker = createMarker(x, y, z, "corona", 0.05, 255, 0, 0) --attachElements(g_VehicleList[veh].radioMarker, veh) g_VehicleList[veh].idleTimer = setTimer(radioIdleTimer, idleTime, 0, veh) radioStreams = radioStreams + 1 outputServerLog(getPlayerName(player) .. " Ligou o rádio em seu veículo (streams: " .. radioStreams .. ")") for seat = 0, seats do local occupant = occupants[seat] if occupant and getElementType(occupant) == "player" then triggerClientEvent("onServerToggleRadio", root, true, g_VehicleList[veh].radioStation, veh, g_VehicleList[veh].volume) local r, g, b = getPlayerNametagColor(player) colorHex = string.format("%02X%02X%02X", r, g, b) outputChatBox("#" .. colorHex .. "" .. getPlayerName(player) .. " #696969Rádio: [#00ff00ONLINE#696969]", occupant, 0, 0, 0, true) end end else g_VehicleList[veh].radio = false --destroyElement(g_VehicleList[veh].radioMarker) killTimer(g_VehicleList[veh].idleTimer) radioStreams = radioStreams - 1 outputServerLog(getPlayerName(player) .. " desligou o rádio em seu veículo (streams: " .. radioStreams .. ")") for seat = 0, seats do local occupant = occupants[seat] if occupant and getElementType(occupant) == "player" then triggerClientEvent("onServerToggleRadio", root, false, nil, veh, g_VehicleList[veh].volume) local r, g, b = getPlayerNametagColor(player) colorHex = string.format("%02X%02X%02X", r, g, b) outputChatBox("#" .. colorHex .. "" .. getPlayerName(player) .. " #696969Rádio: [#ff0000OFFLINE#696969]", occupant, 0, 0, 0, true) end end end end end function radioIdleTimer(veh) if not get("radioIdlePlayerDistanceCheck") then return end local settingDist = get("radioIdlePlayerDistanceCheck") if veh then if g_VehicleList[veh] ~= nil then if g_VehicleList[veh].radio == true then local playerInRange = false local vx, vy, vz = getElementPosition(veh) for i,player in ipairs(getElementsByType("player")) do local px, py, pz = getElementPosition(player) local distance = getDistanceBetweenPoints3D(vx, vy, vz, px, py, pz) if distance ~= false and distance < settingDist then playerInRange = true end end if playerInRange == false then triggerClientEvent("onServerToggleRadio", root, false, nil, veh) g_VehicleList[veh].radio = false destroyElement(g_VehicleList[veh].radioMarker) killTimer(g_VehicleList[veh].idleTimer) if radioStreams ~= 0 then radioStreams = radioStreams - 1 end outputServerLog("An " .. getVehicleName(veh) .. "'s radio has been idled (streams: " .. radioStreams .. ")") end end end end end addEvent("onPlayerRadioVolumeChange", true) addEventHandler("onPlayerRadioVolumeChange", root, function(currentVol, volumeUp) local veh = getPedOccupiedVehicle(source) if veh then local playerSeat = getPedOccupiedVehicleSeat(source) if playerSeat == 0 or playerSeat == 1 then if volumeUp == true then g_VehicleList[veh].volume = currentVol + 0.05 if g_VehicleList[veh].volume >= 1.00 then g_VehicleList[veh].volume = 1.00 end else g_VehicleList[veh].volume = currentVol - 0.05 if g_VehicleList[veh].volume <= 0.00 then g_VehicleList[veh].volume = 0.00 end end triggerClientEvent("onServerVolumeChangeAccept", root, veh, g_VehicleList[veh].volume) end end end ) function cmdChangeRadioURL(source, commandName, url) if not url then outputChatBox("Usage: /setradio newurl", source, 255, 255, 255) return end local veh = getPedOccupiedVehicle(source) if veh then local occupants = getVehicleOccupants(veh) local seats = getVehicleMaxPassengers(veh) if g_VehicleList[veh] == nil then local x, y, z = getElementPosition(veh) g_VehicleList[veh] = { } g_VehicleList[veh].radio = true g_VehicleList[veh].lastTick = getTickCount() g_VehicleList[veh].radioStation = defaultRadio g_VehicleList[veh].volume = 0.6 g_VehicleList[veh].radioMarker = createMarker(x, y, z, "corona", 0.1, 255, 0, 0) attachElements(g_VehicleList[veh].radioMarker, veh) g_VehicleList[veh].idleTimer = setTimer(radioIdleTimer, idleTime, 0, veh) end local playerSeat = getPedOccupiedVehicleSeat(source) if playerSeat ~= 0 and playerSeat ~= 1 then outputChatBox("Você não pode mudar a estação de rádio.", source, 255, 255, 255) return end for seat = 0, seats do local occupant = occupants[seat] if occupant and getElementType(occupant) == "player" then g_VehicleList[veh].radioStation = url g_VehicleList[veh].changedBy = getPlayerName(source) if g_VehicleList[veh].radio == true then triggerClientEvent("onServerRadioURLChange", root, g_VehicleList[veh].radioStation, veh, g_VehicleList[veh].volume) end local r, g, b = getPlayerNametagColor(source) colorHex = string.format("%02X%02X%02X", r, g, b) outputChatBox("#" .. colorHex .. "" .. getPlayerName(source) .. " #FFFFFFMudou a estação de rádio.", occupant, 0, 0, 0, true) outputConsole(getPlayerName(source) .. " Mudou a estação de rádio em seu veículo: " .. url, occupant) end end outputServerLog(getPlayerName(source) .. " Mudou a estação de rádio em seu veículo: " .. url) end end function cmdDumpVehRadioInfo(source, commandName) for i,veh in ipairs(getElementsByType("vehicle")) do if g_VehicleList[veh] ~= nil then if g_VehicleList[veh].radio == true then local strOut if g_VehicleList[veh].changedBy ~= nil then strOut = "Vehicle: " .. getVehicleName(veh) .. ", URL = " .. g_VehicleList[veh].radioStation .. ", Ligada ao: " .. g_VehicleList[veh].turnedOnBy .. ", URL changed by: " .. g_VehicleList[veh].changedBy else strOut = "Vehicle: " .. getVehicleName(veh) .. ", URL = " .. g_VehicleList[veh].radioStation .. ", Ligada ao: " .. g_VehicleList[veh].turnedOnBy end if getElementType(source) == "console" then outputServerLog(strOut) elseif getElementType(source) == "player" then outputChatBox(strOut, source, 255, 255, 255) end end end end end addCommandHandler("setradio", cmdChangeRadioURL) addCommandHandler("dumpradio", cmdDumpVehRadioInfo) radioSound = { } addEventHandler("onClientResourceStart", resourceRoot, function() bindKey("r", "down", clientToggleRadio) bindKey("mouse_wheel_up", "down", volumeUp) bindKey("mouse_wheel_down", "down", volumeDown) end ) addEventHandler("onClientVehicleEnter", root, function(thePlayer, seat) if thePlayer == getLocalPlayer() then local msg = "Pressione R para ligar a radio. Use a roda do mouse para alterar o volume." if radioSound[source] == nil then outputChatBox(msg, 124, 252, 0) else if radioSound[source].soundElement == nil then outputChatBox(msg, 124, 252, 0) end end end end ) addEventHandler("onClientSoundStream", root, function(success, length, streamName) if streamName then local veh = getPedOccupiedVehicle(getLocalPlayer()) if veh then if radioSound[veh] == nil then return end if radioSound[veh].soundElement == source then outputChatBox("#696969Rádio: #22AA22 " .. streamName, 0, 0, 0, true) end end end end ) addEventHandler("onClientSoundChangedMeta", root, function(streamTitle) if streamTitle then local veh = getPedOccupiedVehicle(getLocalPlayer()) if veh then if radioSound[veh] == nil then return end if radioSound[veh].soundElement == source then outputChatBox("#696969Música: #AA2222 " .. streamTitle, 0, 0, 0, true) end end end end ) addEvent("onServerToggleRadio", true) addEventHandler("onServerToggleRadio", getLocalPlayer(), function(toggle, url, veh, volume) if not isElement(veh) then if radioSound[veh] ~= nil then stopSound(radioSound[veh].soundElement) radioSound[veh].soundElement = nil end return end if toggle == true then local x, y, z = getElementPosition(veh) if radioSound[veh] ~= nil then stopSound(radioSound[veh].soundElement) local sound = playSound3D(url, x, y, z) if volume ~= nil then setSoundVolume(sound, volume) end setSoundMinDistance(sound, 6.0) setSoundMaxDistance(sound, 75.0) attachElements(sound, veh) radioSound[veh] = { } radioSound[veh].soundElement = sound else local sound = playSound3D(url, x, y, z) if volume ~= nil then setSoundVolume(sound, volume) end setSoundMinDistance(sound, 6.0) setSoundMaxDistance(sound, 75.0) attachElements(sound, veh) radioSound[veh] = { } radioSound[veh].soundElement = sound end else if radioSound[veh] ~= nil then stopSound(radioSound[veh].soundElement) radioSound[veh].soundElement = nil end end end ) addEvent("onServerRadioURLChange", true) addEventHandler("onServerRadioURLChange", getLocalPlayer(), function(newurl, veh, volume) if radioSound[veh] ~= nil then stopSound(radioSound[veh].soundElement) local x, y, z = getElementPosition(veh) local sound = playSound3D(newurl, x, y, z) if volume ~= nil then setSoundVolume(sound, volume) end setSoundMinDistance(radioSound, 6.0) setSoundMaxDistance(radioSound, 75.0) attachElements(sound, veh) radioSound[veh] = { } radioSound[veh].soundElement = sound end end ) addEvent("onServerVolumeChangeAccept", true) addEventHandler("onServerVolumeChangeAccept", getLocalPlayer(), function(veh, newVolume) if veh then if radioSound[veh] ~= nil then setSoundVolume(radioSound[veh].soundElement, newVolume) end end end ) function clientToggleRadio() triggerServerEvent("onPlayerToggleRadio", getLocalPlayer()) end function volumeUp() local veh = getPedOccupiedVehicle(getLocalPlayer()) if veh then if radioSound[veh] ~= nil then local volume = getSoundVolume(radioSound[veh].soundElement) if volume ~= false then triggerServerEvent("onPlayerRadioVolumeChange", getLocalPlayer(), volume, true) end end end end function volumeDown() local veh = getPedOccupiedVehicle(getLocalPlayer()) if veh then if radioSound[veh] ~= nil then local volume = getSoundVolume(radioSound[veh].soundElement) if volume ~= false then triggerServerEvent("onPlayerRadioVolumeChange", getLocalPlayer(), volume, false) end end end end
-
Fiz aqui e ele funcionou, porém n completo, ele agora seta skin feminina mesmo sendo masculino, tentei fazer essa modificação e deu nisso: function info(source) if isObjectInACLGroup ( "user." ..getAccountName(getPlayerAccount(source)), aclGetGroup ("Staff")) --Ajudante local getAccountData(account, "RJcartorio.genero", genero) then local genero = getElementData ( source, "Masculino" ) if (genero ~= true) then setElementModel (source, 217) end local genero = getElementData ( source, "Feminino" ) if (genero ~= true) then setElementModel (source, 11) end end end addCommandHandler("staffon", info) Aí agora fica dando erro na linha 3.
-
Bom, estou tentando criar um script para entrar em modo staff, porém preciso que ele leia automaticamente se o usuário que usou o comando, é homem ou mulher, fiz esse script aqui porém fica dando erro no debugscript: function info(source) if isObjectInACLGroup ( "user." ..getAccountName(getPlayerAccount(source)), aclGetGroup ("Staff")) then --Ajudante local ownedVehicle = getElementData ( source, "Masculino" ) if (ownedVehicle ~= true) then setElementModel (source, 217) end local ownedVehicle = getElementData ( source, "Feminino" ) if (ownedVehicle ~= true) then setElementModel (source, 11) end addCommandHandler("staffon", info) Queria sabe o que pode está conflitando o script, desde já, obrigado!