Jump to content

Event not added client-side?


Recommended Posts

Hey guys i got a weird problem, i cant trigger an event Client-Side, it says its not added, but it is!

Script_S:

  
function SetPlayerTeam(prev, acc, auto) 
  
OnlineTable[source] = source 
local acc = getPlayerAccount(source) 
if getAccountData(acc, "Played") ~= false then 
outputChatBox(" Player "..string.gsub(getPlayerName(source), "#%x%x%x%x%x%x", "").. " Logged in", getRootElement(), TextColour.R, TextColour.G, TextColour.B)    
triggerClientEvent("onClientPlayerLogin", getRootElement(), source) 
  

And Script_C:

  
  
function OnPlayerLogin(player) 
if player == getLocalPlayer() then 
executeCommandHandler("gui23456") 
end 
end 
addEvent("onClientPlayerLogin", true) 
addEventHandler("onClientPlayerLogin", getRootElement(), OnPlayerLogin) 

Link to comment
  
function SetPlayerTeam(prev, acc, auto) 
  
OnlineTable[source] = source 
local acc = getPlayerAccount(source) 
if getAccountData(acc, "Played") ~= false then 
outputChatBox(" Player "..string.gsub(getPlayerName(source), "#%x%x%x%x%x%x", "").. " Logged in", getRootElement(), TextColour.R, TextColour.G, TextColour.B)   
if player == client then 
executeCommandHandler("gui23456") 
end 
end 
end  
  

Link to comment
  
function SetPlayerTeam(prev, acc, auto) 
  
OnlineTable[source] = source 
local acc = getPlayerAccount(source) 
if getAccountData(acc, "Played") ~= false then 
outputChatBox(" Player "..string.gsub(getPlayerName(source), "#%x%x%x%x%x%x", "").. " Logged in", getRootElement(), TextColour.R, TextColour.G, TextColour.B)   
if player == client then 
executeCommandHandler("gui23456") 
end 
end 
end  
  

It was a cut part of the code, not needed to add ends or stuff.

I highly recommend using indentation as the code is nearly unreadable right now.

It's the forum's lua code thingy, its width is too shor and lines down alot of stuff, i have everything in one line, so its okay for me :/

Link to comment
  
function SetPlayerTeam(prev, acc, auto) 
  
OnlineTable[source] = source 
local acc = getPlayerAccount(source) 
if getAccountData(acc, "Played") ~= false then 
outputChatBox(" Player "..string.gsub(getPlayerName(source), "#%x%x%x%x%x%x", "").. " Logged in", getRootElement(), TextColour.R, TextColour.G, TextColour.B)   
if player == client then 
executeCommandHandler("gui23456") 
end 
end 
end  
  

if player == client then

What is that? and executeCommandHandler server-side has a player argument.

@Hypex: Forums have no problem with indentation.

Link to comment
  
function SetPlayerTeam(prev, acc, auto) 
  
OnlineTable[source] = source 
local acc = getPlayerAccount(source) 
if getAccountData(acc, "Played") ~= false then 
outputChatBox(" Player "..string.gsub(getPlayerName(source), "#%x%x%x%x%x%x", "").. " Logged in", getRootElement(), TextColour.R, TextColour.G, TextColour.B)   
if player == client then 
executeCommandHandler("gui23456") 
end 
end 
end  
  

if player == client then

What is that? and executeCommandHandler server-side has a player argument.

He mixed my client side with my server side.. didnt even paid attention.

@Topic: Fixed this by sendind to root element and player as arg 1.

Client Side = if Player == getLocalPlayer()

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