SA-MP Forums Archive
/drink - problem - 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: /drink - problem (/showthread.php?tid=351818)



/drink - problem - Dan_Barocu - 17.06.2012

i made a drink command and i get unreachablecode 2 wrning with unreachable

pawn Код:
if(strcmp(cmd, "/drink", true) == 0)
                    {
                        if(IsAtBar(playerid))
                        {
                            if(GetPlayerDrunkLevel(playerid) <= 20000)
                            {
                                ShowPlayerDialog(playerid,Dialog_Bar,DIALOG_STYLE_LIST,"{278227}Bar","Apa\nFanta\nBere\nTuica\nSampanie\nVodka\nLichior","Selecteaza","Inchide");
                                return 1;
                                {
                                    SendClientMessage(playerid, COLOR_WHITE, "Bartender: I don't know that Drink Name.");
                                    return 1;
                                }
                                format(string, sizeof(string), "* %s bea %s de la pahar.", sendername,Dialog_Bar);
                                ProxDetector(30.0, playerid, string, COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
                            }
                            else
                            {
                                SendClientMessage(playerid, COLOR_GREY, "   Numai poti sa bei");
                                return 1;
                            }
                        }
                    }



Re: /drink - problem - Ironboy - 17.06.2012

Show the correct line.


Re: /drink - problem - Dan_Barocu - 17.06.2012

i fixed it sorry.


Re: /drink - problem - Dan_Barocu - 17.06.2012

is it possible so if i listen to one of radios and a passenger enters my cars he listens to the music im listening is it?


Re: /drink - problem - Kindred - 17.06.2012

Make a loop to check if the player is in the same vehicle as the playerid, and if they are, it sets the radio to the same thing you have.

If you have a radio code or something, show it so I can do it for you (unless you want to do it).


Re: /drink - problem - rachit_rocks - 17.06.2012

It is possible in many ways.
You can do anything by scripting dude.


Re: /drink - problem - Dan_Barocu - 17.06.2012

can you show me how i can show here only in pm!how do i do it @Kindred!


Re: /drink - problem - milanosie - 17.06.2012

pawn Код:
new vehid = GetPlayerVehicleID(playerid);
            for(new i = 0; i<MAX_PLAYERS; i++)
            {
            if(IsPlayerInVehicle(i, vehid))
            {
//play music for player "i"



Re: /drink - problem - Dan_Barocu - 17.06.2012

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_ONFOOT)
    {
        StopAudioStreamForPlayer(playerid);
    }
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[128], id;
    cmd = strtok(cmdtext, id);

    if (strcmp(cmd, "/muzica", true) == 0)
    {
    if(IsPlayerInAnyVehicle(playerid) == 1 && GetPlayerVehicleSeat(playerid) == 0)
    {
    ShowPlayerDialog(playerid, Dialog_radio, DIALOG_STYLE_LIST, "Radio InFlame Live", "Pro Fm\nRing Fm\nActualitati\nMuzica 90s\nPrahova\nMuzica 80s\nBrasov\nCluj\nBraila\nGalati\nBucuresti\nTaraf\nVenus\nPro Fm Love\nHit\nConstanta\nAlba Iulia\nPopulara\nHouse\nDans\nMuzica Copii\nBlue Sky Fm\nUBB Radio\nMuzica Romaneasca\nBacau\nPitesti\n", "Asculta","Opreste");
    return 1;
    }
    else
    {
    SendClientMessage(playerid, 0xFF330000, "SERVER: Trebuie sa fiti la Volan pentru a porni Radio!");
    return 1;
    }
    }
    return 0;
    }

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
    {
    if( dialogid == Dialog_radio )
    {
    if( response )
    {
    if( listitem == 0 )
    {
    new vehid = GetPlayerVehicleID(playerid);
    for(new i = 0; i<MAX_PLAYERS; i++)
    {
    if(IsPlayerInVehicle(i, vehid))
    {
    PlayAudioStreamForPlayer(i, "http://stream.profm.ro:8012/profm.mp3");
    SendClientMessage(i, 0xFF330000, "{ACFF05}Ascultati Radio Live: Pro Fm");
    }
    }
    return 1;
    }
    if( listitem == 1 )
    {
    new vehid = GetPlayerVehicleID(playerid);
    for(new i = 0; i<MAX_PLAYERS; i++)
    {
    if(IsPlayerInVehicle(i, vehid))
    {
    PlayAudioStreamForPlayer(i, "http://86.127.81.176:8000/live");
    SendClientMessage(i, 0xFF330000, "{ACFF05}Ascultati Radio Live: Ring Fm ");
    }
    }
    return 1;
    }
    if( listitem == 2 )
    {
    new vehid = GetPlayerVehicleID(playerid);
    for(new i = 0; i<MAX_PLAYERS; i++)
    {
    if(IsPlayerInVehicle(i, vehid))
    {
    PlayAudioStreamForPlayer(i, "http://stream2.srr.ro:8000/");
    SendClientMessage(i, 0xFF330000, "{ACFF05}Ascultati Radio Live: Actualitati ");
    }
    }
    return 1;
    }
    if( listitem == 3 )
    {
    new vehid = GetPlayerVehicleID(playerid);
    for(new i = 0; i<MAX_PLAYERS; i++)
    {
    if(IsPlayerInVehicle(i, vehid))
    {
    PlayAudioStreamForPlayer(i, "http://stream.profm.ro:8092/90s.mp3");
    SendClientMessage(i, 0xFF330000, "{ACFF05}Ascultati Radio Live: Muzica 90s  ");
    }
    }
    return 1;
    }
    if( listitem == 4 )
    {
    new vehid = GetPlayerVehicleID(playerid);
    for(new i = 0; i<MAX_PLAYERS; i++)
    {
    if(IsPlayerInVehicle(i, vehid))
    {
    PlayAudioStreamForPlayer(i, "http://ronix-live.rph.ro:8100/");
    SendClientMessage(i, 0xFF330000, "{ACFF05}Ascultati Radio Live: Prahova");
    }
    }
    return 1;
    }
    if( listitem == 5 )
    {
    new vehid = GetPlayerVehicleID(playerid);
    for(new i = 0; i<MAX_PLAYERS; i++)
    {
    if(IsPlayerInVehicle(i, vehid))
    {
    PlayAudioStreamForPlayer(i, "http://stream.profm.ro:8122/80s.mp3");
    SendClientMessage(i, 0xFF330000, "{ACFF05}Ascultati Radio Live: Muzica 80s ");
    }
    }
    return 1;
    }
    if( listitem == 6 )
    {
    new vehid = GetPlayerVehicleID(playerid);
    for(new i = 0; i<MAX_PLAYERS; i++)
    {
    if(IsPlayerInVehicle(i, vehid))
    {
    PlayAudioStreamForPlayer(i, "http://82.77.45.227:8000");
    SendClientMessage(i, 0xFF330000, "{ACFF05}Ascultati Radio Live: Brasov ");
    }
    }
    return 1;
    }
    if( listitem == 7 )
    {
    new vehid = GetPlayerVehicleID(playerid);
    for(new i = 0; i<MAX_PLAYERS; i++)
    {
    if(IsPlayerInVehicle(i, vehid))
    {
    PlayAudioStreamForPlayer(i, "http://86.35.4.198:8006/");
    SendClientMessage(i, 0xFF330000, "{ACFF05}Ascultati Radio Live: Cluj ");
    }
    }
    return 1;
    }
    if( listitem == 8 )
    {
    new vehid = GetPlayerVehicleID(playerid);
    for(new i = 0; i<MAX_PLAYERS; i++)
    {
    if(IsPlayerInVehicle(i, vehid))
    {
    PlayAudioStreamForPlayer(i, "http://95.76.53.191:8001/");
    SendClientMessage(i, 0xFF330000, "{ACFF05}Ascultati Radio Live: Braila  ");
    }
    }
    return 1;
    }
    if( listitem == 9 )
    {
    new vehid = GetPlayerVehicleID(playerid);
    for(new i = 0; i<MAX_PLAYERS; i++)
    {
    if(IsPlayerInVehicle(i, vehid))
    {
    PlayAudioStreamForPlayer(i, "http://85.120.237.64:8000/");
    SendClientMessage(i, 0xFF330000, "{ACFF05}Ascultati Radio Live: Galati  ");
    }
    }
    return 1;
    }
    if( listitem == 10 )
    {
    new vehid = GetPlayerVehicleID(playerid);
    for(new i = 0; i<MAX_PLAYERS; i++)
    {
    if(IsPlayerInVehicle(i, vehid))
    {
    PlayAudioStreamForPlayer(i, "http://89.238.227.6:8032/");
    SendClientMessage(i, 0xFF330000, "{ACFF05}Ascultati Radio Live: Bucuresti");
    }
    }
    return 1;
    }
    if( listitem == 11 )
    {
    new vehid = GetPlayerVehicleID(playerid);
    for(new i = 0; i<MAX_PLAYERS; i++)
    {
    if(IsPlayerInVehicle(i, vehid))
    {
    PlayAudioStreamForPlayer(i, "http://asculta.radiotaraf.com:7100/");
    SendClientMessage(i, 0xFF330000, "{ACFF05}Ascultati Radio Live: Taraf");
    }
    }
    return 1;
    }
    if( listitem == 12 )
    {
    new vehid = GetPlayerVehicleID(playerid);
    for(new i = 0; i<MAX_PLAYERS; i++)
    {
    if(IsPlayerInVehicle(i, vehid))
    {
    PlayAudioStreamForPlayer(i, "http://asculta.radiovenus.ro:8100/");
    SendClientMessage(i, 0xFF330000, "{ACFF05}Ascultati Radio Live: Venus");
    }
    }
    return 1;
    }
    if( listitem == 13 )
    {
    new vehid = GetPlayerVehicleID(playerid);
    for(new i = 0; i<MAX_PLAYERS; i++)
    {
    if(IsPlayerInVehicle(i, vehid))
    {
    PlayAudioStreamForPlayer(i, "http://stream.profm.ro:8072/love.mp3");
    SendClientMessage(i, 0xFF330000, "{ACFF05}Ascultati Radio Live: ProFm Love");
    }
    }
    return 1;
    }
    if( listitem == 14 )
    {
    new vehid = GetPlayerVehicleID(playerid);
    for(new i = 0; i<MAX_PLAYERS; i++)
    {
    if(IsPlayerInVehicle(i, vehid))
    {
    PlayAudioStreamForPlayer(i, "http://hit-radio.no-ip.org:8374/");
    SendClientMessage(i, 0xFF330000, "{ACFF05}Ascultati Radio Live: Hit");
    }
    }
    return 1;
    }
    if( listitem == 15 )
    {
    new vehid = GetPlayerVehicleID(playerid);
    for(new i = 0; i<MAX_PLAYERS; i++)
    {
    if(IsPlayerInVehicle(i, vehid))
    {
    PlayAudioStreamForPlayer(i, "http://live.radioconstanta.ro:9002/");
    SendClientMessage(i, 0xFF330000, "{ACFF05}Ascultati Radio Live: Constanta ");
    }
    }
    return 1;
    }
    if( listitem == 16 )
    {
    new vehid = GetPlayerVehicleID(playerid);
    for(new i = 0; i<MAX_PLAYERS; i++)
    {
    if(IsPlayerInVehicle(i, vehid))
    {
    PlayAudioStreamForPlayer(i, "http://live.ardeleanulfm.ro:8000/live128");
    SendClientMessage(i, 0xFF330000, "{ACFF05}Ascultati Radio Live: Alba Iulia");
    }
    }
    return 1;
    }
    if( listitem == 17 )
    {
    new vehid = GetPlayerVehicleID(playerid);
    for(new i = 0; i<MAX_PLAYERS; i++)
    {
    if(IsPlayerInVehicle(i, vehid))
    {
    PlayAudioStreamForPlayer(i, "http://94.23.232.141:8070/");
    SendClientMessage(i, 0xFF330000, "{ACFF05}Ascultati Radio Live: Muzica Populara");
    }
    }
    return 1;
    }
    if( listitem == 18 )
    {
    new vehid = GetPlayerVehicleID(playerid);
    for(new i = 0; i<MAX_PLAYERS; i++)
    {
    if(IsPlayerInVehicle(i, vehid))
    {
    PlayAudioStreamForPlayer(i, "http://www.texfm.ro:8000/house");
    SendClientMessage(i, 0xFF330000, "{ACFF05}Ascultati Radio Live: Muzica House ");
    }
    }
    return 1;
    }
    if( listitem == 19 )
    {
    new vehid = GetPlayerVehicleID(playerid);
    for(new i = 0; i<MAX_PLAYERS; i++)
    {
    if(IsPlayerInVehicle(i, vehid))
    {
    PlayAudioStreamForPlayer(i, "http://radiohit-dance.no-ip.org:8888/");
    SendClientMessage(i, 0xFF330000, "{ACFF05}Ascultati Radio Live: Muzica Dance  ");
    }
    }
    return 1;
    }
    if( listitem == 20 )
    {
    new vehid = GetPlayerVehicleID(playerid);
    for(new i = 0; i<MAX_PLAYERS; i++)
    {
    if(IsPlayerInVehicle(i, vehid))
    {
    PlayAudioStreamForPlayer(i, "http://stream.profm.ro:8262/kids.mp3");
    SendClientMessage(i, 0xFF330000, "{ACFF05}Ascultati Radio Live: Muzica Copii  ");
    }
    }
    return 1;
    }
    if( listitem == 21 )
    {
    new vehid = GetPlayerVehicleID(playerid);
    for(new i = 0; i<MAX_PLAYERS; i++)
    {
    if(IsPlayerInVehicle(i, vehid))
    {
    PlayAudioStreamForPlayer(i, "http://radiobluesky.net:8200/");
    SendClientMessage(i, 0xFF330000, "{ACFF05}Ascultati Radio Live: Blue Sky Fm ");
    }
    }
    return 1;
    }
    if( listitem == 22 )
    {
    new vehid = GetPlayerVehicleID(playerid);
    for(new i = 0; i<MAX_PLAYERS; i++)
    {
    if(IsPlayerInVehicle(i, vehid))
    {
    PlayAudioStreamForPlayer(i, "http://stream.radio.ubbcluj.ro:8000/ubb.mp3");
    SendClientMessage(i, 0xFF330000, "{ACFF05}Ascultati Radio Live: UBB Radio ");
    }
    }
    return 1;
    }
    if( listitem == 23 )
    {
    new vehid = GetPlayerVehicleID(playerid);
    for(new i = 0; i<MAX_PLAYERS; i++)
    {
    if(IsPlayerInVehicle(i, vehid))
    {
    PlayAudioStreamForPlayer(i, "http://stream.profm.ro:8242/profmro.mp3");
    SendClientMessage(i, 0xFF330000, "{ACFF05}Ascultati Radio Live: Muzica Romaneasca ");
    }
    }
    return 1;
    }
    if( listitem == 24 )
    {
    new vehid = GetPlayerVehicleID(playerid);
    for(new i = 0; i<MAX_PLAYERS; i++)
    {
    if(IsPlayerInVehicle(i, vehid))
    {
    PlayAudioStreamForPlayer(i, "http://46.102.251.55:8000/stream/1/");
    SendClientMessage(i, 0xFF330000, "{ACFF05}Ascultati Radio Live: Bacau ");
    }
    }
    return 1;
    }
    if( listitem == 25 )
    {
    new vehid = GetPlayerVehicleID(playerid);
    for(new i = 0; i<MAX_PLAYERS; i++)
    {
    if(IsPlayerInVehicle(i, vehid))
    {
    PlayAudioStreamForPlayer(i, "http://82.79.122.196:8000/");
    SendClientMessage(i, 0xFF330000, "{ACFF05}Ascultati Radio Live: Pitesti ");
    }
    }
    }
    }
    else
    {
    new vehid = GetPlayerVehicleID(playerid);
    for(new i = 0; i<MAX_PLAYERS; i++)
    {
    if(IsPlayerInVehicle(i, vehid))
    {
    SendClientMessage(i, 0xFF330000,"** Ai Oprit Radio-ul! **");
    StopAudioStreamForPlayer(i);
    }
    }
    }
    }
    return 1;
    }



Re: /drink - problem - milanosie - 17.06.2012

So, what was the purpose of posting that code, considering I just posted how to do it?