papam77 Posted July 2, 2013 Share Posted July 2, 2013 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
Castillo Posted July 2, 2013 Share Posted July 2, 2013 This doesn't really make much sense to me, why are you using a client side script? you must do it all server side. Use: spawnPlayer setCameraTarget Link to comment
papam77 Posted July 2, 2013 Author Share Posted July 2, 2013 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
MIKI785 Posted July 2, 2013 Share Posted July 2, 2013 That's obvious 'cause you don't know how to use setCameraTarget.. read the wiki for once. Should be setCameraTarget(player) Link to comment
papam77 Posted July 2, 2013 Author Share Posted July 2, 2013 Yes, but it doesn't work i still see the black screen. Link to comment
Castillo Posted July 2, 2013 Share Posted July 2, 2013 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
MIKI785 Posted July 2, 2013 Share Posted July 2, 2013 I would put fadeCamera there as well, just to make sure. Link to comment
papam77 Posted July 2, 2013 Author Share Posted July 2, 2013 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
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