Sande Posted June 17, 2013 Share Posted June 17, 2013 Can someone make this code work, im starter and i dont know how make it work. Thaanks. addEventHandler ( "onClientPlayerChangeNick", root, function ( oldNick, newNick ) nickData = "* " .. oldNick .. " is now known as " .. newNick .. "." exports["drawData"]:outputDraw ( nickData, 255, 100, 100, false ) end ) addEventHandler ( "onClientPlayerJoin", root, function ( thePlayer ) onlineData = "* " .. Online Players: .. getElementsByType('player')) .. "." exports["drawData"]:outputDraw ( onlineData, 255, 100, 100, false ) end ) addEventHandler ( "onClientPlayerQuit", root, function ( thePlayer ) onlineData = "* " .. Online Players: .. getElementsByType('player')) .. "." exports["drawData"]:outputDraw ( onlineData, 255, 100, 100, false ) end ) Link to comment
iPrestege Posted June 17, 2013 Share Posted June 17, 2013 addEventHandler ( "onClientPlayerChangeNick", root, function ( oldNick, newNick ) local nickData = "* " .. oldNick .. " is now known as " .. newNick .. "." exports["drawData"]:outputDraw ( nickData, 255, 100, 100, false ) end ) addEventHandler ( "onClientPlayerJoin", root, function ( ) local onlineData = "* Online Players: "..#getElementsByType( "player" ) .. "." exports["drawData"]:outputDraw ( onlineData, 255, 100, 100, false ) end ) addEventHandler ( "onClientPlayerQuit", root, function ( ) local onlineData = "* Online Players: "..#getElementsByType( "player" ) .. "." exports["drawData"]:outputDraw ( onlineData, 255, 100, 100, false ) end ) Try this client side . Link to comment
Sande Posted June 17, 2013 Author Share Posted June 17, 2013 Working, thanks , can you tell how i can make like: Player Sande logged in, and logget out? Link to comment
iPrestege Posted June 17, 2013 Share Posted June 17, 2013 Event's : onPlayerLogin onPlayerLogout Function : triggerClientEvent Link to comment
GTX Posted June 17, 2013 Share Posted June 17, 2013 Server: addEventHandler("onPlayerLogin", root, function() triggerClientEvent("loginDraw", source) end ) addEventHandler("onPlayerLogout", root, function() triggerClientEvent("logoutDraw", source) end ) Client: addEvent("loginDraw", true) addEventHandler("loginDraw", root, function() local data = getPlayerName(source).." has logged in!" exports["drawData"]:outputDraw(data, 255, 100, 100, false) end ) addEvent("logoutDraw", true) addEventHandler("logoutDraw", root, function() local data = getPlayerName(source).." has logged out!" exports["drawData"]:outputDraw(data, 255, 100, 100, false) end ) Link to comment
iPrestege Posted June 17, 2013 Share Posted June 17, 2013 Server: addEventHandler("onPlayerLogin", root, function() triggerClientEvent("loginDraw", source) end ) addEventHandler("onPlayerLogout", root, function() triggerClientEvent("logoutDraw", source) end ) Client: addEvent("loginDraw", true) addEventHandler("loginDraw", root, function() local data = getPlayerName(source).." has logged in!" exports["drawData"]:outputDraw(data, 255, 100, 100, false) end ) addEvent("logoutDraw", true) addEventHandler("logoutDraw", root, function() local data = getPlayerName(source).." has logged out!" exports["drawData"]:outputDraw(data, 255, 100, 100, false) end ) bool triggerClientEvent ( [element sendTo=getRootElement()], string name, element theElement, [arguments...] ) Link to comment
GTX Posted June 17, 2013 Share Posted June 17, 2013 Server: addEventHandler("onPlayerLogin", root, function() triggerClientEvent("loginDraw", source) end ) addEventHandler("onPlayerLogout", root, function() triggerClientEvent("logoutDraw", source) end ) Client: addEvent("loginDraw", true) addEventHandler("loginDraw", root, function() local data = getPlayerName(source).." has logged in!" exports["drawData"]:outputDraw(data, 255, 100, 100, false) end ) addEvent("logoutDraw", true) addEventHandler("logoutDraw", root, function() local data = getPlayerName(source).." has logged out!" exports["drawData"]:outputDraw(data, 255, 100, 100, false) end ) bool triggerClientEvent ( [element sendTo=getRootElement()], string name, element theElement, [arguments...] ) What? "sendTo" argument is optional. And I'm sure he wants to show text to all players. Link to comment
iPrestege Posted June 17, 2013 Share Posted June 17, 2013 (edited) Server: addEventHandler("onPlayerLogin", root, function() triggerClientEvent("loginDraw", source) end ) addEventHandler("onPlayerLogout", root, function() triggerClientEvent("logoutDraw", source) end ) Client: addEvent("loginDraw", true) addEventHandler("loginDraw", root, function() local data = getPlayerName(source).." has logged in!" exports["drawData"]:outputDraw(data, 255, 100, 100, false) end ) addEvent("logoutDraw", true) addEventHandler("logoutDraw", root, function() local data = getPlayerName(source).." has logged out!" exports["drawData"]:outputDraw(data, 255, 100, 100, false) end ) bool triggerClientEvent ( [element sendTo=getRootElement()], string name, element theElement, [arguments...] ) What? "sendTo" argument is optional. And I'm sure he wants to show text to all players. Yes because that if you don't set the first argument to source it will be set to root automatically. P.S : Sorry i was thinking he want it to the player only. Edited June 17, 2013 by Guest Link to comment
GTX Posted June 17, 2013 Share Posted June 17, 2013 If you set source, it will be sent only to player who has logged in. Root will send to everyone. I'm sure he wants to send text to all players, not only one. Link to comment
PaiN^ Posted June 18, 2013 Share Posted June 18, 2013 change source to root Don't put any thing and it will automatically be root . Link to comment
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