SA-MP Forums Archive
[Mini Help Needed] A Command 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)
+--- Thread: [Mini Help Needed] A Command Problem (/showthread.php?tid=365004)



[Mini Help Needed] A Command Problem - UnknownGamer - 01.08.2012

Код:
    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?


Re : [Mini Help Needed] A Command Problem - lelemaster - 01.08.2012

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).


Re: [Mini Help Needed] A Command Problem - UnknownGamer - 01.08.2012

Worked.

Thanks