SA-MP Forums Archive
Random Skin For Initial Spawn? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Random Skin For Initial Spawn? (/showthread.php?tid=340119)



Random Skin For Initial Spawn? - stuoyto - 06.05.2012

Hello forums members,

I am creating my own game mode and so far its going well. However i have come across a small obstacle and that is that i do not know how to allocate a random skin to a player for their initial spawn. I have already set up the saving system so that the skin they last wore is saved when they disconnect and loaded when they connect.

I would appreciate if anyone could help me, should you need a section of code to analise just ask.


Stuoyto


Re: Random Skin For Initial Spawn? - ReneG - 06.05.2012

pawn Код:
public OnPlayerSpawn(playerid)
{
    new rand=random(299);
    SetPlayerSkin(playerid, rand);
    return 1;
}
You would have to account for the invalid skins ofc.


Re: Random Skin For Initial Spawn? - stuoyto - 06.05.2012

Thank you VincentDunn you have been very helpful, just one more question. Accounting for the invalid skins? How do i do that and can it cause issues?


AW: Random Skin For Initial Spawn? - Nero_3D - 06.05.2012

As there is only one invalid skin left, this should be enough

pawn Код:
new
    skin = random(299)
;
if(74 <= skin) {
    skin += 1;
}