SA-MP Forums Archive
Ayuda - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Español/Spanish (https://sampforum.blast.hk/forumdisplay.php?fid=29)
+---- Thread: Ayuda (/showthread.php?tid=536383)



Ayuda - Jeancarlos009 - 09.09.2014

Buenas, alguien me podrнa explicar como quitarle el velocнmetro a la bicicleta?




Respuesta: Ayuda - Juance - 09.09.2014

Cuando sube al vehнculo, seguramente debes tener para que muestre el textdraw y la barra de progreso.
Antes de la funciones que muestran todo eso colocas:

pawn Код:
if(vehicleid == IDBICI || vehicleid == IDBICI || vehicleid == IDBICI) return 0;



Respuesta: Ayuda - Jeancarlos009 - 09.09.2014

Me da error

pawn Код:
error 017: undefined symbol "vehicleid"
warning 209: function "ServerMicrobeat" should return a value



Respuesta: Ayuda - Juance - 09.09.2014

Te dн un ejemplo. Debes comprobar la condiciуn con la variable que obtenes la ID del coche donde el jugador estб montado.


Respuesta: Ayuda - Jeancarlos009 - 09.09.2014

Es que no entiendo mucho


Respuesta: Ayuda - aoEXE - 09.09.2014

Quote:
Originally Posted by Jeancarlos009
Посмотреть сообщение
Es que no entiendo mucho
pasa el cуdigo donde muestras el textdraw cuando alguien se monta a un vehнculo y te intento explicar


Respuesta: Ayuda - Jeancarlos009 - 10.09.2014

pawn Код:
stock HideFuel(playerid)
{
    HideProgressBarForPlayer(playerid, SpeedBar[playerid]);
    HideProgressBarForPlayer(playerid, SpeedBar2[playerid]);
    TextDrawHideForPlayer(playerid, santiago1[playerid] );
    TextDrawHideForPlayer(playerid, santiago2[playerid] );
    TextDrawHideForPlayer(playerid, santiago3[playerid] );
    TextDrawHideForPlayer(playerid, santiago4[playerid] );
    TextDrawHideForPlayer(playerid, santiago5[playerid] );
    TextDrawHideForPlayer(playerid, santiago6[playerid] );
    TextDrawHideForPlayer(playerid, santiago7[playerid] );

}
stock VelocidadVehiculo(playerid) //GROVE4L
{
    new Float:ST[4];
    if(IsPlayerInAnyVehicle(playerid))
    GetVehicleVelocity(GetPlayerVehicleID(playerid),ST[0],ST[1],ST[2]);
    else GetPlayerVelocity(playerid,ST[0],ST[1],ST[2]);
    ST[3] = floatsqroot(floatpower(floatabs(ST[0]), 2.0) + floatpower(floatabs(ST[1]), 2.0) + floatpower(floatabs(ST[2]), 2.0)) * 180.3;
    return floatround(ST[3]);
}
pawn Код:
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
    new cid = GetPlayerVehicleID(playerid);
    SetProgressBarValue(SpeedBar[playerid], VelocidadVehiculo(playerid));
    UpdateProgressBar(SpeedBar[playerid], playerid);
    SetProgressBarValue(SpeedBar2[playerid], VehicleFuel[cid]);
    UpdateProgressBar(SpeedBar2[playerid], playerid);
    return 1;
    }
    return 1;
}
pawn Код:
veloci[i] = TextDrawCreate(491.000000, 420.000000, "Velocidad: ~g~%.0f~n~~w~Combustible: ~y~%d");
    TextDrawBackgroundColor(veloci[i], 255);
    TextDrawFont(veloci[i], 3);
    TextDrawLetterSize(veloci[i], 0.440000, 1.400000);
    TextDrawColor(veloci[i], -1);
    TextDrawSetOutline(veloci[i], 1);
    TextDrawSetProportional(veloci[i], 1);

        SpeedBar[i] = CreateProgressBar(543.00, 423.00, 85.50, 3.20, 0x0088F5FF, 100.0);
        SetProgressBarMaxValue(SpeedBar[i], 200);

        SpeedBar2[i] = CreateProgressBar(543.00, 377.00, 85.50, 3.20, 0xFFFF00FF, 100.0);
        SetProgressBarMaxValue(SpeedBar2[i], 200);

    santiago1[i] = TextDrawCreate(537.000000, 390.000000, "_");
    TextDrawBackgroundColor(santiago1[i], 255);
    TextDrawFont(santiago1[i], 1);
    TextDrawLetterSize(santiago1[i], 0.419999, 4.399998);
    TextDrawColor(santiago1[i], -1);
    TextDrawSetOutline(santiago1[i], 0);
    TextDrawSetProportional(santiago1[i], 1);
    TextDrawSetShadow(santiago1[i], 1);
    TextDrawUseBox(santiago1[i], 1);
    TextDrawBoxColor(santiago1[i], 124);
    TextDrawTextSize(santiago1[i], 634.000000, 1.000000);

    santiago2[i] = TextDrawCreate(537.000000, 343.000000, "_");
    TextDrawBackgroundColor(santiago2[i], 255);
    TextDrawFont(santiago2[i], 1);
    TextDrawLetterSize(santiago2[i], 0.449999, 4.699998);
    TextDrawColor(santiago2[i], -1);
    TextDrawSetOutline(santiago2[i], 0);
    TextDrawSetProportional(santiago2[i], 1);
    TextDrawSetShadow(santiago2[i], 1);
    TextDrawUseBox(santiago2[i], 1);
    TextDrawBoxColor(santiago2[i], 124);
    TextDrawTextSize(santiago2[i], 634.000000, 0.000000);

    santiago3[i] = TextDrawCreate(594.000000, 401.000000, "Km/h");
    TextDrawBackgroundColor(santiago3[i], 255);
    TextDrawFont(santiago3[i], 2);
    TextDrawLetterSize(santiago3[i], 0.209998, 1.099998);
    TextDrawColor(santiago3[i], 16777215);
    TextDrawSetOutline(santiago3[i], 0);
    TextDrawSetProportional(santiago3[i], 1);
    TextDrawSetShadow(santiago3[i], 2);

    santiago4[i] = TextDrawCreate(559.000000, 387.000000, "Velocimetro");
    TextDrawBackgroundColor(santiago4[i], 255);
    TextDrawFont(santiago4[i], 1);
    TextDrawLetterSize(santiago4[i], 0.260000, 1.399998);
    TextDrawColor(santiago4[i], -1);
    TextDrawSetOutline(santiago4[i], 0);
    TextDrawSetProportional(santiago4[i], 1);
    TextDrawSetShadow(santiago4[i], 2);

    santiago5[i] = TextDrawCreate(556.000000, 400.000000, "300");
    TextDrawBackgroundColor(santiago5[i], 255);
    TextDrawFont(santiago5[i], 2);
    TextDrawLetterSize(santiago5[i], 0.469998, 1.899999);
    TextDrawColor(santiago5[i], -1);
    TextDrawSetOutline(santiago5[i], 0);
    TextDrawSetProportional(santiago5[i], 1);
    TextDrawSetShadow(santiago5[i], 3);

    santiago6[i] = TextDrawCreate(556.000000, 339.000000, "Combustible");
    TextDrawBackgroundColor(santiago6[i], 255);
    TextDrawFont(santiago6[i], 1);
    TextDrawLetterSize(santiago6[i], 0.260000, 1.299996);
    TextDrawColor(santiago6[i], -1);
    TextDrawSetOutline(santiago6[i], 0);
    TextDrawSetProportional(santiago6[i], 1);
    TextDrawSetShadow(santiago6[i], 3);

    santiago7[i] = TextDrawCreate(554.000000, 353.000000, "30/100");
    TextDrawBackgroundColor(santiago7[i], 255);
    TextDrawFont(santiago7[i], 2);
    TextDrawLetterSize(santiago7[i], 0.419999, 1.899999);
    TextDrawColor(santiago7[i], -1);
    TextDrawSetOutline(santiago7[i], 0);
    TextDrawSetProportional(santiago7[i], 1);
    TextDrawSetShadow(santiago7[i], 3);
    }
pawn Код:
GetVehicleHealth(iVehicle,fExpHealth);
            if(fExpHealth < 350.0 && !IsABike(iVehicle)){
                SetVehicleHealth(iVehicle, 251.0);
                GetVehicleParamsEx(iVehicle, arrVehParams[0], arrVehParams[1], arrVehParams[2], arrVehParams[3], arrVehParams[4], arrVehParams[5], arrVehParams[6]);
                if(arrVehParams[0] == VEHICLE_PARAMS_ON) SetVehicleParamsEx(iVehicle,VEHICLE_PARAMS_OFF, arrVehParams[1], arrVehParams[2], arrVehParams[3], arrVehParams[4], arrVehParams[5], arrVehParams[6]);
                GameTextForPlayer(i, "~r~Motor quemado!", 2500, 3);
                arr_Engine{iVehicle} = 0;
            }
            //else if(arr_Engine{GetPlayerVehicleID(i)} != 0) TextDrawHideForPlayer(i, veloci[i] );
            //else if(Info[i][pSpeedo] != 0 && arr_Engine{iVehicle} == 1)
            //{
                TextDrawShowForPlayer(i, santiago7[i] );
                TextDrawShowForPlayer(i, santiago5[i] );
                TextDrawShowForPlayer(i, santiago1[i] );
                TextDrawShowForPlayer(i, santiago2[i] );
                TextDrawShowForPlayer(i, santiago3[i] );
                TextDrawShowForPlayer(i, santiago4[i] );
                TextDrawShowForPlayer(i, santiago6[i] );
                ShowProgressBarForPlayer(i, SpeedBar[i]);
                ShowProgressBarForPlayer(i, SpeedBar2[i]);
                format(szSpeed, sizeof(szSpeed),"%d/200",VehicleFuel[iVehicle]);
                TextDrawSetString(santiago7[i], szSpeed);
                format(szSpeed, sizeof(szSpeed),"%.0f", fCurrentSpeed);
                TextDrawSetString(santiago5[i], szSpeed);

            //}
        }
    }
}



Respuesta: Ayuda - aoEXE - 10.09.2014

pasa la funciуn IsABike


- Jeancarlos009 - 10.09.2014

pawn Код:
IsABike(carid)
{
    if(GetVehicleModel(carid) == 509 || GetVehicleModel(carid) ==  481 || GetVehicleModel(carid) == 510 || GetVehicleModel(carid) == 462)
    {
        return 1;
    }
    return 0;
}
Compila normal pero no me funcionan los comandos.

pawn Код:
CMD:comprar(playerid, params[])
{
    new playername[MAX_PLAYER_NAME];
    new sendername[MAX_PLAYER_NAME];
    new choice[32];
    if(sscanf(params, "s[32]", choice))
    {
        SendClientMessage(playerid, COLOR_WHITE, "{0096FF}USA{FFFFFF}: /Comprar [Armas, Productos, Carnada, Bebida, Ropa, Hotdog, Casa, accesorios]");
        return 1;
    }
    else if(strcmp(choice, "armas", true) == 0)
    {
        if (PlayerToPoint(20, playerid,308.1129,-141.4608,999.6016)||PlayerToPoint(20, playerid,314.2583,-134.0335,999.6016)||PlayerToPoint(20, playerid,313.3958,-138.9780,1004.0625))
    {
        SafeDialogEx(playerid, DIALOG_AMMU, DIALOG_STYLE_LIST, "{0096FF}Armas ala Venta","Pala ($500)\nCuchillo ($500)\nDesert Eagle ($5000)\nM4 ($1000)\nAk 47 ($8000)\nEscopeta SPAS ($10000)\nMata patos ($6000)\nBate de Beisbol ($500)\nRifle Francotirador ($15000)\nMP5 ($12000)\nRevolver cotidiano ($3000)\nPistola Silenciadora($3500)\nKatana ($1000)", "Comprar", "Salir");
    return 1;
    }

    else if(strcmp(choice, "productos", true) == 0)
    {
        if (PlayerToPoint(20, playerid,-22.3260,-138.6221,1003.5469)||PlayerToPoint(20, playerid,1671.0723,-1889.5385,13.6259)||PlayerToPoint(20, playerid,-25.6448,-56.6718,1003.5469)||PlayerToPoint(20, playerid,-29.3554,-28.8020,1003.5573)|| IsAt247(playerid))
    SafeDialogEx(playerid, STOREMENU, DIALOG_STYLE_LIST, "24/7", "Telйfono\t\t$800\nAgenda telйfonica\t\t$20\nLoteria\t\t\t$10\nSpray\t\t\t$20\nCigarros\t\t$40\nCбmara\t\t\t$160\nEncendedor\t\t$20\nSprunk\t\t\t$8\nRadio Portable\t\t$800\nFlores\t\t\t$7\nIpodMusic\t\t$850\nTraba vehiculo\t$10000", "Comprar", "Cancelar");
    return 1;
    }

    else if(strcmp(choice, "bebida", true) == 0)
    {
        if (!IsPlayerInRangeOfPoint(playerid, 4.0, 2306.2051,-1661.1157,-96.9041)) return Enviarmensaje(playerid, -1, "{FFFF54}>> {FFFFFF}No estas en un bar");
        ShowPlayerDialog(playerid, DIALOG_BEBER, DIALOG_STYLE_LIST, "Bar las gatas","Cerveza[$10\n Vodka [$12]\n Whiskey[$8] \n Agua[$3]\n Soda[$5]\n Pepsi[4$]", "comprar", "Cancelar");
        return 1;
        }

 else if(strcmp(choice, "ropa", true) == 0)
 {
     if(!IsAtClothShop(playerid)) return Enviarmensaje(playerid, -1, "{FFFF54}>> {FFFFFF}Ў No estбs en una tienda de Ropa !");
    if(IsPlayerConnected(playerid))
    {
        ShowModelSelectionMenu(playerid, skinlist, "Selecciona el nuevo Skin");
    }
    else SendClientMessage(playerid, -1, "{FFFF54}>> {FFFFFF}Ў No estбs conectado !");
    return 1;
    }
   
     else if(strcmp(choice, "hotdog", true) == 0)
 {
           if(!IsAtHotdog(playerid)) return Enviarmensaje(playerid, -1, "  No Estas en el Lugar De HotDogs");
        if(GetPlayerMoney(playerid) < 0) return Enviarmensaje(playerid, -1, "Camarero dice: Vete a otro lugar a comer gratis!");
       if(Hotdog[playerid] >= 5) return Enviarmensaje(playerid, -1, "{FFFF54}>> {FFFFFF}ЎNo puedes tener mas de 5 hotdogs!");
       if(CheckMoney(playerid,5)){
           new string[86];
         Bought(playerid, 5);
            format(string, sizeof(string), "%s compra un hotdog.", GetPlayerNameEx(playerid));
           ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            Enviarmensaje(playerid, -1, "Has comprado un hotdog, utiliza {FF4564}/chotdog {FFFFFF}para comйrtelo.");
         Hotdog[playerid] += 1;
      }
       return 1;
   }
   
       else if(strcmp(choice, "accesorios", true) == 0)
    {
           if(IsPlayerInRangeOfPoint(playerid,5.0,802.5069,-1419.6813,1016.4688))
        {
            if(Info[playerid][pVIP] >= 3)
            {
                return SafeDialogEx(playerid, BUYTOYSGOLD, DIALOG_STYLE_MSGBOX, "Tienda de Accesorios", "Bienvenido al dispensador de accesorios VIP! Aquн puedes comprar accesorios para ti.\nPrimero, tienes que elegir que menъ verбs","Ok", "Salir");
            }
        }
        if(IsAtClothShop(playerid))
        {
            SafeDialogEx(playerid, BUYTOYS, DIALOG_STYLE_MSGBOX, "Tienda de Accesorios", "{0096FF}Bienvenido {FFFFFF}a la tienda de accesorios! Aquн puedes comprar accesorios para ti.\nPrimero, tienes que elegir que menъ verбs","Normal", "VIP");
            return 1;
        }
        else Enviarmensaje(playerid, -1, "{FFFF54}>> {FFFFFF}Ў No estбs en una tienda de Ropa !");
        return 1;
    }
   
    else if(strcmp(choice, "casa", true) == 0)
    {
    new string[230];
    new Float:oldposx, Float:oldposy, Float:oldposz;
    GetPlayerName(playerid, playername, sizeof(playername));
    GetPlayerPos(playerid, oldposx, oldposy, oldposz);
    for(new h = 0; h < sizeof(HouseInfo); h++)
    {
        if(IsPlayerInRangeOfPoint(playerid,2.0,HouseInfo[h][hExteriorX], HouseInfo[h][hExteriorY], HouseInfo[h][hExteriorZ]) )
        {
            if( HouseInfo[h][hOwned] == 0 )
            {
                if(Info[playerid][pLevel] < HouseInfo[h][hLevel])
                {
                    format(string, sizeof(string), "{FFFF54}>> {FFFFFF}Tъ necesitas ser nivel %d para comprar estб casa.", HouseInfo[h][hLevel]);
                    Enviarmensaje(playerid, -1, string);
                    return 1;
                }
                if(Info[playerid][pPhousekey] == INVALID_HOUSE_ID)
                {

                    if(GetPlayerCash(playerid) > HouseInfo[h][hValue])
                    {
                        Info[playerid][pPhousekey] = h;
                        HouseInfo[h][hOwned] = 1;
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        strmid(HouseInfo[h][hOwner], sendername, 0, strlen(sendername), 255);
                        GivePlayerCash(playerid,-HouseInfo[h][hValue]);
                        SetPlayerInterior(playerid,HouseInfo[h][hHInteriorWorld]);
                        LoadObjects(playerid);
                        SetPlayerPos(playerid,HouseInfo[h][hInteriorX],HouseInfo[h][hInteriorY],HouseInfo[h][hInteriorZ]);
                        GameTextForPlayer(playerid, "~w~Bienvenido~n~Puedes salir en cualquier momento, presionando enter en este mismo lugar.", 5000, 3);
                        Info[playerid][pInt] = HouseInfo[h][hHInteriorWorld];
                        Enviarmensaje(playerid, COLOR_WHITE, "Felicitaciones por tu nueva compra!");
                        Enviarmensaje(playerid, COLOR_WHITE, "Escribe /ayuda casa para ver los comandos disponibles!");
                        SaveHouses();
                        OnPlayerUpdate(playerid);
                        Info[playerid][pVW] = h+6000;
                        SetPlayerVirtualWorld(playerid, h+6000);
                        DestroyDynamicPickup(HouseInfo[h][hPickupID]);
                        HouseInfo[h][hPickupID] = CreateDynamicPickup(1273, 23, HouseInfo[h][hExteriorX], HouseInfo[h][hExteriorY], HouseInfo[h][hExteriorZ]);
                        format(string, sizeof(string), "{FFEE00}Propiedad privada\n{01B0FF}Dueсo {FFFFFF}%s\n{01B0FF}Nivel: {FFFFFF}%d\n{01B0FF}ID: {FFFFFF}%d",HouseInfo[h][hOwner],HouseInfo[h][hLevel],h);
                        UpdateDynamic3DTextLabelText(HouseInfo[h][hTextID], -1, string);
                        new ip[32];
                        GetPlayerIp(playerid,ip,sizeof(ip));
                        format(string,sizeof(string),"%s (IP: %s) has bought house ID %d for $%d.",GetPlayerNameEx(playerid),ip,h,HouseInfo[h][hValue]);
                        Log("logs/house.log", string);//XD
                        return 1;
                    }
                    else
                    {
                        Enviarmensaje(playerid, COLOR_WHITE, "No tienes dinero para comprar esta casa!");
                        return 1;
                    }
                }
                else if(Info[playerid][pPhousekey2] == INVALID_HOUSE_ID)
                {
                    if(GetPlayerCash(playerid) > HouseInfo[h][hValue])
                    {
                        Info[playerid][pPhousekey2] = h;
                        HouseInfo[h][hOwned] = 1;
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        strmid(HouseInfo[h][hOwner], sendername, 0, strlen(sendername), 255);
                        GivePlayerCash(playerid,-HouseInfo[h][hValue]);
                        SetPlayerInterior(playerid,HouseInfo[h][hHInteriorWorld]);
                        LoadObjects(playerid);
                        SetPlayerPos(playerid,HouseInfo[h][hInteriorX],HouseInfo[h][hInteriorY],HouseInfo[h][hInteriorZ]);
                        GameTextForPlayer(playerid, "~w~Bienvenido~n~Puedes salir en cualquier momento, presionando enter en este mismo lugar.", 5000, 3);
                        Info[playerid][pInt] = HouseInfo[h][hHInteriorWorld];
                        Enviarmensaje(playerid, COLOR_WHITE, "Felicitaciones por tu nueva compra!");
                        Enviarmensaje(playerid, COLOR_WHITE, "Escribe /ayuda casa para ver los comandos disponibles!");
                        SaveHouses();
                        OnPlayerUpdate(playerid);
                        Info[playerid][pVW] = h+6000;
                        SetPlayerVirtualWorld(playerid, h+6000);
                        DestroyDynamicPickup(HouseInfo[h][hPickupID]);
                        HouseInfo[h][hPickupID] = CreateDynamicPickup(1273, 23, HouseInfo[h][hExteriorX], HouseInfo[h][hExteriorY], HouseInfo[h][hExteriorZ]);
                        format(string, sizeof(string), "Dueсo\n%s\nNivel: %d\nID: %d",HouseInfo[h][hOwner],HouseInfo[h][hLevel],h);
                        UpdateDynamic3DTextLabelText(HouseInfo[h][hTextID], -1, string);
                        new ip[32];
                        GetPlayerIp(playerid,ip,sizeof(ip));
                        format(string,sizeof(string),"%s (IP: %s) has bought house ID %d for $%d.",GetPlayerNameEx(playerid),ip,h,HouseInfo[h][hValue]);
                        Log("logs/house.log", string);
                        return 1;
                    }
                    else
                    {
                        Enviarmensaje(playerid, COLOR_WHITE, "No tienes dinero para comprar esta casa!");
                        return 1;
                    }
                }
            }
            else
            {
                Enviarmensaje( playerid, COLOR_WHITE, "Estб casa ya tiene dueсo." );
            }
        }
    }
    return 1;
    }

    else if(strcmp(choice, "carnada", true) == 0)
    {
        if (PlayerToPoint(10, playerid,991.2456,-1942.9379,2835.0078))
            SafeDialogEx(playerid, DIALOG_SHOPFISH, DIALOG_STYLE_LIST, "Tienda del Puerto","Carnada\nLineas", "Comprar", "Salir");
        }
        }
    return 1;
    }



Respuesta: Ayuda - aoEXE - 10.09.2014

bien, la funciуn IsABike detecta si vehicleid es una bici (509, 481, 510). En donde detectas que el jugador sea conductor para mostrar el velocнmetro, has una restricciуn abajo que si vehicleid(cid) NO es una Bici muestre el velocimetro. Asн:

pawn Код:
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
    new cid = GetPlayerVehicleID(playerid);
    if(!IsABike(cid))
    {
        //NO es una bici, le muestra el velocimetro
        SetProgressBarValue(SpeedBar[playerid], VelocidadVehiculo(playerid));
        UpdateProgressBar(SpeedBar[playerid], playerid);
        SetProgressBarValue(SpeedBar2[playerid], VehicleFuel[cid]);
        UpdateProgressBar(SpeedBar2[playerid], playerid);
    }
    //si es una bici, no muestra nada
    return 1;
}
No he usado nunca eso pero no estoy seguro que eso muestre el velocнmetro (esto creo que es lo que lo actualiza) busca en el public OnPlayerEnterVehicle y si ahн le muestra el velocнmetro has lo mismo con IsABike