SA-MP Forums Archive
skin command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: skin command (/showthread.php?tid=37126)



skin command - Martin_Smith - 13.05.2008

i need the base of the /Skin command so you say /skin and it give you skin 272, Thanks


Re: skin command - BIGBOY - 13.05.2008

if(strmp(cmdtext,"/skin"......
SetPlayerSkin(playerid,272);


Re: skin command - Cueball - 13.05.2008

Well, if you want the command '/skin' to give you skin 272 everytime, you can do this:
pawn Код:
#include <a_samp>

public OnPlayerCommandText(playerid, cmdtext[])
{
  if(strcmp("/skin", cmdtext, true) == 0)
    return SetPlayerSkin(playerid, 272);

  // All your other commands.

  return 0;
}
If however, you want a command set up like '/skin [skin id]', you could try something like this:
pawn Код:
#include <a_samp>

public OnPlayerCommandText(playerid, cmdtext[])
{
  if(strcmp("/skin", cmdtext, true) == 0)
  {
    if(strlen(cmdtext) < 7)
      return SendClientMessage(playerid, 0x33CCFFAA, "USAGE: /skin [skin id]");
    new skin = strval(cmdtext[6]);
    if(IsInvalidSkin(skin))
      return SendClientMessage(playerid, 0x33CCFFAA, "ERROR: Invalid skin id!");
    SetPlayerSkin(playerid, skin);
    return SendClientMessage(playerid, 0x33CCFFAA, "Your skin id was successfully changed.");
  }

  // All your other commands.

  return 0;
}

IsInvalidSkin(skinid)
{ // Created by Simon
// Checks whether the skinid parsed is crashable or not.

#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 (skinid == badSkins[i]) return true;
}

return false;
}
That code uses IsInvalidSkin() by Simon. I included it, so you don't have to worry.

If you need to clarify any of the functions used, check out the wiki.

~Cueball~



Re: skin command - Martin_Smith - 13.05.2008

ffs, none of em, work, and all i need is command to change to skin 272!! lol


Re: skin command - CristianTdj - 19.12.2009

Thank you Cuecumber, I needed that