Rock

iStreamer

May 24th, 2013
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.52 KB | None | 0 0
  1. #include < a_samp >
  2.  
  3. #if defined _iStreamer_included
  4.     #endinput
  5. #endif
  6.  
  7. #define _iStreamer_included
  8.  
  9. // Settings
  10. #define MAX_MAP_ICONS   400 // Max icons than script allows to be streamed
  11.  
  12. #undef MAX_PLAYERS
  13. #define MAX_PLAYERS     50 // Change this with you current MAX_PLAYERS
  14.  
  15. // End of Settings
  16.  
  17.  
  18. new
  19.     iMap_ID[ MAX_PLAYERS ][ MAX_MAP_ICONS ],
  20.     Float: fPos[ 4 ][ MAX_PLAYERS ][ MAX_MAP_ICONS ],
  21.  
  22.     iMarker_Type[ MAX_PLAYERS ][ MAX_MAP_ICONS ],
  23.     iMap_iColour[ MAX_PLAYERS ][ MAX_MAP_ICONS ]
  24. ;
  25.  
  26. stock SetPlayerStreamedIcon( playerid, Float: fX, Float: fY, Float: fZ, iType, iColour, Float: fV )
  27. {
  28.     for( new i = 1; i < MAX_MAP_ICONS; i++ )
  29.     {
  30.         if( fPos[ 0 ][ playerid ][ i ] == 0 && fPos[ 1 ][ playerid ][ i ] == 0 )
  31.         {
  32.             fPos[ 0 ][ playerid ][ i ] = fX;
  33.             fPos[ 1 ][ playerid ][ i ] = fY;
  34.             fPos[ 2 ][ playerid ][ i ] = fZ;
  35.             fPos[ 3 ][ playerid ][ i ] = fV;
  36.  
  37.             iMarker_Type[ playerid ][ i ] = iType;
  38.             iMap_iColour[ playerid ][ i ] = iColour;
  39.  
  40.             UpdateStreamedMapIcons( playerid );
  41.             return i;
  42.         }
  43.     }
  44.     return false;
  45. }
  46. stock UpdateStreamedIcons( playerid )
  47. {
  48.     new
  49.         iMapIcons = 1;
  50.  
  51.     for( new i = 1; i < MAX_MAP_ICONS; i++ )
  52.     {
  53.         if( iMap_ID[ playerid ][ i ] > 0 )
  54.         {
  55.             RemovePlayerMapIcon( playerid, iMap_ID[ playerid ][ i ] );
  56.         }
  57.     }
  58.  
  59.     for( new i = 1; i < MAX_MAP_ICONS && iMapIcons < 100; i++ )
  60.     {
  61.         if( fPos[ 0 ][ playerid ][ i ] != 0 || fPos[ 1 ][ playerid ][ i ] != 0 || fPos[ 2 ][ playerid ][ i ] != 0 )
  62.         {
  63.             if( GetPlayerDistanceFromPoint( playerid, fPos[ 0 ][ playerid ][ i ], fPos[ 1 ][ playerid ][ i ], fPos[ 2 ][playerid][ i ] ) <= fPos[ 3 ][ playerid ][ i ] )
  64.             {
  65.                 SetPlayerMapIcon( playerid, iMapIcons, fPos[ 0 ][ playerid ][ i ], fPos[ 1 ][ playerid ][ i ], fPos[ 2 ][ playerid ][ i ], iMarker_Type[ playerid ][ i ], iMap_iColour[ playerid ][ i ], MAPICON_GLOBAL );
  66.                 iMap_ID[ playerid ][ i ] = iMapIcons;
  67.                 iMapIcons ++;
  68.             }
  69.         }
  70.     }
  71.     return iMapIcons;
  72. }
  73.  
  74. stock RemoveStreamedIcon( playerid, IconID )
  75. {
  76.     fPos[ 0 ][ playerid ][ IconID ] = 0;
  77.     fPos[ 1 ][ playerid ][ IconID ] = 0;
  78.     fPos[ 2 ][ playerid ][ IconID ] = 0;
  79.     fPos[ 3 ][ playerid ][ IconID ] = 0;
  80.  
  81.     iMarker_Type[ playerid ][ IconID ] = false;
  82.     iMap_iColour[ playerid ][ IconID ] = false;
  83.  
  84.     RemovePlayerMapIcon( playerid, iMap_ID[ playerid ][ IconID ] );
  85.     iMap_ID[ playerid ][ IconID ] = 0;
  86.     return true;
  87. }
Add Comment
Please, Sign In to add comment