Setplayerskin Question
#1

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

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);
}
Reply
#3

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

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

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

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

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.
Reply
#8

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!
Reply
#9

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


Forum Jump:


Users browsing this thread: 2 Guest(s)