[Mini Help Needed] A Command Problem
#1

Код:
    if(strcmp(cmd, "/clothes", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
   				if(IsAtClothShop(playerid))
				{
				new clothesid;
				clothesid = strval(tmp);
	            tmp = strtok(cmdtext, idx);
				if(!strlen(tmp))
				{
					SendClientMessage(playerid, COLOR_WHITE,"USAGE: /clothes [Skin ID]");
					return 1;
				}
				GivePlayerMoney(playerid,-150);
				SafeGivePlayerMoney(playerid, - 150);
			    SetPlayerSkin(playerid, strval(tmp));
			    SendClientMessage(playerid, COLOR_LIGHTBLUE,"That is $150, please. ");
			    format(string, sizeof(string)," Thankyou, you have changed your skin, to skin id %d! ", clothesid);
				SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
	    	}
				else
				{
					SendClientMessage(playerid, COLOR_LIGHTBLUE, "   You are not in a Clothing Shop !");
					return 1;
				}
				return 1;
			}
		}
Why is that showing 0? When it says, "You changed your skin, to skin id 0", Why is it not showing what ID you entered in the string value?
Reply
#2

I never used strtok but try changing:
pawn Код:
clothesid = strval(tmp);
tmp = strtok(cmdtext, idx);
to
pawn Код:
tmp = strtok(cmdtext, idx);
clothesid = strval(tmp);
I guess it's because you defined what tmp is after the strval(tmp).
Reply
#3

Worked.

Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)