SHARE
TWEET

Untitled

a guest Dec 15th, 2018 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. bool:pBoombox,
  2. enum BoomboxInfo {
  3.     boomboxPlaced,
  4.     Float:boomboxPos[ 3 ],
  5.     boomboxInterior,
  6.     boomboxWorld,
  7.     boomboxObject,
  8.     boomboxURL[128 char],
  9.     Text3D:boomboxText3D
  10. };
  11. new BoomboxInfo[MAX_PLAYERS][BoomboxInfo];
  12. new Boombox[ MAX_PLAYERS ];
  13. new globalstring[ 128 ];
  14. PlayerInfo[playerid][pBoombox] = false;
  15. BoomboxInfo[playerid][boomboxPlaced] = 0;
  16. BoomboxInfo[playerid][boomboxPos][0] = 0.0;
  17. BoomboxInfo[playerid][boomboxPos][1] = 0.0;
  18. BoomboxInfo[playerid][boomboxPos][2] = 0.0;
  19. Boombox[playerid] = INVALID_PLAYER_ID;
  20. //------------------------------------------------------------------------------
  21. stock Boombox_Place( playerid ) {
  22.     static
  23.         Float:angle;
  24.  
  25.     GetPlayerFacingAngle(playerid, angle);
  26.  
  27.     strpack(BoomboxInfo[playerid][boomboxURL], "", 128 char);
  28.     GetPlayerPos(playerid, BoomboxInfo[playerid][boomboxPos][0], BoomboxInfo[playerid][boomboxPos][1], BoomboxInfo[playerid][boomboxPos][2] );
  29.  
  30.     BoomboxInfo[playerid][boomboxPlaced] = true;
  31.     BoomboxInfo[playerid][boomboxInterior] = GetPlayerInterior(playerid);
  32.     BoomboxInfo[playerid][boomboxWorld] = GetPlayerVirtualWorld(playerid);
  33.     new string[ 128 ];
  34.     format( string, sizeof( string ), "{B53525}Gazda: {FFFFFF}%s\n{B53525}Koristi {FFFFFF}'/radio url' {B53525}za da pustete pesna\n'{FFFFFF}/radio podigni' {B53525}za da go podignes radioto", GetName(playerid) );
  35.  
  36.     BoomboxInfo[playerid][boomboxObject] = CreateDynamicObject(2103, BoomboxInfo[playerid][boomboxPos][0], BoomboxInfo[playerid][boomboxPos][1], BoomboxInfo[playerid][boomboxPos][2] - 0.9, 0.0, 0.0, angle, BoomboxInfo[playerid][boomboxWorld], BoomboxInfo[playerid][boomboxInterior] );
  37.     BoomboxInfo[playerid][boomboxText3D] = CreateDynamic3DTextLabel( string, -1, BoomboxInfo[playerid][boomboxPos][0], BoomboxInfo[playerid][boomboxPos][1], BoomboxInfo[playerid][boomboxPos][2] - 0.7, 10.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, BoomboxInfo[playerid][boomboxWorld], BoomboxInfo[playerid][boomboxInterior] );
  38.  
  39.     return 1;
  40. }
  41.  
  42. stock Boombox_Nearest(playerid)
  43. {
  44.     foreach (new i : Player) if(BoomboxInfo[ i ][boomboxPlaced] && GetPlayerInterior(playerid) == BoomboxInfo[ i ][boomboxInterior] && GetPlayerVirtualWorld(playerid) == BoomboxInfo[ i ][boomboxWorld] && IsPlayerInRangeOfPoint(playerid, 30.0, BoomboxInfo[ i ][boomboxPos][0], BoomboxInfo[ i ][boomboxPos][1], BoomboxInfo[ i ][boomboxPos][2 ] ) ) {
  45.         return i;
  46.     }
  47.     return INVALID_PLAYER_ID;
  48. }
  49.  
  50. stock Boombox_SetURL(playerid, url[])
  51. {
  52.     if( BoomboxInfo[playerid][boomboxPlaced] ) {
  53.         strpack( BoomboxInfo[playerid][ boomboxURL ], url, 256 char);
  54.  
  55.         foreach (new i : Player) if(Boombox[ i ] == playerid) {
  56.  
  57.             StopAudioStreamForPlayer(i);
  58.             PlayAudioStreamForPlayer(i, url, BoomboxInfo[playerid][boomboxPos][0], BoomboxInfo[playerid][boomboxPos][1], BoomboxInfo[playerid][boomboxPos][2], 30.0, 1);
  59.         }
  60.     }
  61.     return 1;
  62. }
  63.  
  64. stock Boombox_Destroy(playerid)
  65. {
  66.     if(BoomboxInfo[playerid][boomboxPlaced])
  67.     {
  68.         if( IsValidDynamicObject(BoomboxInfo[playerid][boomboxObject ] ) )
  69.             DestroyDynamicObject(BoomboxInfo[playerid][boomboxObject] );
  70.  
  71.         if( IsValidDynamic3DTextLabel(BoomboxInfo[playerid][boomboxText3D ] ) )
  72.             DestroyDynamic3DTextLabel(BoomboxInfo[playerid][boomboxText3D] );
  73.  
  74.         foreach (new i : Player) if(Boombox[ i ] == playerid) {
  75.             StopAudioStreamForPlayer(i);
  76.         }
  77.         BoomboxInfo[playerid][boomboxPlaced] = false;
  78.         BoomboxInfo[playerid][boomboxInterior] = 0;
  79.         BoomboxInfo[playerid][boomboxWorld] = 0;
  80.     }
  81.     return 1;
  82. }task GlobalTimer[1000]()
  83. {
  84.     if( ( id = Boombox_Nearest(i)) != INVALID_PLAYER_ID && Boombox[ i ] != id && strlen (BoomboxInfo[ id ][ boomboxURL ] ) && !IsPlayerInAnyVehicle( i ) ) {
  85.  
  86.         new str[ 128 ];
  87.         strunpack(str, BoomboxInfo[ id ][ boomboxURL ] );
  88.         Boombox[ i ] = id;
  89.  
  90.         StopAudioStreamForPlayer( i );
  91.         PlayAudioStreamForPlayer( i, str, BoomboxInfo[ id ][boomboxPos][0], BoomboxInfo[ id ][boomboxPos][1], BoomboxInfo[ id ][boomboxPos][ 2 ], 30.0, 1);
  92.     }
  93.     else if( Boombox[ i ] != INVALID_PLAYER_ID && !IsPlayerInRangeOfPoint( i, 30.0, BoomboxInfo[ Boombox[ i ] ][boomboxPos][0], BoomboxInfo[ Boombox[ i ] ][boomboxPos][1], BoomboxInfo[ Boombox[ i ] ][boomboxPos][ 2 ] ) ) {
  94.         Boombox[ i ] = INVALID_PLAYER_ID;
  95.         StopAudioStreamForPlayer(i);
  96.     }
  97. }
  98. INI_WriteBool( File, "Boombox", PlayerInfo[playerid][pBoombox] );
  99. INI_Bool( "Boombox", PlayerInfo[playerid][pBoombox] );
  100. if( BoomboxInfo[playerid][boomboxPlaced] )
  101.     {
  102.         Boombox_Destroy( playerid );
  103.     }
  104. CMD:otstraniradio( playerid, params[] ) {
  105.  
  106.     if( PlayerInfo[playerid][pAdmin] >= 4 ) {
  107.         if( !AdminDuty[playerid] ) return SCM(playerid, -1, "{B53525}| ERROR | {FFFFFF}Morate da bidete na dolznost za da ja koristete ovaa komanda!" );
  108.  
  109.         if( Boombox_Nearest( playerid ) == INVALID_PLAYER_ID ) return SCM(playerid, -1, "{B53525}| ERROR | {FFFFFF}Ne ste do radio." );
  110.  
  111.         Boombox_Destroy( Boombox_Nearest( playerid ) );
  112.         SCM(playerid, -1, "{0099FF}| INFO | {FFFFFF}Go izbrisavte radioto." );
  113.     }
  114.     else return SCM(playerid, -1, "{B53525}| ERROR | {FFFFFF}Ne mozete da ja koristete ovaa komanda!" );
  115.     return 1;
  116. }
  117. CMD:kupiradio(playerid, params[])
  118. {
  119.     if(PlayerInfo[playerid][pMoney] < 10000) return SCM(playerid, -1, "{B53525}| ERROR | {FFFFFF}Nemate dovolno pari. Potrebni vi se $10000!");
  120.     if(!IsPlayerInRangeOfPoint(playerid, 3.0, 1295.6611,-1876.3253,13.7239)) // PODESETE STAVETE SI SVOI KOORDINATI
  121.     {
  122.          PlayerInfo[playerid][pBoombox] = true;
  123.          SCM(playerid, -1, "{0099FF}| INFO | {FFFFFF}Kupivte radio. Toa ve cinese $10000");
  124.          GivePlayerMoney(playerid, -10000);
  125.     }
  126.     else return SCM(playerid, -1, "{B53525}| ERROR | {FFFFFF}Ne ste vo prodavnica za kupuvanje radio!");
  127. }
  128. CMD:radio( playerid, params[] ) {
  129.     if( PlayerInfo[playerid][pBoombox] != true ) return SCM(playerid, -1, "{B53525}| ERROR | {FFFFFF}Nemate radio." );
  130.  
  131.     new item[ 24 ], string[ 128 ];
  132.     if( sscanf( params, "s[24] ", item ) ) {
  133.         SCM( playerid, -1, "{0099FF}___________________________________________________________________");
  134.         SCM(playerid, -1, "{F3FF02}/radio [opcija]");
  135.         SCM( playerid, -1, "{F3FF02}[Opcii]: postavi, podigni, url");
  136.         SCM( playerid, -1, "{0099FF}___________________________________________________________________");
  137.         return 1;
  138.     }
  139.     if( strcmp( item, "postavi", true ) == 0 ) {
  140.         if( BoomboxInfo[playerid][boomboxPlaced] ) return SCM(playerid, -1, "{B53525}| ERROR | {FFFFFF}Radioto vekje vi e na zemjata." );
  141.         if( Boombox_Nearest( playerid ) != INVALID_PLAYER_ID ) return SCM(playerid, -1, "{B53525}| ERROR | {FFFFFF}Ne ste kaj vaseto radio.");
  142.         if( IsPlayerInAnyVehicle( playerid ) ) return SCM(playerid, -1, "{B53525}| ERROR | {FFFFFF}Morate da go napustete voziloto." );
  143.  
  144.         Boombox_Place( playerid );
  145.  
  146.         format( globalstring, sizeof( globalstring ), "%s go stava radioto na zemjata i go podesuva.", GetName(playerid) );
  147.         ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  148.         SCM( playerid, -1, "{0099FF}| INFO | {FFFFFF}Go postavivte radioto (koristete '/radio' za opcii).");
  149.         return 1;
  150.     }
  151.     else if( strcmp( item, "podigni", true ) == 0 ) {
  152.         if( !BoomboxInfo[playerid][boomboxPlaced] ) return SCM(playerid, -1, "{B53525}| ERROR | {FFFFFF}Nemate postaveno radio.");
  153.         if( !IsPlayerInRangeOfPoint( playerid, 3.0, BoomboxInfo[playerid][boomboxPos][0], BoomboxInfo[playerid][boomboxPos][1], BoomboxInfo[playerid][boomboxPos][ 2 ] ) ) return SCM(playerid, -1, "{B53525}| ERROR | {FFFFFF}Niste u blizini vaseg radia." );
  154.  
  155.         Boombox_Destroy( playerid );
  156.         format( globalstring, sizeof( globalstring ), "%s go diga svoeto radio od zemjata.", GetName(playerid) );
  157.         ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  158.         return 1;
  159.     }
  160.     else if( strcmp( item, "url", true ) == 0 ) {
  161.         new url[ 128 ];
  162.         if( sscanf( params, "s[24]s[128]", item, url ) ) return SCM(playerid, -1, "{F3FF02}| KORISTETE | {FFFFFF}/radio url [song url]");
  163.         if( !BoomboxInfo[playerid][boomboxPlaced] ) return SCM(playerid, -1, "{B53525}| ERROR | {FFFFFF}Nemate postaveno radio.");
  164.         if( !IsPlayerInRangeOfPoint( playerid, 3.0, BoomboxInfo[playerid][boomboxPos][0], BoomboxInfo[playerid][boomboxPos][1], BoomboxInfo[playerid][boomboxPos][ 2 ] ) ) return SCM(playerid, -1, "{B53525}| ERROR | {FFFFFF}Niste u blizini vaseg radia.");
  165.  
  166.         Boombox_SetURL( playerid, url );
  167.         format( globalstring, sizeof( globalstring ), "%s vrti preku frekfenciite i naogja na pesna sto mu se svigja.", GetName(playerid) );
  168.         ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  169.         return 1;
  170.     }
  171.     else {
  172.         SCM( playerid, -1, "{0099FF}___________________________________________________________________");
  173.         SCM(playerid, -1, "{F3FF02}/radio [opcija]");
  174.         SCM( playerid, -1, "{F3FF02}[Opcii]: postavi, podigni, url");
  175.         SCM( playerid, -1, "{0099FF}___________________________________________________________________");
  176.     }
  177.     return 1;
  178. }
  179. CreateDynamic3DTextLabel("{0099FF}[ RADIO ]\n{FFFFFF}Za da kupete radio napisete\n{FFFFFF}/kupiradio",0x9EC73DAA,1295.6611,-1876.3253,13.7239, 30, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 40.0);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top