hihohihohiho Posted January 21, 2008 Share Posted January 21, 2008 Theres alot of players coming into my server and i need like 5 different spawning points because after 1 kills 1 he spawns at the same spot and gets killed, then leaves because they cant even play.If someone could tell me where i can edit that, like which file or scripts to edit that would be great thanks... Link to comment
hihohihohiho Posted January 22, 2008 Author Share Posted January 22, 2008 does anyone no where to edit that or have a script for it??????? Link to comment
hihohihohiho Posted January 23, 2008 Author Share Posted January 23, 2008 come on people...... Link to comment
tma Posted January 25, 2008 Share Posted January 25, 2008 spawnPlayer(player,math.random(1,6) * 5,math.random(1,6) * 5,0) Not tested it but that should spawn a player on a 6x6 grid at height 0 (the centre of the world). Add in x,y,z offsets for your start area. Link to comment
hihohihohiho Posted January 25, 2008 Author Share Posted January 25, 2008 ok ty, 1. where do i put it in 2. where do i put the xyz and 3. does it random the skin? Link to comment
tma Posted January 26, 2008 Share Posted January 26, 2008 Put it where you put your normal player spawn - you must have this to be playing on your server. You can also do something like : -- A global list of starting positions (x,y,z) for each spot spawnPoints = {{0,0,0},{0,0,30},{1000,300,40}} . . addEventHandler('onPlayerJoin',getRootElement(), function() sp = spawnPoints[math.random(1,#spawnPoints)] spawnPlayer(source,sp[1],sp[2],sp[3]) end ) All I'm showing you is how to spawn a player at a random pre-determined spawn point. Where this code belongs in your servers code is not something I can explain. No it doesn't do skins. Link to comment
eAi Posted January 26, 2008 Share Posted January 26, 2008 You should not be defining spawnpoints in code, you should use a .map file and getElementsByType. Link to comment
hihohihohiho Posted January 26, 2008 Author Share Posted January 26, 2008 ok i see now but where do i put the xyz Link to comment
hihohihohiho Posted January 26, 2008 Author Share Posted January 26, 2008 and i put that in and it doesnt work Link to comment
TmM_Automan Posted January 29, 2008 Share Posted January 29, 2008 function playerWasted () destroyBlipsAttachedTo ( source ) spawn_me ( source, 2500 ) end function playerJoin () spawn_me( source, 1500 ) end function spawn_me( player, timer ) setTimer ( spawnThePlayer, timer, 1, player ) end function spawnThePlayer ( player ) local b = spawnPlayer ( player, -711+randInt(1,5), 957+randInt(5,9), 12.4, 90, randInt(9,288) ) if not b then spawnThePlayer ( player ) return end fadeCamera(player,true) end addEventHandler ( "onPlayerJoin", root, playerJoin ) addEventHandler ( "onPlayerWasted", root, playerWasted ) This will spawn you at random points in a defined area and give u a random skin, this code is from the broph resource. in the function spawnThePlayer on the line that starts with "local b=" is where the xyz is defined, put your x and y before each instance of "randInt" and then put your z coordinate. the next variable is for player rotation and after that the last one defines the range of skin id to select from at random ( uses pretty much all of them except the cj one). This method will work but it is not recomended as eAi pointed out. This is especially true if you are writing a game mode that you want to make more than one map for, but if thats not the case and its just for you and not for release to the comunity then its up to you as it will solve your problem anyway. ps. if eAi (or anyone that can tell me) reads this , please can you tell me if its possible, or how to, use randInt or math.random to spawn players, vehicles and pickups in a .map file , as this is a very useful function but i cant find any mention of it on the wiki and when i try to use it then it does not work unless i just do it in the .lua as above , but I want to use this function in a new map for an existing game mode. 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