Jump to content

Script (PAINEL - TAG)


Recommended Posts

 PMESPTAG = aclCreateGroup ( "Dono PMESP" )
 PMESP = aclCreateGroup ( "PMESP" )
 PAINEL = aclCreateGroup ( "ComandosPolicia" )

 function tagPM(thePlayer)
	login = getAccountName(getPlayerAccount(thePlayer))
	if isObjectInACLGroup("user."..login, aclGetGroup("Dono PMESP")) then
		triggerClientEvent(thePlayer, "PMESPtag", getRootElement())
		else

	end
end
addCommandHandler ("tagpm", tagPM)

--------------------------------

function addPMESP (jogador)
local gett = getTeamName(getPlayerTeam(jogador))
if isGuestAccount(getPlayerAccount(jogador)) then
outputChatBox ("#FF0000[#0000FFErro ]#FFFFFFEsse jogador não está logado", source, 255,255,255, true)
else
if gett == false then
    aclGroupAddObject (aclGetGroup("PMESP"), "user."..getAccountName(getPlayerAccount(jogador)))
	outputChatBox ("#FF0000[SPR]#FFFFFFVocê adicionou o jogador " ..getPlayerName(jogador).." ao grupo da #0000FF PMESP", source, 255,255,255, true)
	outputChatBox ("#FF0000[SPR]#FFFFFFVocê ganhou Tag da #0000FF PMESP", jogador, 255,255,255, true)
	else
	outputChatBox ("#FF0000[SPR]#FFFFFFO jogador já está com Tag", source, 255,255,255, true)
end
end
end
addEvent ("addPMESP", true)
addEventHandler ("addPMESP", getRootElement(), addPMESP)
----------------

function removePMESP (jogador)
local conta = getAccountName ( getPlayerAccount ( jogador ) )
if isGuestAccount(getPlayerAccount(jogador)) then
return
outputChatBox ("#FF0000[SPR]#FFFFFFO jogador não está logado", source, 255,255,255, true)
end
    if isObjectInACLGroup ("user."..conta, aclGetGroup ( "PMESP" ) ) then
          aclGroupRemoveObject (aclGetGroup("PMESP"), "user."..getAccountName(getPlayerAccount(jogador)))
	      outputChatBox ("#FF0000[SPR]#FFFFFFVocê removeu o jogador "..getPlayerName(jogador).." do grupo da #0000FF PMESP", source, 255,255,255, true)
    else
	      outputChatBox ("#FF0000[SPR]#FFFFFFO jogador não está com Tag", source, 255,255,255, true)
	end
end
addEvent ("removePMESP", true)
addEventHandler ("removePMESP", getRootElement(), removePMESP)

-------------------

function addpainel (jogador)
local gett = getTeamName(getPlayerTeam(jogador))
if isGuestAccount(getPlayerAccount(jogador)) then
outputChatBox ("#FF0000[#0000FFErro ]#FFFFFFEsse jogador não está logado", source, 255,255,255, true)
else
if gett == false then
    aclGroupAddObject (aclGetGroup("ComandosPolicia"), "user."..getAccountName(getPlayerAccount(jogador)))
	outputChatBox ("#FF0000[SPR]#FFFFFFVocê deu ao jogador " ..getPlayerName(jogador).." acesso ao #0000FF Painel de Polícia", source, 255,255,255, true)
	outputChatBox ("#FF0000[SPR]#FFFFFFVocê ganhou acesso ao #0000FFPainel de Polícia", jogador, 255,255,255, true)
	else
	outputChatBox ("#FF0000[SPR]#FFFFFFO jogador já está com Painel", source, 255,255,255, true)
end
end
end
addEvent ("addpainel", true)
addEventHandler ("addpainel", getRootElement(), addpainel)

----------

function removepainel (jogador)
local conta = getAccountName ( getPlayerAccount ( jogador ) )
if isGuestAccount(getPlayerAccount(jogador)) then
return
outputChatBox ("#FF0000[SPR]#FFFFFFO jogador não está logado", source, 255,255,255, true)
end
    if isObjectInACLGroup ("user."..conta, aclGetGroup ( "ComandosPolicia" ) ) then
          aclGroupRemoveObject (aclGetGroup("ComandosPolicia"), "user."..getAccountName(getPlayerAccount(jogador)))
	      outputChatBox ("#FF0000[SPR]#FFFFFFVocê removeu o #0000FF Painel de Polícia  #FFFFFF do jogador "..getPlayerName(jogador).." ", source, 255,255,255, true)
    else
	      outputChatBox ("#FF0000[SPR]#FFFFFFO jogador não tem Painel", source, 255,255,255, true)
	end
end
addEvent ("removepainel", true)
addEventHandler ("removepainel", getRootElement(), removepainel)

aqui!!!

 

na hora que vou trocar os Nomes Simplesmente não, ja tentei troca so as tags mas buga, fica colocando nas tags anteriores ....

sou novo com script se alguem conseguir me ajudar agradeço!

2 minutes ago, LT_WOLF said:

local screenW,screenH = guiGetScreenSize()
local resW, resH = 1365,767
local x, y =  (screenW/resW), (screenH/resH)

gridlist = guiCreateGridList(x*529, y*264, x*160, y*260, false)
coluna = guiGridListAddColumn(gridlist, "Players", 0.9)
guiSetVisible(gridlist, false)

painelPMESP = false
function PMESPtag ()
        dxDrawRectangle(x*514, y*171, x*381, y*400, tocolor(0, 0, 0, 225), false)
        dxDrawRectangle(x*514, y*170, x*341, y*42, tocolor(36, 35, 35, 255), false)
        dxDrawText("PMESP", x*515, y*171, x*855, y*212, tocolor(241, 0, 0, 255), x*1.0, "bankgothic", "center", "center", false, false, false, false, false)
        dxDrawText("Selecione o player", x*527, y*244, x*689, y*266, tocolor(255, 255, 255, 255), x*1.00, "default", "center", "bottom", false, false, false, false, false)
        dxDrawRectangle(x*855, y*170, x*40, y*42, tocolor(0, 0, 0, 255), false)
        dxDrawText("X", x*855, y*171, x*895, y*212, tocolor(255, 255, 255, 255), x*2.00, "clear", "center", "center", false, false, false, false, false)
		
        dxDrawRectangle(x*699, y*266, x*186, y*34, tocolor(36, 35, 35, 255), false)
        dxDrawText("Adicionar TAG", x*699, y*266, x*885, y*300, tocolor(241, 0, 0, 255), x*1.30, "default-bold", "center", "center", false, false, false, false, false)

        dxDrawRectangle(x*699, y*310, x*186, y*34, tocolor(36, 35, 35, 255), false)
        dxDrawText("Remover TAG", x*689, y*310, x*885, y*344, tocolor(241, 0, 0, 255), x*1.30, "default-bold", "center", "center", false, false, false, false, false)

        dxDrawRectangle(x*699, y*354, x*186, y*34, tocolor(36, 35, 35, 255), false)
        dxDrawText("Adicionar Painel", x*699, y*354, x*885, y*388, tocolor(241, 0, 0, 255), x*1.30, "default-bold", "center", "center", false, false, false, false, false)
		
        dxDrawRectangle(x*699, y*402, x*186, y*34, tocolor(36, 35, 35, 255), false)
        dxDrawText("Remover Painel", x*699, y*402, x*885, y*436, tocolor(241, 0, 0, 255), x*1.30, "default-bold", "center", "center", false, false, false, false, false)

        dxDrawText("2020 - [SPR] São Paulo Roleplay", x*524, y*548, x*885, y*565, tocolor(255, 255, 255, 255), x*1.00, "default", "center", "top", false, false, false, false, false)
    end

function abrir ()
    if painelPMESP == false then
    addEventHandler ("onClientRender", root, PMESPtag)
    painelPMESP = true
    showCursor (true)
    guiSetVisible(gridlist, true)
    else
    if painelPMESP == true then
    removeEventHandler ("onClientRender", root, PMESPtag)
    guiSetVisible(gridlist, false)
    painelPMESP = false
    showCursor (false)
    end
    end
    end
addEvent ("PMESPtag",true) 
addEventHandler ("PMESPtag",root,abrir)
    
function X ()
    if painelPMESP == true then
       if ( isCursorOnElement (x*855, y*170, x*40, y*42) ) then
           removeEventHandler("onClientRender", root, PMESPtag)
           guiSetVisible(gridlist, false)
           showCursor (false)
           painelPMESP = false
               end
               end
               end
addEventHandler ("onClientClick", root, X)

function Actualizar()
guiGridListClear(gridlist)
for index, player in ipairs(getElementsByType("player")) do
 FILA = guiGridListAddRow(gridlist)
 guiGridListSetItemText ( gridlist, FILA, coluna, (string.gsub ( getPlayerName(player), '#%x%x%x%x%x%x', '' ) or getPlayerName(player)), false, false)
 guiGridListSetItemData ( gridlist, FILA, coluna, getPlayerName(player))
end
end
addEventHandler("onClientPlayerJoin", getRootElement(), Actualizar)
addEventHandler("onClientPlayerQuit", getRootElement(), Actualizar)
addEventHandler("onClientPlayerChangeNick", getRootElement(), Actualizar)
addEventHandler ("onClientResourceStart",getRootElement(), Actualizar)

function pegarnick ()
if source == gridlist then
    local nomeplayer = guiGridListGetItemData(gridlist, guiGridListGetSelectedItem(gridlist), 1)
    local jogadorx = getPlayerFromName(nomeplayer)
    jogador = jogadorx
   end
end
addEventHandler ("onClientResourceStart", getRootElement(), pegarnick)
addEventHandler ("onClientGUIClick", gridlist, pegarnick, false)
addEventHandler("onClientPlayerJoin", getRootElement(), pegarnick)
addEventHandler("onClientPlayerQuit", getRootElement(), pegarnick)
addEventHandler("onClientPlayerChangeNick", getRootElement(), pegarnick)

function addPMESP (_,state)
  if painelPMESP == true then
    if state == "down" then
      if isCursorOnElement (x*699, y*266, x*186, y*34) then
       triggerServerEvent ("addPMESP", getLocalPlayer(), jogador)
    end
 end
end
end
addEventHandler ("onClientClick", root, addPMESP)


function removePMESP (_,state)
  if painelPMESP == true then
    if state == "down" then
      if isCursorOnElement (x*699, y*310, x*186, y*34) then
       triggerServerEvent ("removePMESP", getLocalPlayer(), jogador)
    end
 end
end
end
addEventHandler ("onClientClick", root, removePMESP)


function addpainel (_,state)
  if painelPMESP == true then
    if state == "down" then
      if isCursorOnElement (x*699, y*354, x*186, y*34) then
       triggerServerEvent ("addpainel", getLocalPlayer(), jogador)
    end
 end
end
end
addEventHandler ("onClientClick", root, addpainel)

function removepainel (_,state)
  if painelPMESP == true then
    if state == "down" then
      if isCursorOnElement (x*699, y*402, x*186, y*34) then
       triggerServerEvent ("removepainel", getLocalPlayer(), jogador)
    end
 end
end
end
addEventHandler ("onClientClick", root, removepainel)



function isCursorOnElement(x,y,w,h)
 local mx,my = getCursorPosition ()
 local fullx,fully = guiGetScreenSize()
 cursorx,cursory = mx*fullx,my*fully
 if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then
  return true
 else
  return false
 end
end

esse é o client!

 

Edited by LT_WOLF
Link to comment
  • Other Languages Moderators

No server-side, troque sua função tagPM por essa:

function tagPM (thePlayer)
	local login = getAccountName (getPlayerAccount (thePlayer))
	if isObjectInACLGroup ("user."..login, aclGetGroup ("Dono PMESP")) then
		triggerClientEvent (thePlayer, "PMESPtag", thePlayer)
	else
		outputChatBox ("Acesso negado.", thePlayer, 255, 0, 0)
	end
end
addCommandHandler ("tagpm", tagPM)

E apague as 4 primeiras linhas do server-side, pois não estão sendo usadas.

No client-side, troque a função Abrir, por essa:

function abrir ()
	if painelPMESP then
		removeEventHandler ("onClientRender", root, PMESPtagg)
		guiSetVisible (gridlist, false)
		showCursor (false)
	else
		addEventHandler ("onClientRender", root, PMESPtagg)
		showCursor (true)
		guiSetVisible(gridlist, true)
	end
	painelPMESP = not painelPMESP
end
addEvent ("PMESPtag", true) 
addEventHandler ("PMESPtag", root, abrir)

E na função PMESPtag, adicione mais um g no nome dela pra ficar PMESPtagg pois o nome da função está em conflito com o evento "PMESPtag".

  • Like 1
Link to comment

consegui, obrigado pela ajuda..

 

Aproveitando a oportunidade, estou com um painel de gang, porem não consigo utilizar ele, eu coloco o ID do player mas n da pra clicar nos botões... 

 

são 3 Script vou mandar!

Client

local screenW, screenH = guiGetScreenSize()
local x, y = (screenW/1366), (screenH/768)


local dxfont0_icons = dxCreateFont("font/icons.ttf", 10)
local dxfont1_icons = dxCreateFont("font/icons.ttf", 12)

local ID = createElement("dxEditBox_IDDoJogadorRev")
painel = false


--[[
         ><><><><><><><><><><><><><><><><><><><><
         ><          Painel Inicial            ><
         ><><><><><><><><><><><><><><><><><><><><
--]]

function painelgang ()
        exports["Blur"]:dxDrawBluredRectangle(screenW * 0.6552, screenH * 0.3216, screenW * 0.1757, screenH * 0.3086, tocolor(255, 255, 255, 230))	
         dxDrawRectangle(screenW * 0.6552, screenH * 0.3216, screenW * 0.1757, screenH * 0.3086, tocolor(0, 0, 0, 168), false)
        dxDrawRectangle(screenW * 0.6552, screenH * 0.3216, screenW * 0.1757, screenH * 0.0365, tocolor(0, 0, 0, 168), false)
        dxDrawLine(screenW * 0.6552, screenH * 0.3568, screenW * 0.8302, screenH * 0.3568, tocolor(0, 221, 15, 254), 3, false)
        dxDrawText("ID do jogador :", screenW * 0.6625, screenH * 0.3698, screenW * 0.7328, screenH * 0.3932, tocolor(255, 255, 255, 255), 1.00, dxfont0_icons, "left", "top", false, false, false, false, false)
        dxDrawText("Painel De Gang", screenW * 0.7013, screenH * 0.3229, screenW * 0.7884, screenH * 0.3464, tocolor(255, 255, 255, 255), 1.00, dxfont1_icons, "left", "top", false, false, false, false, false)
        dxDrawRectangle(screenW * 0.6552, screenH * 0.4063, screenW * 0.1757, screenH * 0.0365, CorAmarrar, false)
        dxDrawText("Amarrar", screenW * 0.7204, screenH * 0.4076, screenW * 0.7672, screenH * 0.4375, tocolor(255, 255, 255, 255), 1.00, dxfont1_icons, "left", "top", false, false, false, false, false)
        dxDrawRectangle(screenW * 0.6552, screenH * 0.4557, screenW * 0.1757, screenH * 0.0365, CorDesamarrar, false)
        dxDrawText("Desamarrar", screenW * 0.7086, screenH * 0.4583, screenW * 0.7745, screenH * 0.4883, tocolor(255, 255, 255, 255), 1.00, dxfont1_icons, "left", "top", false, false, false, false, false)
        dxDrawRectangle(screenW * 0.6552, screenH * 0.5013, screenW * 0.1757, screenH * 0.0365, CorSaquear, false)
        dxDrawText("Saquear", screenW * 0.7204, screenH * 0.5039, screenW * 0.7650, screenH * 0.5339, tocolor(255, 255, 255, 255), 1.00, dxfont1_icons, "left", "top", false, false, true, false, false)
        dxDrawRectangle(screenW * 0.6552, screenH * 0.5508, screenW * 0.1757, screenH * 0.0365, CorArrastar, false)
        dxDrawText("Arrastar", screenW * 0.7204, screenH * 0.5534, screenW * 0.7650, screenH * 0.5833, tocolor(255, 255, 255, 255), 1.00, dxfont1_icons, "left", "top", false, false, false, false, false)
        dxDrawEditBox("ID", screenW * 0.7328, screenH * 0.3698, screenW * 0.0644, screenH * 0.0234, false, 10, ID)
		
		CorAmarrar = tocolor(0, 0, 0, 170)
		if isCursorOnElement (screenW * 0.6552, screenH * 0.4063, screenW * 0.1757, screenH * 0.0365) then
		CorAmarrar = tocolor(0, 221, 15, 254)
		end
		
		CorDesamarrar = tocolor(0, 0, 0, 170)
		if isCursorOnElement (screenW * 0.6552, screenH * 0.4557, screenW * 0.1757, screenH * 0.0365) then
		CorDesamarrar = tocolor(0, 221, 15, 254)
		end
		
		CorSaquear = tocolor(0, 0, 0, 170)
		if isCursorOnElement (screenW * 0.6552, screenH * 0.5013, screenW * 0.1757, screenH * 0.0365) then
		CorSaquear = tocolor(0, 221, 15, 254)
		end
		
		CorArrastar = tocolor(0, 0, 0, 170)
		if isCursorOnElement (screenW * 0.6552, screenH * 0.5508, screenW * 0.1757, screenH * 0.0365) then
		CorArrastar = tocolor(0, 221, 15, 254)
		end
	
end


--[[
         ><><><><><><><><><><><><><><><><><><><><
         ><      Configurações N Altere        ><
         ><><><><><><><><><><><><><><><><><><><><
--]]

function convertTime(ms) 
    local min = math.floor ( ms/60000 ) 
    local sec = math.floor( (ms/1000)%60 ) 
    return min, sec 
end

function AbrirPainel ()
if painel == false then
  addEventHandler ( "onClientRender", root, painelsamu )
  painel = true
  showCursor ( true )
  playSoundFrontEnd ( 43 )
else
 removeEventHandler ( "onClientRender", root, painelsamu )
  painel = false
  showCursor ( false )
  playSoundFrontEnd ( 43 )
end
end
addEvent ( "TS:AbrirGangster", true)
addEventHandler ( "TS:AbrirGangster", getRootElement(), AbrirPainel )

function Saquear (_,state)
 if painel == true then
 if state == "down" then
   if isCursorOnElement ( screenW * 0.6552, screenH * 0.5013, screenW * 0.1757, screenH * 0.0365 ) then
   	local getID = tonumber(getElementData(ID, "text"))
    if type(getID) == "number" then
    playSoundFrontEnd ( 43 )
	setElementData(ID, "state", false)
	triggerServerEvent( "TS:Saquear", getLocalPlayer(), localPlayer, getID)
  end
  end
  end
  end
  end
addEventHandler ("onClientClick", root, Saquear )

function Amarrar (_,state)
 if painel == true then
 if state == "down" then
   if isCursorOnElement ( screenW * 0.6552, screenH * 0.4063, screenW * 0.1757, screenH * 0.0365 ) then
   	local getID = tonumber(getElementData(ID, "text"))
    if type(getID) == "number" then
    playSoundFrontEnd ( 43 )
	setElementData(ID, "state", false)
	triggerServerEvent( "TS:Amarrar", getLocalPlayer(), localPlayer, getID)
  end
  end
  end
  end
  end
addEventHandler ("onClientClick", root, Amarrar )

function Desamarrar (_,state)
 if painel == true then
 if state == "down" then
   if isCursorOnElement ( screenW * 0.6552, screenH * 0.4557, screenW * 0.1757, screenH * 0.0365 ) then
   	local getID = tonumber(getElementData(ID, "text"))
    if type(getID) == "number" then
    playSoundFrontEnd ( 43 )
	setElementData(ID, "state", false)

	triggerServerEvent( "TS:Desamarrar", getLocalPlayer(), localPlayer, getID)
  end
  end
  end
  end
  end
addEventHandler ("onClientClick", root, Desamarrar )

function Arrastar (_,state)
 if painel == true then
 if state == "down" then
   if isCursorOnElement ( screenW * 0.6552, screenH * 0.5508, screenW * 0.1757, screenH * 0.0365 ) then
   	local getID = tonumber(getElementData(ID, "text"))
    if type(getID) == "number" then
    playSoundFrontEnd ( 43 )
	setElementData(ID, "state", false)
	triggerServerEvent( "TS:Arrastar", getLocalPlayer(), localPlayer, getID)
  end
  end
  end
  end
  end
addEventHandler ("onClientClick", root, Arrastar )

function Edit1 (_,state)
 if painel == true then
  if state == "down" then
   if isCursorOnElement ( screenW * 0.7328, screenH * 0.3698, screenW * 0.0644, screenH * 0.0234 ) then
	setElementData(ID, "state", true)

  end
  end
  end
 end
addEventHandler ("onClientClick", root, Edit1 )

function isCursorOnElement ( x, y, w, h )
local mx, my = getCursorPosition ()
 local fullx, fully = guiGetScreenSize ()
  cursorx, cursory = mx*fullx, my*fully
   if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then
    return true
   else
  return false
 end
end

 

Edit

 

BindPainel = "n" -------- Coloque a bind entre as ""

ACL = "Gang" -------- Coloque a acl entre as ""

PorcentagemAssalto = 7
TempoParaSerAssaltado = 10 --( Em Minutos )

 

 

server

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

function AbrirPainelServer (source)
 login = getAccountName(getPlayerAccount(source))
  if isObjectInACLGroup("user."..login, aclGetGroup(ACL)) then
    triggerClientEvent(source, "TS:AbrirGangster", getRootElement())
  end
end

function BindRestartScript ()
	for index, player in ipairs(getElementsByType("player")) do
		bindKey ( player, BindPainel, "down", AbrirPainelServer )
	end
end
addEventHandler( "onResourceStart", getResourceRootElement(getThisResource()), BindRestartScript )

function BindEntrarServidor ()
	bindKey(source, BindPainel, "down", AbrirPainelServer )
end
addEventHandler( "onPlayerJoin", getRootElement(), BindEntrarServidor )

function UnBindDesligarScript (player)
	for index, player in ipairs(getElementsByType("player")) do
		unbindKey(player, BindPainel, "down", AbrirPainelServer )
	end
end
addEventHandler( "onResourceStop", getResourceRootElement(getThisResource()), UnBindDesligarScript )

function Saquear (source, getID)
local Jogador = getPlayerID(getID)
if not isElement(Jogador) then
triggerClientEvent(source, "addNotification", root, "#0037FF✘#ffffffINFO#0037FF✘➺ #ffffffJogador não encontrado!")
else
local nick_do_jogador = getPlayerName ( Jogador )
local nick_do_assaltante = getPlayerName ( source )
local jX, jY, jZ = getElementPosition (Jogador) 
local pX, pY, pZ = getElementPosition (source)
local dist = getDistanceBetweenPoints3D ( pX, pY, pZ, jX, jY, jZ)	
local SaqueadoP = getElementData(Jogador, "saqueado")
local MoneyJogador = getPlayerMoney(Jogador)
local MoneyAssalto = PorcentagemAssalto/100 * MoneyJogador
local Verificar = getElementData ( Jogador, "amarrado" ) or false
if Verificar == false then
triggerClientEvent(Jogador, "addNotification", root, "#0037FF✘#ffffffINFO#0037FF✘➺#ffffff #ffffffO jogador não esta amarrado", "info")
else
if SaqueadoP == true then		
triggerClientEvent(Jogador, "addNotification", root, "#0037FF✘#ffffffINFO#0037FF✘➺#ffffff #ffffffO jogador ja foi saqueado recentemente", "info")
else	
if dist <= 5 then
setElementData(Jogador,"saqueado", true )
triggerClientEvent(Jogador, "addNotification", root, "#0037FF✘#ffffffINFO#0037FF✘➺#ffffff #ffffff Você foi saqueado pelo assaltante "..nick_do_assaltante, "info")
triggerClientEvent(source, "addNotification", root, "#0037FF✘#ffffffINFO#0037FF✘➺#ffffff #ffffff Você saqueou Jogador "..nick_do_jogador.." com sucesso!", "info")
givePlayerMoney(source, MoneyAssalto)
takePlayerMoney(Jogador, MoneyAssalto)
setTimer(function()
setElementData(Jogador, "saqueado", false)
end, TempoParaSerAssaltado*60000, 1)
else
triggerClientEvent(source, "addNotification", root, "#0037FF✘#ffffffINFO#0037FF✘➺#ffffff #ffffffVocê esta Muito longe do Jogador!", "info")
end
end
end
end
end
addEvent ( "TS:Saquear", true)
addEventHandler ( "TS:Saquear", getRootElement(), Saquear )

function Amarrar (source, getID)
local Jogador = getPlayerID(getID)
if not isElement(Jogador) then
triggerClientEvent(source, "addNotification", root, "#0037FF✘#ffffffINFO#0037FF✘➺ #ffffffJogador não encontrado!")
else
local nick_do_jogador = getPlayerName ( Jogador )
local nick_do_assaltante = getPlayerName ( source )
local jX, jY, jZ = getElementPosition (Jogador) 
local pX, pY, pZ = getElementPosition (source)
local dist = getDistanceBetweenPoints3D ( pX, pY, pZ, jX, jY, jZ)
local Verificar = getElementData ( Jogador, "amarrado" ) or false
if Verificar == true then
triggerClientEvent(source, "addNotification", root, "#0037FF✘#ffffffINFO#0037FF✘➺#ffffff #ffffff Este jogador ja esta amarrado.", "info")
else				
if dist <= 5 then
setElementData(Jogador,"amarrado", true )
setElementFrozen( Jogador, true )
toggleControl(Jogador, "fire", false)
setPedAnimation( Jogador, "GRAVEYARD", "mrnM_loop", -1, true, false, false, false)
triggerClientEvent(Jogador, "addNotification", root, "#0037FF✘#ffffffINFO#0037FF✘➺#ffffff #ffffff Você foi amarrado pelo assaltante "..nick_do_assaltante, "info")
triggerClientEvent(source, "addNotification", root, "#0037FF✘#ffffffINFO#0037FF✘➺#ffffff #ffffff Você amarrou o Jogador "..nick_do_jogador.." com sucesso!", "info")
else
triggerClientEvent(source, "addNotification", root, "#0037FF✘#ffffffINFO#0037FF✘➺#ffffff #ffffffVocê esta Muito longe do Jogador!", "info")
end
end
end
end
addEvent ( "TS:Amarrar", true)
addEventHandler ( "TS:Amarrar", getRootElement(), Amarrar )

function Desamarrar (source, getID)
local Jogador = getPlayerID(getID)
if not isElement(Jogador) then
triggerClientEvent(source, "addNotification", root, "#0037FF✘#ffffffINFO#0037FF✘➺ #ffffffJogador não encontrado!")
else
local nick_do_jogador = getPlayerName ( Jogador )
local nick_do_assaltante = getPlayerName ( source )
local jX, jY, jZ = getElementPosition (Jogador) 
local pX, pY, pZ = getElementPosition (source)
local dist = getDistanceBetweenPoints3D ( pX, pY, pZ, jX, jY, jZ)
local Verificar = getElementData ( Jogador, "amarrado" ) or false
if Verificar == false then
triggerClientEvent(source, "addNotification", root, "#0037FF✘#ffffffINFO#0037FF✘➺#ffffff #ffffff Este jogador ja esta desamarrado.", "info")
else				
if dist <= 5 then
setElementData(Jogador,"amarrado", false )
setElementFrozen( Jogador, false )
toggleControl(Jogador, "fire", true)
setPedAnimation( Jogador, nil)
triggerClientEvent(Jogador, "addNotification", root, "#0037FF✘#ffffffINFO#0037FF✘➺#ffffff #ffffff Você foi desamarrado pelo assaltante "..nick_do_assaltante, "info")
triggerClientEvent(source, "addNotification", root, "#0037FF✘#ffffffINFO#0037FF✘➺#ffffff #ffffff Você desamarrou o Jogador "..nick_do_jogador.." com sucesso!", "info")
else
triggerClientEvent(source, "addNotification", root, "#0037FF✘#ffffffINFO#0037FF✘➺#ffffff #ffffffVocê esta Muito longe do Jogador!", "info")
end
end
end
end
addEvent ( "TS:Desamarrar", true)
addEventHandler ( "TS:Desamarrar", getRootElement(), Desamarrar )

function Arrastar (source, getID)
local Jogador = getPlayerID(getID)
if not isElement(Jogador) then
triggerClientEvent(source, "addNotification", root, "#0037FF✘#ffffffINFO#0037FF✘➺ #ffffffJogador não encontrado!")
else
local nick_do_jogador = getPlayerName ( Jogador )
local nick_do_assaltante = getPlayerName ( source )
local jX, jY, jZ = getElementPosition (Jogador) 
local pX, pY, pZ = getElementPosition (source)
local dist = getDistanceBetweenPoints3D ( pX, pY, pZ, jX, jY, jZ)	
local Verificar = getElementData ( Jogador, "amarrado" ) or false
local x, y, z = getElementPosition ( source )
local Int = getElementInterior ( source )
if Verificar == false then		
triggerClientEvent(source, "addNotification", root, "#0037FF✘#ffffffINFO#0037FF✘➺#ffffff #ffffffO jogador não testa amarrado", "info")
else
if dist <= 5 then
removePedFromVehicle(Jogador)
setElementPosition(Jogador, x, y, z)
setElementInterior(Jogador, Int)
setPedAnimation( Jogador, "GRAVEYARD", "mrnM_loop", -1, true, false, false, false)
triggerClientEvent(Jogador, "addNotification", root, "#0037FF✘#ffffffINFO#0037FF✘➺#ffffff #ffffff Você foi arrastado pelo assaltante "..nick_do_assaltante, "info")
triggerClientEvent(source, "addNotification", root, "#0037FF✘#ffffffINFO#0037FF✘➺#ffffff #ffffff Você arrastou o Jogador "..nick_do_jogador.." com sucesso!", "info")
else
triggerClientEvent(source, "addNotification", root, "#0037FF✘#ffffffINFO#0037FF✘➺#ffffff #ffffffVocê esta Muito longe do Jogador!", "info")
end
end
end
end
addEvent ( "TS:Arrastar", true)
addEventHandler ( "TS:Arrastar", getRootElement(), Arrastar )

 

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...