CapY Posted July 25, 2011 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
bandi94 Posted July 25, 2011 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 .. Ingame Name : |DGT|Puma DGT Clan Server 24/7 Owner/Scripter MultiGameMode in progress :
myonlake Posted July 25, 2011 Posted July 25, 2011 Just that ? Yes, just that, and if I'm right, there's a spawn script in the 'play' folder. If I helped you, please click the like button on the right Thanks!
JR10 Posted July 25, 2011 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. Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
CapY Posted July 26, 2011 Author Posted July 26, 2011 It's working nice, but when i die it's respawns me at default place....
Jaysds1 Posted July 26, 2011 Posted July 26, 2011 make an onPlayerWasted event/function. My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
JR10 Posted July 26, 2011 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". Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
bandi94 Posted July 26, 2011 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" Ingame Name : |DGT|Puma DGT Clan Server 24/7 Owner/Scripter MultiGameMode in progress :
Jaysds1 Posted July 26, 2011 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. My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
CapY Posted July 26, 2011 Author 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"
bandi94 Posted July 26, 2011 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 ... Ingame Name : |DGT|Puma DGT Clan Server 24/7 Owner/Scripter MultiGameMode in progress :
CapY Posted July 26, 2011 Author 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 ?
JR10 Posted July 26, 2011 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 ) Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
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