SA-MP Forums Archive
[Ajuda] Por Que Acontece ? - 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: [Ajuda] Por Que Acontece ? (/showthread.php?tid=403006)



Por Que Acontece ? - Lucas_Rocha - 28.12.2012

Ola Tava Colocando Uma HQ Mecanicos No Meu Sv Dai COloquei o /abastecer mais quando coloquei /abastecer deu isso no jogo :


Vocк Nao Esta No Posto De Gasolina

Olha o Codigo Do /Abastecer

pawn Код:
if(strcmp(cmd, "/abastecer", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
        if(!IsPlayerInAnyVehicle(playerid))
      return SendClientMessage(playerid,COLOR_RED,"   Vocк nгo estб em um veнculo!");

        new vid = GetPlayerVehicleID(playerid);
        if(Gas[vid] >= 100)
                return SendClientMessage(playerid,COLOR_RED,"POSTO: O tanque jб estб cheio.");

               if(IsAtGasStation(playerid))
            {
                GameTextForPlayer(playerid,"~g~B~y~M~b~S~n~~w~Reabastecendo, Aguarde...~",3000,3);
                SetTimer("Fillup",RefuelWait,0);
                Controle(playerid, 0);
                Refueling[playerid] = 1;
            }
            else
            {
                SendClientMessage(playerid,COLOR_GREY,"   Vocк nгo estб em um Posto de Gasolina");
            }
        }
        return true;
    }
Onde Que As Coordenadas Estao й dentro dakilo ali у IsAtGasStation


Codigo IsAtGasStation :

public IsAtGasStation(playerid)
{
if(IsPlayerConnected(playerid))
{
if(PlayerToPoint(15.0,playerid,1941.9850,-1774.6639,19.7006))
if(PlayerToPoint(15.0,playerid,1378.3605,-1643.0701,13.5469))
{
if(IsAPlane(GetPlayerVehicleID(playerid)))
{
return true;
}
}



Re: Por Que Acontece ? - Galhardo - 28.12.2012

Muda as coordenadas do PlayerToPoint para as do local onde vocк quer que ele abasteзa, ou acrescente.


Re: Por Que Acontece ? - ViniBorn - 28.12.2012

pawn Код:
public IsAtGasStation(playerid)
{
    if(PlayerToPoint(15.0,playerid,1941.9850,-1774.6639,19.7006) || PlayerToPoint(15.0,playerid,1378.3605,-1643.0701,13.5469))
        if(IsAPlane(GetPlayerVehicleID(playerid)))
            return true;
}



Respuesta: Por Que Acontece ? - Lucas_Rocha - 28.12.2012

Deu No Mesmo


Re: Por Que Acontece ? - Galhardo - 28.12.2012

Acho que vocк nгo entendeu, isso que o Viniborn postou й para vocк modificar as coordenadas, ou seja, acrescentando as coordenadas do local onde vocк quer que abasteзa, ou seja, na HQ dos Mecвnicos.

Entгo vocк pega as coordenadas da HQ dos mecanicos e acrescenta no cуdigo.
Ex.:
Vamos supor que a HQ dos Mecanicos fique nas coordenadas x= 1.000 y=2.000 z=3.000, vocк colocarб assim:
pawn Код:
public IsAtGasStation(playerid)
{
    if(PlayerToPoint(15.0,playerid,1941.9850,-1774.6639,19.7006) || PlayerToPoint(15.0,playerid,1378.3605,-1643.0701,13.5469) || PlayerToPoint(15.0,playerid, 1.000, 2.000, 3.000))
        if(IsAPlane(GetPlayerVehicleID(playerid)))
            return true;
}
Entendeu?


Respuesta: Por Que Acontece ? - Lucas_Rocha - 28.12.2012

eu fiz isso pow


Re: Por Que Acontece ? - zSuYaNw - 28.12.2012

pawn Код:
if(!strcmp(cmdtext, "/abastecer", true))
    {
            if(!IsPlayerInAnyVehicle(playerid))
                return SendClientMessage(playerid,COLOR_RED,"   Vocк nгo estб em um veнculo!");

            if(Gas[GetPlayerVehicleID(playerid)] >= 100)
                return SendClientMessage(playerid,COLOR_RED,"POSTO: O tanque jб estб cheio.");

            if(IsAtGasStation(playerid))
            {
                GameTextForPlayer(playerid,"~g~B~y~M~b~S~n~~w~Reabastecendo, Aguarde...~",3000,3);
                SetTimer("Fillup",RefuelWait,0);
                Controle(playerid, 0);
                Refueling[playerid] = 1;
            }
            else
            {
                SendClientMessage(playerid,COLOR_GREY,"   Vocк nгo estб em um Posto de Gasolina");
            }
            return true;
    }

[pawn]

pawn Код:
public IsAtGasStation(playerid)
{
    if(PlayerToPoint(15.0,playerid,1941.9850,-1774.6639,19.7006) ||  PlayerToPoint(15.0,playerid,1378.3605,-1643.0701,13.5469))
    {
        return true;
    }
}



Re: Por Que Acontece ? - Galhardo - 28.12.2012

Me passe as coordenadas da HQ Mecвnico, por favor! x, y e z.


Respuesta: Por Que Acontece ? - Lucas_Rocha - 28.12.2012

Deu erro :

Linha : 6121
pawn Код:
C:\Documents and Settings\LU\Desktop\Geral GTA\MegaState\gamemodes\MegaState.pwn(6121) : error 010: invalid function or declaration
Bem Em Um Return :

pawn Код:
public IsAtGasStation(playerid)
{
        if(PlayerToPoint(6.0,playerid,1941.9850,-1774.6639,19.7006) || PlayerToPoint(6.0,playerid,1373.1667,-1626.8643,13.5395))/* || PlayerToPoint(6.0,playerid,1400.6882,-1680.5344,42.4339) || PlayerToPoint(6.0,playerid,1496.5316,-1544.0677,23.5481) || PlayerToPoint(6.0,playerid,2737.3364,-1774.2123,43.7973*/
        {//LS
            return true;
}
        if(PlayerToPoint(6.0,playerid,1004.0070,-939.3102,42.1797) || PlayerToPoint(6.0,playerid,1944.3260,-1772.9254,13.3906) || PlayerToPoint(6.0,playerid,1400.6882,-1680.5344,42.4339) || PlayerToPoint(6.0,playerid,1496.5316,-1544.0677,23.5481) || PlayerToPoint(6.0,playerid,2737.3364,-1774.2123,43.7973))
        {//LS
            return true;
        }
        else if(PlayerToPoint(6.0,playerid,-90.5515,-1169.4578,2.4079) || PlayerToPoint(6.0,playerid,-1609.7958,-2718.2048,48.5391))
        {//LS
            return true;
        }
        else if(PlayerToPoint(6.0,playerid,-2029.4968,156.4366,28.9498) || PlayerToPoint(8.0,playerid,-2408.7590,976.0934,45.4175))
        {//SF
            return true;
        }
        else if(PlayerToPoint(6.0,playerid,1380.4712,462.7467,20.1107) || PlayerToPoint(8.0,playerid,1385.0475,460.5417,20.1068))
        {//PC
            return true;
        }
        else if(PlayerToPoint(6.0,playerid,1383.5532,457.1286,19.9561) || PlayerToPoint(8.0,playerid,1379.1952,459.1295,19.9587))
        {//PC
            return true;
        }
        else if(PlayerToPoint(5.0,playerid,-2243.9629,-2560.6477,31.8841) || PlayerToPoint(8.0,playerid,-1676.6323,414.0262,6.9484))
        {//Between LS and SF
            return true;
        }
        else if(PlayerToPoint(6.0,playerid,2202.2349,2474.3494,10.5258) || PlayerToPoint(10.0,playerid,614.9333,1689.7418,6.6968))
        {//LV
            return true;
        }
        else if(PlayerToPoint(8.0,playerid,-1328.8250,2677.2173,49.7665) || PlayerToPoint(6.0,playerid,70.3882,1218.6783,18.5165))
        {//LV
            return true;
        }
        else if(PlayerToPoint(8.0,playerid,677.1299,-2866.3892,13.0944) || PlayerToPoint(6.0,playerid,-1327.7218,2678.8723,50.0625))
        {//LV
            return true;
        }
    }
    return 0// Aki
}



Re: Por Que Acontece ? - Galhardo - 28.12.2012

Vocк nгo fechou o retorno

Coloque
pawn Код:
return 0;