Sami_~> Posted September 21, 2017 Share Posted September 21, 2017 does there is any code to remove admin name fro nick Example: player has kept his nick to AdminKalom And it changes to Kalom . Thanks..... Link to comment
xFFrozen Posted September 21, 2017 Share Posted September 21, 2017 addEventHandler('onPlayerChangeNick',getRootElement(),function(oldnick,newnick) local newnick2=string.lower(newnick) local containadmin=string.find(newnick2,'admin') if containadmin == nil then else cancelEvent() outputChatBox('your name contains "admin" wich is not allowed',source) end end) here.. this script dosnt change the name by removing the 'admin'-tag, but it'l show a chatBox and cancel the Event if someone tries to change a name wich contains 'admin' Link to comment
Sami_~> Posted September 21, 2017 Author Share Posted September 21, 2017 thanks but the players are quit the and re join as adminkalom in this way the players are adding admin tag. Link to comment
xFFrozen Posted September 21, 2017 Share Posted September 21, 2017 than check the name when they join your server there isnt a other way I think Link to comment
Sami_~> Posted September 22, 2017 Author Share Posted September 22, 2017 thanks for your support. Link to comment
Sami_~> Posted September 22, 2017 Author Share Posted September 22, 2017 this is the code but it is not working: function loginPlayer ( ) local name = getPlayerName ( source ) if ( string.find(name,"admin")) then (change to your preference) kickPlayer (source,"Remove the admin Tag") end end addEventHandler ( "onPlayerJoin", root, loginPlayer ) -----addEventHandler ( "onPlayerChangeNick", root, loginPlayer ) addEventHandler ( 'onPlayerChangeNick',root, function ( _,Nick ) if string.find ( Nick,'admin' ) then kickPlayer ( source,root,'admin Tag is banned, please remove it' ) end end ) Link to comment
Rockyz Posted September 22, 2017 Share Posted September 22, 2017 (edited) try this : function playerName ( nick, nick1 ) local plrName = ( eventName == 'onPlayerConnect' and nick or ( eventName == 'onPlayerChangeNick' and nick1 ) ) local plrName = plrName:lower ( ); if ( plrName:find 'admin' ) then local plr = ( eventName == 'onPlayerConnect' and getPlayerFromName ( plrName ) or ( eventName == 'onPlayerChangeNick' and source ) ) kickPlayer ( plr, 'admin Tag is banned, please remove it' ) end end function playerName1 ( ) for _, player in ipairs ( getElementsByType 'player' ) do if ( getPlayerName ( player ):lower ( ):find 'admin' ) then kickPlayer ( player, 'admin Tag is banned, please remove it' ) end end end addEventHandler ( 'onPlayerConnect', root, playerName ) addEventHandler ( 'onPlayerChangeNick', root, playerName ) addEventHandler ( 'onResourceStart', resourceRoot, playerName1 ) Edited September 22, 2017 by #,+( _xiRoc[K]; > Link to comment
Sami_~> Posted September 23, 2017 Author Share Posted September 23, 2017 (edited) working thank you soo much.. Edited September 23, 2017 by Sami_~> 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