SA-MP Forums Archive
Setplayerskin Question - 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: Setplayerskin Question (/showthread.php?tid=387954)



Setplayerskin Question - jakejohnsonusa - 27.10.2012

Is there a way to use the setplayerskin to set a random skin ID of a set of ID's. What I want is on my duty system is sets Police Officers currently with skin 280. But it isn't very RP to have every officer look the same... so is there a way to have it choose one of six skins for each person.

Here's what I mean the code might look like (Obviosly this isn't it... thats what I'm asking for):
RandomSetPlayerSkin(playerid, 265,266,267,280,281,282);


Please help with this hopefully simple question.
Thanks: jakejohnsonusa


Re: Setplayerskin Question - Catalyst- - 27.10.2012

pawn Код:
switch(random(6))
{
    case 0: SetPlayerSkin(playerid, 265);
    case 1: SetPlayerSkin(playerid, 266);
    case 2: SetPlayerSkin(playerid, 267);
    case 3: SetPlayerSkin(playerid, 280);
    case 4: SetPlayerSkin(playerid, 281);
    case 5: SetPlayerSkin(playerid, 282);
}



Re: Setplayerskin Question - jakejohnsonusa - 27.10.2012

Thanks so much +1 Rep. I will test it now to see if it works


Re: Setplayerskin Question - jakejohnsonusa - 27.10.2012

Wait what EXACTLY should I write instead of SetPlayerSkin(playerid, 265) ?
Do I replace it completely with what you put, or do I still include the SetPlayerSkin text?

Please help with this stupid question,
Thanks: jakejohnsonusa


Re: Setplayerskin Question - jakejohnsonusa - 27.10.2012

Anyone know? Please... How exactly should I write this? Shouldn't I still have somthing about playerskin in there?


Re: Setplayerskin Question - [HK]Ryder[AN] - 27.10.2012

Heres what you need to do
pawn Код:
new rand = random(6)//change it to the number of skins you want
switch(rand)
{
    case 0: SetPlayerSkin(playerid, 265);
    case 1: SetPlayerSkin(playerid, 266);
    case 2: SetPlayerSkin(playerid, 267);
    case 3: SetPlayerSkin(playerid, 280);
    case 4: SetPlayerSkin(playerid, 281);
    case 5: SetPlayerSkin(playerid, 282);
}
What this does is create a variable and generates a pseudo-random number out of it.
If the number is 0 skin 265 is applied and so on..


Re: Setplayerskin Question - YoYo123 - 27.10.2012

I don't understand your current question.. There is only one function that can set a player's skin and that is SetPlayerSkin(playerid, skinid). The Random concept means: Let's take 6 numbers from 0 to 5 and chooose a random number between those. If 0 is chosen, than SetPlayerSkin(playerid, skinid), if 1 is chosen, set it to another skin etc.

EDIT: If you still don't understand tell me exactly what you don't understand or we won't understand you either.


Re: Setplayerskin Question - jakejohnsonusa - 27.10.2012

Quote:
Originally Posted by [HK]Ryder[AN]
Посмотреть сообщение
Heres what you need to do
pawn Код:
new rand = random(6)//change it to the number of skins you want
switch(rand)
{
    case 0: SetPlayerSkin(playerid, 265);
    case 1: SetPlayerSkin(playerid, 266);
    case 2: SetPlayerSkin(playerid, 267);
    case 3: SetPlayerSkin(playerid, 280);
    case 4: SetPlayerSkin(playerid, 281);
    case 5: SetPlayerSkin(playerid, 282);
}
What this does is create a variable and generates a pseudo-random number out of it.
If the number is 0 skin 265 is applied and so on..
This is exactly what I meant thanks! It was hard to word right... +1 REP thanks!


Re: Setplayerskin Question - _Khaled_ - 27.10.2012

OR If you want it random through out all skins
PHP код:
new srand =random(299); //Max skin is 299
SetPlayerSkin(playeridsrand);