Buying ammo. (Giving Credits to Helpers!)
#1

How do i make it so you can
/buygrenades Amount
Each 1 grenade cost 1k

I am new to scripting, So please help.


All people who help i will put there names in my FS credits.
Reply
#2

https://sampwiki.blast.hk/wiki/Fast_Commands
Reply
#3

Quote:
Originally Posted by kc
That did not help.
Reply
#4

Come on anyone?
I am giving credits.
Reply
#5

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp(cmd, "/buygrenades", true) == 0)
	{
	new
	tmp[20],
	amount;
	tmp = strtok(cmdtext, index);
	if (strlen(tmp))
	{
	amount = strval(tmp);
	if (IsPlayerConnected(amount))
	{
	GivePlayerWeapon(playerid,16,amount");
	GivePlayerMoney(playerid,-amount*1000)
	}
	else
	{
	SendClientMessage(playerid, 0xFF0000AA, "Amount is too hight");
	}
	}
	else
	{
	SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/buygrenades <amount>\"");
	}
	return 1;
	}
	return 0;
}
Not tested...
Reply
#6

Quote:
Originally Posted by xCoder
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp(cmd, "/buygrenades", true) == 0)
	{
	new
	tmp[20],
	amount;
	tmp = strtok(cmdtext, index);
	if (strlen(tmp))
	{
	amount = strval(tmp);
	if (IsPlayerConnected(amount))
	{
	GivePlayerWeapon(playerid,16,amount");
	GivePlayerMoney(playerid,-amount*1000)
	}
	else
	{
	SendClientMessage(playerid, 0xFF0000AA, "Amount is too hight");
	}
	}
	else
	{
	SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/buygrenades <amount>\"");
	}
	return 1;
	}
	return 0;
}
You didn't check if had enough money.

Not tested...
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)