Jump to content

how to disable short nicks.


killingyasoon

Recommended Posts

Posted
"onPlayerConnect"
-- To get length of letters  in name use # Ex. #getPlayerName(player)
getPlayerName -- if was less than 3 letters then cancelEvent

 

Experienced MTA developer for 4 years. | MTA خبرة 4 سنين في برمجة

ليس عليك اسعاد الجميع ,
ولكن عليك بإن لا تؤذي أحداً 

=========
You do not have to make everyone happy,
But you should not hurt anyone

 

Want to contact with me?

 

Discord: JustCarry#2616 (Always there)
Skype: Live:JustCarry10 (Not always)

Posted
// SERVER

function nickHandler( playerNick )
	if ( playerNick and ( #playerNick <= 3 ) ) then
    	// DO SOMETHING
     	cancelEvent() // KICK
    end
end

addEventHandler( 'onPlayerConnect', root, nickHandler )

 

  • Thanks 2

"Keep making it simplex."

Posted
19 hours ago, Simple01 said:

// SERVER

function nickHandler( playerNick )
	if ( playerNick and ( #playerNick <= 3 ) ) then
    	// DO SOMETHING
     	cancelEvent() // KICK
    end
end

addEventHandler( 'onPlayerConnect', root, nickHandler )

 

there're no errors but still doesn't work.

Posted (edited)
function nickHandler(playerNick) 
  if (playerNick) and string.len(playerNick) <3 then
    cancelEvent() 
  end
end 
addEventHandler("onPlayerConnect", root, nickHandler) 

 

Edited by Dimos7

 

 

Posted
On 02/09/2018 at 05:25, Simple01 said:

// SERVER

function nickHandler( playerNick )
	if ( playerNick and ( #playerNick <= 3 ) ) then
    	// DO SOMETHING
     	cancelEvent() // KICK
    end
end

addEventHandler( 'onPlayerConnect', root, nickHandler )

 

Way to reinvent how Lua comments are supposed to be.

  • Haha 1

~ This has to be the worst board post I have ever read. It simply makes no sense. You start off by talking about space or something, then you randomly start babbling about cupcakes, and you end off with random fish names.

~ Don't listen to this guy, any board with the categories 'dinosaurs, spaceships, fried foods, wild animals, alien abductions, business casual, robots, and fireworks' has true potential.

 

Posted
2 hours ago, SP3CTR3 said:

Way to reinvent how Lua comments are supposed to be.

Wrote it fast and since I haven't been coding in Lua for a while made those comments in C++.

"Keep making it simplex."

Posted (edited)
function nickHandler(playerNick) 
  if (playerNick) and string.len(playerNick) <=3 then
    cancelEvent(true, "Your nickname is too short for that") 
  end
end 
addEventHandler("onPlayerConnect", root, nickHandler) 

 

Edited by Dimos7

 

 

Posted
2 hours ago, Dimos7 said:

function nickHandler(playerNick) 
  if (playerNick) and string.len(playerNick) <=3 then
    cancelEvent(true, "Your nickname is too short for that") 
  end
end 
addEventHandler("onPlayerConnect", root, nickHandler) 

 

Works totally perfect, thank you bud.

Posted
1 minute ago, killingyasoon said:

btw xd sorry to bother you, can you make it for OnplayerChangeNick too? it's not working for me xd.

no change nick if are less 3 characters ?

 

 

Posted
addEventHandler("onPlayerChangeNick", root, function(oldNick, newNick)
    if string.len(newNick) <= 3 then
          setPlayerName(source,oldNick)
	end
end)

 

turkey_1274.jpg İstikbal göklerdedir.

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...