[Ajuda] Comando
#6

pawn Код:
CMD:reparar(playerid) {
    new v = GetClosestVehicle(playerid);
    new Float:vv[3];
    GetVehiclePos(v, vv[0], vv[1], vv[2]);
    if(IsPlayerInRangeOfPoint(playerid, /*raio*/, vv[0], vv[1], vv[2])) {
        RepairVehicle(v);
        SendClientMessage(playerid, -1, "Veнculo reparado");
    }
    else {
        SendClientMessage(playerid, -1, "Nenhum carro nesse raio..");
    }
    return true;
}

stock GetClosestVehicle(playerid) {
    new Float:x, Float:y, Float:z;
    new Float:dist, Float:closedist=9999, closeveh;
    for(new i=1; i < MAX_VEHICLES; i++) {
        if(GetVehiclePos(i, x, y, z)) {
            dist = GetPlayerDistanceFromPoint(playerid, x, y, z);
            if(dist < closedist) {
                closedist = dist;
                closeveh = i;
            }
        }
    }
    return closeveh;
}
Reply


Messages In This Thread
Comando - by Adriano_MQD - 13.07.2012, 13:35
Re: Comando - by .FuneraL. - 13.07.2012, 13:44
Re: Comando - by Adriano_MQD - 13.07.2012, 14:56
Re: Comando - by sanalex - 13.07.2012, 15:01
Re: Comando - by Adriano_MQD - 13.07.2012, 15:08
Re: Comando - by zbt - 13.07.2012, 16:05
Re: Comando - by Adriano_MQD - 13.07.2012, 16:26
Re: Comando - by zbt - 13.07.2012, 16:33
Re: Comando - by Adriano_MQD - 13.07.2012, 16:33
Re: Comando - by zbt - 13.07.2012, 16:36

Forum Jump:


Users browsing this thread: 1 Guest(s)