[Ajuda] Comando sу para um ID de veiculo
#4

Nгo entendi Muito ... Ve ser pega !

pawn Код:
if(!strcmp("/race", cmdtext, true))
    {
        if(IsPlayerConnected(playerid))
        {
            new counter = 0;
            new result;
            new plyName[MAX_PLAYER_NAME];
            GetPlayerName(playerid, plyName, MAX_PLAYER_NAME);
            for(new i; i != MAX_VEHICLES; i++)
            {
                new dist = Checarveiculo(5, playerid, i);
                if(dist)
                {
                    result = i;
                    counter++;
                }
            }
            switch(counter)
            {
                case 0:
                {
                    MSGPLAYER(playerid, COLOR_GREY, "   Nгo hб nenhum carro nesse raio!");
                }
                case 1:
                {
                    new name[MAX_PLAYER_NAME];
                    GetPlayerName(playerid, name, sizeof(name));
                    format(string, sizeof(string), "Vocк deu respawn no carro ID:[%d]", result);
                    MSGPLAYER(playerid, COLOR_GREY, string);
                    format(string, sizeof(string), "AdmAviso: Carro ID:[%d] foi respawnado Por: %s", result, name);
                    ABroadCast(COLOR_YELLOW,string,1);
                }
                SetVehicleToRespawn(result);
            }
            default:
            {
                MSGPLAYER(playerid, COLOR_GREY, "   Foram encontrados mais de um carro nesse raio");
            }
        }
        return 1;
    }

//-------------------//
stock Checarveiculo(Float:radi, playerid, vehicleid)//Final do GM ou FS
{
    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:Distance = (X-PX)*(X-PX)+(Y-PY)*(Y-PY)+(Z-PZ)*(Z-PZ);
        if(Distance <= radi*radi)
        {
            return 1;
        }
    }
    return 0;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)