Jump to content

banPlayer


ZeyadGTX

Recommended Posts

Hello i would like to ban Tunisians when Join

my friend script

Not working

local countries = 
    { 
        [ "TN" ] = true 
    } 
local serials = 
    { 
        [ "" ] = true 
    } 
  
function paises ( ) 
    local gCountry = exports.admin:getPlayerCountry ( source ) or "N/A" 
    local gSerial = getPlayerSerial ( source ) 
    if ( serials [ gSerial ] ) then 
    elseif ( countries [gCountry]  ) then 
    banPlayer ( source, "Tunisia Is Banned." ) 
end 
end 
addEventHandler ( "onPlayerJoin", getRootElement(), paises ) 

Edited by Guest
Link to comment

It Doesn't Outputchatbox

local countries = 
    { 
        [ "TN" ] = true 
    } 
local serials = 
    { 
        [ "" ] = true 
    } 
  
function paises ( ) 
    local gCountry = exports.admin:getPlayerCountry ( source ) or "N/A" 
    local gSerial = getPlayerSerial ( source ) 
    if ( serials [ gSerial ] ) then 
    elseif ( countries [gCountry]  ) then 
    banPlayer(source,true,false,true,"Console","Tunisia is Banned.",0) 
    outputChatBox(#FFFFFFgetPlayerName(source).."#FF0000Has Been Banned.#FFFFFF[Reason : Tunisia Is Banned.]", root, 255,255,255,true) 
end 
end 
addEventHandler ( "onPlayerJoin", getRootElement(), paises ) 

Link to comment
  
function paises ( banner) 
  
    local gCountry = exports.admin:getPlayerCountry ( source ) or "N/A" 
  
    local gSerial = getPlayerSerial ( source ) 
  
    if ( serials [ gSerial ] ) then 
  
    elseif ( countries [gCountry]  ) then 
  
    banPlayer(source,true,false,true,"Console","Tunisia is Banned.",0) 
  
    outputChatBox("#FFFFFF"..getPlayerName(source).."#FF0000Has Been Banned by "..getPlayerName(banner)..". #FFFFFF[Reason : Tunisia Is Banned.]", root, 255,255,255,true) 
  
end 
  
end 
  
addEventHandler ( "onPlayerJoin", getRootElement(), paises ) 
  

Link to comment
  
function paises ( banner) 
  
    local gCountry = exports.admin:getPlayerCountry ( source ) or "N/A" 
  
    local gSerial = getPlayerSerial ( source ) 
  
    if ( serials [ gSerial ] ) then 
  
    elseif ( countries [gCountry]  ) then 
  
    banPlayer(source,true,false,true,"Console","Tunisia is Banned.",0) 
  
    outputChatBox("#FFFFFF"..getPlayerName(source).."#FF0000Has Been Banned by "..getPlayerName(banner)..". #FFFFFF[Reason : Tunisia Is Banned.]", root, 255,255,255,true) 
  
end 
  
end 
  
addEventHandler ( "onPlayerJoin", getRootElement(), paises ) 
  

but you forgot to add Function to ban Tunisia ?

local countries = 
    { 
        [ "TN" ] = true 
    } 
local serials = 
    { 
        [ "" ] = true 
    } 
  
  
function paises ( banner) 
  
    local gCountry = exports.admin:getPlayerCountry ( source ) or "N/A" 
  
    local gSerial = getPlayerSerial ( source ) 
  
    if ( serials [ gSerial ] ) then 
  
    elseif ( countries [gCountry]  ) then 
  
    banPlayer(source,true,false,true,"Console","Tunisia is Banned.",0) 
  
    outputChatBox("#FFFFFF"..getPlayerName(source).."#FF0000Has Been Banned by "..getPlayerName(banner)..". #FFFFFF[Reason : Tunisia Is Banned.]", root, 255,255,255,true) 
  
end 
  
end 
  
addEventHandler ( "onPlayerJoin", getRootElement(), paises ) 
  

Link to comment
  
function paises ( banner) 
  
    local gCountry = exports.admin:getPlayerCountry ( source ) or "N/A" 
  
    local gSerial = getPlayerSerial ( source ) 
  
    if ( serials [ gSerial ] ) then 
  
    elseif ( countries [gCountry]  ) then 
  
    banPlayer(source,true,false,true,"Console","Tunisia is Banned.",0) 
  
    outputChatBox("#FFFFFF"..getPlayerName(source).."#FF0000Has Been Banned by "..getPlayerName(banner)..". #FFFFFF[Reason : Tunisia Is Banned.]", root, 255,255,255,true) 
  
end 
  
end 
  
addEventHandler ( "onPlayerJoin", getRootElement(), paises ) 
  

but you forgot to add Function to ban Tunisia ?

local countries = 
    { 
        [ "TN" ] = true 
    } 
local serials = 
    { 
        [ "" ] = true 
    } 
  
  
function paises ( banner) 
  
    local gCountry = exports.admin:getPlayerCountry ( source ) or "N/A" 
  
    local gSerial = getPlayerSerial ( source ) 
  
    if ( serials [ gSerial ] ) then 
  
    elseif ( countries [gCountry]  ) then 
  
    banPlayer(source,true,false,true,"Console","Tunisia is Banned.",0) 
  
    outputChatBox("#FFFFFF"..getPlayerName(source).."#FF0000Has Been Banned by "..getPlayerName(banner)..". #FFFFFF[Reason : Tunisia Is Banned.]", root, 255,255,255,true) 
  
end 
  
end 
  
addEventHandler ( "onPlayerJoin", getRootElement(), paises ) 
  

Nope. I'm on from my mob so I can't select and copy much text since it's a pain so I just copied the function but you should add the table. :P

Link to comment
local countries = 
    { 
        [ "TN" ] = true 
    } 
local serials = 
    { 
        [ "" ] = true 
    } 
  
  
function paises () 
  
    local gCountry = exports.admin:getPlayerCountry ( source ) or "N/A" 
  
    if ( countries [gCountry]  ) then 
  
      banPlayer(source,true,false,true,"Console","Tunisia is Banned.",0) 
  
      outputChatBox("#FFFFFF"..getPlayerName(source).."#FF0000has been banned by the server. #FFFFFF[Reason : Tunisia is Banned.]", root, 255,255,255,true) 
  
    end 
  
end 
  
addEventHandler ( "onPlayerJoin", getRootElement(), paises ) 
  

Link to comment
local countries = 
    { 
        [ "TN" ] = true 
    } 
local serials = 
    { 
        [ "" ] = true 
    } 
  
  
function paises () 
  
    local gCountry = exports.admin:getPlayerCountry ( source ) or "N/A" 
  
    if ( countries [gCountry]  ) then 
  
      banPlayer(source,true,false,true,"Console","Tunisia is Banned.",0) 
  
      outputChatBox("#FFFFFF"..getPlayerName(source).."#FF0000has been banned by the server. #FFFFFF[Reason : Tunisia is Banned.]", root, 255,255,255,true) 
  
    end 
  
end 
  
addEventHandler ( "onPlayerJoin", getRootElement(), paises ) 
  

The Player Banned Successfully but There is no outputChatBox

Link to comment
  • Other Languages Moderators

You should output before banning the player, as you now ban the player then trying to get the name of the player but the player no longer exist.

Link to comment

^ That is correct indeed.

  
local countries = 
    { 
        [ "TN" ] = true 
    } 
local serials = 
    { 
        [ "" ] = true 
    } 
  
  
function paises () 
  
    local gCountry = exports.admin:getPlayerCountry ( source ) or "N/A" 
  
    if ( countries [gCountry]  ) then 
  
      outputChatBox("#FFFFFF"..getPlayerName(source).."#FF0000has been banned by the server. #FFFFFF[Reason : Tunisia is Banned.]", root, 255,255,255,true) 
      banPlayer(source,true,false,true,"Console","Tunisia is Banned.",0) 
  
    end 
  
end 
  
addEventHandler ( "onPlayerJoin", getRootElement(), paises ) 
  

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