CapY Posted July 25, 2011 Share Posted July 25, 2011 When player joins to a server, it must be spawned here : x = -1942 y = 537 z = 277 So anybody knows how to create that script ? IDK what this exactly says :https://wiki.multitheftauto.com/wiki/Map_manager Link to comment
bandi94 Posted July 25, 2011 Share Posted July 25, 2011 function spaw(player) spawnPlayer(player, x , y ,z , 0 , skin id ) end addEventHandler("onPlayerJoin",root,spaw) next time make it yourself use wiki .. Link to comment
myonlake Posted July 25, 2011 Share Posted July 25, 2011 Just that ? Yes, just that, and if I'm right, there's a spawn script in the 'play' folder. Link to comment
JR10 Posted July 25, 2011 Share Posted July 25, 2011 Well, with bandi's code the player will spawn, but you will still see a black screen. And next time, use the wiki and the search in it. For spawning a player you must use 3 functions: fadeCamera -- fades the player's camera to a color or back to normal setCameraTarget -- used to make the camera follows the player (or follows another player 'spectate') spawnPlayer -- spawns the player Example: addEventHandler("onPlayerJoin", root, function() local x = -1942 local y = 537 local z = 277 spawnPlayer(source, x, y, z) fadeCamera(source, true) setCameraTarget(source, source) end) You can change the x, y, z. Good luck. Link to comment
CapY Posted July 26, 2011 Author Share Posted July 26, 2011 It's working nice, but when i die it's respawns me at default place.... Link to comment
Jaysds1 Posted July 26, 2011 Share Posted July 26, 2011 make an onPlayerWasted event/function. Link to comment
JR10 Posted July 26, 2011 Share Posted July 26, 2011 It's working nice, but when i die it's respawns me at default place.... Respawns you, how? It shouldn't respawn you at all, unless you made a script for it, with "onPlayerWasted". Link to comment
bandi94 Posted July 26, 2011 Share Posted July 26, 2011 we use "onPlayerJoin" and when somebody get killed then you get respawn whit the normal play script respawn you need to add "onPlayerWasted" and "onPlayerJoin" Link to comment
Jaysds1 Posted July 26, 2011 Share Posted July 26, 2011 Are you using the freeroam resource or the play resource? Those already have scripts for spawning and when somebody dies, they spawn in the same place in LV. Link to comment
CapY Posted July 26, 2011 Author Share Posted July 26, 2011 Are you using the freeroam resource or the play resource?Those already have scripts for spawning and when somebody dies, they spawn in the same place in LV. None of them ...i named resource "Join handler" Link to comment
bandi94 Posted July 26, 2011 Share Posted July 26, 2011 It's working nice, but when i die it's respawns me at default place.... the play resourc have a default respawn place ... Link to comment
CapY Posted July 26, 2011 Author Share Posted July 26, 2011 This works good. addEventHandler("onResourceStart", resourceRoot, function() resetMapInfo() for i,player in ipairs(getElementsByType("player")) do spawn(player) end end ) function spawn(player) if not isElement(player) then return end repeat until spawnPlayer ( player, -711+math.random(1,5), 957+math.random(5,9), 12.4, 90, math.random(9,288), 0, 0) fadeCamera(player, true) setCameraTarget(player, player) showChat(player, true) end addEventHandler("onPlayerJoin", root, function() local x = -1942 local y = 537 local z = 277 spawnPlayer(source, x, y, z) fadeCamera(source, true) setCameraTarget(source, source) end ) addEventHandler("onPlayerWasted", root, function() local x = -1942 local y = 537 local z = 277 spawnPlayer(source, x, y, z) fadeCamera(source, true) setCameraTarget(source, source) setTimer(spawn, 1000, 1, source) end ) On join i spawn there and when i die i respawn there , but when i die i respawn there for 1 second and then it backs me to the default spawn... What i did wrong ? Link to comment
JR10 Posted July 26, 2011 Share Posted July 26, 2011 That's because you are using a timer to call "spawn" which will spawn the player back at the default position. here: addEventHandler("onPlayerWasted", root, function() local x = -1942 local y = 537 local z = 277 spawnPlayer(source, x, y, z) fadeCamera(source, true) setCameraTarget(source, 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