[Streamer] Limit items
#8

Quote:
Originally Posted by Dignity
View Post
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
I also tried this method but thanks for your reply. It should work but it's only working for me if I destroy the map icon but it's almost the same. I hoped there are some other ways to figure this out.

Quote:
Originally Posted by Logic_
View Post
In the code where you create the house map icons, decrease their range.

EDIT: I checked the Streamer Wiki but there's no such function that can limit the max visibility of the pickups SPECIFICALLY, you can do that globally by setting the SetVisibleItem for Pickups to 5. Once again, this will affect all pickups and not just house pickups or specific ones.
I cannot decrease their range becouse I'd like to inform the player for available property purchase from a 'normal' distance. Maybe I'll loop through all of the houses while creating another map icon at the same place to avoid this stacking.
Reply


Messages In This Thread
[Streamer] Limit items - by m4karow - 07.04.2019, 18:33
Re: [Streamer] Limit items - by AnthonyGates - 07.04.2019, 19:28
Re: [Streamer] Limit items - by m4karow - 08.04.2019, 15:27
Re: [Streamer] Limit items - by MP2 - 08.04.2019, 15:30
Re: [Streamer] Limit items - by m4karow - 08.04.2019, 17:11
Re: [Streamer] Limit items - by Logic_ - 08.04.2019, 17:29
Re: [Streamer] Limit items - by Dignity - 08.04.2019, 17:40
Re: [Streamer] Limit items - by m4karow - 08.04.2019, 18:27

Forum Jump:


Users browsing this thread: 1 Guest(s)