PDA

View Full Version : [HELP] Skin System!


McCurdy
18/07/2012, 01:13 PM
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?

L.Hudson
18/07/2012, 02:08 PM
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;
}

McCurdy
18/07/2012, 02:35 PM
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...

McCurdy
19/07/2012, 05:32 AM
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:
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 (c) 1997-2006, ITB CompuPhase


4 Errors.

Please somebody fix this problem, thank's...

Jstylezzz
19/07/2012, 11:58 AM
that means pawno cant handle that long line, so, you will need to format the line
this:

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:

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

McCurdy
19/07/2012, 12:09 PM
that means pawno cant handle that long line, so, you will need to format the line
this:

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:

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 :
format(level,sizeof(level),"a bit of the code here");

and where i put this code?
format(level,sizeof(level),"%s another bit of the code here",level);

McCurdy
21/07/2012, 05:11 AM
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...

Kindred
21/07/2012, 05:50 AM
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?


format(...............................)
{
//What the hell ^

McCurdy
21/07/2012, 05:52 AM
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...

McCurdy
21/07/2012, 01:56 PM
bump!

McCurdy
22/07/2012, 02:18 AM
bump! please somebody help me

McCurdy
22/07/2012, 10:21 AM
bump! come on, nobody can help me? i hate always bump this thread...

Kindred
22/07/2012, 10:22 AM
bump! come on, nobody can help me? i hate always bump this thread...

I hate it too, you know why?

You can't follow rules because you have no common sense.

+1 for you, Mr.Bumper.