xXMADEXx Posted March 2, 2013 Share Posted March 2, 2013 I have made this script, but when the player joins it will not check his serial to see if he is in bans.xml! I'm not sure how to fix this. (Server) addEventHandler('onPlayerJoin',root, function () local file = xmlLoadFile("bans.xml", "bans") for k,v in ipairs(xmlNodeGetChildren(file)) do local hisSerial = xmlNodeGetAttribute(v,"serial") local hisIp = xmlNodeGetAttribute(v,"IP") local banner = xmlNodeGetAttribute(v,"banner") if (getPlayerSerial(v)==hisSerial) then triggerClientEvent(v,'bans:heJoinedAndIsBanned',v,banner,hisIp,hisSerial) end end end ) (Client) local url = "http://www.rog-mta.tk" function dx() dxDrawRectangle(0, 0, 1800, 1000, tocolor(0, 0, 0, 255), false) dxDrawText("Your Serial Is Banned!", 0, 0, 1279, 51, tocolor(255, 0, 0, 255), 4, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("( "..getPlayerSerial(localPlayer).." )", 0, 51, 1279, 102, tocolor(255, 25, 0, 255), 3, "default", "center", "center", false, false, false, false, false) --dxDrawText("IP: "..getPlayerIp(localPlayer), 0, 847, 1279, 950, tocolor(0, 255, 0, 255), 3, "default-bold", "center", "center", false, false, false, false, false) dxDrawImage(250, 102, 800, 800, "image.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) end addEvent("bans:heJoinedAndIsBanned",true) addEventHandler("bans:heJoinedAndIsBanned",root, function (banner,hisIp,hisSerial) addEventHandler('onClientRender',root,dx) showChat(false) showCursor(true) end ) Link to comment
MIKI785 Posted March 2, 2013 Share Posted March 2, 2013 If the player is banned, it won't trigger onPlayerJoin, he will be disconnected automatically. Btw. you're using your own ban system? Because you can't open bans.xml. use getBans. Link to comment
xXMADEXx Posted March 2, 2013 Author Share Posted March 2, 2013 It dosnt ban him. Its making XML of players, and if the player who joins Serial is in bans.xml, it should show the screen. So really the player never gets banned, he just cannot play. Link to comment
Jaysds1 Posted March 3, 2013 Share Posted March 3, 2013 wait, so your ban system doesn't kick the player out, it just not makes the player play? Link to comment
Fury Posted March 3, 2013 Share Posted March 3, 2013 addEventHandler('onPlayerJoin',root, function () local banList = getBans() for banID, ban in ipairs ( banList ) do local hisSerial = getBanSerial ( ban ) local hisIP = getBanIP ( ban ) local banner = getBanAdmin(ban) if (getPlayerSerial(ban)==hisSerial) then triggerClientEvent(ban,'bans:heJoinedAndIsBanned',ban,banner,hisIp,hisSerial) end end end ) not tested. it can be wrong, im not sure. Link to comment
Castillo Posted March 3, 2013 Share Posted March 3, 2013 That would be useless, because the player can't join the game if he's banned. The script from xXMADEXx is a custom ban system. Link to comment
Guest Guest4401 Posted March 3, 2013 Share Posted March 3, 2013 Server addEvent('downloadOver',true) addEventHandler('downloadOver',root, function() local f = xmlLoadFile('bans.xml') local s = getPlayerSerial(source) if f then for i,v in ipairs(xmlNodeGetChildren(f)) do if xmlNodeGetAttribute(v,'serial') == s then triggerClientEvent(source,'bans:heJoinedAndIsBanned',source) break end end xmlUnloadFile(f) end end ) Client addEventHandler('onClientResourceStart',resourceRoot, function() triggerServerEvent('downloadOver',localPlayer) end ) function dx() dxDrawRectangle(0, 0, 1800, 1000, tocolor(0, 0, 0, 255), false) dxDrawText("Your Serial Is Banned!", 0, 0, 1279, 51, tocolor(255, 0, 0, 255), 4, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("( "..getPlayerSerial(localPlayer).." )", 0, 51, 1279, 102, tocolor(255, 25, 0, 255), 3, "default", "center", "center", false, false, false, false, false) --dxDrawText("IP: "..getPlayerIp(localPlayer), 0, 847, 1279, 950, tocolor(0, 255, 0, 255), 3, "default-bold", "center", "center", false, false, false, false, false) dxDrawImage(250, 102, 800, 800, "image.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) end addEvent("bans:heJoinedAndIsBanned",true) addEventHandler("bans:heJoinedAndIsBanned",root, function() addEventHandler('onClientRender',root,dx) showChat(false) showCursor(true) end ) 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