task OtherTimer[1000]()
{
foreach(new i : Player)
{
if(UseFind[i] == 1)
{
new string[120];
new Float: distance;
distance = GetDistanceBetweenPlayers(i, targetfind[i]);
format(string, sizeof(string), "Distanta ramasa: %.0f metri", distance);
PlayerTextDrawSetString(i, FindTimerTxT[i], string);
PlayerTextDrawShow(i, FindTimerTxT[i]);
}
else
{
PlayerTextDrawHide(i, FindTimerTxT[i]);
}
}
return 1;
}
function Float:GetDistanceBetweenPlayers(playerid,targetplayerid)
{
new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
if(!IsPlayerConnected(playerid) || !IsPlayerConnected(targetplayerid)) {
return -1.00;
}
GetPlayerPos(playerid,x1,y1,z1);
GetPlayerPos(targetplayerid,x2,y2,z2);
return floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
}
GetDistanceBetweenPlayers(playera, playerb)
{
if(!IsPlayerConnected(playera) || !IsPlayerConnected(playerb))
{
return -1.00;
}
new Float:pPos[3], Float:pDistance;
GetPlayerPos(playerb, pPos[0], pPos[1], pPos[2]);
pDistance = GetPlayerDistanceFromPoint(playera, pPos[0], pPos[1], pPos[2]);
return pDistance;
}
C:\Users\StR\Desktop\Scripting\snake\gamemodes\server.pwn(36920) : warning 217: loose indentation C:\Users\StR\Desktop\Scripting\snake\gamemodes\server.pwn(36922) : warning 213: tag mismatch C:\Users\StR\Desktop\Scripting\snake\gamemodes\server.pwn(36923) : warning 213: tag mismatch
line 36920: new Float:pPos[3], pDistance; line 36922: pDistance = GetPlayerDistanceFromPoint(playera, pPos[0], pPos[1], pPos[2]); line 36923: return pDistance;
|
Код:
GetDistanceBetweenPlayers(playera, playerb)
{
if(!IsPlayerConnected(playera) || !IsPlayerConnected(playerb))
{
return -1.00;
}
new Float:pPos[3], Float:pDistance;
GetPlayerPos(playerb, pPos[0], pPos[1], pPos[2]);
pDistance = GetPlayerDistanceFromPoint(playera, pPos[0], pPos[1], pPos[2]);
return pDistance;
}
|