Fist Posted March 28, 2016 Share Posted March 28, 2016 Hello! How i could find player name in gridlist when he changes name and update's it with the new name in gridlist? i tried this but didnt work, it gave me errors that he gets boolen or user data i tried to use tostring() also getPlayerName(), didnt work either. client code: function updatePlayerList(oldNick,newNick) if string.find(oldNick,gridlistPlayers1) then guiGridListSetItemText(gridlistPlayers1, 0, string.find(oldNick,gridlistPlayers1), newNick, false, false) end end addEvent("updatePlayerList",true) addEventHandler("updatePlayerList",root,updatePlayerList) server code: function updatePlayerListOnNickChange(oldNick,newNick) triggerClientEvent(source,"updatePlayerList",source,oldNick,newNick) end addEventHandler("onPlayerChangeNick",root,updatePlayerListOnNickChange) Link to comment
pro-mos Posted March 28, 2016 Share Posted March 28, 2016 whats the line number that has error, post the full error please Link to comment
Fist Posted March 28, 2016 Author Share Posted March 28, 2016 whats the line number that has error, post the full error please its wroten in topic, error is that he gets userdata or boolen, even tough i convert oldNick and newNick to string or to playerName anyway here is image its 3th line in client side script. Link to comment
pro-mos Posted March 28, 2016 Share Posted March 28, 2016 this is strange, i guess its caused because you passed source then oldNick then newNick to updatePlayer function, here: triggerClientEvent(source,"updatePlayerList",source,oldNick,newNick) try this: triggerClientEvent(source,"updatePlayerList",oldNick,newNick, source) Link to comment
Fist Posted March 28, 2016 Author Share Posted March 28, 2016 yep now no errors, but still it doesnt work what i wanted to. It doesnt update player list at all, i never used string.find before, maybe could you help me with that? Link to comment
pro-mos Posted March 28, 2016 Share Posted March 28, 2016 i dont think string.find is the function you wanna use, it returns the number where the string starts and ends example: string.find("i will say YES", "will") -- returns >> 3 6 http://www.lua.org/pil/20.1.html Link to comment
Fist Posted March 28, 2016 Author Share Posted March 28, 2016 i dont think string.find is the function you wanna use, it returns the number where the string starts and endsexample: string.find("i will say YES", "will") -- returns >> 3 6 http://www.lua.org/pil/20.1.html no i needed to use it, i just made it work with my friends help, he explained me how it works. and btw your code what u gave me about triggering client event, was wrong either. So please learn first by your self scripting before helping others. 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