[Streamer] Limit items
#1

Hey there

How I can limit amount of models that streamer streams for the player?

For example I want to avoid this:


So I'd like to show 5 green house icon at this location. (I don't want to limit the whole map icon items)
Is there any way to solve this?
Reply
#2

csб rasheed

Streamer_SetVisibleItems(type, items, playerid = -1)
Parameters:
type: The item type.
items: The visible item amount.
playerid: The player ID.
Returns:
0 on failure, 1 on success.
Sets the current visible item amount (number of items that can be streamed) for the specified item type and player.

Defaults:
Objects: 500
Pickups: 4096
Map Icons: 100
3D Text Labels: 1024
This native cannot be used with checkpoints, race checkpoints, or areas.
Reply
#3

bump
Reply
#4

https://github.com/samp-incognito/sa...ives-(Settings)

See Streamer_SetVisibleItems. As pointed out by Anthony.
Reply
#5

Quote:
Originally Posted by MP2
View Post
https://github.com/samp-incognito/sa...ives-(Settings)

See Streamer_SetVisibleItems. As pointed out by Anthony.
Still bad answer. This will be limit all of the map icons. I want to limit a specific modelid from map icons, not the amount of the whole map icons.
Reply
#6

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.
Reply
#7

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
Reply
#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


Forum Jump:


Users browsing this thread: 2 Guest(s)