[HELP] Skin System!
#1

Hey all, i want to ask something and i need help from you all...

First this is my skin code :
Код:
	if(strcmp(cmd, "/clothes", true) == 0)
	{
		if(IsPlayerConnected(playerid))
		{
			if(IsAtClothShop(playerid))
			{
				tmp = strtok(cmdtext, idx);
				if(!strlen(tmp))
				{
					SendClientMessage(playerid, COLOR_WHITE,"USAGE: /clothes [Skin ID]");
					return 1;
				}
				new level = strval(tmp);
				if(level == 0 || level == 70 || level == 71 || level == 147 || level == 163 || level == 164 || level == 165 || level == 211 || level == 252 || level == 265 || level == 266 || level == 266 || level == 267 || level >= 274 && level <= 288)
				{
					SendClientMessage(playerid , COLOR_GRAD2, "That skin is not allowed !");
					return 1;
				}
				GivePlayerMoney(playerid,-150);
				SafeGivePlayerMoney(playerid, - 150);
				if(!IsValidSkin(level))
				return SendClientMessage(playerid, COLOR_GREY, "Wrong skin ID!");
				PlayerInfo[playerid][pModel] = level;
				SetPlayerSkin(playerid, PlayerInfo[playerid][pModel]);
			}
		}
		return 1;
	}
The problem is not at there, i want make something unique like this :
- If my sex is male, so when i buy a female skin that not allowed...
- Same like that, if my sex is female i can't buy male skin...

Somebody can edit my code, for do like that?
Reply
#2

pawn Код:
if(strcmp(cmd, "/clothes", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(IsAtClothShop(playerid))
            {
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, COLOR_WHITE,"USAGE: /clothes [Skin ID]");
                    return 1;
                }
                new level = strval(tmp);
                if(PlayerInfo[playerid][pSex] == 1)
                {
                    if(level == femaleskin1 || level == femaleskin2) // add more female skins in femalesskin1/2 or add more || level
                    {
                        SendClientMessage(COLOR_CREAM, "Your gender cannot buy those skins.");
                        return 1;
                    }
                }
                else if(PlayerInfo[playerid][pSex] == 2)
                {
                    if(level == maleskin1 || level == maleskin2) // add more male skins in malesskin1/2 or add more || level
                    {
                        SendClientMessage(COLOR_CREAM, "Your gender cannot buy those skins.");
                        return 1;
                    }
                }
                else if(level == 0 || level == 70 || level == 71 || level == 147 || level == 163 || level == 164 || level == 165 || level == 211 || level == 252 || level == 265 || level == 266 || level == 266 || level == 267 || level >= 274 && level <= 288)
                {
                    SendClientMessage(playerid , COLOR_GRAD2, "That skin is not allowed !");
                    return 1;
                }
                GivePlayerMoney(playerid,-150);
                SafeGivePlayerMoney(playerid, - 150);
                if(!IsValidSkin(level))
                return SendClientMessage(playerid, COLOR_GREY, "Wrong skin ID!");
                PlayerInfo[playerid][pModel] = level;
                SetPlayerSkin(playerid, PlayerInfo[playerid][pModel]);
            }
        }
        return 1;
    }
Reply
#3

Quote:
Originally Posted by L.Hudson
Посмотреть сообщение
pawn Код:
if(strcmp(cmd, "/clothes", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(IsAtClothShop(playerid))
            {
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, COLOR_WHITE,"USAGE: /clothes [Skin ID]");
                    return 1;
                }
                new level = strval(tmp);
                if(PlayerInfo[playerid][pSex] == 1)
                {
                    if(level == femaleskin1 || level == femaleskin2) // add more female skins in femalesskin1/2 or add more || level
                    {
                        SendClientMessage(COLOR_CREAM, "Your gender cannot buy those skins.");
                        return 1;
                    }
                }
                else if(PlayerInfo[playerid][pSex] == 2)
                {
                    if(level == maleskin1 || level == maleskin2) // add more male skins in malesskin1/2 or add more || level
                    {
                        SendClientMessage(COLOR_CREAM, "Your gender cannot buy those skins.");
                        return 1;
                    }
                }
                else if(level == 0 || level == 70 || level == 71 || level == 147 || level == 163 || level == 164 || level == 165 || level == 211 || level == 252 || level == 265 || level == 266 || level == 266 || level == 267 || level >= 274 && level <= 288)
                {
                    SendClientMessage(playerid , COLOR_GRAD2, "That skin is not allowed !");
                    return 1;
                }
                GivePlayerMoney(playerid,-150);
                SafeGivePlayerMoney(playerid, - 150);
                if(!IsValidSkin(level))
                return SendClientMessage(playerid, COLOR_GREY, "Wrong skin ID!");
                PlayerInfo[playerid][pModel] = level;
                SetPlayerSkin(playerid, PlayerInfo[playerid][pModel]);
            }
        }
        return 1;
    }
Thank's i will try this...
Reply
#4

When i try that and this is the code (from line 54997 to line 55041):
Код:
//-------------------------[CLOTHES]-------------------------
	if(strcmp(cmd, "/clothes", true) == 0)
	{
		if(IsPlayerConnected(playerid))
		{
			if(IsAtClothShop(playerid))
			{
				tmp = strtok(cmdtext, idx);
				if(!strlen(tmp))
				{
					SendClientMessage(playerid, COLOR_WHITE,"USAGE: /clothes [Skin ID]");
					return 1;
				}
				new level = strval(tmp);
				if(PlayerInfo[playerid][pSex] == 1)
				{
					if(level >= 9 && level <= 13 || level == 31 || level >= 39 && level <= 41 || level >= 53 && level <= 56 || level >= 63 && level <= 65 || level == 69 || level >= 75 && level <= 77 || level == 85 || level >= 87 && level <= 93 || level >= 129 && level <= 131 || level >= 138 && level <= 141 || level == 145 || level == 148 || level >= 150 && level <= 152 || level == 157 || level == 169 || level == 172 || level == 178 || level >= 190 && level <= 199 || level == 201 || level == 205 || level == 207 || level == 211 || level >= 214 && level <= 216 || level >= 218 && level <= 219 || level >=224 && level <= 226 || level >= 231 && level <= 233 || level >= 237 && level <= 238 || level >= 243 && level <= 246 || level == 251 || level >= 256 && level <= 257 || level == 263 || level == 298)
					{
						SendClientMessage(COLOR_CREAM, "You are male, you can't buy female clothes!");
						return 1;
					}
				}
				else if(PlayerInfo[playerid][pSex] == 2)
				{
					if(level >= 14 && level <= 30 || level >= 32 && level <= 38 || level >= 42 && level <= 52 || level >= 57 && level <= 62 || level >= 66 && level <= 68 || level >= 72 && level <= 73 || level >= 78 && level <= 84 || level == 86 || level >= 94 && level <= 128 || level >= 132 && level <= 137 || level >= 142 && level <= 144 || level == 146 || level == 149 || level >= 153 && level <= 156 || level >= 158 && level <= 162 || level >= 165 && level <= 168 || level >= 170 && level <= 171 || level >= 173 && level <= 177 || level >= 179 && level <= 189 || level == 200 || level >= 202 && level <= 204 || level == 206 || level >= 208 && level <= 210 || level >= 212 && level <= 213 || level == 217 || level >= 220 && level <= 223 || level >= 227 && level <= 230 || level >= 234 && level <= 236 || level >= 239 && level <= 242 || level >= 247 && level <= 250 || level >= 253 && level <= 255 || level >= 258 && level <= 262 || level == 264 || level >= 268 && level <= 273 || level >= 289 && level <= 297 || level == 299)
					{
						SendClientMessage(COLOR_CREAM, "You are female, you can't buy male clothes!");
						return 1;
					}
				}
				else if(level == 0 || level == 70 || level == 71 || level == 74 || level == 147 || level == 163 || level == 164 || level == 165 || level == 211 || level == 252 || level == 265 || level == 266 || level == 267 || level >= 274 && level <= 288)
				{
					SendClientMessage(playerid , COLOR_GRAD2, "That clothes is not allowed !");
					return 1;
				}
				GivePlayerMoney(playerid,-150);
				SafeGivePlayerMoney(playerid, - 150);
				if(!IsValidSkin(level))
				return SendClientMessage(playerid, COLOR_GREY, "Wrong skin ID!");
				PlayerInfo[playerid][pModel] = level;
				SetPlayerSkin(playerid, PlayerInfo[playerid][pModel]);
			}
		}
		return 1;
	}
I get 4 error and this is the error:
Quote:

D:\States Roleplay [2012]\gamemodes\STATES.pwn(55012) : error 075: input line too long (after substitutions)
D:\States Roleplay [2012]\gamemodes\STATES.pwn(55016) : error 035: argument type mismatch (argument 2)
D:\States Roleplay [2012]\gamemodes\STATES.pwn(55021) : error 075: input line too long (after substitutions)
D:\States Roleplay [2012]\gamemodes\STATES.pwn(55025) : error 035: argument type mismatch (argument 2)
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.

Please somebody fix this problem, thank's...
Reply
#5

that means pawno cant handle that long line, so, you will need to format the line
this:
pawn Код:
if(level >= 14 && level <= 30 || level >= 32 && level <= 38 || level >= 42 && level <= 52 || level >= 57 && level <= 62 || level >= 66 && level <= 68 || level >= 72 && level <= 73 || level >= 78 && level <= 84 || level == 86 || level >= 94 && level <= 128 || level >= 132 && level <= 137 || level >= 142 && level <= 144 || level == 146 || level == 149 || level >= 153 && level <= 156 || level >= 158 && level <= 162 || level >= 165 && level <= 168 || level >= 170 && level <= 171 || level >= 173 && level <= 177 || level >= 179 && level <= 189 || level == 200 || level >= 202 && level <= 204 || level == 206 || level >= 208 && level <= 210 || level >= 212 && level <= 213 || level == 217 || level >= 220 && level <= 223 || level >= 227 && level <= 230 || level >= 234 && level <= 236 || level >= 239 && level <= 242 || level >= 247 && level <= 250 || level >= 253 && level <= 255 || level >= 258 && level <= 262 || level == 264 || level >= 268 && level <= 273 || level >= 289 && level <= 297 || level == 299)
has to be:
pawn Код:
format(level,sizeof(level),"a bit of the code here");
format(level,sizeof(level),"%s another bit of the code here",level);
and so on
Reply
#6

Quote:
Originally Posted by Jari_Johnson*
Посмотреть сообщение
that means pawno cant handle that long line, so, you will need to format the line
this:
pawn Код:
if(level >= 14 && level <= 30 || level >= 32 && level <= 38 || level >= 42 && level <= 52 || level >= 57 && level <= 62 || level >= 66 && level <= 68 || level >= 72 && level <= 73 || level >= 78 && level <= 84 || level == 86 || level >= 94 && level <= 128 || level >= 132 && level <= 137 || level >= 142 && level <= 144 || level == 146 || level == 149 || level >= 153 && level <= 156 || level >= 158 && level <= 162 || level >= 165 && level <= 168 || level >= 170 && level <= 171 || level >= 173 && level <= 177 || level >= 179 && level <= 189 || level == 200 || level >= 202 && level <= 204 || level == 206 || level >= 208 && level <= 210 || level >= 212 && level <= 213 || level == 217 || level >= 220 && level <= 223 || level >= 227 && level <= 230 || level >= 234 && level <= 236 || level >= 239 && level <= 242 || level >= 247 && level <= 250 || level >= 253 && level <= 255 || level >= 258 && level <= 262 || level == 264 || level >= 268 && level <= 273 || level >= 289 && level <= 297 || level == 299)
has to be:
pawn Код:
format(level,sizeof(level),"a bit of the code here");
format(level,sizeof(level),"%s another bit of the code here",level);
and so on
How is that meaning?

I'm not understand with this :
Quote:

format(level,sizeof(level),"a bit of the code here");

and where i put this code?
Quote:

format(level,sizeof(level),"%s another bit of the code here",level);

Reply
#7

Hey Jari, i try your code and this is the code :
Код:
//-------------------------[CLOTHES]-------------------------
	if(strcmp(cmd, "/clothes", true) == 0)
	{
		if(IsPlayerConnected(playerid))
		{
			if(IsAtClothShop(playerid))
			{
				tmp = strtok(cmdtext, idx);
				if(!strlen(tmp))
				{
					SendClientMessage(playerid, COLOR_WHITE,"USAGE: /clothes [Skin ID]");
					return 1;
				}
				new level = strval(tmp);
				if(PlayerInfo[playerid][pSex] == 1)
				{
					format(string,sizeof(string),"level >= 9 && level <= 13 || level == 31 || level >= 39 && level <= 41 || level >= 53 && level <= 56 || level >= 63 && level <= 65 || level == 69 || level >= 75 && level <= 77 ||");
					format(string,sizeof(string),"%s level == 85 || level >= 87 && level <= 93 || level >= 129 && level <= 131 || level >= 138 && level <= 141 || level == 145 || level == 148 || level >= 150 && level <= 152 ||",string);
					format(string,sizeof(string),"%s level == 157 || level == 169 || level == 172 || level == 178 || level >= 190 && level <= 199 || level == 201 || level == 205 || level == 207 || level == 211 ||",string);
					format(string,sizeof(string),"%s level >= 214 && level <= 216 || level >= 218 && level <= 219 || level >=224 && level <= 226 || level >= 231 && level <= 233 || level >= 237 && level <= 238 ||",string);
					format(string,sizeof(string),"%s level >= 243 && level <= 246 || level == 251 || level >= 256 && level <= 257 || level == 263 || level == 298 ||",string);
					{
						SendClientMessage(playerid, COLOR_CREAM, "You are male, you can't buy female clothes!");
						return 1;
					}
				}
				else if(PlayerInfo[playerid][pSex] == 2)
				{
					format(string,sizeof(string),"level >= 14 && level <= 30 || level >= 32 && level <= 38 || level >= 42 && level <= 52 || level >= 57 && level <= 62 || level >= 66 && level <= 68 || level >= 72 && level <= 73 ||");
					format(string,sizeof(string),"%s level >= 78 && level <= 84 || level == 86 || level >= 94 && level <= 128 || level >= 132 && level <= 137 || level >= 142 && level <= 144 || level == 146 || level == 149 ||",string);
					format(string,sizeof(string),"%s level >= 153 && level <= 156 || level >= 158 && level <= 162 || level >= 165 && level <= 168 || level >= 170 && level <= 171 || level >= 173 && level <= 177 ||",string);
					format(string,sizeof(string),"%s level >= 179 && level <= 189 || level == 200 || level >= 202 && level <= 204 || level == 206 || level >= 208 && level <= 210 || level >= 212 && level <= 213 || level == 217 ||",string);
					format(string,sizeof(string),"%s level >= 220 && level <= 223 || level >= 227 && level <= 230 || level >= 234 && level <= 236 || level >= 239 && level <= 242 || level >= 247 && level <= 250 ||",string);
					format(string,sizeof(string),"%s level >= 253 && level <= 255 || level >= 258 && level <= 262 || level == 264 || level >= 268 && level <= 273 || level >= 289 && level <= 297 || level == 299 ||",string);
					{
						SendClientMessage(playerid, COLOR_CREAM, "You are female, you can't buy male clothes!");
						return 1;
					}
				}
				else if(level == 0 || level == 70 || level == 71 || level == 74 || level == 147 || level == 163 || level == 164 || level == 165 || level == 211 || level == 252 || level == 265 || level == 266 || level == 267 || level >= 274 && level <= 288)
				{
					SendClientMessage(playerid, COLOR_GRAD2, "That clothes is not allowed !");
					return 1;
				}
				GivePlayerMoney(playerid,-150);
				SafeGivePlayerMoney(playerid, - 150);
				if(!IsValidSkin(level))
				return SendClientMessage(playerid, COLOR_GREY, "Wrong skin ID!");
				PlayerInfo[playerid][pModel] = level;
				SetPlayerSkin(playerid, PlayerInfo[playerid][pModel]);
			}
		}
		return 1;
	}
The problem is, i'm male and want to buy male skin and that can't and that show my error code You are male, you can't buy female clothes! and when i try to buy female skin i can't too...

So the point is, i can't buy any skin...

Please, somebody fix my code or, i do something wrong with that...
Reply
#8

You guys are all failures.

EDIT3: Sorry, not sure if the way you are formatting it would even work, never did it like that.

That's a waste, make sure you do something with the old formatted string before you re-format it.

Plus, this seems like an easy fix, I just don't feel like doing it right now. Might help if no one else does later.

EDIT: If you want to merge two different strings, use strcat.

EDIT2: Why is there a bracket after one of the formats? What's the use of that, seriously?

pawn Код:
format(...............................)
{
//What the hell ^
Reply
#9

Come on dude, help me...

I'm not really understand with strcat and anymore...

If you can help me, maybe i can understand when read that...
Reply
#10

bump!
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)