Om. Posted January 26, 2015 Share Posted January 26, 2015 Hello MTA Developers, I've made a script in which Serial must be whitelisted to Join the server or else it'll redirect to main server (dev -> main) --[[ Author: iOm Project: UGC:MTA Development Server ]]-- SerialList = { ["Serial"] = true, -- Chillax } -- Checker function serialCheck (source) local SV = getPlayerSerial(source) if SV then if (SerialList[SV]) then outputChatBox("Welcome To Development Server of UGC:MTA (Serial Logger)",source,255,0,0) else redirectPlayer(source, "s1.ugcmta.net", 22003) ) end end end addEventHandler("onPlayerJoin", getRootElement(), serialCheck) I don't know what's wrong with this. so i'd request for some help over here. Link to comment
Malak Posted January 26, 2015 Share Posted January 26, 2015 Try like that. tableSerial = { serial1, serial2 } and you condition : for i, s in ipairs(tableSerial) do if s == SV then -- action else --action end end don't forget to close your boucle when the result is find with break. Link to comment
WASSIm. Posted January 26, 2015 Share Posted January 26, 2015 try this --[[ Author: iOm Project: UGC:MTA Development Server ]]-- SerialList = { ["Serial"] = true, -- Chillax } -- Checker function serialCheck ( ) local SV = getPlayerSerial(source) if SV then if (SerialList[SV]) then outputChatBox("Welcome To Development Server of UGC:MTA (Serial Logger)",source,255,0,0) else redirectPlayer(source, "s1.ugcmta.net", 22003) end end end addEventHandler("onPlayerJoin", getRootElement(), serialCheck) if not working try to change "s1.ugcmta.net" to "mtasa://s1.ugcmta.net" Link to comment
AJXB Posted January 26, 2015 Share Posted January 26, 2015 -- Client Side allowedSerials = { {"MYSERIAL"} -- Myself } function check () local SV = getPlayerSerial (localPlayer) if SV then for i,v in ipairs (allowedSerials) do -- loop the table if v == SV then -- if we got a match outputChatBox ('Welcome to ') else -- triggerServerEvent ('redirectNotAllowedPlayer',localPlayer) -- because redirectPlayer is serverside only end end end end addEventHandler ('onClientResourceStart',getResourceRootElement (getThisResource()),check) -- onClientResourceStart will do Link to comment
TAPL Posted January 26, 2015 Share Posted January 26, 2015 -- Client Side allowedSerials = { {"MYSERIAL"} -- Myself } function check () local SV = getPlayerSerial (localPlayer) if SV then for i,v in ipairs (allowedSerials) do -- loop the table if v == SV then -- if we got a match outputChatBox ('Welcome to ') else -- triggerServerEvent ('redirectNotAllowedPlayer',localPlayer) -- because redirectPlayer is serverside only end end end end addEventHandler ('onClientResourceStart',getResourceRootElement (getThisResource()),check) -- onClientResourceStart will do Client side for whitelist, seriously? Link to comment
Moderators IIYAMA Posted January 28, 2015 Moderators Share Posted January 28, 2015 Add admin rights? Link to comment
AJXB Posted January 31, 2015 Share Posted January 31, 2015 (edited) -- Client Side allowedSerials = { {"MYSERIAL"} -- Myself } function check () local SV = getPlayerSerial () if SV then for i,v in ipairs (allowedSerials) do -- loop the table if v == SV then -- if we got a match outputChatBox ('Welcome to ') else -- triggerServerEvent ('redirectNotAllowedPlayer',localPlayer) -- because redirectPlayer is serverside only end end end end addEventHandler ('onClientResourceStart',resourceRoot ,check) -- onClientResourceStart will do Client side for whitelist, seriously? Lol you're old mate, really old, now are people still scared of client side files? haha, cute. Edited January 31, 2015 by Guest Link to comment
TAPL Posted January 31, 2015 Share Posted January 31, 2015 Wow Mr.gSub you very smart! So you want to let the player download your client files and also waiting it to complete before you make the amazing trigger to server side for redirecting the player. Very good! excellent!!! And by the way, getPlayerSerial doesn't require argument at client side! Link to comment
AJXB Posted January 31, 2015 Share Posted January 31, 2015 Wow Mr.gSub you very smart!So you want to let the player download your client files and also waiting it to complete before you make the amazing trigger to server side for redirecting the player. Very good! excellent!!! And by the way, getPlayerSerial doesn't require argument at client side! Calm your tits, you're using sarcasm to express your "issues", and I'm not here to make jokes, unlike you, apparently. Here's the deal, there are many ways to make a good, working resource, choose yours, I'll choose mine, don't get me wrong, I respect and value your opinion, but not the way you're presenting it. I believe that the code I submitted works well, yet I do believe the method is wrong. if you think otherwise, propose another way, we'll respect it, but don't make jokes, or act "funny", I don't have time for that. 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