Jump to content

Recommended Posts

Posted

Eu tava fazendo um painel que quando a pessoa clicava no botão tocava musica so que começou a bugar então resolvir pedir ajudar aqui ja que você se mt pro em programação


Script:

function showPanellr(thePlayer)
  accountname = getAccountName(getPlayerAccount(thePlayer))
  if isObjectInACLGroup("user." .. accountname, aclGetGroup("surpresa")) then ---So Mude  "PCC" Grupo que vai poder abrir o painel !
    triggerClientEvent(thePlayer, "painelrota", getRootElement())
  end
end
function onResStartlr()
  for index, player in ipairs(getElementsByType("player")) do
    bindKey(player, "k", "down", showPanellr)------"K" Botao Para Abrir O Painel
  end
end
addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), onResStartlr)
function onPlayerJoinlr()
  bindKey(source, "k", "down", showPanellr)------"K" Botao Para Abrir O Painel
end
addEventHandler("onPlayerJoin", getRootElement(), onPlayerJoinlr)
function cleanAlllr(player)
  for index, player in ipairs(getElementsByType("player")) do
    unbindKey(player, "k", "down", showPanellr)------"K" Botao Para Abrir O Painel
  end
end
addEventHandler("onResourceStop", getResourceRootElement(getThisResource()), cleanAlllr)

veh = {}
function playTheSound()
  soundinside = playSound3D("natal.mp3", source, 255, 255, 255,true)
  setElementInterior(soundinside, 2)
  setElementDimension(soundinside, 5)
  setSoundVolume(soundinside, 1)
  setSoundMinDistance(soundinside, 17)
  setSoundMaxDistance(soundinside, 100)
  soundout = playSound3D("natal.mp3", source, 255, 255, 255,true)
  setSoundVolume(soundout, 1)
  setSoundMinDistance(soundout, 17)
  setSoundMaxDistance(soundout, 100)
end

Erro:

WARNING: [managers]\PainelSurpresa\server.lua:3: Bad argument @ 'isObjectInACLGroup' [Expected acl-group at argument 2, got boolean]

 

Posted

1. Indente o código para ficar mais legível e fácil de entender o que cada parte faz, leia esse artigo na wikipedia: Sobre Indentação

Então ficaria assim:

local veh = {}

function showPanellr (thePlayer)
	local acc = getPlayerAccount (thePlayer)
	if isObjectInACLGroup ( "user." ..getAccountName(acc), aclGetGroup ("surpresa")) then
		triggerClientEvent(thePlayer, "painelrota", getRootElement())
	end
end

function onResStartlr ()
	for index, player in ipairs(getElementsByType("player")) do
		bindKey(player, "k", "down", showPanellr)------"K" Botao Para Abrir O Painel
	end
end
addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), onResStartlr)

function onPlayerJoinlr ()
	bindKey(source, "k", "down", showPanellr)------"K" Botao Para Abrir O Painel
end
addEventHandler("onPlayerJoin", getRootElement(), onPlayerJoinlr)

function cleanAlllr (player)
	for index, player in ipairs(getElementsByType("player")) do
		unbindKey(player, "k", "down", showPanellr)------"K" Botao Para Abrir O Painel
	end
end
addEventHandler("onResourceStop", getResourceRootElement(getThisResource()), cleanAlllr)

function playTheSound ()
	soundinside = playSound3D("natal.mp3", source, 255, 255, 255,true)
	setElementInterior(soundinside, 2)
	setElementDimension(soundinside, 5)
	setSoundVolume(soundinside, 1)
	setSoundMinDistance(soundinside, 17)
	setSoundMaxDistance(soundinside, 100)
	soundout = playSound3D("natal.mp3", source, 255, 255, 255,true)
	setSoundVolume(soundout, 1)
	setSoundMinDistance(soundout, 17)
	setSoundMaxDistance(soundout, 100) 
end

2. Crie a ACL 'surpresa' na sua ACL pelo painel P, ou pela ACL mesmo.

  • Like 1
Posted (edited)

Uma parte do código deve ser no lado client, esta aqui:

veh = {}
function playTheSound()
  soundinside = playSound3D("natal.mp3", source, 255, 255, 255,true)
  setElementInterior(soundinside, 2)
  setElementDimension(soundinside, 5)
  setSoundVolume(soundinside, 1)
  setSoundMinDistance(soundinside, 17)
  setSoundMaxDistance(soundinside, 100)
  soundout = playSound3D("natal.mp3", source, 255, 255, 255,true)
  setSoundVolume(soundout, 1)
  setSoundMinDistance(soundout, 17)
  setSoundMaxDistance(soundout, 100)
end

 

Edited by DNL291

Please do not PM me with scripting related question nor support, use the forums instead.

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...