Jump to content

[Problema]triggerClientEvent


Narutimmy

Recommended Posts

Posted

Holal o que pasa es que estoy trabajando en un vip en base al panel frerom, ase un tiempo me ayudo asus, el problema, es que ayer lo edite para que no sea por acl, solo user.... despues de horas funciono, el problema es que el debug me tira error de que el evento no a sido agregado al cliente, segun lei en el foro el problema es que el server lo carga antes que al cliento algo asi... como lo solociono?

sv:

  --Server. 
  function Test(player) 
 if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(player)), aclGetGroup ( "VIP" ) ) then 
  triggerClientEvent ( player, "Panel", player) 
   
  else 
  outputChatBox("Acceso denegado", player, 255, 0, 0) 
  end 
  end 

cl:

addEvent ("Panel", true) 
function AbrePanel(player) 
--abre o cierra el panel. 
toggleFRWindow() 
end 
addEventHandler( "Panel", getRootElement(), AbrePanel ) 

mtasa://66.85.14.178:22003

350x20_FFFFFF_FFFFFF_000000_000000.png

Ts3: thezombiworld.com:7777

350x20_FFFFFF_FFFFFF_000000_000000.png

Posted

Server

function showPanel(thePlayer) 
     local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) -- get his account name 
     if isObjectInACLGroup ("user."..accName, aclGetGroup ( "VIP" ) ) then 
        triggerClientEvent(thePlayer, "Panel", getRootElement()) 
    else 
        outputChatBox ("Acesso Negado", thePlayer, 193, 13, 13) 
    end 
end 
addCommandHandler("ELCOMANDO", showPanel) 

Client

addEvent("Panel",true) 
function openWindow6() 
  
end 
addEventHandler("Panel", getRootElement(), openWindow6) 

Visita Full GameZ DayZ Mod

Server IP: mtasa://158.69.125.144:29015

Posted
Server
function showPanel(thePlayer) 
     local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) -- get his account name 
     if isObjectInACLGroup ("user."..accName, aclGetGroup ( "VIP" ) ) then 
        triggerClientEvent(thePlayer, "Panel", getRootElement()) 
    else 
        outputChatBox ("Acesso Negado", thePlayer, 193, 13, 13) 
    end 
end 
addCommandHandler("ELCOMANDO", showPanel) 

Client

addEvent("Panel",true) 
function openWindow6() 
  
end 
addEventHandler("Panel", getRootElement(), openWindow6) 

Me tira el mismo problema, ademas como estaba es con el F1, me olvide poner eso, no ocupa comando... el problema es que dice que el evento "Panel" no esta agregado en el cliente.

mtasa://66.85.14.178:22003

350x20_FFFFFF_FFFFFF_000000_000000.png

Ts3: thezombiworld.com:7777

350x20_FFFFFF_FFFFFF_000000_000000.png

Posted
Creo que te falta el getRootElement
triggerClientEvent ( player, "Panel", getRootElement(), player) 

Mismo error :/

644504_535081956543610_1764107883_n.jpg

mtasa://66.85.14.178:22003

350x20_FFFFFF_FFFFFF_000000_000000.png

Ts3: thezombiworld.com:7777

350x20_FFFFFF_FFFFFF_000000_000000.png

Posted
function Test(thePlayer) 
     local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) 
     if isObjectInACLGroup ("user."..accName, aclGetGroup ( "VIP" ) ) then 
        triggerClientEvent(thePlayer, "Panel", getRootElement()) 
    else 
        outputChatBox ("Acesso Negado", thePlayer, 193, 13, 13) 
end 
end 
  

remplaza

Visita Full GameZ DayZ Mod

Server IP: mtasa://158.69.125.144:29015

Posted
function Test(thePlayer) 
     local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) 
     if isObjectInACLGroup ("user."..accName, aclGetGroup ( "VIP" ) ) then 
        triggerClientEvent(thePlayer, "Panel", getRootElement()) 
    else 
        outputChatBox ("Acesso Negado", thePlayer, 193, 13, 13) 
end 
end 
  

remplaza

el problema es que dice que el event "Panel" no esta agregado pero si lo esta :/, ya remplaze pero mismo error

mtasa://66.85.14.178:22003

350x20_FFFFFF_FFFFFF_000000_000000.png

Ts3: thezombiworld.com:7777

350x20_FFFFFF_FFFFFF_000000_000000.png

Posted

Y si le agregas a lo primero de todo esto?

addEventHandler("onClientResourceStart", root, 
function () 
end 
) 

State: Inactive

Posted

Estas seguro de que no hay ningun error en el script client side? y que esta en el archivo meta.xml?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
A ver... lo que ocurre probablemente es que se triggea en algun momento antes de estar descargado en el cliente.

justo eso lei.... me estuve leyendo como 4 horas todos los temas que encontre en el forum :I

mtasa://66.85.14.178:22003

350x20_FFFFFF_FFFFFF_000000_000000.png

Ts3: thezombiworld.com:7777

350x20_FFFFFF_FFFFFF_000000_000000.png

Posted
Estas seguro de que no hay ningun error en el script client side? y que esta en el archivo meta.xml?

es el mismo que el del panel frerom , intente poniendo el client antes que el server, segun lei eso en un tema pero nada :/

mtasa://66.85.14.178:22003

350x20_FFFFFF_FFFFFF_000000_000000.png

Ts3: thezombiworld.com:7777

350x20_FFFFFF_FFFFFF_000000_000000.png

Posted
Y si le agregas a lo primero de todo esto?
addEventHandler("onClientResourceStart", root, 
function () 
end 
) 

la funcion no es al iniciar, es al precionar F1, pero esos esta en otra parte del codigo son unas pocas lineas.

mtasa://66.85.14.178:22003

350x20_FFFFFF_FFFFFF_000000_000000.png

Ts3: thezombiworld.com:7777

350x20_FFFFFF_FFFFFF_000000_000000.png

Posted
You can treat this function as if it was an asynchronous function call, using triggerServerEvent to pass back any returned information if necessary.

Según yo, tengo entendido que tienes que agregar toda función server a un evento para tener a la función asincrónica:

Server

... 
addEvent( "tests", true ) 
addEventHandler( "tests", getRootElement(), showpanel) 

Client

... 
addCommandHandler("ELCOMANDO", 
function () 
    triggerServerEvent ( "tests", getRootElement() ) 
end ) 

Progreso: ∞

76561198084458455.png

  • Recently Browsing   0 members

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