SA-MP Forums Archive
Buying ammo. (Giving Credits to Helpers!) - 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: Buying ammo. (Giving Credits to Helpers!) (/showthread.php?tid=90275)



Buying ammo. (Giving Credits to Helpers!) - Sal_Kings - 07.08.2009

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.


Re: Buying ammo. (Giving Credits to Helpers!) - kc - 07.08.2009

https://sampwiki.blast.hk/wiki/Fast_Commands


Re: Buying ammo. (Giving Credits to Helpers!) - Sal_Kings - 07.08.2009

Quote:
Originally Posted by kc
That did not help.



Re: Buying ammo. (Giving Credits to Helpers!) - Sal_Kings - 07.08.2009

Come on anyone?
I am giving credits.


Re: Buying ammo. (Giving Credits to Helpers!) - xCoder - 07.08.2009

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


Re: Buying ammo. (Giving Credits to Helpers!) - Chrham_2 - 07.08.2009

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