Jump to content

[HELP]Redirect Player & Serial Whitelisted


Om.

Recommended Posts

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

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
  
-- 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
  
-- 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
  
-- 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 by Guest
Link to comment
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

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