Problem with Male Skin (Roleplay Server)
#1

I got a problem in my script. When the player spawn, if the player choose male, the skin that spawned is female skin. Can anyone help me?

Code:
if(RegistrationStep[playerid] != 0)
	{
	    if(dialogid == REGISTERSEX)
	    {
		    if(response)
		    {
		        new stringdiag[410];
				for(new x=18;x<99;x++)
				{
					format(stringdiag, sizeof(stringdiag), "%s%d\n", stringdiag, x);
				}
			    if(listitem == 0)
			    {
					PlayerInfo[playerid][pSex] = 1;
					SendClientMessageEx(playerid, COLOR_LIGHTRED, "Alright, so you're a male.");
					ShowPlayerDialog(playerid, REGISTERAGE, DIALOG_STYLE_LIST, "{33CCFF}What is your characters age? - www.usa-rp.cf", stringdiag, "Submit", "");
					RegistrationStep[playerid] = 2;
				}
				else
				{
					PlayerInfo[playerid][pSex] = 2;
					SendClientMessageEx(playerid, COLOR_LIGHTRED, "Alright, so you're a female.");
					ShowPlayerDialog(playerid, REGISTERAGE, DIALOG_STYLE_LIST, "{33CCFF}What is your characters age? - www.usa-rp.cf", stringdiag, "Submit", "");
					RegistrationStep[playerid] = 2;
				}
			}
			else
			{
			    ShowPlayerDialog(playerid, REGISTERSEX, DIALOG_STYLE_LIST, "{33CCFF}Is your character male or female? - www.usa-rp.cf", "Male\nFemale", "Submit", "");
			}
		}
Reply
#2

Show us the snippet on where you spawn and get the skin?
Reply
#3

Code:
if(dialogid == DIALOG_SPAWN)
    {
		if(response || !response)
		{
			
			for(new x;x<10000;x++)
						{
							new rand=random(300);
							if(PlayerInfo[playerid][pSex] == 0)
							{
								if(IsValidSkin(rand))
								{
									PlayerInfo[playerid][pModel] = rand;
									SetPlayerSkin(playerid, rand);
									break;
								}
							}
							else
							{
								if(IsFemaleSkin(rand))
								{
									PlayerInfo[playerid][pModel] = rand;
									SetPlayerSkin(playerid, rand);
									break;
								}
							}
						}
Reply
#4

More code

Code:
stock IsValidSkin(skinid)
{
	if (skinid < 0 || skinid > 299)
	    return 0;

	switch (skinid)
	{
	    case
		0, 69, 123, 147, 163, 21, 24, 143, 71,
		156, 176, 177, 165, 166, 275, 265, 266, 
		267, 269, 270, 271, 274, 276, 277, 278, 
		279, 280, 281, 282, 283, 284, 285, 286, 
		287, 288, 294, 296, 297: return 0;
	}

	return 1;
}

stock IsFemaleSpawnSkin(skinid)
{
	switch (skinid)
	{
	    case
		9, 11, 12, 13, 31, 38, 39, 40, 41, 53, 54,
		55, 56, 65, 76, 77, 89, 91, 93, 129, 130,
		131, 141, 148, 150, 151, 157, 169, 172, 190,
		191, 192, 193, 194, 195, 196, 197, 198, 199,
		211, 214, 215, 216, 218, 219, 224, 225, 226,
		231, 232, 233, 263, 298: return 1;
	}

	return 0;
}

stock IsFemaleSkin(skinid)
{
	switch (skinid)
	{
	    case
		9, 11, 12, 13, 31, 38, 39, 40, 41, 53, 54, 55,
		56, 63, 64, 65, 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: return 1;
	}

	return 0;
}
Reply
#5

Please help anyone
Reply
#6

This if-statement is unnecessary as it's true all the time, you can remove it:

pawn Code:
if(response || !response)
If you want to set a skin by gender then organise your skins in arrays. Then you can take the size of the array and select a random skin from this array. This way you can set the skin with SetPlayerSkin() without having to check if it's a female or male skin in the first place:

pawn Code:
new const maleSkins[] = {0, 1 /* , ... */};
new const femaleSkins[] = {9, 10 /* , ... */};

switch(PlayerInfo[playerid][pSex]) {
    case 2: {
        PlayerInfo[playerid][pModel] = femaleSkins[random(sizeof(femaleSkins))];
        SetPlayerSkin(playerid, PlayerInfo[playerid][pModel]);
    }
    default: {
        PlayerInfo[playerid][pModel] = maleSkins[random(sizeof(maleSkins))];
        SetPlayerSkin(playerid, PlayerInfo[playerid][pModel]);
    }
}
Reply
#7

Quote:
Originally Posted by Campbell-
View Post
This if-statement is unnecessary as it's true all the time, you can remove it:

pawn Code:
if(response || !response)
If you want to set a skin by gender then organise your skins in arrays. Then you can take the size of the array and select a random skin from this array. This way you can set the skin with SetPlayerSkin() without having to check if it's a female or male skin in the first place:

pawn Code:
new const maleSkins[] = {0, 1 /* , ... */};
new const femaleSkins[] = {9, 10 /* , ... */};

switch(PlayerInfo[playerid][pSex]) {
    case 2: {
        PlayerInfo[playerid][pModel] = femaleSkins[random(sizeof(femaleSkins))];
        SetPlayerSkin(playerid, PlayerInfo[playerid][pModel]);
    }
    default: {
        PlayerInfo[playerid][pModel] = maleSkins[random(sizeof(maleSkins))];
        SetPlayerSkin(playerid, PlayerInfo[playerid][pModel]);
    }
}
Getting error
Code:
E:\samp7777\samp7777\gamemodes\USA-RP.pwn(5365) : error 010: invalid function or declaration
E:\samp7777\samp7777\gamemodes\USA-RP.pwn(5366) : error 010: invalid function or declaration
E:\samp7777\samp7777\gamemodes\USA-RP.pwn(5370) : error 010: invalid function or declaration
E:\samp7777\samp7777\gamemodes\USA-RP.pwn(128010) : warning 203: symbol is never used: "femaleSkins"
E:\samp7777\samp7777\gamemodes\USA-RP.pwn(128010) : warning 203: symbol is never used: "maleSkins"
Any other idea or solution?
Reply
#8

No one can help me?
Reply
#9

bump
Reply
#10

Rapid bumper.
Nice.

Anyway,, Show part of codes where female and male skin is.
Reply
#11

Quote:
Originally Posted by Bingo
Посмотреть сообщение
Rapid bumper.
Nice.

Anyway,, Show part of codes where female and male skin is.
I think here
Код:
stock IsValidSkin(skinid)
{
	if (skinid < 0 || skinid > 299)
	    return 0;

	switch (skinid)
	{
	    case
		0, 69, 123, 147, 163, 21, 24, 143, 71,
		156, 176, 177, 165, 166, 275, 265, 266, 
		267, 269, 270, 271, 274, 276, 277, 278, 
		279, 280, 281, 282, 283, 284, 285, 286, 
		287, 288, 294, 296, 297: return 0;
	}

	return 1;
}

stock IsFemaleSpawnSkin(skinid)
{
	switch (skinid)
	{
	    case
		9, 11, 12, 13, 31, 38, 39, 40, 41, 53, 54,
		55, 56, 65, 76, 77, 89, 91, 93, 129, 130,
		131, 141, 148, 150, 151, 157, 169, 172, 190,
		191, 192, 193, 194, 195, 196, 197, 198, 199,
		211, 214, 215, 216, 218, 219, 224, 225, 226,
		231, 232, 233, 263, 298: return 1;
	}

	return 0;
}

stock IsFemaleSkin(skinid)
{
	switch (skinid)
	{
	    case
		9, 11, 12, 13, 31, 38, 39, 40, 41, 53, 54, 55,
		56, 63, 64, 65, 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: return 1;
	}

	return 0;
}
Reply
#12

bump
Reply
#13

Quote:
Originally Posted by Y_Less
Посмотреть сообщение
You save their skin as "1" or "2", then check if it is "0", which it never is.
Can you help me where is the false line and how to fix it?
Reply
#14

bump
Reply
#15

bump
Reply
#16

bump
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)