Lorder Posted February 24, 2017 Posted February 24, 2017 fake owner name how to kick out a user ? Script name pls bad english
MTA Team Lpsd Posted February 24, 2017 MTA Team Posted February 24, 2017 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
Lorder Posted February 24, 2017 Author Posted February 24, 2017 Using the server's owner's name to fool everyone
_Kinan Posted February 24, 2017 Posted February 24, 2017 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)
^iiEcoo'x_) Posted February 24, 2017 Posted February 24, 2017 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
_Kinan Posted February 24, 2017 Posted February 24, 2017 17 minutes ago, #_iMr.[E]coo said: + onResourceStart It doesn't seem that the thread owner wanted that....
Om. Posted February 24, 2017 Posted February 24, 2017 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
Lorder Posted February 25, 2017 Author Posted February 25, 2017 19 hours ago, _Kinan said: I did not understand
_Kinan Posted February 25, 2017 Posted February 25, 2017 6 minutes ago, Lorder said: I did not understand @Om. have made a better one. use his not mine....
Lorder Posted February 25, 2017 Author Posted February 25, 2017 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?
_Kinan Posted February 25, 2017 Posted February 25, 2017 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
Lorder Posted February 25, 2017 Author Posted February 25, 2017 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
_Kinan Posted February 25, 2017 Posted February 25, 2017 31 minutes ago, Lorder said: not working show me the code then..
Lorder Posted February 25, 2017 Author Posted February 25, 2017 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)
_Kinan Posted February 25, 2017 Posted February 25, 2017 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>
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