їMe ayudan a hacer esto?
#1

Hola, quiero optimizar un comando, y necesito que me ayuden, miren es el siguiente:
pawn Код:
CMD:llenar(playerid, params[])
{
    new vehicleid = GetPlayerVehicleID(playerid);
    if(InGasStation(6.0,playerid,1004.0070,-939.3102,42.1797) || InGasStation(6.0,playerid,1944.3260,-1772.9254,13.3906))
    {
        GiveFuel(playerid,vehicleid);
    }
    else if(InGasStation(6.0,playerid,-90.5515,-1169.4578,2.4079) || InGasStation(6.0,playerid,-1609.7958,-2718.2048,48.5391))
    {
        GiveFuel(playerid,vehicleid);
    }
    else if(InGasStation(6.0,playerid,-2029.4968,156.4366,28.9498) || InGasStation(8.0,playerid,-2408.7590,976.0934,45.4175))
    {
         GiveFuel(playerid,vehicleid);
    }
    else if(InGasStation(5.0,playerid,-2243.9629,-2560.6477,31.8841) || InGasStation(8.0,playerid,-1676.6323,414.0262,6.9484))
    {
         GiveFuel(playerid,vehicleid);
    }
    else if(InGasStation(6.0,playerid,2202.2349,2474.3494,10.5258) || InGasStation(10.0,playerid,614.9333,1689.7418,6.6968))
    {
         GiveFuel(playerid,vehicleid);
    }
    else if(InGasStation(8.0,playerid,-1328.8250,2677.2173,49.7665) || InGasStation(6.0,playerid,70.3882,1218.6783,18.5165))
    {
         GiveFuel(playerid,vehicleid);
    }
    else if(InGasStation(8.0,playerid,2113.7390,920.1079,10.5255) || InGasStation(6.0,playerid,-1327.7218,2678.8723,50.0625))
    {
         GiveFuel(playerid,vehicleid);
    }
    else{
        GameTextForPlayer(playerid,"~r~No estas en una estacion de gasolina",5000,5);
    }
    return 1;
}

public GiveFuel(playerid,vehicleid)
{
    new lfuel,mon,string[256];
    lfuel = 100 - Fuel[vehicleid];
    mon = lfuel * 7;
    if (mon <= GetPlayerMoney(playerid)){
    Fuel[vehicleid] = 0;
    format(string,255,"Vehiculo llenado por $%d.",mon);
    SendClientMessage(playerid,-1,string);
    }
    else
    {
    SendClientMessage(playerid,-1,"No tienes dinero!.");
    }
}

public InGasStation(Float:radi, playerid, Float:x, Float:y, Float:z)
{
    if(IsPlayerConnected(playerid))
    {
        new Float:oldposx, Float:oldposy, Float:oldposz;
        new Float:tempposx, Float:tempposy, Float:tempposz;
        GetPlayerPos(playerid, oldposx, oldposy, oldposz);
        tempposx = (oldposx -x);
        tempposy = (oldposy -y);
        tempposz = (oldposz -z);
        if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
        {
            return 1;
        }
    }
    return 0;
}
Me gustarнa que me ayudaran a crear un Stock que contenga las coordenadas, para asн achico mбs el comando y queda mбs optimizado.

Desde ya muchas gracias.
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: 2 Guest(s)