S3M Posted April 6, 2012 Posted April 6, 2012 Hi there, i'm looking for a script what makes a spawnpoint onplayername. so that i can give every player his own spawnpoint. any have somthing like this? thx.
Jaysds1 Posted April 6, 2012 Posted April 6, 2012 I don't think that's a good idea, plus, there's no spawnpoint resource, srry. 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/
drk Posted April 6, 2012 Posted April 6, 2012 (edited) You want random spawns? If so, then: local tSpawns = { { -1234, -349, 29 }; { -2945, -296, 10 }; } addEventHandler ( 'onPlayerJoin', root, function ( ) local uRandom = tSpawns [ math.random ( #tSpawns ) ] local nX, nY, nZ = uRandom[1], uRandom[2], uRandom[3] spawnPlayer ( source, nX, nY, nZ ); end ) Edited April 8, 2012 by Guest EPT Team Server Development: 0% Learning C++ | C++ is amazing
Castillo Posted April 6, 2012 Posted April 6, 2012 He's talking about private spawns, e.g: I spawn on Los Santos, you spawn on Las Venturas, and so on, different spawn points for each player. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Khtsjefen Posted April 8, 2012 Posted April 8, 2012 function spawnDaNoobs(source,_) local name = getPlayerName(source) --Get nickname if (name = MyFuckingNiceUsername) then setElementPosition(source, 0, 0, 100) --Spawning xyz, here as a suicide spawn above Blueberry. setElementModel(source, 286) --Setting skin, to the FBI skin. elseif (name = MyFriend) then setElementPosition(source, 0, 0, 5) --Spawning xyz, here at the Blueberry farm. setElementModel(source, 0) --Setting skin, to the CJ skin. else setElementPosition(source, x, y, z) --Edit it. setElementModel(source, skin) --Edit it. end end addEventHandler("onPlayerJoin", getRootElement(), spawnDaNoobs) Not sure, untested.
arezu Posted April 8, 2012 Posted April 8, 2012 function spawnDaNoobs(source,_) local name = getPlayerName(source) --Get nickname if (name = ) then setElementPosition(source, 0, 0, 100) --Spawning xyz, here as a suicide spawn above Blueberry. setElementModel(source, 286) --Setting skin, to the FBI skin. elseif (name = MyFriend) then setElementPosition(source, 0, 0, 5) --Spawning xyz, here at the Blueberry farm. setElementModel(source, 0) --Setting skin, to the CJ skin. else setElementPosition(source, x, y, z) --Edit it. setElementModel(source, skin) --Edit it. end end addEventHandler("onPlayerJoin", getRootElement(), spawnDaNoobs) Not sure, untested. wrong at so many levels
TwiX! Posted April 8, 2012 Posted April 8, 2012 (edited) if (name = ) then what its? if (name ~= ":O") then --code here end or if (name == ":O") then --code here end Edited April 8, 2012 by Guest - Working on [php/HTML/Mysql/Lua/Java Scripts/Web Design/3D Modeling]
Khtsjefen Posted April 8, 2012 Posted April 8, 2012 function spawnDaNoobs(source,_) local name = getPlayerName(source) --Get nickname if (name = ) then setElementPosition(source, 0, 0, 100) --Spawning xyz, here as a suicide spawn above Blueberry. setElementModel(source, 286) --Setting skin, to the FBI skin. elseif (name = MyFriend) then setElementPosition(source, 0, 0, 5) --Spawning xyz, here at the Blueberry farm. setElementModel(source, 0) --Setting skin, to the CJ skin. else setElementPosition(source, x, y, z) --Edit it. setElementModel(source, skin) --Edit it. end end addEventHandler("onPlayerJoin", getRootElement(), spawnDaNoobs) Not sure, untested. wrong at so many levels Well, I'm a new scripter Also, second time I use event handler, and the first script is not donw, and is currently not working. (Prices for winning in race gamemode).
TwiX! Posted April 8, 2012 Posted April 8, 2012 '=' you give the name of the argument '==' compare (As in mathematics) local me = getLocalPlayer() local name = getPlayerName(source) if (me == name) then outputChatBox ('work') end '~=' approximately equal, ie, the system will not be equated as example 2+2.1 = 4.1 so if (2+2.1) == 4 its will wrong else (2+2.1) ~= 4 will working - Working on [php/HTML/Mysql/Lua/Java Scripts/Web Design/3D Modeling]
S3M Posted April 9, 2012 Author Posted April 9, 2012 Searching for the solution, try and try again, but I get this spawn points idea is not good. For 4 years ago was to make a script easier. Is there something changed in mta: sa causing some command no longer function? or am I so stupid and forgetful. Meanwhile I have found this script, it's almost the same idea that I want, I just want some player their own position / spawn point without a vehicle. vehicle1 = createVehicle ( 506, 2506.3994140625, -1651.6337890625, 13.603052139282 ) --here you can change car model and car's coordinates (where it's gonna be) --addVehicleUpgrade ( vehicle1, 1010 ) -- if you want to add an upgrade to certain vehicle setVehicleColor ( vehicle1, 0, 0, 0, 0 ) -- for changing vehicle colour, first '0' is for main vehicle colour setElementData(vehicle1, "owner", "S3M") --"account" replace with player's account name function onLockedVehicleEnter ( player, seat, jacked ) if getElementData(source, "owner") and getElementData(source, "owner" ) ~= getAccountName(getPlayerAccount(player)) and ( seat == 0 ) then outputChatBox ("* VEHICLE * You may not use this vehicle as it belongs to: "..tostring(getElementData(source, "owner" )), player, 255, 0, 0) cancelEvent() end end addEventHandler ( "onVehicleStartEnter", getRootElement(), onLockedVehicleEnter ) How do i change this to only with player spawnpoint on name, onjoin, and onplayerdie.
Castillo Posted April 9, 2012 Posted April 9, 2012 -- Create a table with names and coordinates. local spawnPoints = { [ "Solidsnake14" ] = { 0, 0, 5 }, [ "Castillo" ] = { 0, 0, 10 }, [ "S3M" ] = { 0, 0, 15 } } function spawn ( thePlayer ) local playerName = getPlayerName ( thePlayer ):gsub ( "#%x%x%x%x%x%x", "" ) -- Get the player name and remove his HEX colors. if ( spawnPoints [ playerName ] ) then -- If the player has a spawn point .. spawnPlayer ( thePlayer, unpack ( spawnPoints [ playerName ] ) ) -- Unpack the coordinates of his spawn point and spawn him. end end addEventHandler ( "onPlayerJoin", root, function ( ) spawn ( source ) end ) addEventHandler ( "onPlayerWasted", root, function ( ) spawn ( source ) end ) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
S3M Posted April 12, 2012 Author Posted April 12, 2012 -- Create a table with names and coordinates. local spawnPoints = { [ "Solidsnake14" ] = { 0, 0, 5 }, [ "Castillo" ] = { 0, 0, 10 }, [ "S3M" ] = { 0, 0, 15 } } function spawn ( thePlayer ) local playerName = getPlayerName ( thePlayer ):gsub ( "#%x%x%x%x%x%x", "" ) -- Get the player name and remove his HEX colors. if ( spawnPoints [ playerName ] ) then -- If the player has a spawn point .. spawnPlayer ( thePlayer, unpack ( spawnPoints [ playerName ] ) ) -- Unpack the coordinates of his spawn point and spawn him. end end addEventHandler ( "onPlayerJoin", root, function ( ) spawn ( source ) end ) addEventHandler ( "onPlayerWasted", root, function ( ) spawn ( source ) end ) THX Solidsnake14 this works ... only now a problem with the spawnpoint that i have in resource cdm or play. Maybe i must only use this, but then i mis the player spawnpoint who not this table you made. you ( Solidsnake14) know a solution for this?
Castillo Posted April 12, 2012 Posted April 12, 2012 You can get a random spawn point if he's not in the table. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
S3M Posted April 12, 2012 Author Posted April 12, 2012 You can get a random spawn point if he's not in the table. but its spawn the player who's in table too. if i use resource cdm/play then first it use the table, after team choice/enter to join, the player in table goes to the spawnpoint too, to the spawnpoint what is set in the cdm/play resource. i hope you understand my explanation. maybe you must try this code/script on play/cdm mode
Castillo Posted April 12, 2012 Posted April 12, 2012 The script I made was an example, you can edit your main spawn script and add mine to work together. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
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