ZeyadGTX Posted October 18, 2014 Share Posted October 18, 2014 (edited) 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 October 18, 2014 by Guest Link to comment
John Smith Posted October 18, 2014 Share Posted October 18, 2014 is resource in acl group admin? Link to comment
ZeyadGTX Posted October 18, 2014 Author Share Posted October 18, 2014 Yes it's but when player joins he doesn't get banned banPlayer ( source, "Tunisia Is Banned." ) Link to comment
John Smith Posted October 18, 2014 Share Posted October 18, 2014 banPlayer(source,false,false,true,"Console","Tunisia is Banned.",0) Link to comment
ZeyadGTX Posted October 18, 2014 Author Share Posted October 18, 2014 banPlayer(source,false,false,true,"Console","Tunisia is Banned.",0) Wow worked 10/10 Thanks. Link to comment
ZeyadGTX Posted October 22, 2014 Author Share Posted October 22, 2014 i would like to outPutChatBox when he gets banned outputChatBox ( banner .." has banned ".. getPlayerName( source ) ..".", getRootElement(), 255, 0, 0 ) Tunisia is banned Link to comment
King12 Posted October 22, 2014 Share Posted October 22, 2014 Add this line under your banPlayer function : outputChatBox(getPlayerName(source).."is banned by Console. Reason : ( Tunisia is banned ).", root, 255,0,0,true) Link to comment
ZeyadGTX Posted October 22, 2014 Author Share Posted October 22, 2014 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
Saml1er Posted October 22, 2014 Share Posted October 22, 2014 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
ZeyadGTX Posted October 22, 2014 Author Share Posted October 22, 2014 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
Saml1er Posted October 22, 2014 Share Posted October 22, 2014 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. Link to comment
ZeyadGTX Posted October 22, 2014 Author Share Posted October 22, 2014 I can't See OutputChatBox actually it's not working ! Link to comment
rtx Posted October 22, 2014 Share Posted October 22, 2014 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
ZeyadGTX Posted October 22, 2014 Author Share Posted October 22, 2014 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
TAPL Posted October 22, 2014 Share Posted October 22, 2014 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
rtx Posted October 22, 2014 Share Posted October 22, 2014 ^ 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
ZeyadGTX Posted October 23, 2014 Author Share Posted October 23, 2014 Thanks 100 % works Link to comment
Saml1er Posted October 24, 2014 Share Posted October 24, 2014 Ah, it was not a command handler. Missed it. ^^ Link to comment
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