/Buybeer amount.
#1

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

Again, use your old topic.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)