pawn Code:
// Credits to AbyssMorgan
stock Float:GetDistanceBetweenPoints3D(Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2){
return VectorSize(x1-x2,y1-y2,z1-z2);
}
PreventMapIconStack() {
// For the loop
new MAX_MAP_ICONS = 1024 ;
// distance you want to stop the stack in
new Float: MAX_MAPICON_DIST = 25.0 ;
// Mapicon type /model you want to check for
new LIMIT_MODEL_ID = 31 ;
// ID to store last visible map icon in
new LAST_EXCEPTION = -1 ;
// Two sets of coord variables so we can check distance
new Float: x1, Float: y1, Float: z1 ;
new Float: x2, Float: y2, Float: z2 ;
for(new i; i < MAX_MAP_ICONS; i ++){
// If our type / model isn't the one we want, continue the loop / skip
if(Streamer_GetIntData(STREAMER_TYPE_MAP_ICON, i, E_STREAMER_TYPE) == LIMIT_MODEL_ID){
// If last_exception isn't set, let's go ahead and set it
if(LAST_EXCEPTION != -1){
if(IsValidDynamicMapIcon(LAST_EXCEPTION)) {
// Let's get our coordinates so we can check distance
Streamer_GetFloatData(STREAMER_TYPE_MAP_ICON, i, E_STREAMER_X, x1);
Streamer_GetFloatData(STREAMER_TYPE_MAP_ICON, i, E_STREAMER_Y, y1);
Streamer_GetFloatData(STREAMER_TYPE_MAP_ICON, i, E_STREAMER_Z, z1);
Streamer_GetFloatData(STREAMER_TYPE_MAP_ICON, LAST_EXCEPTION, E_STREAMER_X, x2);
Streamer_GetFloatData(STREAMER_TYPE_MAP_ICON, LAST_EXCEPTION, E_STREAMER_Y, y2);
Streamer_GetFloatData(STREAMER_TYPE_MAP_ICON, LAST_EXCEPTION, E_STREAMER_Z, z2);
// Checking distance...
if(GetDistanceBetweenPoints3D(x1, y1, z1, x2, y2, z2) < MAX_MAPICON_DIST){
// Set the "playerid" to MAX_PLAYERS+1 aka nobody so nobody will see the map icon
Streamer_SetIntData(STREAMER_TYPE_MAP_ICON, i, E_STREAMER_PLAYER_ID, MAX_PLAYERS + 1);
}
else continue ;
}
else LAST_EXCEPTION = i ;
}
else LAST_EXCEPTION = i ;
}
else continue ;
}
// Re-stream the map icons if need be
return true ;
}
Untested, but something like this is what you need.
edit: Added some comments / pointers