SA-MP Forums Archive
[Pedido] Comando /piloto - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Pedido] Comando /piloto (/showthread.php?tid=458613)



Comando /piloto - TorresPutado - 17.08.2013

Queria um comando /piloto Exemplo se o player digita-se: /piloto iria apareзer isso: [INFO] Piloto %s esta trabalhando.
Tentei usar esse codigo:
pawn Код:
if (!strcmp(cmdtext, "/piloto", true))
    {
        new vehid = GetPlayerVehicleID(playerid);
        new carid = GetVehicleModel(vehid);
        if(carid == 511 || carid == 512 || carid == 593 || carid == 520 || carid == 553 || carid == 476 || carid == 464 || carid == 519 || carid == 460)
        {
            if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
            {
                if(!smoking[vehid])
                {
                    smoking[vehid] = true;
                    return format(stringa, sizeof(stringa), "[INFO] Piloto %s esta trabalhando.", pname);
                    SendClientMessageToAll(0x0016DDFF, stringa);
                }
                else
                {
                    smoking[vehid] = false;
                    return
                    format(stringa, sizeof(stringa), "[INFO] Piloto %s parou de trabalhar.", pname);
        SendClientMessageToAll(0x0016DDFF, stringa);
                }
            }
            else return SendClientMessage(playerid, -1, "Vocк nгo estб dirigindo a aeronave!");
        }
        else return SendClientMessage(playerid, -1, "Vocк nгo estб em uma aeronave!");
    }
Mais nao apareзe a mensagem [INFO] Piloto %s esta trabalhando. Ajuda por favor.


Re: Comando /piloto - xxRaioxx - 17.08.2013

pawn Код:
if (!strcmp(cmdtext, "/piloto", true))
    {
        new vehid = GetPlayerVehicleID(playerid);
        new carid = GetVehicleModel(vehid);
        if(carid == 511 || carid == 512 || carid == 593 || carid == 520 || carid == 553 || carid == 476 || carid == 464 || carid == 519 || carid == 460)
        {
            if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
            {
                if(!smoking[vehid])
                {
                    smoking[vehid] = true;
                    format(stringa, sizeof(stringa), "[INFO] Piloto %s esta trabalhando.", pname);
                    SendClientMessageToAll(0x0016DDFF, stringa);
                }
                else
                {
                    smoking[vehid] = false;
                    return
                    format(stringa, sizeof(stringa), "[INFO] Piloto %s parou de trabalhar.", pname);
        SendClientMessageToAll(0x0016DDFF, stringa);
                }
            }
            else return SendClientMessage(playerid, -1, "Vocк nгo estб dirigindo a aeronave!");
        }
        else return SendClientMessage(playerid, -1, "Vocк nгo estб em uma aeronave!");
    }
Testa aн,nгo sei muito strcmp mais zcmd.


Re: Comando /piloto - xxRaioxx - 17.08.2013

@ Edit > Malz pelo double, o fуrum postou 2 vezes '-'


Respuesta: Re: Comando /piloto - TorresPutado - 17.08.2013

Quote:
Originally Posted by xxRaioxx
Посмотреть сообщение
pawn Код:
if (!strcmp(cmdtext, "/piloto", true))
    {
        new vehid = GetPlayerVehicleID(playerid);
        new carid = GetVehicleModel(vehid);
        if(carid == 511 || carid == 512 || carid == 593 || carid == 520 || carid == 553 || carid == 476 || carid == 464 || carid == 519 || carid == 460)
        {
            if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
            {
                if(!smoking[vehid])
                {
                    smoking[vehid] = true;
                    format(stringa, sizeof(stringa), "[INFO] Piloto %s esta trabalhando.", pname);
                    SendClientMessageToAll(0x0016DDFF, stringa);
                }
                else
                {
                    smoking[vehid] = false;
                    return
                    format(stringa, sizeof(stringa), "[INFO] Piloto %s parou de trabalhar.", pname);
        SendClientMessageToAll(0x0016DDFF, stringa);
                }
            }
            else return SendClientMessage(playerid, -1, "Vocк nгo estб dirigindo a aeronave!");
        }
        else return SendClientMessage(playerid, -1, "Vocк nгo estб em uma aeronave!");
    }
Testa aн,nгo sei muito strcmp mais zcmd.
So apareзe que o piloto ta trabalhando. Mais quando repete nao fala que ele parou de trabalhar.


Re: Comando /piloto - xxRaioxx - 17.08.2013

Tire o outro return do que fala que parou .

pawn Код:
if (!strcmp(cmdtext, "/piloto", true))
    {
        new vehid = GetPlayerVehicleID(playerid);
        new carid = GetVehicleModel(vehid);
        if(carid == 511 || carid == 512 || carid == 593 || carid == 520 || carid == 553 || carid == 476 || carid == 464 || carid == 519 || carid == 460)
        {
            if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
            {
                if(!smoking[vehid])
                {
                    smoking[vehid] = true;
                    format(stringa, sizeof(stringa), "[INFO] Piloto %s esta trabalhando.", pname);
                    SendClientMessageToAll(0x0016DDFF, stringa);
                }
                else
                {
                    smoking[vehid] = false;
                    format(stringa, sizeof(stringa), "[INFO] Piloto %s parou de trabalhar.", pname);
        SendClientMessageToAll(0x0016DDFF, stringa);
                }
            }
            else return SendClientMessage(playerid, -1, "Vocк nгo estб dirigindo a aeronave!");
        }
        else return SendClientMessage(playerid, -1, "Vocк nгo estб em uma aeronave!");
    }
Testa aн de novo.


Respuesta: Re: Comando /piloto - TorresPutado - 17.08.2013

Quote:
Originally Posted by xxRaioxx
Посмотреть сообщение
Tire o outro return do que fala que parou .

pawn Код:
if (!strcmp(cmdtext, "/piloto", true))
    {
        new vehid = GetPlayerVehicleID(playerid);
        new carid = GetVehicleModel(vehid);
        if(carid == 511 || carid == 512 || carid == 593 || carid == 520 || carid == 553 || carid == 476 || carid == 464 || carid == 519 || carid == 460)
        {
            if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
            {
                if(!smoking[vehid])
                {
                    smoking[vehid] = true;
                    format(stringa, sizeof(stringa), "[INFO] Piloto %s esta trabalhando.", pname);
                    SendClientMessageToAll(0x0016DDFF, stringa);
                }
                else
                {
                    smoking[vehid] = false;
                    format(stringa, sizeof(stringa), "[INFO] Piloto %s parou de trabalhar.", pname);
        SendClientMessageToAll(0x0016DDFF, stringa);
                }
            }
            else return SendClientMessage(playerid, -1, "Vocк nгo estб dirigindo a aeronave!");
        }
        else return SendClientMessage(playerid, -1, "Vocк nгo estб em uma aeronave!");
    }
Testa aн de novo.
Esta indo apareзe tudo direitinho. Mais fica assim embaixo para min:
/piloto - Comando invalido. Alem disso esta funcionando perfeitamente.


Re: Comando /piloto - xxRaioxx - 17.08.2013

pawn Код:
if (!strcmp(cmdtext, "/piloto", true))
Coloque assim:

pawn Код:
if (strcmp(cmdtext, "/piloto", true))



Re: Comando /piloto - Cidiei - 17.08.2013

Tenta ai!
Cuidado na definiзгo de variбveis.
pawn Код:
if(strcmp(cmdtext, "/piloto",true)){
        new trabalhando[MAX_PLAYERS];
        new vehid = GetPlayerVehicleID(playerid);
        new carid = GetVehicleModel(vehid);
        if(carid == 511 || carid == 512 || carid == 593 || carid == 520 || carid == 553 || carid == 476 || carid == 464 || carid == 519 || carid == 460){
            if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER){
                if(!trabalhando[playerid]){
                    trabalhando[playerid] = true;
                    format(stringa, sizeof(stringa),"[INFO] Piloto %s esta trabalhando.", pname);
                    SendClientMessageToAll(0x0016DDFF, stringa);
                }else{
                    trabalhando[playerid] = false;
                    format(stringa, sizeof(stringa), "[INFO] Piloto %s parou de trabalhar.", pname);
                    SendClientMessageToAll(0x0016DDFF, stringa);
                }
            }
            else return SendClientMessage(playerid,-1,"Vocк nгo estб dirigindo a aeronave!");
        }
        else return SendClientMessage(playerid, -1, "Vocк nгo estб em uma aeronave!");
    }



Respuesta: Re: Comando /piloto - TorresPutado - 17.08.2013

Quote:
Originally Posted by Cidiei
Посмотреть сообщение
Tenta ai!
Cuidado na definiзгo de variбveis.
pawn Код:
if(strcmp(cmdtext, "/piloto",true)){
        new trabalhando[MAX_PLAYERS];
        new vehid = GetPlayerVehicleID(playerid);
        new carid = GetVehicleModel(vehid);
        if(carid == 511 || carid == 512 || carid == 593 || carid == 520 || carid == 553 || carid == 476 || carid == 464 || carid == 519 || carid == 460){
            if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER){
                if(!trabalhando[playerid]){
                    trabalhando[playerid] = true;
                    format(stringa, sizeof(stringa),"[INFO] Piloto %s esta trabalhando.", pname);
                    SendClientMessageToAll(0x0016DDFF, stringa);
                }else{
                    trabalhando[playerid] = false;
                    format(stringa, sizeof(stringa), "[INFO] Piloto %s parou de trabalhar.", pname);
                    SendClientMessageToAll(0x0016DDFF, stringa);
                }
            }
            else return SendClientMessage(playerid,-1,"Vocк nгo estб dirigindo a aeronave!");
        }
        else return SendClientMessage(playerid, -1, "Vocк nгo estб em uma aeronave!");
    }
Vlw cara, TE AMO.