Jump to content

[help] With text for player


kamani

Recommended Posts

Hey everyone :) my problem with text showing for all players of server.. i want set outputchat text to see for one player!

this is script:

SERVER

  
addEvent("Text", true) 
addEventHandler("Text", getRootElement(), 
function() 
triggerClientEvent("SetText",getRootElement(),"blablabla") 
end) 
  

CLIENT

  
addEvent("SetText",true) 
addEventHandler("SetText", getRootElement(), 
function(source) 
outputChatBox("Text for player!",source) 
end) 
  

"Text for player" see all players, i want this text set for player when he click button from gui panel..

Link to comment
  • Moderators

You don't need a triggerClientEvent to show a text for only one player,

In server-side:

outputChatBox( " Text for only one player ", thePlayer ) 
outputChatBox( " Text for all players ") 

In client-side:

outputChatBox( " Text for all players ") -- no need source or something like that 

In client-side, it's always for the player of this client

Link to comment

i set in server-side this:

addEvent("Text", true) 
addEventHandler("Text", getRootElement(), 
function() 
outputChatBox( " Text for only one player ", thePlayer ) 
outputChatBox( " Text for all players ") 
end) 

and now when i click button "Text for only one player" and text "Text for all players" show for all players..

whats wrong?

Link to comment

hi, i have some problem .. i update function of mysql where playername is... , but mysql update function for all players of server. script:

SERVER-SIDE

  
addEvent("blabla", true) 
addEventHandler("blabla", getRootElement(), 
function() 
local Save = "UPDATE players SET Function='1'  WHERE username='" .. getPlayerName (source) .."'" 
mysql_query(sqllogin, Save) 
end) 
  

this function run when i click button of GUI.. this function update Function to 1 by playername, but don't work.. now when i click button of my gui window, this function update Function to 1 for all online players..

Link to comment

I don't understand you, you want to execute that mysql function for all online players?

if so use:

  
addEvent("blabla", true) 
addEventHandler("blabla", getRootElement(), 
function() 
for i,v in pairs(getElementsByType("player")) do 
playername = getPlayerName(v) 
local Save = "UPDATE players SET Function='1'  WHERE username='" .. tostring(playername) .."'" 
mysql_query(sqllogin, Save) 
end 
end) 

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