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 )