SA-MP Forums Archive
/Buybeer amount. - 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: /Buybeer amount. (/showthread.php?tid=102193)



/Buybeer amount. - Sal_Kings - 14.10.2009

I tried to make a /buybeer amount command.
But when i type /buybeer 3 ingame, it says "unknown command".
If i type /buybeer with any number after it it says "unkown command".
When i type /buybeer alone it does not say "Usage : /buybeer amount". It just stays like that.


Код:
if(strcmp(cmdtext, "/buybeer", true) == 0)
{
	new tmp[5], index;

	new length = strlen(cmdtext);
	while ((index < length) && (cmdtext[index] <= ' '))
	{
		index++;
	}

	new offset = index;
	while ((index < length) && (cmdtext[index] > ' ') && ((index - offset) < (sizeof(tmp) - 1)))
	{
		tmp[index - offset] = cmdtext[index];
		index++;
	}
	tmp[index - offset] = EOS;

	if( ! strlen(tmp) ) return SendClientMessage(playerid, 0xFFFFFFAA, "/buybeer [amount]");
	new amount = strval(tmp);

	if ( GetPlayerMoney(playerid) < (amount*50) ) return SendClientMessage(playerid, 0xFFFFFFAA, "You don't have enough money to buy that amount of beer.");

	GivePlayerMoney( playerid, (50*amount) );

	BEER[playerid] += amount;

	return 1;
}



Re: /Buybeer amount. - Correlli - 14.10.2009

Again, use your old topic.