SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 07/04/2019, 06:33 PM   #1
m4karow
Huge Clucker
 
Join Date: Oct 2015
Posts: 287
Reputation: 37
Default [Streamer] Limit items

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?

Last edited by m4karow; 08/04/2019 at 03:27 PM.
m4karow is offline   Reply With Quote
Old 07/04/2019, 07:28 PM   #2
AnthonyGates
Little Clucker
 
Join Date: Oct 2013
Posts: 14
Reputation: 0
Default Re: [Streamer] Limit items

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.
AnthonyGates is offline   Reply With Quote
Old 08/04/2019, 03:27 PM   #3
m4karow
Huge Clucker
 
Join Date: Oct 2015
Posts: 287
Reputation: 37
Default Re: [Streamer] Limit items

bump
m4karow is offline   Reply With Quote
Old 08/04/2019, 03:30 PM   #4
MP2
Godfather
 
MP2's Avatar
 
Join Date: Jan 2011
Location: England
Posts: 6,234
Reputation: 1004
Default Re: [Streamer] Limit items

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

See Streamer_SetVisibleItems. As pointed out by Anthony.
__________________
Owner and developer of Mike's Cops and Robbers.

Click here to visit our site and find out more. Click here to view trailers.
Enter referral code SAMPFORUM after registering for a $5000 starting bonus!
MP2 is offline   Reply With Quote
Old 08/04/2019, 05:11 PM   #5
m4karow
Huge Clucker
 
Join Date: Oct 2015
Posts: 287
Reputation: 37
Default Re: [Streamer] Limit items

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.
m4karow is offline   Reply With Quote
Old 08/04/2019, 05:29 PM   #6
Logic_
Banned
 
Join Date: Jun 2015
Posts: 1,513
Reputation: 305
Default Re: [Streamer] Limit items

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.
Logic_ is offline   Reply With Quote
Old 08/04/2019, 05:40 PM   #7
Dignity
High-roller
 
Dignity's Avatar
 
Join Date: May 2013
Location: Belgium
Posts: 1,637
Reputation: 1185
Default Re: [Streamer] Limit items

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
Dignity is offline   Reply With Quote
Old 08/04/2019, 06:27 PM   #8
m4karow
Huge Clucker
 
Join Date: Oct 2015
Posts: 287
Reputation: 37
Default Re: [Streamer] Limit items

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.
m4karow is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Streamer Destroy All Items NoteND Scripting Help 1 08/01/2019 07:46 PM
streamer limit TheSimpleGuy Scripting Help 6 19/06/2016 10:48 AM
Incognito's Streamer - Limit Objects @ ID corne Scripting Help 0 28/09/2013 06:55 PM
[Solved]Streamer limit!? Jstylezzz Scripting Help 0 19/08/2012 06:13 PM
Incognito's Streamer plugin showed objects limit Pooh7 Help Archive 1 10/08/2011 08:54 PM


All times are GMT. The time now is 12:27 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.