Jump to content

[HELP] TriggerClientEvent


Death

Recommended Posts

Posted

I am not able to use the trigger

-------------- server

  
resourceRoot = getResourceRootElement() 
function createNew() 
for _, areia in pairs ( radar_table ) do 
pesq = executeSQLQuery("SELECT * FROM `area` WHERE `nome`=?", area.nome ) 
for k, a in ipairs (pesq) do 
triggerClientEvent( "onSetOwner", root, areia.nome, a.owner, areia.preco, areia.x, areia.y, areia.z, a.corR, a.corG, a.corB) 
end 
end 
end 
addEventHandler("onResourceStart", resourceRoot, createNew) 
  

client

  
addEvent("onSetOwner", true) 
  
function lol(name, owner, preco, x, y, z, red, green, blue) 
    outputChatBox(name) 
    outputChatBox(owner) 
    outputChatBox(preco) 
    outputChatBox(x) 
    outputChatBox(y) 
    outputChatBox(z) 
    outputChatBox(red) 
    outputChatBox(green) 
    outputChatBox(blue) 
end 
addEventHandler ( "onSetOwner", root, lol ) 

Posted
Bad argument @ 'triggerClientEvent' [Expected element at argument 2, got nil]

try this

resourceRoot = getResourceRootElement() 
function createNew() 
for _, areia in pairs ( radar_table ) do 
pesq = executeSQLQuery("SELECT * FROM `area` WHERE `nome`=?", area.nome ) 
for k, a in ipairs (pesq) do 
triggerClientEvent( root,"onSetOwner", root, areia.nome, a.owner, areia.preco, areia.x, areia.y, areia.z, a.corR, a.corG, a.corB) 
end 
end 
end 
addEventHandler("onResourceStart", resourceRoot, createNew) 

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

Posted
ERROR : Server triggered clientside event onSetOwner, but event is not added clientside

ok all what you need to do is

-- Client side

addEventHandler("onClientResourceStart",resourceRoot, 
function() 
    triggerServerEvent( "clientReady", resourceRoot ) 
end 
) 

-- Server side

readyPlayerList = {} 
  
addEvent("clientReady", true ) 
addEventHandler("clientReady",resourceRoot, 
function() 
    table.insert( readyPlayerList, client ) 
    createNew() 
end 
) 
  
addEventHandler("onPlayerQuit",root, 
function() 
    table.removevalue( readyPlayerList, source ) 
end 
) 
  
-- Your function 
function createNew() 
for _, areia in pairs ( radar_table ) do 
pesq = executeSQLQuery("SELECT * FROM `area` WHERE `nome`=?", areia.nome ) 
for k, a in ipairs (pesq) do 
triggerClientEvent(readyPlayerList,"onSetOwner",readyPlayerList, areia.nome, a.owner, areia.preco, areia.x, areia.y, areia.z, a.corR, a.corG, a.corB) 
end 
end 
end 
  
  
-- table.removevalue function, in case you don't already have it 
function table.removevalue(t, val) 
    for i,v in ipairs(t) do 
        if v == val then 
            table.remove(t, i) 
            return i 
        end 
    end 
    return false 
end 

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

Posted

not work

[2015-04-21 14:43:11] Warning Bad usage @ 'triggerClientEvent' [ section in the meta.xml is incorrect or missing (expected at least server 1.3.0-9.04570 because a send list is being used)]

Posted

use upgrade all

type upgrade all in your console then click enter

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

Posted

other error :|

[2015-04-21 14:52:03] WARNING: Sistema_BASES\script.lua:35: Bad argument @ 'triggerClientEvent' [Expected element at argument 3, got table]

Posted
other error :|

[2015-04-21 14:52:03] WARNING: Sistema_BASES\script.lua:35: Bad argument @ 'triggerClientEvent' [Expected element at argument 3, got table]

try this

triggerClientEvent(readyPlayerList,"onSetOwner",root, areia.nome, a.owner, areia.preco, areia.x, areia.y, areia.z, a.corR, a.corG, a.corB) 

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

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