Jump to content

Painel de corporaçoes bugando


Recommended Posts

Bom eu eu não sei oque ouve mais tipo assim

Eu coloquei um painel pra 2 corps

 

Um pra - BOPE outro pra - PMRJ

 

O da bope ta normal

 

Mais agora o da PMRJ - Quando clico em viatura 1 e viatura 2 spawna a vtr da bope junto com a vtr da pm ja a segunda opçao helicoptero da pm junto com o caveirao




Se alguem souber resolver

Codigo server.Lua do painel da PMRJ

 

function showPanel(thePlayer)
  accountname = getAccountName(getPlayerAccount(thePlayer))
  if isObjectInACLGroup("user." .. accountname, aclGetGroup("PMRJ")) then
    triggerClientEvent(thePlayer, "STOP", getRootElement())
   else
  end
end
function onResStart()
  for index, player in ipairs(getElementsByType("player")) do
    bindKey(player, "i", "down", showPanel)
  end
end
addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), onResStart)
function onPlayerJoin()
  bindKey(source, "i", "down", showPanel)
end
addEventHandler("onPlayerJoin", getRootElement(), onPlayerJoin)
function cleanAll(player)
  for index, player in ipairs(getElementsByType("player")) do
    unbindKey(player, "i", "down", showPanel)
  end
end
addEventHandler("onResourceStop", getResourceRootElement(getThisResource()), cleanAll)

veh = {}
function criarxx()
    if veh[source] and isElement( veh[source] ) then destroyElement( veh[source] ) 
 veh[source] = nil 
 end
    local x,y,z = getElementPosition(source)
    veh[source] = createVehicle(597, x,y,z + 2)
 warpPedIntoVehicle (source,veh[source])
 outputChatBox ("", source, 255, 255, 255, true)
end
addEvent("carrop1",true)
addEventHandler("carrop1",root,criarxx)

function criarxx()
    if veh[source] and isElement( veh[source] ) then destroyElement( veh[source] ) 
 veh[source] = nil 
 end
    local x,y,z = getElementPosition(source)
    veh[source] = createVehicle(497, x,y,z + 2)
 warpPedIntoVehicle (source,veh[source])
 outputChatBox ("", source, 255, 255, 255, true)
end
addEvent("carrop2",true)
addEventHandler("carrop2",root,criarxx)

function arm ()
	giveWeapon(source, 2, 2000)
	giveWeapon(source, 23, 2000)
	giveWeapon(source, 26, 2000)
	giveWeapon(source, 28, 2000)
	giveWeapon(source, 31, 2000)
	giveWeapon(source, 34, 2000)
	giveWeapon(source, 46, 2000)
outputChatBox ("", source, 255, 255, 255, true)
end
addEvent("arma",true)
addEventHandler ( "arma", getRootElement(), arm )



 

function skin ()
     setPedSkin ( source, 282 )
outputChatBox ("", source, 255, 255, 255, true)
end
addEvent("skinns1",true)
addEventHandler ( "skinns1", getRootElement(), skin )

function skin ()
     setPedSkin ( source, 200 )
outputChatBox ("", source, 255, 255, 255, true)
end
addEvent("skinns2",true)
addEventHandler ( "skinns2", getRootElement(), skin )

function vidacolete ()
setElementHealth(source, 100)
outputChatBox ("", source, 255, 255, 255, true)
end
addEvent( "vidacolete", true )
addEventHandler( "vidacolete", root, vidacolete )
-------------------------------------------------
function vidacolete ()
setPedArmor(source, 100)
outputChatBox ("", source, 255, 255, 255, true)
end
addEvent( "vidacolete", true )
addEventHandler( "vidacolete", root, vidacolete )

function habilidades ()
setPedStat(source, 69, 1000)
setPedStat(source, 70, 1000)
setPedStat(source, 71, 1000)
setPedStat(source, 72, 1000)
setPedStat(source, 73, 1000)
setPedStat(source, 74, 1000)
setPedStat(source, 75, 1000)
setPedStat(source, 76, 1000)
setPedStat(source, 77, 1000)
setPedStat(source, 78, 1000)
setPedStat(source, 79, 1000)
outputChatBox ("", source, 255, 255, 255, true)
end
addEvent("habilidades", true)
addEventHandler("habilidades", root, habilidades )

function destrui ()
destroyElement ( veh[source] )
outputChatBox ("", source, 255, 255, 255, true)
end
addEvent ("destroi", true)
addEventHandler ("destroi", getRootElement(), destrui)

 

 

 

 

 

Codigo Server.Lua do painel bope

 

 

 



function showPanel(thePlayer)
  accountname = getAccountName(getPlayerAccount(thePlayer))
  if isObjectInACLGroup("user." .. accountname, aclGetGroup("BOPE")) then
    triggerClientEvent(thePlayer, "PRF", getRootElement())
   else
  end
end
function onResStart()
  for index, player in ipairs(getElementsByType("player")) do
    bindKey(player, "i", "down", showPanel)
  end
end
addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), onResStart)
function onPlayerJoin()
  bindKey(source, "i", "down", showPanel)
end
addEventHandler("onPlayerJoin", getRootElement(), onPlayerJoin)
function cleanAll(player)
  for index, player in ipairs(getElementsByType("player")) do
    unbindKey(player, "i", "down", showPanel)
  end
end
addEventHandler("onResourceStop", getResourceRootElement(getThisResource()), cleanAll)

veh = {}
function criarxx()
    if veh[source] and isElement( veh[source] ) then destroyElement( veh[source] ) 
 veh[source] = nil 
 end
    local x,y,z = getElementPosition(source)
    veh[source] = createVehicle(490, x,y,z + 2)
 warpPedIntoVehicle (source,veh[source])
end
addEvent("carrop",true)
addEventHandler("carrop",root,criarxx)


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


function criarxx2()
    if veh[source] and isElement( veh[source] ) then destroyElement( veh[source] ) 
 veh[source] = nil 
 end
    local x,y,z = getElementPosition(source)
    veh[source] = createVehicle(427, x,y,z + 2)
 warpPedIntoVehicle (source,veh[source])
end
addEvent("carrop2",true)
addEventHandler("carrop2",root,criarxx2)


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


function arm ()
	giveWeapon(source, 2, 2000)
	giveWeapon(source, 23, 2000)
	giveWeapon(source, 26, 2000)
	giveWeapon(source, 28, 2000)
	giveWeapon(source, 31, 2000)
	giveWeapon(source, 34, 2000)
	giveWeapon(source, 46, 2000)
end
addEvent("arma",true)
addEventHandler ( "arma", getRootElement(), arm )


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

function skin ()
     setPedSkin ( source, 283 )
end
addEvent("skinns",true)
addEventHandler ( "skinns", getRootElement(), skin )

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


function skin2 ()
     setPedSkin ( source, 285 )
end
addEvent("skinns2",true)
addEventHandler ( "skinns2", getRootElement(), skin2 )


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


function destrui ()
destroyElement ( veh[source] )
end
addEvent ("destroi", true)
addEventHandler ("destroi", getRootElement(), destrui)


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


function life ()
setElementHealth (source, 100)
outputChatBox ("", source, 255,255,255, true)
	 end
addEvent("vida",true)
addEventHandler ( "vida", getRootElement(), life )



function col ()
setPedArmor (source, 100)
outputChatBox ("", source, 255,255,255, true)
	 end
addEvent("colete",true)
addEventHandler ( "colete", getRootElement(), col )


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


function baseft ()
setElementPosition (source, -2943.176, -1437.046, 14.511)

end
addEvent ("baseft", true)
addEventHandler ("baseft", getRootElement(), baseft)

 

Edited by SkillZNT
Link to comment

Isso ocorre pelo fato de os dois painéis estarem com o mesmo nome evento, ou seja, um exemplo :

       - [ PAINEL BOPE ]

  • triggerServerEvent("carrop1") -- Client
  • addEvent("carrop1",true) -- Server
  • addEventHandler("carrop1",root,criarxx) -- Server

       - [ PAINEL PMERJ ]

  • triggerServerEvent("carrop1")  -- Client
  • addEvent("carrop1",true) -- Server
  • addEventHandler("carrop1",root,criarxx) -- Server

-- SOLUÇÃO :

Em ambos existe o mesmo nome no evento nos painéis, para resolver isso, você precisa muda-los os nomes dos eventos, ou seja...

 

       - [ PAINEL BOPE ]

client

      triggerServerEvent("BOPE_pegar_viatura_bope") 

server : 

  • addEvent("BOPE_pegar_viatura_bope",true)
  • addEventHandler("BOPE_pegar_viatura_bope",root,criarxx)

 

       - [ PAINEL PMERJ ]

client

      triggerServerEvent("PMERJ_pegar_viatura_pmerj") 

server

  • addEvent("PMERJ_pegar_viatura_pmerj",true)
  • addEventHandler("PMERJ_pegar_viatura_pmerj",root,criarxx)

 

Espero que consiga entender com esse mini exemplo, ou aguarde alguém mais experiente, para da uma melhor explicação !

Edited by Angelo Pereira
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...