SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 06/09/2019, 11:34 AM   #1
Symon
Gangsta
 
Symon's Avatar
 
Join Date: Apr 2019
Location: Italy
Posts: 515
Reputation: 18
Default Boombox

So i made a small boombox system but seems to not work for ID 0.

This is OnPlayerEnterDynamicArea:

pawn Code:
for(new i = 0; i < sizeof(BoomboxData); i++)
    {
        if(IsValidDynamicArea(BoomboxData[i][BoomboxMusicArea]))
        {
            if(areaid == BoomboxData[i][BoomboxMusicArea])
            {
                PlayAudioStreamForPlayer(playerid, BoomboxData[i][BoomboxURL], BoomboxData[i][BoomboxX], BoomboxData[i][BoomboxY], BoomboxData[i][BoomboxZ], DEFAULT_BOOMBOX_RANGE, 1);            
                InformPlayer(playerid, 5000, "You are now listening to ~g~a nearby boombox~w~.");
                return 1;
            }
        }
    }

This when creating the boombox:

pawn Code:
stock Boombox_Create(playerid, szURL[], Float: X, Float: Y, Float: Z, Float: Angle, Float: fDistance = 30.0)
{
    format(BoomboxData[playerid][BoomboxURL], 128, "%s", szURL);

    BoomboxData[playerid][BoomboxX] = X;
    BoomboxData[playerid][BoomboxY] = Y;
    BoomboxData[playerid][BoomboxZ] = Z;

    BoomboxData[playerid][BoomboxObject] = CreateDynamicObject(2103, X, Y, Z - 0.92, 0, 0, 0, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid), -1, Angle);
    BoomboxData[playerid][BoomboxLabel] = CreateDynamic3DTextLabel(sprintf( "%s (%d)'s "ORANGE"Boombox", ReturnPlayerName(playerid), playerid), -1, X, Y, Z, 10, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = GetPlayerInterior(playerid));
    BoomboxData[playerid][BoomboxMusicArea] = CreateDynamicSphere(X, Y, Z, fDistance, -1, -1, -1, 0);
    return 1;
}

What's wrong?
__________________


Discord | Play Now | Website

Add your server to favourites and join our Discord.
Symon is offline   Reply With Quote
Old 06/09/2019, 12:22 PM   #2
Hazon
Big Clucker
 
Hazon's Avatar
 
Join Date: May 2018
Location: Who cares ?
Posts: 140
Reputation: 25
Default Re: Boombox

You have to loop for players.
Hazon is offline   Reply With Quote
Old 06/09/2019, 02:25 PM   #3
Symon
Gangsta
 
Symon's Avatar
 
Join Date: Apr 2019
Location: Italy
Posts: 515
Reputation: 18
Default Re: Boombox

Why? If player enters the boombox area i think i don't need for loop?
__________________


Discord | Play Now | Website

Add your server to favourites and join our Discord.
Symon is offline   Reply With Quote
Old 06/09/2019, 02:49 PM   #4
Jonny
Huge Clucker
 
Jonny's Avatar
 
Join Date: Nov 2009
Location: Italy
Posts: 284
Reputation: 38
Default Re: Boombox

Since the boombox data is set for [playerid] in Boombox_Create, he's right, you should loop for players instead of BoomboxData
__________________
Jonny is offline   Reply With Quote
Old 06/09/2019, 02:59 PM   #5
Symon
Gangsta
 
Symon's Avatar
 
Join Date: Apr 2019
Location: Italy
Posts: 515
Reputation: 18
Default Re: Boombox

I did already looping using foreach but didn't worked...
__________________


Discord | Play Now | Website

Add your server to favourites and join our Discord.
Symon is offline   Reply With Quote
Old 08/09/2019, 10:36 AM   #6
Symon
Gangsta
 
Symon's Avatar
 
Join Date: Apr 2019
Location: Italy
Posts: 515
Reputation: 18
Default Re: Boombox

Bump.
__________________


Discord | Play Now | Website

Add your server to favourites and join our Discord.
Symon is offline   Reply With Quote
Old 08/09/2019, 11:51 AM   #7
Jonny
Huge Clucker
 
Jonny's Avatar
 
Join Date: Nov 2009
Location: Italy
Posts: 284
Reputation: 38
Default Re: Boombox

Honestly seems impossible to me that it doesn't fix the problem, looping through the players in OnPlayerEnterDynamicArea should've worked, i bet nobody is replying just because it impossible
__________________
Jonny is offline   Reply With Quote
Old 08/09/2019, 01:35 PM   #8
Symon
Gangsta
 
Symon's Avatar
 
Join Date: Apr 2019
Location: Italy
Posts: 515
Reputation: 18
Default Re: Boombox

E ti dico che non va, ho già provato il loop

Non va per l'id 0, perchè io sono id 1 e la sento la musica.
__________________


Discord | Play Now | Website

Add your server to favourites and join our Discord.
Symon is offline   Reply With Quote
Old 08/09/2019, 07:47 PM   #9
SiaReyes
Huge Clucker
 
SiaReyes's Avatar
 
Join Date: Mar 2019
Location: Coordinates X,Y,Z
Posts: 328
Reputation: 22
Default Re: Boombox

Quote:
Originally Posted by KeyOfKey View Post
E ti dico che non va, ho già provato il loop

Non va per l'id 0, perchè io sono id 1 e la sento la musica.
Is it like this?
Code:
BoomboxData[MAX_PLAYERS][info]
__________________
Offshowtime Fuck It!

Quote:
Originally Posted by Toroi View Post
blackmail people that join your server using their ip address as hostage

or get a job and play sa-mp for fun
SiaReyes is offline   Reply With Quote
Old 08/09/2019, 07:59 PM   #10
Symon
Gangsta
 
Symon's Avatar
 
Join Date: Apr 2019
Location: Italy
Posts: 515
Reputation: 18
Default Re: Boombox

pawn Code:
static stock BoomboxData[MAX_PLAYERS][E_BOOMBOX_DATA];
__________________


Discord | Play Now | Website

Add your server to favourites and join our Discord.
Symon 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
[Ajuda] Boombox CoronelAraujo Português/Portuguese 7 16/09/2015 04:48 AM
Boombox SoFahim Scripting Help 4 20/05/2015 12:06 AM
Boombox Help Chris009 Scripting Help 1 02/02/2013 09:01 AM
Boombox Help San1 Scripting Help 3 11/11/2012 09:15 AM
Boombox help again please San1 Scripting Help 2 25/06/2012 05:17 AM


All times are GMT. The time now is 10:00 AM.


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