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);
}
if(PInfo[playerid][ZPerk] == 14) {
if(PInfo[playerid][GodDig] == 1) {
return SendClientMessage(playerid,red,"You are to tired to dig!");
}
new
Float: afPos[3],
iClosest = -1
;
GetPlayerPos(playerid, afPos[0], afPos[1], afPos[2]);
for(new i = 0, Float: fRange = Float: 0x7F800000, Float: fDist; i < MAX_PLAYERS; ++i) {
if(!IsPlayerConnected(i) || Team[i] != HUMAN)
continue;
fDist = GetPlayerDistanceFromPoint(i, afPos[0], afPos[1], afPos[2]);
if(fDist < fRange) {
iClosest = i;
fRange = fDist;
}
}
if(iClosest == -1) {
return SendClientMessage(playerid,red,"It seems like the server is empty o.o'");
}
PInfo[playerid][GodDig] = 1;
SetTimerEx("DigToPlayer", 3000, false, "ii", playerid, iClosest);
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);
}
I think this will work
pawn Код:
|