Jump to content

remove admin from nick.


Sami_~>

Recommended Posts

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

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

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 by #,+( _xiRoc[K]; >
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...