Random Skin For Initial Spawn?
#1

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
Reply
#2

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

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?
Reply
#4

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)