08.06.2012, 22:12
Hello everyone. Is there anyway of making random skins depending on if you're a male or female? If so, can you show me?
switch(random(amount of female skins))
{
case 0: SetPlayerSkin// Skin 1 and so on.
}
// Same goes for males.
new gMaleSkins[] = {0,1,2,3,4,5,6,7,8,14,15,16, /* etc, etc, etc */ };
new gFemaleSkins[] = {9,10,11,12,13,17, /* etc, etc, etc */ };
stock IsMale(skinid)
{
new const Females[] =
{
9,10,11,12,13,31,38,39,40,41,53,54,55,56,63,64,69,75,76,77,85,87,88,89,90,91,92,93,129,130,131,138,139,140,141, 145,148,150,151,
152,157,169,172,178,190,191,192,193,194,195,196,197,198,199,201,205,207,211,214,215,216,218,219,224,225,226, 231,232,233,237,238,
243,244,245,246,251,256,257,263,298
};
for(new i = 0; i < sizeof(Females); i++)
{
if(skinid == Females[i]) return 0;
}
return 1;
}
pawn Код:
|
stock MaleFemale(playerid)
{
new string[100];
format(string, 100, "Please select your gender below:", PlayerName(playerid));
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_MSGBOX, "Male or Female?", string, "Male", "Female");
}
OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_REGISTER)
{
if(response)//male response
{
//function here
}
if(!response)//female response
{
//function here
}
}
}
pawn Код:
|
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case DIALOG_REGISTER:
{
if(response)// male response
{
// male code
}
// female code here
return 1;
}
}
return 1;
}
if(response)// male response
{
PlayerSkin[playerid] = maleArray[random(sizeof(maleArray))];
}
Make two arrays:
pawn Код:
|
pawn Код:
|
new FemaleSkins[] = {
9,10,11,12,13,31,38,39,40,41,53,54,55,56,63,64,69,75,76,77,85,87,88,89,90,91,92,93,129,130,131,138,139,140,141,145,148,150,151,
152,157,169,172,178,190,191,192,193,194,195,196,197,198,199,201,205,207,211,214,215,216,218,219,224,225,226,231,232,233,237,238,
243,244,245,246,251,256,257,263,298
};
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case DIALOG_REGISTER:
{
if(response)
{
new rand = random(sizeof(MaleSkins));
SetPlayerSkin(playerid, MaleSkins[rand]);
}
else
{
new rand = random(sizeof(FemaleSkins));
SetPlayerSkin(playerid, FemaleSkins[rand]);
}
}
}
return 1;
}