Jump to content

How can spawn player without export freeroam?


papam77

Recommended Posts

Hello, i have this code, but it doesn't spawn me on my place...

client

-------------------------- 
-- Welcome To Los Santos 
-------------------------- 
addEvent("spawn", true) 
function spawn ()    
local player = getRootElement() 
  
  
setElementPosition ( player, 1642.5999755859, -2241.1999511719, 13.10000038147 ) 
setElementRotation ( player, 0, 0, 180 ) 
end 
addEventHandler ("spawn", getRootElement(), spawn) 
  
  
function time() 
    local realtime = getRealTime() 
  
    setTime(realtime.hour, realtime.minute) 
    setMinuteDuration(60000) 
end 
addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), time) 

server

-------------------------- 
-- Welcome To Los Santos 
-------------------------- 
addEventHandler("onPlayerLogin", root, 
function() 
outputChatBox ("Vítej na serveru " ..getPlayerName(source)..".") 
  
triggerClientEvent("spawn", getRootElement(), source) 
end) 
  
addEventHandler("onPlayerJoin", root, 
function() 
outputChatBox ("cus") 
triggerClientEvent("spawn", getRootElement(), source) 
end) 

I see only sky...

Link to comment
addEventHandler("onPlayerJoin", root, 
function() 
local player = getRootElement() 
spawnPlayer ( player,1642.5999755859, -2241.1999511719, 13.10000038147) 
setCameraTarget ( player, 1642.5999755859, -2241.1999511719, 13.10000038147) 
end) 

I have this now, but i still see only sky or black screen.

Link to comment
addEventHandler("onPlayerJoin", root, 
function() 
local player = getRootElement() 
spawnPlayer ( player,1642.5999755859, -2241.1999511719, 13.10000038147) 
setCameraTarget ( player, 1642.5999755859, -2241.1999511719, 13.10000038147) 
end) 

I have this now, but i still see only sky or black screen.

addEventHandler ( "onPlayerJoin", root, 
    function ( ) 
        spawnPlayer ( source, 1642.5999755859, -2241.1999511719, 13.10000038147 ) 
        setCameraTarget ( source ) 
    end 
) 

Link to comment

Ah now works

addEventHandler ( "onPlayerLogin", root, 
    function ( ) 
    fadeCamera ( source, true, 1.0, 255, 0, 0 ) 
    outputChatBox ("Vítej na server"..getPlayerName( source )..".") 
    setElementRotation ( source, 0, 0, 180) 
    spawnPlayer ( source, 1642.5999755859, -2241.1999511719, 13.10000038147 ) 
    setCameraTarget ( source ) 
    end 
) 

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