DjMixCuma Posted October 14, 2012 Posted October 14, 2012 Hello, how to create random skins on player join??
Baseplate Posted October 14, 2012 Posted October 14, 2012 (edited) use function randomSkin () setElementModel(source, math.random(7,288)) end addEventHandler("onPlayerJoin", root, randomSkin) Edited October 14, 2012 by Guest
DjMixCuma Posted October 14, 2012 Author Posted October 14, 2012 Also I ran into this idea, but how will the id of the Skin, which is not programmed (san andreas) it will crash player.
Baseplate Posted October 14, 2012 Posted October 14, 2012 It should be workin no player will crash, try it
denny199 Posted October 15, 2012 Posted October 15, 2012 ... it's easier to change your'e spawn script. syntax spawnplayer: spawnPlayer ( player thePlayer, float x, float y, float z, [ int rotation = 0, int skinID = 0, int interior = 0, int dimension = 0, team theTeam = nil ] ) as you can see it's supported skinID changing, so change the skinID to math.random (7,288)
myonlake Posted October 16, 2012 Posted October 16, 2012 Why from 7 to 288? There are skins from 0 to over 300. local fit = false; addEventHandler("onPlayerJoin", root, function() spawnPlayer(source, 0, 0, 3); while(fit == false) do if(setElementModel(source, math.random(0, 312))) then fit = true; end end end ) Not tested.
Castillo Posted October 17, 2012 Posted October 17, 2012 Is easier to use: getValidPedModels to get all valid skin models. Also, the spawnPlayer function has a skin argument. addEventHandler ( "onPlayerJoin", root, function ( ) spawnPlayer ( source, 0, 0, 3, 0, getValidPedModels ( ) [ math.random ( #getValidPedModels ( ) ) ] ) end )
myonlake Posted October 17, 2012 Posted October 17, 2012 Oh, I completely forgot that we had that valid skins functions, nice. Oh yes, spawnPlayer does have a skin argument, but I tried to make the skin check a little more dedicated.
DjMixCuma Posted October 17, 2012 Author Posted October 17, 2012 addEventHandler("onPlayerSpawn", getRootElement(), function() setElementModel(source, math.random(312)) end) WORKING !!
myonlake Posted October 17, 2012 Posted October 17, 2012 addEventHandler("onPlayerSpawn", getRootElement(), function() setElementModel(source, math.random(312)) end) WORKING !! Not really. Read posts above.
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