[Ajuda] Sistema portamalas
#6

Quote:
Originally Posted by hard_dalzot
Посмотреть сообщение
Tenta fazer alguma funзгo para fazer com que o player deva estar a 1 metro do portamalas do carro para poder abri-lo ex:
pawn Код:
//poe no seu comando /portamalas

            new contar = 0;
            new resultado;
            for(new i; i != MAX_VEHICLES; i++)
            {
                new distancia = ChecarDistanciaPlayerVeiculo(3.5, playerid, i);
                if(distancia)
                {
                    resultado = i;
                    countar++;
                }
            }

//coloca no fim de seu GM
stock ChecarDistanciaPlayerVeiculo(Float:radi, playerid, vehicleid)
{
    if(IsPlayerConnected(playerid))
    {
        new Float:PX,Float:PY,Float:PZ,Float:X,Float:Y,Float:Z;
        GetPlayerPos(playerid,PX,PY,PZ);
        GetVehiclePos(vehicleid, X,Y,Z);
        new Float:Distancia = (X-PX)*(X-PX)+(Y-PY)*(Y-PY)+(Z-PZ)*(Z-PZ);
        if(Distancia <= radi*radi)
        {
            return 1;
        }
    }
    return 0;
}
tenta usar isso ai
tenta colocar isso na frente(mas dentro) do comando(tirando a stock e claro) que esta acima.......
ficaria e depois coloque o
Код:
if(Distancia => 3.6)	return SendClientMessage(playerid, COLOR_WHITE, "Nenhum veiculo perto de vocк");
como no exemplo abaixo
pawn Код:
if(strcmp(cmd, "/portamalas", true) == 0)
                    {

                    new vehicleid = GetNearestVehicle(playerid, 10);

                    new Float: Pos[3];

                    GetVehiclePos(vehicleid, Pos[0], Pos[1], Pos[2]);

                    if(Distancia => 3.6)    return SendClientMessage(playerid, COLOR_WHITE, "Nenhum veiculo perto de vocк");
                            // se GetNearestVehicle n encontrar nenhum, a funcao retorna 0, dai essa linha ai :D
Reply


Messages In This Thread
Sistema portamalas - by billygod - 11.04.2014, 18:07
Re: Sistema portamalas - by hard_dalzot - 11.04.2014, 20:47
Re: Sistema portamalas - by billygod - 12.04.2014, 03:55
Re: Sistema portamalas - by hard_dalzot - 12.04.2014, 14:36
Re: Sistema portamalas - by billygod - 15.04.2014, 16:27
Re: Sistema portamalas - by williamgato - 15.04.2014, 18:04

Forum Jump:


Users browsing this thread: 1 Guest(s)