Panda Posted December 25, 2014 Share Posted December 25, 2014 Hello everyone, Well first of all i tried to do when i open my panel it appears ACC NAME : "My Account name". I really can't do it since i can't use getplayeraccount in Client side so this is a part of my script that is related to acc name thing: account = guiCreateLabel(56, 138, 65, 16, "ACC NAME :", false, GUIEditor.window[1]) guiSetFont(account, "default-bold-small") account1 = guiCreateLabel(127, 128, 160, 32, "", false, GUIEditor.window[1]) In account1, My account name should appear over there. I want it to appear thanks for helping. This is what i tried to do, stupid thing but i have nothing to do: guiSetText(account1,"I want a player's account name appear here.") Thanks everyone. Link to comment
Panda Posted December 25, 2014 Author Share Posted December 25, 2014 What? Why do i need that? I gave u a client side Script not server side.. Link to comment
AJXB Posted December 25, 2014 Share Posted December 25, 2014 Seriously? wow I really didn't notice. (sarcasm) on the server side: getPlayerAccount getAccountName triggerClientEvent Client side: guiSetText Link to comment
Panda Posted December 25, 2014 Author Share Posted December 25, 2014 Yeah ik that , but the problem is idk how to merge it, i mean i tried but it didn't work, can u help me ? thanks mate. Link to comment
AJXB Posted December 25, 2014 Share Posted December 25, 2014 function onJoin () local account = getPlayerAccount (source) local accountName = getAccountName (account) triggerClientEvent ('handleSetGUIText',source,accountName) end If you can write two lines of code, you can complete this. Link to comment
Panda Posted December 25, 2014 Author Share Posted December 25, 2014 Yeah i did that and what about client side ? i should add a new function like this? function hi() guiSetText(account1,"What should i type here?") end addEvent("handleSetGUIText",true) addEventHandler("handleSetGUIText",root,hi) Link to comment
AJXB Posted December 25, 2014 Share Posted December 25, 2014 function handleSetText (accountName) guiSetText (account1,accountName) end addEvent("handleSetGUIText",true) addEventHandler("handleSetGUIText",root,handleSetText ) Link to comment
Panda Posted December 25, 2014 Author Share Posted December 25, 2014 --Client Side. function handleSetText (accountName) guiSetText (account1,accountName) end addEvent("handleSetGUIText",true) addEventHandler("handleSetGUIText",root,handleSetText ) --Server Side. function onJoin () local account = getPlayerAccount (source) local accountName = getAccountName (account) triggerClientEvent ('handleSetGUIText',source,accountName) end Not working bro Link to comment
Panda Posted December 25, 2014 Author Share Posted December 25, 2014 Still need Help, Can anyone answer me? thanks. Link to comment
Panda Posted December 26, 2014 Author Share Posted December 26, 2014 Hellooo! Can anyone answer me? Link to comment
John Smith Posted December 26, 2014 Share Posted December 26, 2014 replace your serverside file with this one function onJoin () local account = getPlayerAccount (source) local accountName = getAccountName (account) triggerClientEvent ('handleSetGUIText',source,source,accountName) end addEventHandler("onPlayerJoin",root,onJoin) Link to comment
Panda Posted December 27, 2014 Author Share Posted December 27, 2014 Nope mate.. It Doesn't work, nothing appear on my panel.. pff. Link to comment
AJXB Posted December 27, 2014 Share Posted December 27, 2014 http://codepad.org/5j6TjHwY I tried to give you a chance to use your brain cells. Just un-comment the guiSetText. Link to comment
Panda Posted December 27, 2014 Author Share Posted December 27, 2014 Mate.. It doesn't work Too D:.. Look at this pic, let me show u! http://i.imgur.com/ZWz19o2.png It doesn't appear! Server Side addEventHandler ('onPlayerLogin',root, function (_, Account) local accountName = getAccountName( Account ) triggerClientEvent ('handleClient',source,accountName) end ) Client Side addEvent ('handleClient',true) addEventHandler ('handleClient',root, function (accountName) if tostring (accountName) then guiSetText (account1,'Your account name is '..accountName) outputChatbox (accountName) end end ) Link to comment
AJXB Posted December 27, 2014 Share Posted December 27, 2014 The text will change once you login.. using /login command Do /debugscript 3 and post the errors here. You can change the server side to: addCommandHandler ("acc", function (p) local account = getPlayerAccount (p) local accountName = getAccountName (account) triggerClientEvent ('handleClient',source,accountName) end ) After you change it, have the GUI opened, and do /acc it should work, if it didn't, post /debugscript 3 Link to comment
Panda Posted December 28, 2014 Author Share Posted December 28, 2014 Nope not working! Error : "WARNING: Test/server.lua:58 Bad Argument @ 'triggerClientEvent'[Expected Element at argument 2, got nil]" Link to comment
Panda Posted December 28, 2014 Author Share Posted December 28, 2014 Oh done! I changed the source with P ;P Thanks mate it's working but now i need to edit something D: i mean i want it to appear when i open the panel not when i press the command Link to comment
Panda Posted December 28, 2014 Author Share Posted December 28, 2014 Yeah ik with events! But Idk which one i already tried but not working ._. Fuck me D:. Link to comment
Panda Posted December 29, 2014 Author Share Posted December 29, 2014 Still need help! Can anyone answer ?thanks. Link to comment
Panda Posted January 2, 2015 Author Share Posted January 2, 2015 Well still waiting for someone to answer me D:. Thanks. Link to comment
Panda Posted January 5, 2015 Author Share Posted January 5, 2015 Come on Guys! ignore power 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