ruanlima212 Posted October 10, 2019 Posted October 10, 2019 ola, estou desenvolvendo um sistema de garagem ligado com a concessionaria, porem, estou tendo problema na parte de vender os carros, junto ao inventario de carros. ultilizei o debugscript 3 e o seguinte erro aparece: ERROR: [DevMods]\Eagle-Concessionaria\Inventario_C.Lua:188:attempt to call global 'triggerClientEvent' (a nill value). gostaria que me ajuda-sem, pois ja fiz de tudo e nao resolveu. aqui esta o codigo. function Vender_Carro ( _,state ) local id = DGS:dgsGridListGetSelectedItem(Invetario_Car) local NickPlayer = getElementData(Nick_Jogador, "text") local PrecoVeh = tonumber(getElementData(Preco_Car, "text")) if isEventHandlerAdded("onClientRender", getRootElement(), Dx_Vender) then if state == "down" then if isCursorOnElement ( x*693, y*418, x*149, y*40 ) then showCursor(false) removeEventHandler("onClientRender", root, Dx_Vender) end if (id ~= -1) then if isCursorOnElement ( x*525, y*418, x*149, y*40 ) then if (NickPlayer ~= "") then if type(PrecoVeh) == "number" then if PrecoVeh >= 500 then VeiculoName = DGS:dgsGridListGetItemText(Invetario_Car, id, 1) VeiculoID = DGS:dgsGridListGetItemData(Invetario_Car, id, 1) playSoundFrontEnd ( 4 ) showCursor(false) triggerServerEvent("EGL:Vender_Veh", root, localPlayer, NickPlayer, PrecoVeh, VeiculoName, VeiculoID ) removeEventHandler("onClientRender", root, Dx_Vender) else playSoundFrontEnd ( 6 ) triggerClientEvent(localPlayer, "addNotification", root, "[Concessionaria] Valor Minimo e De 2500 Reais!", "info") end else playSoundFrontEnd ( 6 ) triggerClientEvent(localPlayer, "addNotification", root, "[Concessionaria] O Comprador Não Possui Dinheiro Suficiente!", "info") end else playSoundFrontEnd ( 6 ) triggerClientEvent(localPlayer, "addNotification", root, "[Concessionaria] Coloque o Nick da Pessoa que Deseja Você Queira Vender o Veiculo!", "info") end end else triggerClientEvent(localPlayer, "addNotification", root, "[Concessionaria] Nenhum Veiculo Selecionado!", "info") end end end end addEventHandler ( "onClientClick", root, Vender_Carro )
Moderators Lord Henry Posted October 10, 2019 Moderators Posted October 10, 2019 Não se usa triggerClientEvent em um script client-side. Eu te ajudei ou achou meu comentário útil? Não esqueça de deixar um Thanks! Minhas contribuições para a comunidade: LordHenry - MTA Wiki Profile Inscreva-se no meu canal do YouTube: Lord Henry - Entertainment Discord Oficial do MTA: https://mtasa.com/discord Blacklist e Whitelist de Scripters: Planilha Por favor, não me envie mensagens privadas solicitando suporte. Crie um tópico no fórum em vez disso.
ruanlima212 Posted October 10, 2019 Author Posted October 10, 2019 entao como faço pra organiza-lo? por que ja tentei mudar para outras funções e ainda continua dando erro
root. Posted October 11, 2019 Posted October 11, 2019 Você não deve usar a função triggerClientEvent () no lado do cliente. Você deve usar triggerServerEvent () para enviar dados para o servidor e triggerClientEvent () para enviar dados para o cliente. E você deve postar a linha 188, é a que marca erro
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