Jump to content

Bryan321

Members
  • Posts

    14
  • Joined

  • Last visited

Posts posted by Bryan321

  1. Olá pessoal,

    Estou com um painel de Ranking de Drift, e gostaria de retirar os codigos HEX dos nicks na qual aparecem na lista, tentei pelo getPlayerFromNamePart e também tentei fazer um string.gsub, porém nenhuma das duas opções funcionou

    Imagem da Situação:

    https://imgur.com/a/JAY9u

    client

    local screenWidth,screenHeight = guiGetScreenSize()
    local score = 0
    local combo = 0
    local multiplier = 1
    local failDrift = false
    local size = 2
    local fps = getFPSLimit()
    local vehicle
    local inVehicle = false
    local multipliers = {
    {100000,5},
    {50000,4},
    {25000,3},
    {10000,2},
    {0,1},
    }
    
    local textX = screenWidth/2
    local textY = screenHeight/4
    local lineY = 45
    local textScale = 2                               
    local red = tocolor(255,0,0)
    local green = tocolor(255,140,0)
    local font = "default-bold"
    local alignX = "center"
    local alignY = "center"
    
    local gui = {}
    
    local allowedType =
    {
    	["Automobile"] = true,
    	["Quad"] = true,
    	["Monster Truck"] = true,
    }
    
    local forcedEvents =
    {
    	["onClientElementDestroy"] = true,
    	["onClientPlayerWasted"] = true,
    }
    
    local function convertNumber ( number )
    	local formatted = number
    	while true do
    		formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1 %2')
    		if ( k==0 ) then
    			break
    		end
    	end
    	return formatted
    end
    
    local function checkVehicleHandling()
    
    	local flags = getVehicleHandling(vehicle)["handlingFlags"]
    	if (bitAnd( flags, 32 ) == 32) or (bitAnd( flags, 64 ) == 64) then
    		return true
    	end
    	
    end
    
    local function driftEnd (endscore,endcombo)
    	local oldBestDrift = getElementData (localPlayer,"Best Drift") or 0
    	local oldTotalDrift = getElementData (localPlayer,"Total Drift") or 0
    
    	score = 0
    	combo = 0
    	
    	if endscore ~= 0 then
    		setElementData(localPlayer,"Total Drift",math.floor(endscore+oldTotalDrift))
    		setElementData(localPlayer,"Last Drift",math.floor(endscore))
    	end
    
    	if endscore > oldBestDrift then
    		setElementData(localPlayer,"Best Drift",endscore)
    	end
    	if endscore >= 2000 then
    		triggerServerEvent("onDriftEnd",localPlayer,endscore)
    		triggerEvent("onClientDriftEnd",localPlayer,endscore)
    	end
    end
    
    local function calculateAngle ()
    	if not allowedType[vehicle.vehicleType] then return 0,0 end
    	if not isVehicleOnGround(vehicle) then return 0,0 end
    	if failDrift then return 0,0 end
    	
    	local vx,vy,vz = getElementVelocity(vehicle)
    	local rx,ry,rz = getElementRotation(vehicle)
    	local sn,cs = -math.sin(math.rad(rz)), math.cos(math.rad(rz))
    	local speed = (vx^2 + vy^2 + vz^2)^(0.5)
    	local modV = math.sqrt(vx*vx + vy*vy)
    	local cosX = (sn*vx + cs*vy)/modV
    	
    	if modV <= 0.2 then return 0,0 end
    	if cosX > 0.966 or cosX < 0 then return 0,0 end
    	
    	return math.deg(math.acos(cosX))*0.5,speed
    end
    
    local function updateFPS(msSinceLastFrame)
        fps = (1 / msSinceLastFrame) * 1000
    end
    
    local function resetFail()
    
    	failDrift = false
    	showScore=false
    
    end
    
    local function onCollide(attacker)
    
    	if attacker or failDrift then return end
    	
    	failDrift = true
    	driftEnd(0,0)
    	setTimer(resetFail,2000,1)
    	
    end
    
    local function drawMeter ()
    	if isWorldSpecialPropertyEnabled("hovercars") then return end
    	if checkVehicleHandling() then return end
    	
    	if localPlayer.vehicle ~= vehicle then
    		removeEventHandler("onClientVehicleDamage",vehicle,onCollide)
    		removeEventHandler("onClientElementDestroy",vehicle,checkVehicle)
    		removeEventHandler("onClientPlayerWasted",localPlayer,checkVehicle)
    		removeEventHandler("onClientRender",root,drawMeter)
    		removeEventHandler("onClientPreRender", root, updateFPS)
    		vehicle=nil
    		inVehicle=false
    		checkVehicle()
    		return
    	end
    	
    	local angle,speed = calculateAngle()
    	if isTimer (resetTimer) and angle ~= 0 then
    		killTimer(resetTimer)
    		showScore = true
    		if comboReady then
    			combo = combo + 1
    			comboReady = false
    		end
    	end
    	if angle == 0 then
    		if not isTimer(resetTimer) then
    			comboReady = true
    			resetTimer = setTimer (function()
    				if score == 0 then return end
    				driftEnd (score,combo)
    				score = 0
    				combo = 0
    				showScore = false
    			end,1300,1)
    		end
    	end
    	local gameSpeed = getGameSpeed()
    	for k,v in ipairs(multipliers) do
    		local pointsNeeded,multi = unpack(multipliers[k])
    		if score > pointsNeeded then
    			multiplier = multi
    			break
    		end
    	end
    	local fpsMultiplier = 100/fps
    	local angleScore = angle/2
    	local speedScore = speed*3
    	local driftScore = angleScore*speedScore
    	local addScore = math.floor(driftScore*multiplier)
    	local gameSpeedFixedScore = math.floor(gameSpeed*addScore)
    	score = score + math.floor(fpsMultiplier*gameSpeedFixedScore)
    	if showScore then
    		local color = (failDrift and red or green)
    		dxDrawText ("Pontos de Drift x"..tostring(combo),textX,0,textX,textY-lineY,color,textScale,font,alignX,alignY)
    		dxDrawText (score,textX,0,textX,textY,color,textScale,font,alignX,alignY)
    	end
    
    end
    
    function checkVehicle(vehicleEntered)
    
    	local isForcedFalse = forcedEvents[eventName] ~= true
    	if localPlayer.inVehicle == inVehicle and isForcedFalse then return end
    	
    	local tempVehicle = vehicleEntered or getPedOccupiedVehicle(localPlayer)
    	local seat = getPedOccupiedVehicleSeat(localPlayer)
    	inVehicle = ((seat == 0 and allowedType[tempVehicle.vehicleType]) and (isForcedFalse and localPlayer.inVehicle or false) or false)
    
    	if inVehicle and seat==0 then
    		vehicle = tempVehicle
    		addEventHandler("onClientVehicleDamage",vehicle,onCollide)
    		addEventHandler("onClientElementDestroy",vehicle,checkVehicle)
    		addEventHandler("onClientPlayerWasted",localPlayer,checkVehicle)
    		addEventHandler("onClientRender",root,drawMeter)
    		addEventHandler("onClientPreRender", root, updateFPS)
    	elseif not inVehicle and vehicle then
    		removeEventHandler("onClientVehicleDamage",vehicle,onCollide)
    		removeEventHandler("onClientElementDestroy",vehicle,checkVehicle)
    		removeEventHandler("onClientPlayerWasted",localPlayer,checkVehicle)
    		removeEventHandler("onClientRender",root,drawMeter)
    		removeEventHandler("onClientPreRender", root, updateFPS)
    		vehicle=nil
    	end
    
    end
    
    local function loadRecords(records,maxPosition,myAcc)
    
    	guiSetText(gui.window,"Top "..tostring(maxPosition).." drifters")  
    
    	guiGridListClear(gui.list)
    	local guestID = 0
    	for position,record in ipairs(records) do
    		local player,score,name,isGuest = record.username,record.score,record.playername,record.isGuest
    		if isGuest == "true" then
    			guestID=guestID+1
    			if myAcc == "guest" then
    				myAcc = hash("sha512",getPlayerSerial())
    			end
    		end
    		local row = guiGridListAddRow(gui.list,"#"..tostring(position).." "..name,(isGuest == "true" and "guest_"..tostring(guestID) or player),convertNumber(score))
    		if player == myAcc then
    			guiGridListSetItemColor(gui.list,row,gui.namecolumn,255,255,255,255)
    			guiGridListSetItemColor(gui.list,row,gui.usercolumn,255,255,255,255)
    			guiGridListSetItemColor(gui.list,row,gui.scorecolumn,255,255,255,255)
    		end
    	end
    	
    end
    
    local function toggleGUI()
    
    	local isVisible = guiGetVisible(gui.window)
    	
    	if isVisible then
    		guiSetVisible(gui.window,false)
    		showCursor(false)
    	else
    		guiSetVisible(gui.window,true)
    		showCursor(true)
    	end
    
    end
    
    local function initScript()
    
    	addEvent("onClientDriftEnd",false)
    	addEvent("Drift:loadRecords",true)
    	
    	gui.window = guiCreateWindow(0.35,0.15,0.3,0.7,"",true)
    	gui.list = guiCreateGridList(0,0.05,1,0.95,true,gui.window)
    	gui.namecolumn = guiGridListAddColumn(gui.list,"Jogador",0.4)
    	gui.usercolumn = guiGridListAddColumn(gui.list,"Login",0.3)
    	gui.scorecolumn = guiGridListAddColumn(gui.list,"Pontos",0.2)
    	guiGridListSetSortingEnabled(gui.list,false)
    	
    	guiSetVisible(gui.window,false)
    	
    	bindKey("F5","down",toggleGUI)
    	
    	checkVehicle()
    	addEventHandler("Drift:loadRecords",localPlayer,loadRecords)
    	addEventHandler("onClientPlayerVehicleEnter",localPlayer,checkVehicle)
    	addEventHandler("onClientPlayerVehicleExit",localPlayer,checkVehicle)
    	
    	triggerServerEvent("Drift:scriptLoaded",localPlayer)
    
    end
    
    addEventHandler("onClientResourceStart",resourceRoot,initScript)

    server

    local connection
    local driftRecords = {}
    local loadedClients = {}
    local recordListMaxPosition = 50
    
    local excludedUsernames = -- Add accountnames of who you want to blacklist from ranking, like to prevent players tracking (undercover) admins through F5 (current nick + username)
    {
    	["Adminusername1"] = true,
    	["Test2"] = true,
    }
    
    local function comp(a,b)
    
    	return a.score > b.score
    
    end
    
    function getPlayerFromNamePart(name)
        if name then 
            for i, player in ipairs(getElementsByType("player")) do
                if string.find(getPlayerName(player):lower(), tostring(name):lower(), 1, true) then
                    return player 
                end
            end
        end
        return false
    end
    
    local function checkDriftRecord(score)
    
    	if not client.account then return end
    	if excludedUsernames[client.account.name] then return end
    	
    	local acc = (client.account.name~="guest" and client.account.name or hash("sha512",client.serial))
    	local name = client.name
    	local oldJSON = toJSON(driftRecords)
    	local isGuest = tostring(isGuestAccount(client.account))
    	
    	if driftRecords[#driftRecords] == nil or (score > driftRecords[#driftRecords].score or #driftRecords < recordListMaxPosition) then
    		local existingPosition = false
    		for position,record in ipairs(driftRecords) do
    			if record.username == acc then
    				existingPosition = position
    				break
    			end
    		end
    		if existingPosition and score > driftRecords[existingPosition].score then
    			driftRecords[existingPosition].score = score
    			driftRecords[existingPosition].playername = name
    		elseif not existingPosition then
    			table.insert(driftRecords,{username=acc,score=score,playername=name,isGuest=isGuest})
    		end
    	else
    		return
    	end
    	
    	table.sort(driftRecords,comp)
    	
    	if #driftRecords > recordListMaxPosition then
    		for position=recordListMaxPosition+1,#driftRecords do
    			driftRecords[position]=nil
    		end
    	end
    	
    	if oldJSON == toJSON(driftRecords) then
    		return
    	end
    	
    	for player,_ in pairs(loadedClients) do
    		triggerClientEvent(player,"Drift:loadRecords",player,driftRecords,recordListMaxPosition,player.account.name)
    	end
    	
    	connection:exec("DELETE FROM records")
    	
    	for position,record in ipairs(driftRecords) do
    		connection:exec("INSERT INTO records VALUES (?,?,?,?)",record.username,record.playername,record.score,record.isGuest)
    	end
    	
    end
    
    local function recheckPlayer()
    
    	triggerClientEvent(source,"Drift:loadRecords",source,driftRecords,recordListMaxPosition,source.account.name)
    
    end
    
    local function resetPlayer()
    
    	loadedClients[source] = nil
    
    end
    
    local function clientLoaded()
    
    	if source~=client then return end
    	
    	triggerClientEvent(client,"Drift:loadRecords",client,driftRecords,recordListMaxPosition,client.account.name)
    	addEventHandler("onDriftEnd",client,checkDriftRecord)
    	loadedClients[client] = true
    	addEventHandler("onPlayerLogin",client,recheckPlayer)
    	addEventHandler("onPlayerLogout",client,recheckPlayer)
    	addEventHandler("onPlayerQuit",client,resetPlayer)
    	
    end
    
    local function initScript()
    	
    	connection = Connection("sqlite",":/drift.db")
    	connection:exec("CREATE TABLE IF NOT EXISTS records (username TEXT, playername TEXT, score NUMBER, isGuest TEXT)")
    	
    	local handle = connection:query("SELECT * FROM records")
    	driftRecords = handle:poll(-1)
    	
    	addEvent("Drift:scriptLoaded",true)
    	addEvent("onDriftEnd",true)
    	
    	addEventHandler("Drift:scriptLoaded",root,clientLoaded)
    
    	for _,v in ipairs({"Best Drift","Total Drift","Last Drift"}) do exports["scoreboard"]:addScoreboardColumn(v) end
    	
    end
    
    addEventHandler("onResourceStart",resourceRoot,initScript)

    Gostaria de apesar retirar os códigos hex dos nicks, e deixar apenas o name 

  2. Olá,

    Estou com o seguinte problema, á cada vez que um player morre dentro do veiculo, aparece a seguinte mensagem no debugscript 

    WARNING: \carro.lua:20: Bad argument @'destroyElement' [Expected element at argument 1, got nil]

    Porem na tal linha o argumento já está setado para source

    Gostaria de saber como posso resolver isso 

    local Veiculo = { 411,411}
    Drzika = {}
    
    function CreateVehicle (source)
    if getElementData (source, "Pegou", true) then outputChatBox ('#ffffff*#BF6F14Aguarde 20 Segundos para Pegar um Carro Novamente.',source,255,255,255,true) return end
    if isElement(Drzika[source]) then destroyElement (Drzika[source]) 
    Drzika[source] = nil
    end
    local x,y,z = getElementPosition (source)
    local Cars = Veiculo[math.random(#Veiculo)]
    Drzika[source] = createVehicle (Cars,x,y,z)
    warpPedIntoVehicle (source,Drzika[source])
    --outputChatBox ('#000000[ #00bfffVEICULO#000000 ] - #FFFFFF'..getPlayerName(source)..' #6C6C6CPegou um Carro digitando #00bffa/carro', root, 255, 255, 255, true)
    setElementData (source, "Pegou",true)
    setTimer (setElementData, 20000, 1, source, "Pegou", false)
    end
    addCommandHandler ("carro", CreateVehicle)
    
    function DestroyVeiculo ()
    destroyElement (Drzika[source])
    end
    addEventHandler ("onPlayerLogout", root, DestroyVeiculo)
    addEventHandler ("onPlayerQuit", root, DestroyVeiculo)
    addEventHandler ("onPlayerWasted", root, DestroyVeiculo)
    

     

  3. Olá

    Estou fazendo um admin mensagem, e gostaria de deixar ele setado para uma acl, mas está dando um erro na qual não estou conseguindo resolver:

    ERROR: script\server.lua:4: attempt to concatenate local 'player' (a nil value)

    function adminmensagem(player,commandName, ...) 
    local player 
    imsg = table.concat({...}, " ") 
            if isObjectInACLGroup ( "user." .. player, aclGetGroup ( "Console" ) ) then 
            if imsg and imsg ~= "" then 
                triggerClientEvent("dxTextMostrar",getRootElement(),getPlayerName(player)..":#FFFFFF "..imsg) 
                setTimer ( triggerClientEvent, 5000, 1, "dxTextEsconder",getRootElement() ) 
            else 
                outputChatBox("#FFF000[AVISO]#FFFFFFDigite uma mensagem!",player,255,255,255,true) 
            end 
        end 
    end 
    addCommandHandler("stg", adminmensagem) 
    

    Agradeço desde já e aguardo resposta!

  4. Gostaria de saber como faço e quais as funções para adicionar um dxDrawText para ficar acima da cabeça, tipo uma NameTag, só que eu gostaria de deixar ela acima da cabeça dos players que são setados nas acls por exemplo.

    Admin - escrito Admin acima da cabeça e da Nametag do jogador. E também gostaria de saber como faço para calcular e achar a posiçao correta(left,right) pra ficar o texto?

  5. Olá!

    eu peguei uma resource em um site de proteção de base, na qual estou precisando, eu peguei a script mas ela não funciona de jeito nenhum, tentei editar e tals para ver se conseguia funcionar, mas nada, a proteção simplesmente não funciona/ativa nas coordenadas selecionadas

    no caso eu testei em coordenadas diferentes, testei para grupo e para acl, ambas não funcionaram

      
    EnabledAlarm = true 
    ColCuboid = false 
      
    --------------------------------------- CONFIGS -------------------------------------------- 
      
      
    RestricLocation["location1"] = {2153.12451,-1761.95825,13.54556} -- Local 1  
    RestricLocation["location2"] = {2195.95605,-1818.96802,13.1796} -- Local 2  
    TeleportLocation = {2186.80249,-1711.85938,13.34949} -- Local de TP  
    GroupName = "PM" -- Nome da Gang ou Grupo ACL 
    GroupNameBy = 2 -- 1 para Gang, e 2 para ACL 
    MsgInvasao = "Voce Precisa ser do [PM] para poder entrar!" 
    EnableVehicleGodMode = true -- Habilitar 
    HabilitarAdmin = false -- Todos admins vao poder entrar na base 
    GodMode = false -- Ao entrar na área protegida, habilita GodMode 
    NaoAtirar = false -- Ao entrar na área protegida, não podera atirar 
      
      
    --------------------------------------- CONFIGS -------------------------------------------- 
      
    function sendMsg(iplayer,msg) 
      outputChatBox ( msg, iplayer, 255, 0, 0, true ) 
    end 
      
    function EnterPlace ( theElement ) 
    local veh = getPedOccupiedVehicle(theElement) 
    local accName = getAccountName(getPlayerAccount(theElement)) 
      if HabilitarAdmin == true then 
        if ( isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) ) then 
          return 
        end 
      end 
      if (getElementType ( theElement ) == "player") and (PlayerHaveLevel (theElement) == false) then 
        sendMsg(theElement,MsgInvasao) 
        if veh then 
          setElementPosition( veh, TeleportLocation[1], TeleportLocation[2], TeleportLocation[3]) 
        else 
          setElementPosition( theElement, TeleportLocation[1], TeleportLocation[2], TeleportLocation[3]) 
        end 
        sendMsgOwners(theElement) 
      elseif getElementType ( theElement ) == "vehicle" then 
        SetVehicleGodMode(theElement,true) 
      end 
    end 
      
    function ExitPlace ( theElement ) 
      if GodMode == true then 
        setElementData(theElement,"blood",12000) 
      end 
      if NaoAtirar == true then 
      toggleControl(theElement, "fire", true) 
      toggleControl(theElement, "vehicle_fire", true) 
      toggleControl(theElement, "vehicle_secondary_fire", true) 
      toggleControl(theElement, "aim_weapon", true) 
      end 
      if getElementType ( theElement ) == "vehicle" then 
        SetVehicleGodMode(theElement,false) 
      end 
    end 
      
    function PlayerHaveLevel( PlayerID ) 
      if GroupNameBy == 1 then 
        if ( getElementData ( PlayerID , "gang" ) == GroupName ) then 
          if GodMode == true then 
            setElementData(PlayerID,"blood",999999999999999) 
          end 
          if NaoAtirar == true then 
            toggleControl (PlayerID, "fire", false) 
            toggleControl (PlayerID, "vehicle_fire", false) 
            toggleControl (PlayerID, "vehicle_secondary_fire", false) 
            toggleControl (PlayerID, "aim_weapon", false) 
          end 
          return true 
        else 
          return false 
        end 
      else 
        local accName = getAccountName ( getPlayerAccount ( PlayerID ) ) 
        if ( isObjectInACLGroup ("user."..accName, aclGetGroup ( GroupName ) ) ) then 
          if GodMode == true then 
            setElementData(PlayerID,"blood",999999999999999) 
          end 
          if NaoAtirar == true then 
            toggleControl (PlayerID, "fire", false) 
            toggleControl (PlayerID, "vehicle_fire", false) 
            toggleControl (PlayerID, "vehicle_secondary_fire", false) 
            toggleControl (PlayerID, "aim_weapon", false) 
          end 
          return true 
        else 
          return false 
        end 
      end 
    end 
      
    function ResourceStart( ) 
        LoadLocations() 
        CreateCollision() 
    end 
    addEventHandler( "onResourceStart", getResourceRootElement( getThisResource() ),ResourceStart) 
      
    function LoadLocations() 
        local RX, RY, RZ, WRX, WRX, WRX 
        if(RestricLocation["location1"][1] > RestricLocation["location2"][1]) then 
            RestricLocation["maxx"] = RestricLocation["location1"][1] 
            RestricLocation["minx"] = RestricLocation["location2"][1] 
        else 
            RestricLocation["maxx"] = RestricLocation["location2"][1] 
            RestricLocation["minx"] = RestricLocation["location1"][1] 
        end 
        if(RestricLocation["location1"][2] > RestricLocation["location2"][2]) then 
            RestricLocation["maxy"] = RestricLocation["location1"][2] 
            RestricLocation["miny"] = RestricLocation["location2"][2] 
        else 
            RestricLocation["maxy"] = RestricLocation["location2"][2] 
            RestricLocation["miny"] = RestricLocation["location1"][2] 
        end 
        if(RestricLocation["location1"][3] > RestricLocation["location2"][3]) then 
            RestricLocation["maxz"] = RestricLocation["location1"][3] 
            RestricLocation["minz"] = RestricLocation["location2"][3] 
        else 
            RestricLocation["maxz"] = RestricLocation["location2"][3] 
            RestricLocation["minz"] = RestricLocation["location1"][3] 
        end 
    end 
      
    function CreateCollision() 
        RX = RestricLocation["minx"] 
        WRX = RestricLocation["maxx"] - RestricLocation["minx"] 
        RY = RestricLocation["miny"] 
        WRY = RestricLocation["maxy"] - RestricLocation["miny"] 
        RZ = RestricLocation["minz"] 
        WRZ = RestricLocation["maxz"] - RestricLocation["minz"] 
        ColCuboid = createColCuboid ( RX, RY, RZ, WRX, WRY, WRZ ) 
        if ColCuboid then 
            addEventHandler ( "onColShapeHit", ColCuboid, EnterPlace ) 
            addEventHandler ( "onColShapeLeave", ColCuboid, ExitPlace ) 
        else 
            outputDebugString("Erro, verifique: location1 e location2") 
        end 
    end 
      
    function ResourceStop( ) 
        destroyElement ( ColCuboid ) 
    end 
    addEventHandler( "onResourceStop", getResourceRootElement( getThisResource() ),ResourceStop) 
      
    function sendMsgOwners( PlayerID ) 
        local connectedPlayers = getElementsByType ( "player" ) 
        for i, aPlayer in ipairs(connectedPlayers) do 
            if(PlayerHaveLevel (aPlayer) == true) then 
                sendMsg(aPlayer," O Jogador " ..getPlayerName ( PlayerID ) .." esta tentando invadir a sua BASE !") 
            end 
        end 
    end 
      
    function SetVehicleGodMode( VehicleID, godEoD ) 
        if EnableVehicleGodMode == true then 
            setElementData(VehicleID, "godmode", godEoD) 
            setVehicleDamageProof (VehicleID, godEoD ) 
        end 
    end 
    

    Gostaria de saber qual seria o erro na script para que ele não esteja funcionando

    Agradeço desde já!

  6. Olá

    Tenho uma duvida, acredito que seja até simples, e é algo que procurei em vários lugares e não achei.

    Gostaria de saber qual função/Comando ou até a script mesmo caso for possível e caso haja na comunidade.

    Gostaria de colocar algumas resources do meu servidor (carro,moto, armas, skin, teleporte) e até a própria freeroam, para que ela se desativase automaticamente ao mudar de dimensão (1 á 3), para que ninguem tivesse "vantagem" em eventos que seriam feitos em outras dimensões.

    Peço desculpas caso tenha feito o tópico na area errada,

    Aguardo resposta.

  7. Opa, tudo bem com vocês??

    Começei á pouco tempo á aprender mais sobre .lua, mas ainda sou muito novato nisso e gostaria de uma pequena ajuda nessa simples script.

    A script é para o BOPE, para pegar só quem é do bope um kit de armas e skin, o código está funcionando bem, normal e tals, mas o unico problema é que ao digitar o comando ele só vem as armas e não vem a skin no personagem.

    Acredito que eu tenha tido um simples erro, tentei resolver mas não obtive sucesso, espero uma ajuda nisso, apesar de ser simples para quem já "manja" da programação, eu sou bem inexperiente nisso.

    A Script:

    function kitarmas ( source ) 
        accountname = getAccountName ( getPlayerAccount ( source ) ) 
        if isObjectInACLGroup("user." .. accountname, aclGetGroup("BOPE")) then 
            giveWeapon(source, 4, 200, true) 
            giveWeapon(source, 24, 200, true) 
            giveWeapon(source, 26, 200, true) 
            giveWeapon(source, 28, 200, true) 
            giveWeapon(source, 31, 200, true) 
            giveWeapon(source, 34, 200, true) 
            giveWeapon(source, 37, 200, true) 
            giveWeapon(source, 16, 200, true) 
            giveWeapon(source, 46, 200, true) 
             setElementData(thePlayer,"invincible",false) 
             setElementModel(thePlayer, 283) 
            outputChatBox("#00ff00[bOPE]: Você pegou o Kit de Armas e Skin do BOPE", source, 255, 255, 255, true) 
        end 
    end 
    addCommandHandler("kitbope", kitarmas) 
    

    Obrigado desde já!

  8. oi, tranquilos?

    eu gostaria de saber como eu colocaria os argumentos que eu colocaria na meta.xml para essa script? Sei que é uma pergunta meio boba, mas eu acho que o erro está na meta que eu fiz

    A Script:

    local acls = { "SuperModerator", "Admin", "Console" } 
         
         
        local on = "nao"
        local coisa = nil
         
        function event (thePlayer)
             local account = getPlayerAccount(thePlayer)
                 if (not account or isGuestAccount(account)) then return end
                 local accountName = getAccountName(account)
                 for i, v in pairs ( acls ) do
                 if ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( v ) ) ) then
                if(on == "sim")then
                    outputChatBox("#FFF000[sERVER#FFFFFF Evento criado, use #FF0000/devent#FFFFFF to close the Event!",thePlayer,255,255,255,true)
                else
                    local x,y,z = getElementPosition(thePlayer)
                                on = "sim"
                    coisa = createMarker(x,y,z-1,"cylinder",2,0,255,0)
                    dimen = getElementDimension(thePlayer)
                    inte = getElementInterior(thePlayer)
                                outputChatBox("#FFF000[sERVER]#FFFFFF Administrador #FF0000"..getPlayerName(thePlayer).."#FFFFFF criou um evento, digite #FF0000/irevento#FFFFFF para participar!",root,255,255,255,true)
         
                    if(inte)then
                        setElementInterior(coisa, inte)
                     end
                    if(dimen)then
                        setElementDimension(coisa, dimen)
                    end
                    end
         
         
            else
            outputChatBox("#FFF000[sERVER]#FFFFFF Você não é um admin para criar um evento!",thePlayer,255,255,255,true)
            end
          end
          end
        addCommandHandler("cevento", event)local acls = { "SuperModerator", "Admin", "Console" }
         
         
        local on = "nao"
        local coisa = nil
         
        function event (thePlayer)
             local account = getPlayerAccount(thePlayer)
                 if (not account or isGuestAccount(account)) then return end
                 local accountName = getAccountName(account)
                 for i, v in pairs ( acls ) do
                 if ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( v ) ) ) then
                if(on == "sim")then
                    outputChatBox("#FFF000[sERVER#FFFFFF Evento created, use #FF0000/cancelarevento#FFFFFF to close the Event!",thePlayer,255,255,255,true)
                else
                    local x,y,z = getElementPosition(thePlayer)
                                on = "sim"
                    coisa = createMarker(x,y,z-1,"cylinder",2,0,255,0)
                    dimen = getElementDimension(thePlayer)
                                inte = getElementInterior(thePlayer)
                    outputChatBox("#FFF000[sERVER]#FFFFFF Administrador #FF0000"..getPlayerName(thePlayer).."#FFFFFF criou um evento, digite #FF0000/irevento#FFFFFF para participar!",root,255,255,255,true)
                        setElementInterior(coisa, inte)
                        if (dimen)then
                        setElementDimension(coisa, dimen)
                        end
                     end  
                     end
                     end
                     end
            if not (isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( v ) ) ) then
            outputChatBox("#FFF000[sERVER]#FFFFFF Você não é um Admin para criar um evento!",thePlayer,255,255,255,true)
            end
        addCommandHandler("devento", event)
         
        function irevento(thePlayer,cmd)
            local x,y,z = getElementPosition(coisa)
            local inEvent = getElementData(thePlayer, "Evento")
         
            if(on == "sim")then -- "on == sim", on is a string var? setted in outside of this code?
                if(getPedOccupiedVehicle (thePlayer))then
                    outputChatBox("#FFF000[sERVER]#FFFFFF Leave your vehicle to enter the event",thePlayer,255,255,255,true)
                else
                    if (inEvent) then -- if the var "Evento" is true then say to player:
                        outputChatBox("#FFF000[sERVER]#FFFFFF You're already at the event.",thePlayer,255,255,255,true)
                    else
                        -- only take weapons and give armor and helth if the player joined in event.
                        takeAllWeapons ( thePlayer )          
                        setElementHealth ( thePlayer, 100 )
                        setPedArmor ( thePlayer, 100 )
         
                        setElementData(thePlayer, "Evento", true) -- set var "Evento" to true
                        setElementPosition(thePlayer,x,y,z+1) -- set player position
                        setElementDimension(thePlayer, getElementDimension(coisa))
                        setElementInterior(thePlayer,inte)
                        outputChatBox("#FFF000[sERVER]#FFFFFF Welcome in the Event!",thePlayer,255,255,255,true)
                    end
                end
            else
                outputChatBox("#FFF000[sERVER]#FFFFFF There isn't a event created!",thePlayer,255,255,255,true)
            end
        end
        addCommandHandler("irevento",irevento)
         
        function Infor(thePlayer)
            local accountname = getAccountName (getPlayerAccount(thePlayer))
            if (isObjectInACLGroup ( "user."..accountname, aclGetGroup ( "SuperModerator" or "Admin" ) )) then  
                outputChatBox("#FFF000[sERVER]#FFFFFF  - Commands for Event ",thePlayer, 255, 255, 255, true)
                outputChatBox("#FFF000[sERVER]#FFFFFF  #FF0000/cevento#FFFFFF - To create a event [Administators]!",thePlayer, 255, 255, 255, true)
                outputChatBox("#FFF000[sERVER]#FFFFFF  #FF0000/devento #FFFFFF- To close the event [Administators]!",thePlayer, 255, 255, 255, true)
                outputChatBox("#FFF000[sERVER]#FFFFFF #FF0000/irevento #FFFFFF- To enter the event [Players]!",thePlayer, 255, 255, 255, true)
                outputChatBox("#FFF000[sERVER]#FFFFFF #FF0000/sawnoff ,/m4,/tec9,/deagle #FFFFFF- To give players weapons [Administators]!",thePlayer, 255, 255, 255, true)
                outputChatBox("#FFF000[sERVER]#FFFFFF #FF0000/nrg500 , /dnrg500 #FFFFFF- To give and destroy a NRG-500 [Administators]!",thePlayer, 255, 255, 255, true)
                outputChatBox("#FFF000[sERVER]#FFFFFF #FF0000/givehealth , /takeweapons #FFFFFF- To give player health&armour and take weapons [Administators]!",thePlayer, 255, 255, 255, true)
            else
                outputChatBox("#FFF000[sERVER]#FFFFFF You aren't an admin to use this command",thePlayer,255,255,255,true)
            end
        end
        addCommandHandler ("event",Infor)
         
         
        function getWeapons ( thePlayer )
        local accountname = getAccountName (getPlayerAccount(thePlayer))
        if (isObjectInACLGroup ( "user."..accountname, aclGetGroup ( "SuperModerator" or "Admin" ) )) then  
        for _, events in ipairs(getElementsByType("player")) do
        local isPlayerInEvento = getElementData( events, "Evento" , nil )
        if ( isPlayerInEvento) then
        takeAllWeapons (events)
        outputChatBox("#FFF000[EVENTO]#FFFFFF "..getPlayerName(thePlayer).." Removeu suas Armas",events, 255, 255, 255, true)
        end
        end
        end
        end
        addCommandHandler ("tirararmas",getWeapons)
        function GiveHealthAndArmour ( thePlayer )
        local accountname = getAccountName (getPlayerAccount(thePlayer))
        if (isObjectInACLGroup ( "user."..accountname, aclGetGroup ( "SuperModerator" or "Admin" ) )) then  
        for _, events in ipairs(getElementsByType("player")) do
        local isPlayerInEvento = getElementData( events, "Evento" , nil )
        if ( isPlayerInEvento) then
        setElementHealth ( events, 100 )
        setPedArmor ( events, 100 )
        outputChatBox("#FFF000[EVENTO]#FFFFFF "..getPlayerName(thePlayer).." Deu Colete e Vida",events, 255, 255, 255, true)
        end
        end
        end
        end
        addCommandHandler ("darvida",GiveHealthAndArmour)
        function Frooze ( thePlayer )
        local accountname = getAccountName (getPlayerAccount(thePlayer))
        if (isObjectInACLGroup ( "user."..accountname, aclGetGroup ( "SuperModerator" or "Admin" ) )) then  
        for _, events in ipairs(getElementsByType("player")) do
        local isPlayerInEvento = getElementData( events, "Evento" , nil )
        if ( isPlayerInEvento) then
        setElementFrozen ( events, true )
        outputChatBox("#FFF000[EVENTO]#FFFFFF "..getPlayerName(thePlayer).." te Congelou",events, 255, 255, 255, true)
        end
        end
        end
        end
        addCommandHandler ("congelar",Frooze)
        function UnFrooze ( thePlayer )
        local accountname = getAccountName (getPlayerAccount(thePlayer))
        if (isObjectInACLGroup ( "user."..accountname, aclGetGroup ( "SuperModerator" or "Admin" ) )) then  
        for _, events in ipairs(getElementsByType("player")) do
        local isPlayerInEvento = getElementData( events, "Evento" , nil )
        if ( isPlayerInEvento) then
        setElementFrozen ( events, false )
        outputChatBox("#FFF000[EVENTO]#FFFFFF "..getPlayerName(thePlayer).." Te descongelou",events, 255, 255, 255, true)
        end
        end
        end
        end
        addCommandHandler ("descongelar",UnFrooze)
        function Deagle ( thePlayer )
        local accountname = getAccountName (getPlayerAccount(thePlayer))
        if (isObjectInACLGroup ( "user."..accountname, aclGetGroup ( "SuperModerator" or "Admin" ) )) then  
        for _, events in ipairs(getElementsByType("player")) do
        local isPlayerInEvento = getElementData( events, "Evento" , nil )
        if ( isPlayerInEvento) then
        giveWeapon ( events, 24, 9999 )
        setPedStat ( events, 73, 1000 )
        setPedStat ( events, 75, 1000 )
        setPedStat ( events, 71, 1000 )
        setPedStat ( events, 75, 1000 )
        setPedStat ( events, 77, 1000 )
        setPedStat ( events, 78, 1000 )
        outputChatBox("#FFF000[EVENTO]#FFFFFF "..getPlayerName(thePlayer).." Given you a Deagle !",events, 255, 255, 255, true)
        end
        end
        end
        end
        addCommandHandler ("deagle",Deagle)
        function SawnOff ( thePlayer )
        local accountname = getAccountName (getPlayerAccount(thePlayer))
        if (isObjectInACLGroup ( "user."..accountname, aclGetGroup ( "SuperModerator" or "Admin" ) )) then  
        for _, events in ipairs(getElementsByType("player")) do
        local isPlayerInEvento = getElementData( events, "Evento" , nil )
        if ( isPlayerInEvento) then
        giveWeapon ( events, 26, 9999 )
        setPedStat ( events, 73, 1000 )
        setPedStat ( events, 75, 1000 )
        setPedStat ( events, 71, 1000 )
        setPedStat ( events, 75, 1000 )
        setPedStat ( events, 77, 1000 )
        setPedStat ( events, 78, 1000 )
        outputChatBox("#FFF000[EVENTO]#FFFFFF "..getPlayerName(thePlayer).." Given you a Sawn off  !",events, 255, 255, 255, true)
        end
        end
        end
        end
        addCommandHandler ("sawnoff",SawnOff)
        function M4 ( thePlayer )
        local accountname = getAccountName (getPlayerAccount(thePlayer))
        if (isObjectInACLGroup ( "user."..accountname, aclGetGroup ( "SuperModerator" or "Admin" ) )) then  
        for _, events in ipairs(getElementsByType("player")) do
        local isPlayerInEvento = getElementData( events, "Evento" , nil )
        if ( isPlayerInEvento) then
        giveWeapon ( events, 31, 9999 )
        setPedStat ( events, 73, 1000 )
        setPedStat ( events, 75, 1000 )
        setPedStat ( events, 71, 1000 )
        setPedStat ( events, 75, 1000 )
        setPedStat ( events, 77, 1000 )
        setPedStat ( events, 78, 1000 )
        outputChatBox("#FFF000[EVENTO]#FFFFFF "..getPlayerName(thePlayer).." Given you a M4  !",events, 255, 255, 255, true)
        end
        end
        end
        end
        addCommandHandler ("m4",M4)
        function Tec9 ( thePlayer )
        local accountname = getAccountName (getPlayerAccount(thePlayer))
        if (isObjectInACLGroup ( "user."..accountname, aclGetGroup ( "SuperModerator" or "Admin" ) )) then  
        for _, events in ipairs(getElementsByType("player")) do
        local isPlayerInEvento = getElementData( events, "Evento" , nil )
        if ( isPlayerInEvento) then
        giveWeapon ( events, 32, 9999 )
        setPedStat ( events, 73, 1000 )
        setPedStat ( events, 75, 1000 )
        setPedStat ( events, 71, 1000 )
        setPedStat ( events, 75, 1000 )
        setPedStat ( events, 77, 1000 )
        setPedStat ( events, 78, 1000 )
        outputChatBox("#FFF000[EVENTO]#FFFFFF "..getPlayerName(thePlayer).." Given you a Tec 9  !",events, 255, 255, 255, true)
        end
        end
        end
        end
        addCommandHandler ("tec9",Tec9)
        function Minigun ( thePlayer )
        local accountname = getAccountName (getPlayerAccount(thePlayer))
        if (isObjectInACLGroup ( "user."..accountname, aclGetGroup ( "SuperModerator" or "Admin" ) )) then  
        for _, events in ipairs(getElementsByType("player")) do
        local isPlayerInEvento = getElementData( events, "Evento" , nil )
        if ( isPlayerInEvento) then
       
×
×
  • Create New...