29.12.2012, 09:11
Hello. I want to make a good /pay command, so I want the receiver to be near the giver, but I don't know how to script this! Any help?
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid,x, y, z);
if(!IsPlayerInRangeOfPoint(targetid,5,x,y,z)return SendClientMessage(playerid,-1,"There isn't a near by player");
if (ProxDetectorS(8.0, playerid, giveplayerid))
{
//Your action
}
stock ProxDetector(Float:radi, playerid, string[],color)
{
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
for(new player;player<MAX_PLAYERS;player++)
{
if(!IsPlayerConnected(playerid))continue;
if(IsPlayerInRangeOfPoint(playerid,radi,x,y,z))SendClientMessage(player,color,string);
}
}