Quick Help - Invalid Skin
#1

Hi,

i've got this as a command:
pawn Код:
if(strcmp(cmd, "/setskin", true) == 0)
    {
    if(PlayerInfo[playerid][pAdmin] < 7) return DenyMessage(playerid, 7);
    new tmp2[256];
    tmp = strtok(cmdtext, idx);
    new otherplayer = strval(tmp);
    tmp2 = strtok(cmdtext, idx);
    new skin = strval(tmp2);
    if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setskin [playerid] [skinid]");
        if(!strlen(tmp2)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setskin [playerid] [skinid]");
        if(!IsPlayerConnected(otherplayer)) SendClientMessage(playerid, COLOR_WHITE, "Invalid Player ID.");
        else if (IsInvalidSkin(skin)) SendClientMessage(playerid, COLOR_GREY, "* Invalid Skin ID");
        SetPlayerSkin(otherplayer, skin);
        SendClientMessage(otherplayer, COLOR_WHITE, "An Admin has changed your skin.");
        return 1;
    }
pawn Код:
stock IsInvalidSkin(skin)
{
  #define   MAX_BAD_SKINS  14
  new badSkins[MAX_BAD_SKINS] =
  {
    3, 4, 5, 6, 8, 42, 65, 74, 86,
    119, 149, 208, 273, 289
  };

  for (new i = 0; i < MAX_BAD_SKINS; i++)
  {
    if (skin == badSkins[i] || skin < 0 || skin >= 300) return true;
  }

  return false;
}
Now, what's supposed to happen is that if the player has entered an incorrect skin id, it returns them the "* Invalid Skin ID" message.
But, I think it ignores the IsInvalidSkin stock, and this makes me crash, i.e. it's not working.

i've used this in my gamemode in another way for setting team skins, and that works, but the admin script uses a different way (as above).

I'm probably making a simple stupid mistake. Help is much appreciated
Reply


Messages In This Thread
Quick Help - Invalid Skin - by member - 15.02.2009, 16:27
Re: Quick Help - Invalid Skin - by Backwardsman97 - 15.02.2009, 16:49
[SOLVED] Quick Help - Invalid Skin - by member - 15.02.2009, 17:07

Forum Jump:


Users browsing this thread: 1 Guest(s)