Jump to content

Random Skins


DjMixCuma

Recommended Posts

Posted

... 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)

Sometimes I dream about cheese

Posted

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.

If I helped you, please click the like button on the right ;) Thanks!

Posted

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 
) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

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.

If I helped you, please click the like button on the right ;) Thanks!

Posted
addEventHandler("onPlayerSpawn", getRootElement(), function() 
    setElementModel(source, math.random(312)) 
end) 

WORKING !!

Not really. Read posts above.

If I helped you, please click the like button on the right ;) Thanks!

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...