Jump to content

[help] join player


Death

Recommended Posts

server ----------------------

function join ( ) 
    triggerClientEvent ( source, "onClientPlayerJoinn", source ) 
end 
addEventHandler ( "onPlayerJoin", getRootElement(), join ) 
  
  

client--

addEvent("onClientPlayerJoinn", true) 
 myFont = nil 
-- Display text using dxDrawText 
function tela_Carregando() 
local x, y = guiGetScreenSize () 
    sx = x 
    sy = y + 400 
            setCameraMatrix(1234.0230712891, 43.429969787598, 65.919090270996, 1468.388671875, -918.42474365234, 99.881813049316) 
            dxDrawText( getServerName().." Loading...", x/2-230, sy*0.2+50, 500, 25, tocolor(255,255,255), 1, myFont ) 
end 
  
function inicio() 
    if not myFont then 
            myFont = dxCreateFont( "font/Oswald.ttf", 30 )  -- Create custom font 
    end    
    addEventHandler( "onClientRender", root, tela_Carregando) 
end 
  
  
function timer(source) 
    setTimer ( inicio, 100, 1, source ) 
end 
addEventHandler("onClientPlayerJoinn", root, timer) 
function lol( startedRes ) 
    if getResourcerName(startedRes) == "GM" then 
        removeEventHandler( "onClientRender", root, tela_Carregando) 
    end 
end 
addEventHandler( "onClientResourceStart", getRootElement(), lol) 
  
  
  

the problem and that only works after downloading all resources

plis help

Link to comment

try this:

  
 -- CLIENTSIDE 
local myFont = dxCreateFont( "font/Oswald.ttf", 30 ) 
 sName = "" 
  
 addEvent("onClientPlayerJoinn", true) 
function timer(servername) 
    sName = tostring(servername) 
end 
addEventHandler("onClientPlayerJoinn", root, timer) 
  
function tela_Carregando() 
local x, y = guiGetScreenSize () 
    sx = x 
    sy = y + 400 
    dxDrawText( sName.." Loading...", x/2-230, sy*0.2+50, 500, 25, tocolor(255,255,255), 1, "arial" ) 
end 
addEventHandler( "onClientRender", root, tela_Carregando) 
  
  
function lol( startedRes ) 
    if getResourcerName(startedRes) == "GM" then 
        removeEventHandler( "onClientRender", root, tela_Carregando) 
    end 
end 
  
--SERVERSIDE 
function join () 
    local serverName = getServerName() 
    setTimer(triggerClientEvent, 3000, 1, source, "onClientPlayerJoinn", source, serverName ) 
    setCameraMatrix(source, 1234.0230712891, 43.429969787598, 65.919090270996, 1468.388671875, -918.42474365234, 99.881813049316) 
  
end 
addEventHandler ( "onPlayerJoin", root, join ) 

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