SA-MP Forums Archive
EASY - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: EASY (/showthread.php?tid=374111)



EASY - Windrush - 01.09.2012

pawn Код:
public OnPlayerDeath(playerid, killerid, reason) {
    new Name[128];
    GetPlayerName(killerid, Name, sizeof(Name));
    PlayerTotalKills[killerid] = PlayerTotalKills[killerid] +1;
    PlayerTotalKills[playerid] = 0;
    if(PlayerTotalKills[killerid] == 1) {
        PlayAudioStreamForPlayer(playerid, "http://uploads3.mp3songurls.com/1351113.mp3");
        format(string, sizeof(string), "~r~%s FIRST BLOOD", Name);
        GameTextForAll(string, 6000,3);
    }
    if(PlayerTotalKills[killerid] == 2) {
        PlayAudioStreamForPlayer(playerid, "http://uploads3.mp3songurls.com/1351108.mp3");
        format(string, sizeof(string), "~r~%s DOUBLE KILL.", Name);
        GameTextForAll(string, 6000,3);
        return 1;
    }
This Script, Play Only 1 Player

But I want
All Players IN The Server Play That Sound

Rep Those Who help me: ( [ON]/OFF )


Re: EASY - Dan. - 01.09.2012

This will play a mp3 for all the players:
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(killerid, name, sizeof(name));
   
    PlayerTotalKills[killerid] = PlayerTotalKills[killerid] +1;
    PlayerTotalKills[playerid] = 0;
   
    if(PlayerTotalKills[killerid] == 1)
    {
        format(string, sizeof(string), "~r~%s FIRST BLOOD", Name);
        GameTextForAll(string, 6000,3);
    }
    if(PlayerTotalKills[killerid] == 2)
    {
        format(string, sizeof(string), "~r~%s DOUBLE KILL.", Name);
        GameTextForAll(string, 6000,3);
    }

    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        PlayAudioStreamForPlayer(i, "http://uploads3.mp3songurls.com/1351108.mp3");
    }
   
    return 1;
}



Re: EASY - Windrush - 01.09.2012

you didnt what i mean

If Player Kill One

pawn Код:
if(PlayerTotalKills[killerid] == 1) {
        PlayAudioStreamForPlayer(playerid, "http://uploads3.mp3songurls.com/1351113.mp3");
        format(string, sizeof(string), "~r~%s FIRST BLOOD", Name);
        GameTextForAll(string, 6000,3);
    }
if player kill two
pawn Код:
if(PlayerTotalKills[killerid] == 2) {
        PlayAudioStreamForPlayer(playerid, "http://uploads3.mp3songurls.com/1351108.mp3");
        format(string, sizeof(string), "~r~%s DOUBLE KILL.", Name);
        GameTextForAll(string, 6000,3);
        return 1;
    }
And i Want That Sound That all players can hear them

like
1st kill
They were hear a sound http://uploads3.mp3songurls.com/1351113.mp3

2nd kills
they were hear a sound http://uploads3.mp3songurls.com/1351108.mp3


Re: EASY - Dan. - 01.09.2012

In my code I already played 1 mp3 link to all players, you can edit it easily, you had the example right in front of you how to play it for all...
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(killerid, name, sizeof(name));

    PlayerTotalKills[killerid] = PlayerTotalKills[killerid] +1;
    PlayerTotalKills[playerid] = 0;

    if(PlayerTotalKills[killerid] == 1)
    {
        format(string, sizeof(string), "~r~%s FIRST BLOOD", Name);
        GameTextForAll(string, 6000,3);
       
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            PlayAudioStreamForPlayer(playerid, "http://uploads3.mp3songurls.com/1351113.mp3");
        }
    }
    if(PlayerTotalKills[killerid] == 2)
    {
        format(string, sizeof(string), "~r~%s DOUBLE KILL.", Name);
        GameTextForAll(string, 6000,3);

        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            PlayAudioStreamForPlayer(playerid, "http://uploads3.mp3songurls.com/1351108.mp3");
        }
    }
    return 1;
}