Jump to content

[Help]Fake Owner name Kick


Lorder

Recommended Posts

  • Administrators

A simple Google search for 'kick player mtasa' brings up the official wiki as the first result, kickPlayer

There's even an example code right on the same page.

function kickPlayerHandler ( sourcePlayer, commandname, kickedname, reason )
	-- Get player element from the name
	local kicked = getPlayerFromName ( kickedname )
	-- If the client who sent the command has a higher level
	if ( hasObjectPermissionTo ( sourcePlayer, "function.kickPlayer" ) ) then
		-- Kick the player
		kickPlayer ( kicked, sourcePlayer, reason )
	end
end
-- Add the "kick" command handler
addCommandHandler ( "kick", kickPlayerHandler )

Usage: /kick player reason

Link to comment
local OwnerName = "-#ff0000Kinan"
function check()
  	playername = getPlayerName(source)
  	if playername:gsub("#%x%x%x%x%x%x","") == OwnerName:gsub("#%x%x%x%x%x%x","") then
    	kickPlayer(source,"You can't use the Owner's name!")
    end
end
addEventHandler("onPlayerJoin",getRootElement(),check)
addEventHandler("onPlayerChangeNick", getRootElement(), check)

 

Link to comment
2 hours ago, _Kinan said:

local OwnerName = "-#ff0000Kinan"
function check()
  	playername = getPlayerName(source)
  	if playername:gsub("#%x%x%x%x%x%x","") == OwnerName:gsub("#%x%x%x%x%x%x","") then
    	kickPlayer(source,"You can't use the Owner's name!")
    end
end
addEventHandler("onPlayerJoin",getRootElement(),check)
addEventHandler("onPlayerChangeNick", getRootElement(), check)

 

+ onResourceStart 

Link to comment

OR, You can use something like table to protect many nicks e.g

local protected = {
  ["Nickname1"] = "Player 1 Serial",
  ["Nickname2"] = "Player 2 Serial"
}

function checkForNickname()
  local name = getPlayerName(source)
  if protected[name] then
   local serial = getPlayerSerial(source)
      if serial ~= protected[name] then
      	kickPlayer(source, "Nickname is protected!")
      end
   end
end
addEventHandler("onPlayerJoin", root, checkForNickname)
addEventHandler("onPlayerChangeNick", root, checkforNickname)

Still didn't test it tho, should work

Link to comment
local OwnerName = "Name"
function check()
  	playername = getPlayerName(source)
  	if playername:gsub("#%x%x%x%x%x%x","") == OwnerName:gsub("#%x%x%x%x%x%x","") then
    	kickPlayer(source,"You can't use the Owner's name!")
    end
end
addEventHandler("onPlayerJoin",getRootElement(),check)
addEventHandler("onPlayerChangeNick", getRootElement(), check)

 

2 hours ago, _Kinan said:

@Om. have made a better one. use his not mine....

Do I do the right thing?

Link to comment
local OwnerName = "Name" -- Change "Name" to your name ( DONT Remove the ")

I suggest you using this code instead :
 

local protected = {
  ["Nickname1"] = "Player 1 Serial", -- Change Nickname1, don't remove the " ! and then Change your Player 1 Serial to your serial
  ["Nickname2"] = "Player 2 Serial",
}

function checkForNickname()
  local name = getPlayerName(source)
  if protected[name] then
   local serial = getPlayerSerial(source)
      if serial ~= protected[name] then
      	kickPlayer(source, "Nickname is protected!")
      end
   end
end
addEventHandler("onPlayerJoin", root, checkForNickname)
addEventHandler("onPlayerChangeNick", root, checkforNickname)

made by @Om.

to get your serial type /serial and press F8 And copy it

Link to comment
55 minutes ago, _Kinan said:

local OwnerName = "Name" -- Change "Name" to your name ( DONT Remove the ")

I suggest you using this code instead :
 


local protected = {
  ["Nickname1"] = "Player 1 Serial", -- Change Nickname1, don't remove the " ! and then Change your Player 1 Serial to your serial
  ["Nickname2"] = "Player 2 Serial",
}

function checkForNickname()
  local name = getPlayerName(source)
  if protected[name] then
   local serial = getPlayerSerial(source)
      if serial ~= protected[name] then
      	kickPlayer(source, "Nickname is protected!")
      end
   end
end
addEventHandler("onPlayerJoin", root, checkForNickname)
addEventHandler("onPlayerChangeNick", root, checkforNickname)

made by @Om.

to get your serial type /serial and press F8 And copy it

not working

Link to comment
4 minutes ago, _Kinan said:

show me the code then..

meta.xml

<meta>
    <info author="lorder" type="script" name="fke" description="fke" version="1.0.0"/>
	<script src="lorder.lua" type="client"/>
</meta>

lorder.lua

local protected = {
  ["lorder"] = "8E7052E35762093C4DA83FC51D88L",
}

function checkForNickname()
  local name = getPlayerName(source)
  if protected[name] then
   local serial = getPlayerSerial(source)
      if serial ~= protected[name] then
      	kickPlayer(source, "Nickname is protected!")
      end
   end
end
addEventHandler("onPlayerJoin", root, checkForNickname)
addEventHandler("onPlayerChangeNick", root, checkforNickname)

 

Link to comment
1 minute ago, Lorder said:

meta.xml


<meta>
    <info author="lorder" type="script" name="fke" description="fke" version="1.0.0"/>
	<script src="lorder.lua" type="client"/>
</meta>

lorder.lua


local protected = {
  ["lorder"] = "8E7052E35762093C4DA83FC51D88L",
}

function checkForNickname()
  local name = getPlayerName(source)
  if protected[name] then
   local serial = getPlayerSerial(source)
      if serial ~= protected[name] then
      	kickPlayer(source, "Nickname is protected!")
      end
   end
end
addEventHandler("onPlayerJoin", root, checkForNickname)
addEventHandler("onPlayerChangeNick", root, checkforNickname)

 

It's server side.

<meta>
    <info author="lorder" type="script" name="fke" description="fke" version="1.0.0"/>
	<script src="lorder.lua" type="server"/>
</meta>

 

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