heavy air Posted February 18, 2008 Posted February 18, 2008 HELLO i am trying to define what skins are randomly chosen when u spawn a player i only like about 20 - 25 of the skins and would like to use just them i use broph/fr gamemode and i have found the spawnpoint but i can only set it to choose between a single range of numbers EG : 10 - 20 / 21 - 30 and so on what i want to do is set 16, 33, 61, 164, 165, and so on im not sure how to put this into the line i can use the randInt command but it only seems to accept two numbers to create skins i really want to be able to set individual numbers into the field so it will only spawn with the skins i set but still at random MTA the gift that keeps on giving ALL! HAIL! THE MTA TEAM!!!
50p Posted February 18, 2008 Posted February 18, 2008 local spawn_skins = { 16, 33, 61, 164, 165 } local rnd = randInt( 1, #spawn_skins ) setPlayerSkin( player, spawn_skins[ rnd ] ) It should choose a random skin from the spawn_skins table and then set player's skin. - MTA Script Editor - Ask your scripting questions properly, please. - 50p's public resources - Meta.xml - what is it for? How is it possible LOL
heavy air Posted February 18, 2008 Author Posted February 18, 2008 sweet thank u very much will give it a go EDIT : seem to be having trouble with the syntax should i put this within the spawn function or run it as a separate function it seems to be a problem with this local spawn_skins = { 16, 33, 61, 164, 165 } EDIT 2 : sorry i just noticed i had some of the characters wrong but have got them right now no longer gives an error but just uses default cj skin now this is from the broph script and i think ive got it setup right but i guess not function spawnThePlayer ( player ) local b = spawnPlayer ( player, -711+randInt(1,5), 957+randInt(5,9), 12.4, 90 ) local spawn_skins = { 16, 33, 61, 164, 165 } local rnd = randInt( 1, #spawn_skins ) if not b then spawnThePlayer ( player ) setPlayerSkin( player, spawn_skins[ rnd ] ) return end fadeCamera(player,true) end MTA the gift that keeps on giving ALL! HAIL! THE MTA TEAM!!!
50p Posted February 19, 2008 Posted February 19, 2008 Please, use tags so that the code is readable. Thanks. Try this one: function spawnThePlayer ( player ) local spawn_skins = { 16, 33, 61, 164, 165 } local rnd = randInt( 1, #spawn_skins ) local b = spawnPlayer ( player, -711+randInt(1,5), 957+randInt(5,9), 12.4, 90, spawn_skins[ rnd ] ) if not b then spawnThePlayer ( player ) return end fadeCamera(player,true) end - MTA Script Editor - Ask your scripting questions properly, please. - 50p's public resources - Meta.xml - what is it for? How is it possible LOL
heavy air Posted February 19, 2008 Author Posted February 19, 2008 sorry forgot about the code tab thanx for the help though EDIT : awesome works perfect thank u very much MTA the gift that keeps on giving ALL! HAIL! THE MTA TEAM!!!
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