A Little warning -
Adarsh007 - 18.09.2016
Hello,
I am getting this warning.
beta.pwn(4336) : warning 203: symbol is never used: "playerid" .
and here is the line, 4336.
Код:
stock IsNearATM(playerid)
{
new bool:IsClose = false;
for(new i=0; i < MAX_PLAYERS; i++)
{
if(IsPlayerInRangeOfPoint(i, 1.0, -1867.30005, 943.35999, 34.80000)) //Checking if player close to first/only ATm we created.
{
IsClose = true;
}
else if(IsPlayerInRangeOfPoint(i, 1.0, -1622.09998, 716.82001, 14.24000)) //Checking if player close to first/only ATm we created.
{
IsClose = true;
}
else if(IsPlayerInRangeOfPoint(i, 1.0, -2450.19995, 755.59998, 34.80000)) //Checking if player close to first/only ATm we created.
{
IsClose = true;
}
else if(IsPlayerInRangeOfPoint(i, 1.0, -2727.46777, 388.97891, 4.00720)) //Checking if player close to first/only ATm we created.
{
IsClose = true;
}
else if(IsPlayerInRangeOfPoint(i, 1.0, -2638.05371, 635.36920, 14.07310)) //Checking if player close to first/only ATm we created.
{
IsClose = true;
}
else if(IsPlayerInRangeOfPoint(i, 1.0, -1939.57678, 265.36539, 40.66030)) //Checking if player close to first/only ATm we created.
{
IsClose = true;
}
else if(IsPlayerInRangeOfPoint(i, 1.0, -1764.69995, 1084.00000, 45.10000)) //Checking if player close to first/only ATm we created.
{
IsClose = true;
}
else if(IsPlayerInRangeOfPoint(i, 1.0, -1493.13049, 930.49518, 6.81230)) //Checking if player close to first/only ATm we created.
{
IsClose = true;
}
}
return IsClose;
}
I don't want to remove the playerid, because it is being used, but in different function.
I mean, the function is in a include of this gamemode.
Re: A Little warning -
JaKe Elite - 18.09.2016
PHP код:
stock IsNearATM(playerid)
{
if(IsPlayerInRangeOfPoint(playerid, 1.0, -1867.30005, 943.35999, 34.80000) || IsPlayerInRangeOfPoint(playerid, 1.0, -1622.09998, 716.82001, 14.24000) || IsPlayerInRangeOfPoint(playerid, 1.0, -2450.19995, 755.59998, 34.80000) ||
IsPlayerInRangeOfPoint(playerid, 1.0, -2727.46777, 388.97891, 4.00720) || IsPlayerInRangeOfPoint(playerid, 1.0, -2638.05371, 635.36920, 14.07310) || IsPlayerInRangeOfPoint(playerid, 1.0, -1939.57678, 265.36539, 40.66030) ||
IsPlayerInRangeOfPoint(playerid, 1.0, -1764.69995, 1084.00000, 45.10000) || IsPlayerInRangeOfPoint(playerid, 1.0, -1493.13049, 930.49518, 6.81230))
{ //Checking if player close to first/only ATm we created.
return 1;
}
return 0;
}
Re: A Little warning -
Vince - 18.09.2016
It is not being used within
this function. This checks if ANY player is close, rather than just the single player. Remove the loop and replace
i with
playerid. And to clean up the code you can use arrays.
PHP код:
IsNearATM(playerid, &Float:locX = 0, &Float:locY = 0, &Float:locZ = 0)
{
static const Float:atmLocations[][3] = {
{-1867.30005, 943.35999, 34.80000},
{-1622.09998, 716.82001, 14.24000},
{-2450.19995, 755.59998, 34.80000},
{-2727.46777, 388.97891, 4.00720},
{-2638.05371, 635.36920, 14.07310},
{-1939.57678, 265.36539, 40.66030},
{-1764.69995, 1084.0000, 45.10000},
{-1493.13049, 930.49518, 6.81230}
};
for(new i; i < sizeof(atmLocations); i++)
{
if(IsPlayerInRangeOfPoint(playerid, 1.0, atmLocations[i][0], atmLocations[i][1], atmLocations[i][2])
{
locX = atmLocations[i][0];
locY = atmLocations[i][1];
locZ = atmLocations[i][2];
return true;
}
}
return false;
}