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



Range - StR_MaRy - 18.05.2015

Where i can find or how to make a /freezerange or /givegunrange ?

not a playertopoint i don't want to use those cmd at some coord just want to give guns to a distance


Re: Range - JaydenJason - 18.05.2015

zcmd and foreach

Код:
CMD:rgivegun(playerid, params[])
{
	new Float:x, Float:y, Float:z, dist;
	if(pData[playerid][AdmLvl] > 3) // change to your own adm var
	{
		if(sscanf(params"ii", dist, wepid)) return SendClientMessage(playerid, 0xFF0000FF, "Usage:{FFFFFF} /rgivegun [radius] [weaponid]");
		{
			if(wepid < 0 || wepid > 46) return SendClientMessage(playerid, 0xFF0000FF, "Weapon ID can not be less than 0 or higher than 46!");
			GetPlayerPos(playerid, x, y, z);
			foreach(Player, i)
			{
				if(IsPlayerInRangeOfPoint(playerid, dist, x, y, z))
				{
					GivePlayerWeapon(i, wepid, 100);
					SendClientMessage(playerid, 0x00BFFFFF, "You have been given a weapon!");
				}
			}
		}
	}
	else return SendClientMessage(playerid, 0xFF0000FF, "You are not authorized for this command!");
	return 1;
}
(made on phone so errors could occur)