23.05.2012, 14:20
I think this will work
pawn Код:
if(PInfo[playerid][ZPerk] == 14)
{
//if(PInfo[playerid][GodDig] == 1) return SendClientMessage(playerid,red,"You are to tired to dig!");
new id = -1,Distance,Float:VBPos[3],VBPos2[3];
GetPlayerPos(playerid,VBPos[0],VBPos[1],VBPos[2]);
for(new i; i < MAX_PLAYERS;i++)
{
if(!IsPlayerConnected(i)) continue;
if(Team[i] == ZOMBIE) continue;
if(IsPlayerInRangeOfPoint(i,2000,VBPos[0],VBPos[1],VBPos[2]))
{
GetPlayerPos(i,VBPos2[0],VBPos2[1],VBPos2[2]);
if(floatsqroot(floatabs(floatadd(floatsub(VBPos[0],VBPos2[0]),floatsub(VBPos[1],VBPos2[1])))) < Distance)
{
Distance = floatsqroot(floatabs(floatadd(floatsub(VBPos[0],VBPos2[0]),floatsub(VBPos[1],VBPos2[1]))));
id = i;
}
}
}
if(id == -1) return SendClientMessage(playerid,red,"It seems like the server is empty o.o'");
PInfo[playerid][GodDig] = 1;
SetTimerEx("DigToPlayer",3000,false,"ii",playerid,id);
ApplyAnimation(playerid,"RIFLE","RIFLE_crouchload",0.5,0,0,0,1,3000,1);
static string[120];
format(string,sizeof string,"%s(%i) has god digged. Keep an eye on him. || 1 GOD DIG PER ROUND!",GetPName(playerid),playerid);
SendAdminMessage(red,string);
}