DjMixCuma Posted October 14, 2012 Share Posted October 14, 2012 Hello, how to create random skins on player join?? Link to comment
Baseplate Posted October 14, 2012 Share 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 Link to comment
DjMixCuma Posted October 14, 2012 Author Share 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. Link to comment
Baseplate Posted October 14, 2012 Share Posted October 14, 2012 It should be workin no player will crash, try it Link to comment
denny199 Posted October 15, 2012 Share 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) Link to comment
myonlake Posted October 16, 2012 Share 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. Link to comment
Castillo Posted October 17, 2012 Share 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 ) Link to comment
myonlake Posted October 17, 2012 Share 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. Link to comment
DjMixCuma Posted October 17, 2012 Author Share Posted October 17, 2012 addEventHandler("onPlayerSpawn", getRootElement(), function() setElementModel(source, math.random(312)) end) WORKING !! Link to comment
myonlake Posted October 17, 2012 Share Posted October 17, 2012 addEventHandler("onPlayerSpawn", getRootElement(), function() setElementModel(source, math.random(312)) end) WORKING !! Not really. Read posts above. 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