#include <a_samp>
if(IsPlayerInRangeOfPoint(playerid, Float:range, Float:x, Float:y, Float:z))
#include <a_samp>
if(IsPlayerInRangeOfPoint(playerid, 10.0, 50.0, 40.0, 30.0))
#include <a_samp>
#include <zcmd>
CMD:radius(playerid, params[])
{
for(new i = 0; i < MAX_PLAYERS; i ++)
{
if(IsPlayerInRangeOfPoint(i, 10.0, 50.0, 40.0, 30.0))
{
SendClientMessage(i, 0xFFFFFFFF, "You're within the range of the points 50.0, 40.0 and 30.0!");
}
}
return 1;
}
#include <a_samp>
#include <sscanf2>
#include <zcmd>
CMD:rangeheal(playerid, params[])
{
new Float:range, Float:health;
if(sscanf(params, "ff", health)) return SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /rangeheal [range] [health]");
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
for(new i = 0; i < MAX_PLAYERS; i ++)
{
if(IsPlayerInRangeOfPoint(i, range, x, y, z))
{
SetPlayerHealth(i, health);
SendClientMessage(i, 0xFFFFFFFF, "You have been range healed!");
}
}
return 1;
}
CMD:rangekick(playerid, params[])
{
new Float:range;
if(sscanf(params, "f", range)) return SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /rangekick [range]");
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
for(new i = 0; i < MAX_PLAYERS; i ++)
{
if(IsPlayerInRangeOfPoint(i, range, x, y, z))
{
Kick(i);
}
}
return 1;
}
The function supports x, y and z so I'm pretty sure it should be ball shaped instead of a circle. The explenation stays the same just add a dimension
|
This is really a simple tut, if you think you could expand it to the basics of SA-MP mathematics like calculating the co - ordinates infront of the player using SIN and COS, offsets, and so on. Keep going
|