magicplayerc Posted January 9, 2019 Share Posted January 9, 2019 function algemar(player, command, p) local acc = getPlayerAccount(player) local job = getElementData(player, 'ocupacao') or "Nenhum" if (job == "Policial") then if p then local target = getPlayerFromName(p) or getPlayerFromPartialName(p) if target and target ~= player then local px, py, pz = getElementPosition(player) local tx, ty, tz = getElementPosition(target) if getDistanceBetweenPoints3D(px, py, pz, tx, ty, tz) < 4 then if command == "algemar" then setElementData(target,"algemado",true) triggerClientEvent("algemaAdd", target) triggerClientEvent(target,"onClientPlayerAlgemado",resourceRoot,20000) setElementFrozen(target, true) setPedAnimation(player, "GANG", "prtial_gngtlkA", false, false) setTimer(function() setPedAnimation(player, false) end, 3000, 1, player, source) timer[target] = setTimer(desalgemar, 20000, 1, target) elseif command == "desalgemar" then local dataAlgemado = getElementData(target, "algemado") if (not dataAlgemado) then return outputChatBox("#FF0000ERROR: #FFFFFFEste jogador não está algemado", player, 255, 255, 255, true) end desalgemar(target) end else outputChatBox("#FF0000ERROR: #FFFFFFChegue mais perto do jogador", player, 255, 255, 255, true) end else outputChatBox("#FF0000ERROR: #FFFFFFVocê não pode algemar a si mesmo", player, 255, 255, 255, true) end else outputChatBox("#FF0000ERROR: #FFFFFFDigite /algemar <nick> ou /desalgemar <nick>", player, 255, 255, 255, true) end end end addCommandHandler("algemar", algemar) Link to comment
Jonas^ Posted January 9, 2019 Share Posted January 9, 2019 (edited) 1. Indentação do código esta incorreta. 2. Basta usar a função IsObjectInACLGroup Então o código ficaria desta forma: function algemar(player, command, p) local acc = getPlayerAccount (player) if isObjectInACLGroup ( "user." ..getAccountName(acc), aclGetGroup ("algemar")) then local job = getElementData(player, 'ocupacao') or "Nenhum" if (job == "Policial") then if p then local target = getPlayerFromName(p) or getPlayerFromPartialName(p) if target and target ~= player then local px, py, pz = getElementPosition(player) local tx, ty, tz = getElementPosition(target) if getDistanceBetweenPoints3D(px, py, pz, tx, ty, tz) < 4 then if command == "algemar" then setElementData(target,"algemado",true) triggerClientEvent("algemaAdd", target) triggerClientEvent(target,"onClientPlayerAlgemado",resourceRoot,20000) setElementFrozen(target, true) setPedAnimation(player, "GANG", "prtial_gngtlkA", false, false) setTimer(function() setPedAnimation(player, false) end, 3000, 1, player, source) timer[target] = setTimer(desalgemar, 20000, 1, target) elseif command == "desalgemar" then local dataAlgemado = getElementData(target, "algemado") if (not dataAlgemado) then return outputChatBox("#FF0000ERROR: #FFFFFFEste jogador não está algemado", player, 255, 255, 255, true) end desalgemar(target) end else outputChatBox("#FF0000ERROR: #FFFFFFChegue mais perto do jogador", player, 255, 255, 255, true) end else outputChatBox("#FF0000ERROR: #FFFFFFVocê não pode algemar a si mesmo", player, 255, 255, 255, true) end else outputChatBox("#FF0000ERROR: #FFFFFFDigite /algemar <nick> ou /desalgemar <nick>", player, 255, 255, 255, true) end end else outputChatBox("#FF0000ERROR: #FFFFFFVocê não esta na ACL 'algemar'", player, 255, 255, 255, true) end end addCommandHandler("algemar", algemar) Edited January 9, 2019 by OverKILL Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now