їMe ayudan a hacer esto?
#6

pawn Код:
#define DISTANCIA_GAS 6.0
enum gas { Float:GasUbicacion[3] };
new AtodoGas[][gas] = {
    {0.0, 0.0, 0.0},
    {0.0, 0.0, 0.0},
    {0.0, 0.0, 0.0},
    {0.0, 0.0, 0.0},
    {0.0, 0.0, 0.0}
    /*ETC...*/
};

CMD:llenar(playerid, params[]){
    new vehicleid = GetPlayerVehicleID(playerid);
    if(InGasStation(playerid)){
        GiveFuel(playerid,vehicleid);
    }else{
        GameTextForPlayer(playerid,"~r~No estas en una estacion de gasolina",5000,5);
    }
    return false;
}

stock InGasStation(playerid){
    for(new idx=0; idx< sizeof(AtodoGas); idx++){
        if(IsPlayerInRangeOfPoint(playerid, DISTANCIA_GAS, AtodoGas[idx][GasUbicacion][0], AtodoGas[idx][GasUbicacion][1], AtodoGas[idx][GasUbicacion][2])) return true;
    }return false;
}
pawn Код:
enum gas { Float:GasUbicacion[4] };
new AtodoGas[][gas] = {
    {/*posicion*/0.0, 0.0, 0.0,  /*distancia*/0.0},
    {/*posicion*/0.0, 0.0, 0.0,  /*distancia*/0.0},
    {/*posicion*/0.0, 0.0, 0.0,  /*distancia*/0.0},
    {/*posicion*/0.0, 0.0, 0.0,  /*distancia*/0.0},
    {/*posicion*/0.0, 0.0, 0.0,  /*distancia*/0.0},
   
    /*ETC...*/
};

CMD:llenar(playerid, params[]){
    new vehicleid = GetPlayerVehicleID(playerid);
    if(InGasStation(playerid)){
        GiveFuel(playerid,vehicleid);
    }else{
        GameTextForPlayer(playerid,"~r~No estas en una estacion de gasolina",5000,5);
    }
    return false;
}

stock InGasStation(playerid){
    for(new idx=0; idx< sizeof(AtodoGas); idx++){
        if(IsPlayerInRangeOfPoint(playerid, AtodoGas[idx][GasUbicacion][3], AtodoGas[idx][GasUbicacion][0], AtodoGas[idx][GasUbicacion][1], AtodoGas[idx][GasUbicacion][2])) return true;
    }return false;
}
PD: no tiene lуgica crear una funciуn 'InGasStation' con el mismo funcionamiento que la funciуn nativa de samp 'IsPlayerInRangeOfPoint'
Reply


Messages In This Thread
їMe ayudan a hacer esto? - by Alexander11 - 05.09.2014, 03:19
Respuesta: їMe ayudan a hacer esto? - by Swedky - 05.09.2014, 03:23
Respuesta: їMe ayudan a hacer esto? - by YazukiAkira - 05.09.2014, 03:29
Respuesta: їMe ayudan a hacer esto? - by Alexander11 - 05.09.2014, 03:34
Respuesta: їMe ayudan a hacer esto? - by Swedky - 05.09.2014, 03:37
Respuesta: їMe ayudan a hacer esto? - by OTACON - 05.09.2014, 03:51

Forum Jump:


Users browsing this thread: 6 Guest(s)