Jump to content

Archz

Members
  • Posts

    9
  • Joined

  • Last visited

Everything posted by Archz

  1. local discordInfo = {} local discordCommands = { -- Funções/Comandos que serão executados pelo BOT ["settime"] = function(admin, args) local hour, minute = args[1], args[2] local success = setTime(hour, minute) if success then outputMessage(admin .. " #ffffffalterou o horário do servidor para " .. hour .. ":" .. minute .. "!") return "você alterou o horário no servidor." else return "algo deu errado. Use o comando novamente usando-o corretamente. " end end, ["text"] = function(admin, args) outputMessage(admin .. " #ffffffdisse: " .. args[1]) return "sua mensagem ``" .. args[1] .. "`` foi enviada." end, ["status"] = function(admin, args) local online = getPlayerCount() local maxPlayers = getMaxPlayers() local serverName = getServerName() local serverIp = getServerConfigSetting("serverip") local serverPort = getServerPort() return { online = online, maxPlayers = maxPlayers, serverName = serverName, serverIp = serverIp, serverPort = serverPort } end, ["mute"] = function(admin, args) local player = getPlayerFromName(args[1]) if isElement(player) then local playerName = getPlayerName(player) setPlayerMuted(player, true) outputMessage(admin .. " #ffffffmutou " .. playerName .. "!") return "**" .. playerName .. "** foi mutado(a)!" else return "**" .. args[1] .. "** está inválido." end end, ["givemoney"] = function(admin, args) local player = getPlayerFromName(args[1]) local amount = tonumber(args[2]) if not isElement(player) then return "**" .. args[1] .. "** está inválido." end if not amount or amount <= 0 then return "insira um valor válido e maior que 0." end local playerName = getPlayerName(player) givePlayerMoney(player, amount) outputMessage(admin .. " #ffffffdeu #008500R$" .. amount .. " #ffffffpara " .. playerName .. "!") return "**" .. playerName .. "** recebeu ``R$" .. amount .. "``." end, ["cgroup"] = function(admin, args) local groupName = args[1] if groupName then local checkGroup = aclGetGroup(groupName) if checkGroup then return "um grupo com esse nome já existe." end local newGroup = aclCreateGroup(groupName) if not newGroup then return "ocorreu um erro ao tentar criar o novo grupo." end return "grupo com o nome ``" .. groupName .. "`` foi adicionado à ACL." end end, ["uuu"] = function(admin, args) if admin == "Console" then discordInfo.members = args[1] discordInfo.inviteCode = args[2] discordInfo.guildName = args[3] updateInfo() end end } function discordRequest(command, admin, ...) if not discordCommands[command] then return "o comando não existe no servidor MTA." end local args = {...} return discordCommands[command](admin, args) end function updateInfo() triggerClientEvent("discordapp.update", resourceRoot, discordInfo) end function outputMessage(message) return outputChatBox("#cccccc[DISCORD] #ffffff" .. message, root, 255, 255, 255, true) end Ao invés de executar os comandos a partir do nome do player, queria que executasse pelo id do player e não sei como eu poderia fazer isso [SISTEMA DE ID QUE USO] function Start_Id ( _, acc ) if eventName == "onPlayerLogin" then setElementData ( source, "ID", getAccountID(acc) or "N/A" ) elseif eventName == "onPlayerLogout" then removeElementData( source, "ID" ) elseif eventName == "onResourceStart" then for _, player in pairs(getElementsByType("player")) do local acc = getPlayerAccount(player) if not isGuestAccount(acc) then setElementData( source, "ID", getAccountID(acc) or "N/A" ) end end end end addEventHandler("onResourceStart", resourceRoot, Start_Id) addEventHandler("onPlayerLogout", root, Start_Id) addEventHandler("onPlayerLogin", root, Start_Id) function getPlayerID(id) v = false for i, player in ipairs (getElementsByType("player")) do if getElementData(player, "ID") == id then v = player break end end return v end --============================================================================================================================-- --=============================-- ----------- ID PLAYER ------------ --=============================-- function getnick(player, command, id, ...) if(id) then local playerID = tonumber(id) if(playerID) then local Player2 = getPlayerID(playerID) if(Player2) then outputChatBox ( "#106FE7 #ffffffINFO #106FE7➺ #ffffff Nome do Jogador #106FE7" .. getPlayerName(Player2) .."", player, 255,255,255,true) else outputChatBox ( "#106FE7 #ffffffERRO #106FE7➺ #ffffff O Jogador(a) de ID: #106FE7( " .. id .. " ) #ffffffNão Foi Encontrado!", player, 255,255,255,true) end else outputChatBox ( "#106FE7 #ffffffERRO #106FE7➺ #ffffff ID: #106FE7( " .. id .. " ) #ffffffInválido!", player, 255,255,255,true) end else outputChatBox ( "#106FE7 #ffffffERRO #106FE7➺ #ffffffUse /id #106FE7[#ffffffID#106FE7]", player, 255,255,255,true) end end addCommandHandler("id", getnick) function getPlayerID(id) v = false for i, player in ipairs (getElementsByType("player")) do if getElementData(player, "ID") == id then v = player break end end return v end
  2. @Spakye ah, now i understand how it works, thank you so much man, you helped me a lot. s2
  3. local gate = createObject(16773, 978.79998779297, -1693, 14.699999809265, 0, 0, 0) local marker = createMarker(978.79998779297, -1693, 14.699999809265, "cylinder", 8, 0, 0, 0, 0) function moveGate(thePlayer) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)) , aclGetGroup("pm")) then moveObject(gate, 3000, 978.79998779297, -1693, 8.1999998092651) end end addEventHandler("onMarkerHit", marker, moveGate) function move_back_gate() moveObject(gate, 3000, 978.79998779297, -1693, 14.699999809265) end addEventHandler("onMarkerLeave", marker, move_back_gate) Mensagem no Debug: WARNING lua:5: Bad Argument @ 'getPlayerAccount' [Expected player or console at argument 1, got vehicle WARNING lua:5: Bad Argument @ 'getPlayerAccountName' [Expected account at argument 1, got boolean ERROR: lua:5: attempt to concatenate a boolean value Warning Nesse script de portão por acl quando chego a frente dele a pé funciona normalmente sem nenhum erro, más quando pego um carro e chego no portão aparece isso no debug
  4. consegui resolver, obrigado amigo você é um amigo
  5. entendi e como eu poderia resolver isso? @Boechat
  6. local show_radar = false; local function render( ) if ( not show_radar or not isPedInVehicle( localPlayer ) or not INTERFACE_UTILS.SHOW ) then return; end local position = { getElementPosition( localPlayer ) }; dxSetRenderTarget( INTERFACE.Radar.render_targer, true ); dxDrawRectangle( 0, 0, INTERFACE.Radar.w, INTERFACE.Radar.h, tocolor( 94, 101, 107 ) ); local map_size = INTERFACE.unit / ( 200 / 125 ); local cx, cy, _, tx, ty = getCameraMatrix( ); local north = findRotation( cx, cy, tx, ty ); local map_x, map_y = -( reMap( position[ 1 ] + INTERFACE.unit, 0, 6000, 0, map_size ) - INTERFACE.Radar.w / 2 ), -( reMap( -position[ 2 ] + INTERFACE.unit, 0, 6000, 0, map_size ) - INTERFACE.Radar.h / 2 ); dxDrawImage( map_x, map_y, map_size, map_size, map_texture, north, - map_size / 2 - map_x + INTERFACE.Radar.w / 2, - map_size / 2 - map_y + INTERFACE.Radar.h / 2, tocolor( 255, 255, 255 ) ); for index, value in ipairs( INTERFACE.gps_lines ) do local NODE_X, NODE_Y = value.x, value.y; local w, h = 25, 25; local line_x, line_y, line_w, line_h = ( INTERFACE.unit + ( NODE_X - w + 10 ) ) / 6000 * map_size, ( INTERFACE.unit - ( NODE_Y - h ) ) / 6000 * map_size, w / 6000 * map_size, -( h / 6000 * map_size ); line_x = line_x + map_x; line_y = line_y + map_y; dxSetBlendMode( "modulate_add" ); dxDrawImage( line_x, line_y, line_w, line_h, "assets/minimap/radar_area.png", north, -line_w / 2 - line_x + INTERFACE.Radar.w / 2, -line_h / 2 - line_y + INTERFACE.Radar.h / 2, tocolor( 131, 112, 245 ) ); dxSetBlendMode( "blend" ); end for index, value in ipairs( getElementsByType( "radararea" ) ) do local area_pos = { getElementPosition( value ) }; local w, h = getRadarAreaSize( value ); local r, g, b, a = 255, 255, 255, 255; local area_x, area_y, area_w, area_h = ( INTERFACE.unit + area_pos[ 1 ] ) / 6000 * map_size, ( INTERFACE.unit - area_pos[ 2 ] ) / 6000 * map_size, w / 6000 * map_size, -( h / 6000 * map_size ); area_x = area_x + map_x; area_y = area_y + map_y; r, g, b, a = getRadarAreaColor( value ); if ( isRadarAreaFlashing( value ) ) then a = a * math.abs( getTickCount( ) % 1000 - 500 ) / 500; end dxSetBlendMode( "modulate_add" ); dxDrawImage( area_x, area_y, area_w, area_h, "assets/minimap/radar_area.png", north, -area_w / 2 - area_x + INTERFACE.Radar.w / 2, -area_h / 2 - area_y + INTERFACE.Radar.h / 2, tocolor( r, g, b, a ) ); dxSetBlendMode( "blend" ); end for index, value in ipairs( getElementsByType( "blip" ) ) do local blip_pos = { getElementPosition( value ) }; local blip_icon = getBlipIcon( value ); local blip_x, blip_y = getRadarFromWorldPosition( blip_pos[ 1 ], blip_pos[ 2 ], -40, -40, INTERFACE.Radar.w + 80, INTERFACE.Radar.h + 80, map_size ); local blip_color = { 255, 255, 255 }; if ( blip_icon == 0 ) then blip_color = { getBlipColor( value ) }; end if ( getDistanceBetweenPoints2D( blip_pos[ 1 ], blip_pos[ 2 ], position[ 1 ], position[ 2 ] ) <= 450 ) then dxDrawImage( blip_x - INTERFACE.blip_size / 2, blip_y - INTERFACE.blip_size / 2, INTERFACE.blip_size, INTERFACE.blip_size, INTERFACE.blips[ blip_icon ], 0, 0, 0, tocolor( blip_color[ 1 ], blip_color[ 2 ], blip_color[ 3 ] ) ); end end local blip_x, blip_y = ( INTERFACE.unit + position[ 1 ] ) / 6000 * map_size, ( INTERFACE.unit - position[ 2 ] ) / 6000 * map_size; blip_x = blip_x + map_x; blip_y = blip_y + map_y; dxDrawImage( blip_x - INTERFACE.blip_size / 2, blip_y - INTERFACE.blip_size / 2, INTERFACE.blip_size, INTERFACE.blip_size, arrow_player, north - getPedRotation( localPlayer ), 0, 0, tocolor( 255, 255, 255 ) ); dxSetRenderTarget( ); dxDrawRectangle( INTERFACE.Radar.x - 2, INTERFACE.Radar.y - 2, INTERFACE.Radar.w + 4, INTERFACE.Radar.h + 4, tocolor( 33, 33, 33 ) ); dxDrawImage( INTERFACE.Radar.x, INTERFACE.Radar.y, INTERFACE.Radar.w, INTERFACE.Radar.h, INTERFACE.Radar.render_targer, 0, 0, 0, tocolor( 255, 255, 255 ) ); removePointMap( ); end function setRadarVisible( bool ) show_radar = not not bool; if ( show_radar ) then addEventHandler( "onClientRender", root, render ); else removeEventHandler( "onClientRender", root, render ); end end function getRadarVisible( ) return show_radar; end está aparecendo o seguinte aviso "Bad Argument @ 'dxDrawImage' [Expected material at argument 5, got nil] esse aviso está aparecendo na linha 86 que tem isso aqui dxDrawImage( blip_x - INTERFACE.blip_size / 2, blip_y - INTERFACE.blip_size / 2, INTERFACE.blip_size, INTERFACE.blip_size, INTERFACE.blips[ blip_icon ], 0, 0, 0, tocolor( blip_color[ 1 ], blip_color[ 2 ], blip_color[ 3 ] ) ); Sou novo como script e estou aprendendo e queria muito que alguém me ajudasse a resolver esse problema
  7. Então queria saber se tem como e qual seria o script usado para não deixar alguém morrer, Exemplo a pessoa leva um tiro na cabeça e ao invés de morrer ela fica desmaiada, sei que tem vários script na net disso, mais nenhum deles é realmente oque eu preciso, queria um script que independente do que acontecer a pessoa não morrer, mesmo se cair de um lugar alto, alguém pode me ajudar em quanto a isso?
  8. então não funcionou, desculpa pela forma do script e que eu n sei colocar como forma de scritp, so copiei e colei aqui, perdao, mais tipo oq eu queria era deixar para todo mundo do servidor não aparecer o id, e para os que estao na acl staff conseguir ver o id em cima da cabeça
  9. então esse script deixa o id invisível para todo mundo, e queria colocar que somente membros da acl staff consiga ver o id, normalmente, já procurei tutorial e não entendi muito bem como fazer isso, alguém poderia me ajudar nessa questão? local drawDistance = 7 g_StreamedInPlayers = {} function onClientRender() local cx, cy, cz, lx, ly, lz = getCameraMatrix() for k, player in pairs(g_StreamedInPlayers) do if isElement(player) and isElementStreamedIn(player) then local vx, vy, vz = getPedBonePosition(player, 4) local dist = getDistanceBetweenPoints3D(cx, cy, cz, vx, vy, vz) if dist < drawDistance and isLineOfSightClear(cx, cy, cz, vx, vy, vz, true, false, false) then local x, y = getScreenFromWorldPosition(vx, vy, vz + 0.3) if x and y then if getElementAlpha(player) > 0 then -- se o alpha do player for maior que 0 mostra o ID local ID = getElementData(player, "ID") or "N/A" local w = dxGetTextWidth(ID, 0.1, "default-bold") local h = dxGetFontHeight(1, "default-bold") dxDrawText(""..ID.."", x - 1 - w / 1, y - 1 - h - 12, w, h, CorTag, 1.20, "default-bold", "left", "top", false, false, false, false, false) CorTag = tocolor(255, 255, 255) if getElementData(player, "Cor", true) then CorTag = tocolor(0, 255, 0) end end end end end else table.remove(g_StreamedInPlayers, k) end end addEventHandler("onClientRender", root, onClientRender) function CorTagid () if getElementData(localPlayer, "Cor", true) then setElementData(localPlayer, "Cor", false) else setElementData(localPlayer, "Cor", true) end end bindKey ( "z", "both", CorTagid ) function onClientElementStreamIn() if getElementType(source) == "player" and source ~= getLocalPlayer() then setPlayerNametagShowing(source, false) table.insert(g_StreamedInPlayers, source) end end addEventHandler("onClientElementStreamIn", root, onClientElementStreamIn) function onClientResourceStart() local players = getElementsByType("player") for k, v in pairs(players) do if isElementStreamedIn(v) and v ~= getLocalPlayer() then setPlayerNametagShowing(v, false) table.insert(g_StreamedInPlayers, v) end end end addEventHandler("onClientResourceStart", resourceRoot, onClientResourceStart)
×
×
  • Create New...