MisterQuestions Posted June 4, 2014 Posted June 4, 2014 (edited) Hi...I have ~Ppl//Login, So i need when a player login, change his nick to his accountname, ej: Nick:1234ffa, User account:HiMan! Then change nick to: HiMan, (Useraccount, setNick) Edited June 5, 2014 by Guest "El conocimiento jamás debe detenerse, por que es lo único que nos salvará cuando no nos quede más". Att: -|TG|-Mister[Q]<.
Max+ Posted June 5, 2014 Posted June 5, 2014 (edited) Use These , setPlayerName getAccountName Edited June 5, 2014 by Guest - New , Kill System - New, GameMode Intro - Leve / Exp System - New nametag showing style - New , Hud For Players - Skin Selection from SA-MP - Money System / Buy Weapons - Drop Weapons - New, Flood System - New , Group Assign - Gun license For Weapons - Random Rule System For Money
Den. Posted June 5, 2014 Posted June 5, 2014 addEventHandler("onPlayerLogin", root, function(_, account) local name = getAccountName(account) setPlayerName(source, name) end)
xXMADEXx Posted June 5, 2014 Posted June 5, 2014 Use These , SetPlayerName GetAccountName Remember, Lua is case sensitive. getPlayerName getAccountName The Ultimate Lua Tutorial! | MTA PHP SDK
MisterQuestions Posted June 5, 2014 Author Posted June 5, 2014 I tried addEventHandler("onPlayerLogin", root, function(_, account) local name = getAccountName(account) setPlayerName(source, name) end) but doesn´t work. "El conocimiento jamás debe detenerse, por que es lo único que nos salvará cuando no nos quede más". Att: -|TG|-Mister[Q]<.
MisterQuestions Posted June 5, 2014 Author Posted June 5, 2014 ----------Login---------- addEvent("Don't", true) addEventHandler("Don't", root, function (mensaje) kickPlayer(source, mensaje) end ) function PlayerLogin(username,password,checksave) if not (username == "") then if not (password == "") then local account = getAccount ( username, password ) if ( account ~= false ) then logIn(source, account, password) triggerClientEvent (source,"hideLoginWindow",getRootElement()) if checksave == true then triggerClientEvent(source,"saveLoginToXML",getRootElement(),username,password) else triggerClientEvent(source,"resetSaveXML",getRootElement(),username,password) end else triggerClientEvent(source,"set_warning_text",getRootElement(),"Login","Wrong username and/or password") end else triggerClientEvent(source,"set_warning_text",getRootElement(),"Login","Please enter your password!") end else triggerClientEvent(source,"set_warning_text",getRootElement(),"Login","Please enter your username!") end end addEvent("onRequestLogin",true) addEventHandler("onRequestLogin",getRootElement(),PlayerLogin) function registerPlayer(username,password,passwordConfirm) if not (username == "") then if not (password == "") then if not (passwordConfirm == "") then if password == passwordConfirm then local account = getAccount (username,password) if (account == false) then local accountAdded = addAccount(tostring(username),tostring(password)) if (accountAdded) then outputChatBox ("[username: #5c0d0d" .. username .. " #5c0d0d| Password: #5c0d0d" .. password .. "#5c0d0d ]",source,255,255,255,true ) --outputChatBox ("#ff9e00Login Panel by:#ff9e00-ffw-#6600CCRandom*",source,255,255,255,true ) else triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","Error! Please try again with new username or password!") end else triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","This username already taken!") end else triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","The passwords does not match!") end else triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","Please confirm your password!") end else triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","Please enter yout password!") end else triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","Please enter your username!") end end addEvent("onRequestRegister",true) addEventHandler("onRequestRegister",getRootElement(),registerPlayer) addEventHandler("onPlayerLogin", root, function() triggerClientEvent("addNotification", getRootElement(), getPlayerName(source).." has logged in!",1) --outputChatBox(getPlayerName(source).." has logged in!", root) end ) --------Set Nick--------- addEventHandler("onPlayerLogin", root, function(_, account) local name = getAccountName(account) setPlayerName(source, name) end) That is Server.lua of loginpanel. "El conocimiento jamás debe detenerse, por que es lo único que nos salvará cuando no nos quede más". Att: -|TG|-Mister[Q]<.
Max+ Posted June 5, 2014 Posted June 5, 2014 Here Test This , addEventHandler ( 'onPlayerLogin', root, function ( _, theCurrentAccount ) local acc = getAccountName(theCurrentAccount) setPlayerName ( source, acc ) end ) function nickChangeHandler() cancelEvent() end addEventHandler("onPlayerChangeNick", root, nickChangeHandler) - New , Kill System - New, GameMode Intro - Leve / Exp System - New nametag showing style - New , Hud For Players - Skin Selection from SA-MP - Money System / Buy Weapons - Drop Weapons - New, Flood System - New , Group Assign - Gun license For Weapons - Random Rule System For Money
MisterQuestions Posted June 5, 2014 Author Posted June 5, 2014 Amazing!!!!!!, Work Thanks Thanks!, so, now, how to do, players cant change nick? "El conocimiento jamás debe detenerse, por que es lo único que nos salvará cuando no nos quede más". Att: -|TG|-Mister[Q]<.
Max+ Posted June 5, 2014 Posted June 5, 2014 Amazing!!!!!!, Work Thanks Thanks!, so, now, how to do, players cant change nick? your , welcome , and about Change Nick they alredy there they Can't Change it , - New , Kill System - New, GameMode Intro - Leve / Exp System - New nametag showing style - New , Hud For Players - Skin Selection from SA-MP - Money System / Buy Weapons - Drop Weapons - New, Flood System - New , Group Assign - Gun license For Weapons - Random Rule System For Money
MisterQuestions Posted June 5, 2014 Author Posted June 5, 2014 Ooo thanks!! If you want you can visit server -ffw- race thanks so..can you help me whit another script?? "El conocimiento jamás debe detenerse, por que es lo único que nos salvará cuando no nos quede más". Att: -|TG|-Mister[Q]<.
Max+ Posted June 5, 2014 Posted June 5, 2014 MayBe, you Can Connect Me , Private - Msg - New , Kill System - New, GameMode Intro - Leve / Exp System - New nametag showing style - New , Hud For Players - Skin Selection from SA-MP - Money System / Buy Weapons - Drop Weapons - New, Flood System - New , Group Assign - Gun license For Weapons - Random Rule System For Money
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