Jump to content

Recommended Posts

Posted

Buna seara tuturor.

In acest tutorial va voi explica cum sa creati mai multe frecvente de radio pe serverul vostru folosind dialog.

[Tutorial]Pasul 1

Adaugati la inceputul script-ului urmatoarele :

[pawn]#include <a_samp>

#define Radio 2[/pawn]

[Tutorial]Pasul 2

Adaugam doua stock-uri pentru PlayAudioStreamForPlayersInCar si StopAudioStreamForPlayersInCar

[pawn]stock PlayAudioStreamForPlayersInCar(vehicleid,url[])

{

    for(new i=0; i < MAX_PLAYERS; i++)

    {

        if(IsPlayerInAnyVehicle(i))

        {

            if(GetPlayerVehicleID(i) == vehicleid)

            {

            PlayAudioStreamForPlayer(i,url);

            }

        }

    }

}

stock StopAudioStreamForPlayersInCar(vehicleid)

{

    for(new i=0; i < MAX_PLAYERS; i++)

    {

        if(IsPlayerInAnyVehicle(i))

        {

            if(GetPlayerVehicleID(i) == vehicleid)

            {

            StopAudioStreamForPlayer(i);

            }

        }

    }

}[/pawn]

[Tutorial]Pasul 3

Cautam public OnVehicleDeath.Daca nu este il adaugam si introducem urmatoarele :

[pawn]public OnVehicleDeath(vehicleid, killerid)

{

for(new playerid = 0; playerid < GetMaxPlayers(); playerid++)

{

    StopAudioStreamForPlayersInCar(vehicleid);

}

    return 1;

}[/pawn]

[Tutorial]Pasul 5

Atunci cand player-ul respectiv coboara din masina radio-ul se opreste asa ca adaugam:

[pawn]public OnPlayerExitVehicle(playerid, vehicleid)

{

StopAudioStreamForPlayersInCar(vehicleid);

return 1;

}[/pawn]

[Tutorial]Pasul 6

Dupa cum am spus vom folosi un dialog asa ca introducem urmatoarele in OnDialogResponse

[pawn]public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])

{

new vehicleid = GetPlayerVehicleID(playerid);

    if(response)

{

switch(dialogid == 2)

        {

case 1: {

          switch(listitem)

        {

            case 0: {

            StopAudioStreamForPlayersInCar(vehicleid);

            PlayerPlaySound(playerid,1056,0.0,0.0,0.0);

                        PlayAudioStreamForPlayersInCar(vehicleid, "http://stream.profm.ro:8012/profm.mp3");

                        SendClientMessage(playerid,0x00FFFAFF,"ProFM");

                        return 1;

            }

            case 1: {

            StopAudioStreamForPlayersInCar(vehicleid);

            PlayerPlaySound(playerid,1056,0.0,0.0,0.0);

                        PlayAudioStreamForPlayersInCar(vehicleid, "http://radiotaraf.no-ip.biz:7100");

                        SendClientMessage(playerid,0x00FFFAFF,"Radio Taraf");

                        return 1;

            }

    case 2: {

            StopAudioStreamForPlayersInCar(vehicleid);

            PlayerPlaySound(playerid,1056,0.0,0.0,0.0);

                        PlayAudioStreamForPlayersInCar(vehicleid, "http://srv04.bigstreams.de/bigfm-mp3-64");

                        SendClientMessage(playerid,0x00FFFAFF,"BigFM");

                        return 1;

            }

    case 3: {

            StopAudioStreamForPlayersInCar(vehicleid);

            PlayerPlaySound(playerid,1056,0.0,0.0,0.0);

                        PlayAudioStreamForPlayersInCar(vehicleid, "http://rpr1.fmstreams.de/stream1");

                        SendClientMessage(playerid,0x00FFFAFF,"RPR1");

return 1;

            }

    case 4: {

            StopAudioStreamForPlayersInCar(vehicleid);

            PlayerPlaySound(playerid,1056,0.0,0.0,0.0);

                        PlayAudioStreamForPlayersInCar(vehicleid, "http://gffstream.ic.llnwd.net/stream/gffstream_stream_wdr_einslive_a");

                        SendClientMessage(playerid,0x00FFFAFF,"1Live");

                        return 1;

            }

      case 5: {

            StopAudioStreamForPlayersInCar(vehicleid);

            PlayerPlaySound(playerid,1056,0.0,0.0,0.0);

                        PlayAudioStreamForPlayersInCar(vehicleid, "http://stream.blackbeats.fm/");

                        SendClientMessage(playerid,0x00FFFAFF,"BlackBeatsFM");

                        return 1;

            }

      case 6: {

            StopAudioStreamForPlayersInCar(vehicleid);

            PlayerPlaySound(playerid,1056,0.0,0.0,0.0);

                        PlayAudioStreamForPlayersInCar(vehicleid, "http://live.itsybitsy.ro:8000/itsybitsy");

                        SendClientMessage(playerid,0x00FFFAFF,"Itsy Bitsy");

                        return 1;

            }

      case 7: {

            StopAudioStreamForPlayersInCar(vehicleid);

            PlayerPlaySound(playerid,1056,0.0,0.0,0.0);

                        PlayAudioStreamForPlayersInCar(vehicleid, "http://stream.dancefm.ro:8032/dancefm.mp3");

                        SendClientMessage(playerid,0x00FFFAFF,"Dance FM");

                        return 1;

            }

      case 8: {

            StopAudioStreamForPlayersInCar(vehicleid);

            PlayerPlaySound(playerid,1056,0.0,0.0,0.0);

                        PlayAudioStreamForPlayersInCar(vehicleid, "http://80.86.106.35:8000/");

                        SendClientMessage(playerid,0x00FFFAFF,"Vibe FM");

                        return 1;

            }

      case 9: {

            StopAudioStreamForPlayersInCar(vehicleid);

            PlayerPlaySound(playerid,1056,0.0,0.0,0.0);

                        PlayAudioStreamForPlayersInCar(vehicleid, "http://173.236.56.82:8004");

                        SendClientMessage(playerid,0x00FFFAFF,"Dubstep Live");

                        return 1;

            }

      case 10: {

            StopAudioStreamForPlayersInCar(vehicleid);

            PlayerPlaySound(playerid,1056,0.0,0.0,0.0);

                        PlayAudioStreamForPlayersInCar(vehicleid, "http://80.86.106.136:80/");

                        SendClientMessage(playerid,0x00FFFAFF,"Kiss FM");

                        return 1;

            }

      case 11: {

            StopAudioStreamForPlayersInCar(vehicleid);

                        SendClientMessage(playerid,0x00FFFAFF,".");//In caz ca doriti sa trimiteti un mesaj catre player !

                        SendClientMessage(playerid,0x00FFFAFF,".");//In caz ca doriti sa trimiteti un mesaj catre player !

                        return 1;

            }

    case 12: {

            StopAudioStreamForPlayersInCar(vehicleid);

            SendClientMessage(playerid,0xFF0000FF,"Radio stopped.");

            }

}

}

}

}

return 1;

}[/pawn]

[Tutorial]Pasul 7

Pentru folosirea acestui dialog avem nevoie de o comanda asa ca vom folosi :

[pawn]    if (strcmp("/radio", cmdtext, true, 10) == 0)

{

if(IsPlayerInAnyVehicle(playerid))ShowPlayerDialog(playerid, 2 , DIALOG_STYLE_LIST, "Radio.", "ProFM\nRadioTaraf\nBigFM\nRPR1\n1LIVE\nBlackBeatsFM\nItsy Bitsy\nDanceFM\nVibeFM\nDubstepLive\nKiss FM\nStream not playing?\nStop the music", "Ok", "Cancel");

        else SendClientMessage(playerid,0x00FF00AA,"Radio stopped.");StopAudioStreamForPlayer(playerid);

        return 1;

}[/pawn]

Sper ca v-am fost de folos,

[Pawn]

Pentru suport nu ezitati sa ma contactati printr-un mesaj privat sau un mesaj pe Y/M.(Scripting sa:mp/cs,ScripturiWEB,phpbb,mysql,ipb,photoshop,html)

Posted

Update !

Modificari - Nu am numerotat cum trebuie urmatorul:

[pawn]case[/pawn]

Pentru suport nu ezitati sa ma contactati printr-un mesaj privat sau un mesaj pe Y/M.(Scripting sa:mp/cs,ScripturiWEB,phpbb,mysql,ipb,photoshop,html)

Posted

Salut [Pawn].

Vreau sa iti spun ca ceea ce ai facut tu nu se numeste tutorial.

Intr-un tutorial se presupune sa explici ceva,nu sa pui codul si atat.

Trebuie sa explici de ce ai pus o functie in loc de alta,ce face fiecare functie,si de ce ai pus-o acolo.

            Rimmon

Massari e curva mea

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.