Sign in to follow this  
SkatCh

Need a little Help

Recommended Posts

Hello there ,

i create a new ban system with a special view etc ... but the problem is how can i check the player serial before he press the login button . so which one i need to use "onPlayerJoin" or "onPlayerConnect". i tried this but didn't work .

function checkBan() 
    for index, ban in pairs(banList) do 
    local serial = getPlayerSerial (source) 
        if (ban[1] == serial) then 
            triggerClientEvent(source, "showBanScreen", source,ban[1],ban[2], ban[3], ban[4]) 
        end 
    end 
end 
addEventHandler ( "onPlayerJoin", getRootElement(), checkBan ) 

banList -- special Table like getBans()

Share this post


Link to post

You should first make sure that the player have their resources downloaded and loaded, so you should use onClientResourceStart then trigger to server side and check if he banned then trigger again to client side to show ban screen.

Share this post


Link to post
--server 
  
function checkBan() 
    for index, ban in pairs(banList) do 
    local serial = getPlayerSerial (source) 
        if (ban[1] == serial) then 
            triggerClientEvent(source, "showBanScreen", source,ban[1],ban[2], ban[3], ban[4]) 
        end 
    end 
end 
addEvent("checkMyBan", true) 
addEventHandler("checkMyBan", root, checkBan) 

-- client 
  
addEventHandler("onClientResourceStart", resourceRoot, 
function() 
    triggerServerEvent("checkMyBan", localPlayer) 
end) 

Share this post


Link to post

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.