CMD:setskin(playerid, params[]) { if (PlayerInfo[playerid][pAdmin] >= 3) { new string[128], giveplayerid, skinid; if(sscanf(params, "ud", giveplayerid, skinid)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /setskin [player] [skinid]"); if(IsPlayerConnected(giveplayerid)) { if(!IsInvalidSkin(skinid)) { if(GetPlayerSkin(giveplayerid) == skinid) { SendClientMessageEx( playerid, COLOR_WHITE, "The person you're trying to change skins of already is using the skin you're trying to set." ); } else { PlayerInfo[giveplayerid][pModel] = skinid; format(string, sizeof(string), "Your skin has been changed to ID %d by Administrator %s.", skinid, GetPlayerNameEx(playerid)); SendClientMessageEx(giveplayerid, COLOR_WHITE, string); format(string, sizeof(string), "You have given %s skin ID %d.", GetPlayerNameEx(giveplayerid), skinid); SendClientMessageEx(playerid, COLOR_WHITE, string); SetPlayerSkin(giveplayerid, PlayerInfo[giveplayerid][pModel]); } } else { SendClientMessageEx(playerid, COLOR_GREY, "Invalid skin ID!"); } } } else { SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command."); } return 1; }
stock IsValidSkin(skinid)
{
if (skinid < 0 || skinid > 311)
return 0;
switch (skinid)
{
case
0, 105, 106, 107, 102, 103, 69, 123,
104, 114, 115, 116, 174, 175, 100, 247, 173,
248, 117, 118, 147, 163, 21, 24, 143, 71,
156, 176, 177, 108, 109, 110, 165, 166,
265, 266, 267, 269, 270, 271, 274, 276,
277, 278, 279, 280, 281, 282, 283, 284,
285, 286, 287, 288, 294, 296, 297, 300, 301,
302, 303,304, 305, 310, 311: 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, 306, 307, 308, 309: 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, 306, 307, 308, 309: return 1;
}
return 0;
}
Your functions names are different.
Change if(!IsInvalidSkin(skinid)) to if(IsValidSkin(skinid)) And remove skin id 300 to 311 from IsValidSkin function. |
case G_LOCKER_UNIFORM: if(response) {
new skin = strval(inputtext), iGroupID = PlayerInfo[playerid][pMember];
if(IsInvalidSkin(skin)) {
return ShowPlayerDialog(playerid, G_LOCKER_UNIFORM, DIALOG_STYLE_INPUT, arrGroupData[iGroupID][g_szGroupName],"Invalid skin specified. Choose another.", "Select", "Cancel");
}
PlayerInfo[playerid][pModel] = skin;
SetPlayerSkin(playerid, PlayerInfo[playerid][pModel]);
it did work for /setskin but now if I try to take a skin above ID 300 from the group locker it doesn't work here the dialog:
PHP код:
|
case G_LOCKER_UNIFORM: if(response) {
new skin = strval(inputtext), iGroupID = PlayerInfo[playerid][pMember];
if(IsValidSkin(skin)) {
return ShowPlayerDialog(playerid, G_LOCKER_UNIFORM, DIALOG_STYLE_INPUT, arrGroupData[iGroupID][g_szGroupName],"Invalid skin specified. Choose another.", "Select", "Cancel");
}
PlayerInfo[playerid][pModel] = skin;
SetPlayerSkin(playerid, PlayerInfo[playerid][pModel]);