client crashes when invalid /skin is chosen.
#1

Код:
if(strcmp(cmd, "/clothes", true) == 0) {
    	tmp = strtok(cmdtext,idx);
	SetPlayerSkin(playerid,strval(tmp));
	return 1;
Works fine as long as the skin id is a valid one. But how can I make it so it doesn't crash if someone does something like /clothes 1313 ?
Reply
#2

Search for IsValidSkin.
Reply
#3

Код:
forward IsValidSkin(skinid);
public IsValidSkin(skinid)
{
  #define	MAX_BAD_SKINS 22
  new badSkins[MAX_BAD_SKINS] =
  { 3, 4, 5, 6, 8, 42, 65, 74, 86, 119, 149, 208, 268, 273, 289 };
  if (skinid < 0 || skinid > 299) return false;
  for (new i = 0; i < MAX_BAD_SKINS; i++) { if (skinid == badSkins[i]) return false; }
  #undef MAX_BAD_SKINS
  return 1;
}
Try it, hope It will work for you.
Reply
#4

Update, thanks for the help I got it to compile now but it still is not preventing crashes..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)