/skin problem
#1

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;
}
Reply
#2

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;
  }
Reply
#3

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

My fault. Change the number in cmdtext.

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

Thanks very very much dude!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)