PlayAudioStreamForPlayer help?
#1

I trying to make so everyone can hear this but wont work, only me can hear it why?


pawn Код:
if(strcmp(cmd, "/hotwire", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
            {
                if(VehAsk[playerid] == 2 && HotWire[playerid] == 0)
                {
                    GetPlayerName(playerid, sendername, sizeof(sendername));
                    GiveNameSpace(sendername);
                    if(PlayerInfo[playerid][pMaskUse] == 1) { format(sendername, sizeof(sendername), "Stranger_%d", RandMask[playerid]); }
                    format(string, sizeof(string), "* %s rips the wires out of the ignition and attempts to hotwire the vehicle.", sendername);
                    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                    format(string, sizeof(string), "* *BEEP* *BEEP* *BEEP* (( Car Alarm ))");
                    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                    new Float:X, Float:Y, Float:Z, Float:Distance = 10.0;
                    GetPlayerPos(playerid, X, Y, Z);
                    if(IsPlayerInRangeOfPoint(playerid, 10.0,X, Y, Z))
                    {
                        PlayAudioStreamForPlayer(playerid,"http://www.fileden.com/files/2012/4/18/3293679/Sound%20Car%20alarm%20%28Alarma%20de%20coche%29.mp3", X, Y, Z, Distance, 0);
                    }
                    HotWire[playerid] = 1;
                    if(CarInfo[VehicleOwned[idcar]][cAlarm] == 1)
                    {
                        HotWireTime[playerid] = 60;
                    }
                    else if(CarInfo[VehicleOwned[idcar]][cAlarm] == 2)
                    {
                        HotWireTime[playerid] = 120;
                    }
                    else if(CarInfo[VehicleOwned[idcar]][cAlarm] == 3)
                    {
                        HotWireTime[playerid] = 128;
                    }
                    else
                    {
                        HotWireTime[playerid] = 30;
                    }
                }
                else
                {
                    SendClientMessage(playerid,COLOR_GREY,"You was not asked to Hotwire this vehicle !");
                }
            }
            else
            {
                SendClientMessage(playerid,COLOR_GREY,"You are not even in a vehicle or the Driver of it !");
            }
            return 1;
        }
    }
Reply
#2

You need to loop through all player's, try this
pawn Код:
if(strcmp(cmd, "/hotwire", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
            {
                if(VehAsk[playerid] == 2 && HotWire[playerid] == 0)
                {
                    GetPlayerName(playerid, sendername, sizeof(sendername));
                    GiveNameSpace(sendername);
                    if(PlayerInfo[playerid][pMaskUse] == 1) { format(sendername, sizeof(sendername), "Stranger_%d", RandMask[playerid]); }
                    format(string, sizeof(string), "* %s rips the wires out of the ignition and attempts to hotwire the vehicle.", sendername);
                    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                    format(string, sizeof(string), "* *BEEP* *BEEP* *BEEP* (( Car Alarm ))");
                    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                    new Float:X, Float:Y, Float:Z, Float:Distance = 10.0;
                    GetPlayerPos(playerid, X, Y, Z);
                    if(IsPlayerInRangeOfPoint(playerid, 10.0,X, Y, Z))
                    {
                        for(new i = 0; i < MAX_PLAYERS; i++)
                        {
                            PlayAudioStreamForPlayer(i,"http://www.fileden.com/files/2012/4/18/3293679/Sound%20Car%20alarm%20%28Alarma%20de%20coche%29.mp3", X, Y, Z, Distance, 0);
                        }
                    }
                    HotWire[playerid] = 1;
                    if(CarInfo[VehicleOwned[idcar]][cAlarm] == 1)
                    {
                        HotWireTime[playerid] = 60;
                    }
                    else if(CarInfo[VehicleOwned[idcar]][cAlarm] == 2)
                    {
                        HotWireTime[playerid] = 120;
                    }
                    else if(CarInfo[VehicleOwned[idcar]][cAlarm] == 3)
                    {
                        HotWireTime[playerid] = 128;
                    }
                    else
                    {
                        HotWireTime[playerid] = 30;
                    }
                }
                else
                {
                    SendClientMessage(playerid,COLOR_GREY,"You was not asked to Hotwire this vehicle !");
                }
            }
            else
            {
                SendClientMessage(playerid,COLOR_GREY,"You are not even in a vehicle or the Driver of it !");
            }
            return 1;
        }
    }
not sure about it but try it.
Reply
#3

Quote:
Originally Posted by [Lexi]
Посмотреть сообщение
You need to loop through all player's, try this
pawn Код:
if(strcmp(cmd, "/hotwire", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
            {
                if(VehAsk[playerid] == 2 && HotWire[playerid] == 0)
                {
                    GetPlayerName(playerid, sendername, sizeof(sendername));
                    GiveNameSpace(sendername);
                    if(PlayerInfo[playerid][pMaskUse] == 1) { format(sendername, sizeof(sendername), "Stranger_%d", RandMask[playerid]); }
                    format(string, sizeof(string), "* %s rips the wires out of the ignition and attempts to hotwire the vehicle.", sendername);
                    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                    format(string, sizeof(string), "* *BEEP* *BEEP* *BEEP* (( Car Alarm ))");
                    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                    new Float:X, Float:Y, Float:Z, Float:Distance = 10.0;
                    GetPlayerPos(playerid, X, Y, Z);
                    if(IsPlayerInRangeOfPoint(playerid, 10.0,X, Y, Z))
                    {
                        for(new i = 0; i < MAX_PLAYERS; i++)
                        {
                            PlayAudioStreamForPlayer(i,"http://www.fileden.com/files/2012/4/18/3293679/Sound%20Car%20alarm%20%28Alarma%20de%20coche%29.mp3", X, Y, Z, Distance, 0);
                        }
                    }
                    HotWire[playerid] = 1;
                    if(CarInfo[VehicleOwned[idcar]][cAlarm] == 1)
                    {
                        HotWireTime[playerid] = 60;
                    }
                    else if(CarInfo[VehicleOwned[idcar]][cAlarm] == 2)
                    {
                        HotWireTime[playerid] = 120;
                    }
                    else if(CarInfo[VehicleOwned[idcar]][cAlarm] == 3)
                    {
                        HotWireTime[playerid] = 128;
                    }
                    else
                    {
                        HotWireTime[playerid] = 30;
                    }
                }
                else
                {
                    SendClientMessage(playerid,COLOR_GREY,"You was not asked to Hotwire this vehicle !");
                }
            }
            else
            {
                SendClientMessage(playerid,COLOR_GREY,"You are not even in a vehicle or the Driver of it !");
            }
            return 1;
        }
    }
not sure about it but try it.
Thank you, i will test this.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)