SA-MP Forums Archive
/skin problem - 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 problem (/showthread.php?tid=156819)



/skin problem - 2kool4skool - 24.06.2010

Hello everyone again,I just made a /skin command and it worked.here is the problem:When you do /skin the USAGE will Apprear Normaly and when you want to choose a skin for example /skin 114 the USAGE Appears Again.hope you can help me.thanks again
Pawn Code:
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  if(!strcmp(cmdtext, "/skin ", true, 3))
  {
    SendClientMessage(playerid, 0xFF9900AA, "USAGE: /skin [skin id]");
    return 1;
  }
	if(!strcmp(cmdtext, "/skin 0", true, 3))
  {
		SetPlayerSkin(playerid, 0);
		SendClientMessage(playerid, 0xFFFF00AA,"[SUCCESS]You have successfully changed your Skin!");
    return 1;
  }
	if (strcmp("/skin 1", cmdtext, true, 10) == 0)
	{
		SetPlayerSkin(playerid,1);
		SendClientMessage(playerid, 0xFFFF00AA,"[SUCCESS]You have successfully changed your Skin!");
		return 1;
	}
	if (strcmp("/skin 2", cmdtext, true, 10) == 0)
	{
		SetPlayerSkin(playerid,2);
		SendClientMessage(playerid, 0xFFFF00AA,"[SUCCESS]You have successfully changed your Skin!");
		return 1;
	}
	return 0;
}



Re: /skin problem - KuHS - 24.06.2010

You have placed wrong numbers at strcmp.

if(!strcmp(cmdtext, "/skin ", true, 3)) <--- has 5 characters (with space), but there's only 3
if(!strcmp(cmdtext, "/skin 0", true, 3)) <--- wrong too...
if (strcmp("/skin 1", cmdtext, true, 10) == 0) <--- i think it's wrong too.

I suggest you to try to do one command within checking. Ex.:

Код:
  if(!strcmp(cmdtext, "/skin", true, 4))
  {
    if(cmdtext[3]==0) return SendClientMessage(playerid, 0xFF9900AA, "USAGE: /skin [skin id]");
    new skin[11];
    strmid(skin,cmdtext[5],0,11);
    if(!strcmp(skin,"0",true)) return SendClientMessage(playerid, 0xFF9900AA, "Invalid skin ID!"); // "0" for blank input, the problem is for cj skin
    new skinid = strval(skin);
    // check here for valid skin IDs...
    // and when set the skin if it's valid.
    SetPlayerSkin(playerid, skinid);
    return 1;
  }



Re: /skin problem - 2kool4skool - 24.06.2010

The skins worked! But the Usage Doesn't Shows When i do /skin .


Re: /skin problem - KuHS - 24.06.2010

My fault. Change the number in cmdtext.

Код:
if(cmdtext[5]==0)



Re: /skin problem - 2kool4skool - 24.06.2010

Thanks very very much dude!