Help with skin sorting.
#1

So I am making a gamemode for a server, and I am making it so that if you are a female Caucasian then you have to use a female Caucasian skin. The only problem is that it isn't actually working. I have looked over the code and I can find nothing wrong with it. Here is the code


Here is the dialog for the skin picking

Код:
Dialog:Skin(playerid, response, listitem, inputtext[])
{
	if(response)
	{
	    if(isnull(inputtext))
	    {
	    	ShowDialog(playerid, Show:<Skin>, DIALOG_STYLE_INPUT,"{08088A}Eastside Gaming Roleplay","Please pick the skin you wish to use.\nThis skin must be correct to your gender and race.","Accept","Quit");
      	}
	    else if(strval(inputtext) > 299 || strval(inputtext) < 0)
	    {
    		ShowDialog(playerid, Show:<Skin>, DIALOG_STYLE_INPUT,"{08088A}Eastside Gaming Roleplay","Please pick the skin you wish to use.\nThis skin must be correct to your gender and race.\nPlease pick a skin between 0 - 299.","Accept","Quit");
      	}
      	else if(strlen(inputtext) > 4)
      	{
      		ShowDialog(playerid, Show:<Skin>, DIALOG_STYLE_INPUT,"{08088A}Eastside Gaming Roleplay","Please pick the skin you wish to use.\nThis skin must be correct to your gender and race.\nThe skin should only be a three digit integer.","Accept","Quit");
      	}
      	/*new string[25];
		format(string,sizeof(string),"%i",inputtext);
		new skinid = strval(string);*/
      	//format(skinid,sizeof(skinid),"%i",inputtext);
		/*format(msg, sizeof(msg),"This is your skin: %i",strval(inputtext));
		SCM(playerid, COLOR_RED, msg);*/
	    else if(strcmp(PlayerInfo[playerid][pSex],"Male",true,7))
		{
			if(strcmp(PlayerInfo[playerid][pRace],"Caucasian",true,22))
			{
			    if(!SkinIsWhiteMale(strval(inputtext)))
			    {
			    	GameTextForPlayer(playerid,"~r~The skin you have choosen is one that does not fit with your race/sex.",10000,3);
					ShowDialog(playerid, Show:<Skin>, DIALOG_STYLE_INPUT,"{08088A}Eastside Gaming Roleplay","Please pick the skin you wish to use.\nThis skin must be correct to your gender and race.\nPlease double check that the skin is the right Gender/Race","Register","Quit");
   				}
			    else
				{
					PlayerInfo[playerid][pSkin] = strval(inputtext);
			        BeginTutorial(playerid);
				}
			}
		}
		else if(strcmp(PlayerInfo[playerid][pSex],"Female",true,7))
		{
		    if(strcmp(PlayerInfo[playerid][pRace],"Caucasian",true,22))
		    {
		        if(SkinIsWhiteFemale(strval(inputtext)))
				{
				    PlayerInfo[playerid][pSkin] = strval(inputtext);
				    {
				        BeginTutorial(playerid);
				    }
				}
				else
				{
					GameTextForPlayer(playerid,"~r~The skin you have choosen is one that does not fit with your race/sex.",10000,3);
					ShowDialog(playerid, Show:<Skin>, DIALOG_STYLE_INPUT,"{08088A}Eastside Gaming Roleplay","Please pick the skin you wish to use.\nThis skin must be correct to your gender and race.\nPlease double check that the skin is the right Gender/Race","Register","Quit");
   				}
			}
		}
	}
	else
	{
	    Kick(playerid);
	}
	return 1;
}
Here is the stocks for checking if the skin is a white male/female

Код:
stock SkinIsWhiteMale(skinid)
{
	if(skinid == 1 && skinid == 2 && skinid == 3 && skinid == 23 && skinid == 26 && skinid == 27 && skinid == 29 && skinid == 32 && skinid == 33 && skinid == 34 && skinid == 35)
		return true;
	else if(skinid == 37 && skinid == 42 && skinid == 45 && skinid == 52 && skinid == 53 && skinid == 59 && skinid == 60 && skinid == 61 && skinid == 62 && skinid == 68 && skinid == 68)
	    return true;
	else if(skinid == 70 && skinid == 71 && skinid == 72 && skinid == 73 && skinid == 78 && skinid == 81 && skinid == 82 && skinid == 94 && skinid == 95 && skinid == 96 && skinid == 97)
		return true;
	else if(skinid == 98 && skinid == 99 && skinid == 100 && skinid == 101 && skinid == 111 && skinid == 112 && skinid == 113 && skinid == 119 && skinid == 124 && skinid == 125 && skinid == 126)
	    return true;
	else if(skinid == 127 && skinid == 128 && skinid == 132 && skinid == 133 && skinid == 135 && skinid == 137 && skinid == 146 && skinid == 147 && skinid == 153 && skinid == 154 && skinid == 158)
	    return true;
	else if(skinid == 159 && skinid == 160 && skinid == 161 && skinid == 162 && skinid == 164 && skinid == 165 && skinid == 167 && skinid == 171 && skinid == 177 && skinid == 179 && skinid == 181)
		return true;
	else if(skinid == 187 && skinid == 188 && skinid == 189 && skinid == 200 && skinid == 202 && skinid == 204 && skinid == 206 && skinid == 209 && skinid == 210 && skinid == 212 && skinid == 213)
	    return true;
	else if(skinid == 217 && skinid == 230 && skinid == 234 && skinid == 234 && skinid == 235 && skinid == 236 && skinid == 239 && skinid == 240 && skinid == 241 && skinid == 242 && skinid == 247)
		return true;
	else if(skinid == 248 && skinid == 250 && skinid == 254 && skinid == 255 && skinid == 258 && skinid == 259 && skinid == 261 && skinid == 264 && skinid == 266 && skinid == 268 && skinid == 272)
	    return true;
	else if(skinid == 276 && skinid == 277 && skinid == 279 && skinid == 280 && skinid == 281 && skinid == 282 && skinid == 283 && skinid == 285 && skinid == 286 && skinid == 287 && skinid == 288)
		return true;
	else if(skinid == 289 && skinid == 290 && skinid == 291 && skinid == 294 && skinid == 295 && skinid == 299)
	    return true;
	else
	    return false;
}
stock SkinIsWhiteFemale(skinid)
{
	if(skinid == 39 && skinid == 53 && skinid == 55 && skinid == 75 && skinid == 77 && skinid == 85 && skinid == 87 && skinid == 88 && skinid == 89 && skinid == 90 && skinid == 91)
	    return 0;
	if(skinid == 92 && skinid == 93 && skinid == 130 && skinid == 131 && skinid == 138 && skinid == 140 && skinid == 145 && skinid == 151 && skinid == 152 && skinid == 157 && skinid == 172)
	    return 0;
	if(skinid == 178 && skinid == 192 && skinid == 193 && skinid == 194 && skinid == 196 && skinid == 197 && skinid == 198 && skinid == 199 && skinid == 201 && skinid == 211 && skinid == 214)
	    return 0;
	if(skinid == 216 && skinid == 231 && skinid == 231 && skinid == 233 && skinid == 237 && skinid == 246 && skinid == 251 && skinid == 257)
		return 0;
	else
	    return 1;
}
Also, those are all the skins for white males/females. If anyone needs them there they are feel free to use them (If they are correctly formatted so you can use them that is.)

Thank you for anyone who can and does help!
Reply
#2

I have a way you can sort the skins out, see, if you have the mSelection include, you can make different txt files, one for male, one for female, and put all the id's in those. So like:

I could link you to the include and show you exactly how to use it if you'd like

Код:
#define sendClientMessage   SendClientMessage //I like my way of doing it, so fuck logic ok? =3
new femaleList = mS_INVALID_LISTID;
new maleList = mS_INVALID_LISTID;

CMD:clothes(playerid) {
    if(IsPlayerInRangeOfPoint(playerid,1.5, 211.94, -100.89, 1005.25)) {
		if(playerInfo[playerid][pSex] == 1) { //We'll use this for female right now
			ShowModelSelectionMenu(playerid, femaleList, "Select Skin");
			return 1;
		}
		else if(playerInfo[playerid][pSex] == 2) {
		    ShowModelSelectionMenu(playerid, maleList, "Select Skin");
			return 1;
		}
	} else {
	    sendClientMessage(playerid, COLOR_LIGHTRED, "(( You are not at binco! ))");
	}
	return 1;
}
Reply
#3

Quote:
Originally Posted by ******
Посмотреть сообщение
OK, quick test:

pawn Код:
if(skinid == 1 && skinid == 2)
        return true;
For what value of "skinid" does this check pass?
The value skinid is what ever the player would put in as wanting, as seen in the dialog.
Reply
#4

Quote:
Originally Posted by Jay_Dixon
Посмотреть сообщение
I have a way you can sort the skins out, see, if you have the mSelection include, you can make different txt files, one for male, one for female, and put all the id's in those. So like:

I could link you to the include and show you exactly how to use it if you'd like

Код:
#define sendClientMessage   SendClientMessage //I like my way of doing it, so fuck logic ok? =3
new femaleList = mS_INVALID_LISTID;
new maleList = mS_INVALID_LISTID;

CMD:clothes(playerid) {
    if(IsPlayerInRangeOfPoint(playerid,1.5, 211.94, -100.89, 1005.25)) {
		if(playerInfo[playerid][pSex] == 1) { //We'll use this for female right now
			ShowModelSelectionMenu(playerid, femaleList, "Select Skin");
			return 1;
		}
		else if(playerInfo[playerid][pSex] == 2) {
		    ShowModelSelectionMenu(playerid, maleList, "Select Skin");
			return 1;
		}
	} else {
	    sendClientMessage(playerid, COLOR_LIGHTRED, "(( You are not at binco! ))");
	}
	return 1;
}
Yea I do like how that one looks, and does it only show the selection with the skin ids that you put into it? Like could I make list for White females/males, black females/males, etc.
Reply
#5

lol no
there is problem wiht your stocks
in stocks in the "if" condition you have put "&&" symbol
thats totally wrong
replace it with " || "" symbol

how can skinid have multiple values?not possible, unless you are passing value by memory location which is not supported in PAWN i think
Reply
#6

Quote:
Originally Posted by BroZeus
Посмотреть сообщение
lol no
there is problem wiht your stocks
in stocks in the "if" condition you have put "&&" symbol
thats totally wrong
replace it with " || "" symbol

how can skinid have multiple values?not possible, unless you are passing value by memory location which is not supported in PAWN i think
I had used the && because of the fact that before when I had tried to use || with another stock in a latter time it would not allow me and any value I gave it would mark it as being wrong. I'll give it a try though.
Reply
#7

Quote:
Originally Posted by BroZeus
Посмотреть сообщение
lol no
there is problem wiht your stocks
in stocks in the "if" condition you have put "&&" symbol
thats totally wrong
replace it with " || "" symbol

how can skinid have multiple values?not possible, unless you are passing value by memory location which is not supported in PAWN i think
Yea, using || instead only made the dialog go away and nothing happened.
Reply
#8

Quote:
Originally Posted by ******
Посмотреть сообщение
No, I meant what specific value is both 1 AND 2 at the same time?
1 and 2 are just place holders, skinid would be what ever the user inputs.
Reply
#9

pawn Код:
stock SkinIsWhiteMale(skinid)
{
    switch(skinid)
    {
        case 1 .. 3, 23, 26, 27, 29, 32 .. 35, 37, 42, 45, 52, 53, 59 .. 62, 68, 70 .. 73, 78, 81, 82, 94 .. 101, 111 .. 113, 119, 124 .. 128: return 1;
        case 132, 133, 135, 137, 146, 147, 153, 154, 158 .. 162, 164, 165, 167, 171, 177, 179, 181, 187 .. 189, 200, 202, 204, 206, 209, 210, 212, 213: return 1;
        case 217, 230, 234 .. 236, 239 .. 242, 247, 248, 250, 254, 255, 258, 259, 261, 264, 266, 268, 272, 276, 277, 279 .. 283, 285 .. 291, 294, 295, 299: return 1;
    }
    return 0;
}

stock SkinIsWhiteFemale(skinid)
{
    switch(skinid)
    {
        case 39, 53, 55, 75, 77, 85, 87, 92, 93, 130, 131, 138, 140, 145, 151, 152, 157, 172, 178, 192 .. 194, 196 .. 199: return 1;
        case 201, 211, 214, 216, 231, 233, 237, 246, 251, 257: return 1;
    }
    return 0;
}
pawn Код:
Dialog:Skin(playerid, response, listitem, inputtext[])
{
    if(response)
    {
        if(isnull(inputtext)) return ShowDialog(playerid, Show:<Skin>, DIALOG_STYLE_INPUT,"{08088A}Eastside Gaming Roleplay","Please pick the skin you wish to use.\nThis skin must be correct to your gender and race.","Accept","Quit");
        new var = strval(inputtext);
        if(!(0 <= var <= 299)) return ShowDialog(playerid, Show:<Skin>, DIALOG_STYLE_INPUT,"{08088A}Eastside Gaming Roleplay","Please pick the skin you wish to use.\nThis skin must be correct to your gender and race.\nPlease pick a skin between 0 - 299.","Accept","Quit");
        if(strlen(inputtext) > 4) ShowDialog(playerid, Show:<Skin>, DIALOG_STYLE_INPUT,"{08088A}Eastside Gaming Roleplay","Please pick the skin you wish to use.\nThis skin must be correct to your gender and race.\nThe skin should only be a three digit integer at most.","Accept","Quit");
        if(!strcmp(PlayerInfo[playerid][pSex], "Male", true))
        {
            if(!strcmp(PlayerInfo[playerid][pRace], "Caucasian", true))
            {
                if(!SkinIsWhiteMale(var))
                {
                    GameTextForPlayer(playerid,"~r~The skin you have choosen is one~n~that does not fit with your race/sex.",10000,3);
                    return ShowDialog(playerid, Show:<Skin>, DIALOG_STYLE_INPUT,"{08088A}Eastside Gaming Roleplay","Please pick the skin you wish to use.\nThis skin must be correct to your gender and race.\nPlease double check that the skin is the right Gender/Race","Register","Quit");
                }
            }
        }
        else if(!strcmp(PlayerInfo[playerid][pSex], "Female", true))
        {
            if(!strcmp(PlayerInfo[playerid][pRace], "Caucasian", true))
            {
                if(!SkinIsWhiteFemale(var))
                {
                    GameTextForPlayer(playerid, "~r~The skin you have choosen is one~n~that does not fit with your race/sex.",10000,3);
                    return ShowDialog(playerid, Show:<Skin>, DIALOG_STYLE_INPUT,"{08088A}Eastside Gaming Roleplay","Please pick the skin you wish to use.\nThis skin must be correct to your gender and race.\nPlease double check that the skin is the right Gender/Race","Register","Quit");
                }
            }
        }
        PlayerInfo[playerid][pSkin] = var;
        BeginTutorial(playerid);
    }
    else Kick(playerid);
    return 1;
}
There was a lot wrong with this code. The main issue was 'strcmp' wasn't being used properly in any circumstance. STRCMP returns '0' if the true strings match. (Read more here: strcmp)

Even when a player didn't have the right skin, the code would still continue because you didn't use 'return' to stop the code from proceeding. (Read more here: Return)

--

Just take a deep look at the code and try to see how it works, and I would suggest you start reading up on the basics of the pawn language, whether it be through the pawn_lang.pdf or SA-MP wiki.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)