SA-MP Forums Archive
[Ajuda] Nao aparece - 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: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] Nao aparece (/showthread.php?tid=396918)



Nao aparece - Don_Speed - 02.12.2012

Essa coisas nao aparecen (Gasolina & Lataria)
Fiz um de forma diferente do outro !
CODE:
pawn Код:
forward AtualizarVelocimetro(playerid);
public AtualizarVelocimetro(playerid)
{
    static STR[30];
    format(STR, 30, "%i", GetPlayerSpeed(playerid));
    TextDrawSetString(PlayerInfo[playerid][Velocidade], STR);
    TextDrawShowForPlayer(playerid, PlayerInfo[playerid][Velocidade]);
   
    TextDrawSetString(PlayerInfo[playerid][KMH], "KMH");
    TextDrawShowForPlayer(playerid, PlayerInfo[playerid][KMH]);
   
    new vehicleid = GetPlayerVehicleID(playerid);
    Gasolina[vehicleid] -= 0.1;
    new Don[100];
    switch(Gasolina[vehicleid])
    {
           case 901 .. MAX_FUEL:format(Don, sizeof(Don),  "gasolina: ~g~IIIIIIIIII");
           case 801 .. 900:format(Don, sizeof(Don), "gasolina: ~g~IIIIIIIII~r~.");
           case 701 .. 800:format(Don, sizeof(Don), "gasolina: ~g~IIIIIIII~r~..");
           case 601 .. 700:format(Don, sizeof(Don), "gasolina: ~g~IIIIIII~r~...");
           case 501 .. 600:format(Don, sizeof(Don), "gasolina: ~g~IIIIII~r~....");
           case 401 .. 500:format(Don, sizeof(Don), "gasolina: ~g~IIIII~r~.....");
           case 301 .. 400:format(Don, sizeof(Don), "gasolina: ~g~IIII~r~......");
           case 201 .. 300:format(Don, sizeof(Don), "gasolina: ~g~III~r~.......");
           case 101 .. 200:format(Don, sizeof(Don), "gasolina: ~g~II~r~........");
           case 50 .. 100:format(Don, sizeof(Don), "gasolina: ~g~I~r~.........");
           case 0 .. 49 :
           {
                new mot, lu, alar, por, cap, porma, ob;
                GetVehicleParamsEx(vehicleid, mot, lu, alar, por, cap, porma, ob);
                SetVehicleParamsEx(vehicleid, 0, lu, alar, por, cap, porma, ob);
                format(Don, sizeof(Don), "gasolina: ~r~acabou");
               
           }
    }
    TextDrawSetString(PlayerInfo[playerid][gasolina],Don);
    TextDrawShowForPlayer(playerid, PlayerInfo[playerid][gasolina]);
   
    new Float:LATARIA;
    GetVehicleHealth(vehicleid, LATARIA);
    switch(LATARIA)
    {
           case 901 .. 1000:TextDrawSetString(PlayerInfo[playerid][Lataria], "lataria: ~g~IIIIIIIIII");
           case 801 .. 900 :TextDrawSetString(PlayerInfo[playerid][Lataria], "lataria: ~g~IIIIIIIII~r~.");
           case 701 .. 800:TextDrawSetString(PlayerInfo[playerid][Lataria], "lataria: ~g~IIIIIIII~r~..");
           case 601 .. 700:TextDrawSetString(PlayerInfo[playerid][Lataria], "lataria: ~g~IIIIIII~r~...");
           case 501 .. 600:TextDrawSetString(PlayerInfo[playerid][Lataria], "lataria: ~g~IIIIII~r~....");
           case 401 .. 500:TextDrawSetString(PlayerInfo[playerid][Lataria], "lataria: ~g~IIIII~r~.....");
           case 301 .. 400:TextDrawSetString(PlayerInfo[playerid][Lataria], "lataria: ~g~IIII~r~......");
           case 201 .. 300:TextDrawSetString(PlayerInfo[playerid][Lataria], "lataria: ~g~III~r~.......");
           case 101 .. 200:TextDrawSetString(PlayerInfo[playerid][Lataria], "lataria: ~g~II~r~........");
           case 51 .. 100:TextDrawSetString(PlayerInfo[playerid][Lataria], "lataria: ~g~I~r~.........");
           case 0 .. 50:
           {
                new mot, lu, alar, por, cap, porma, ob;
                GetVehicleParamsEx(vehicleid, mot, lu, alar, por, cap, porma, ob);
                SetVehicleParamsEx(vehicleid, 0, lu, alar, por, cap, porma, ob);
                TextDrawSetString(PlayerInfo[playerid][Lataria], "lataria: ~r~fundiu");

           }
    }
    TextDrawShowForPlayer(playerid, PlayerInfo[playerid][Lataria]);
    return 1;
}
As outras duas aparecem!



Re: Nao aparece - @Riichard - 02.12.2012

Nгo sei dizer muito sobre o uso do switch, mas coloque as TextDrawShowForPlayer, logo a baixo das format da mesma.


Re: Nao aparece - Don_Speed - 02.12.2012

Quote:
Originally Posted by @Riichard
Посмотреть сообщение
Nгo sei dizer muito sobre o uso do switch, mas coloque as TextDrawShowForPlayer, logo a baixo das format da mesma.
Nao se coloca isso dentro da swicth.



Re: Nao aparece - Lucas-Fc - 02.12.2012

UP Alguйm ajuda o cara !


Re: Nao aparece - Don_Speed - 02.12.2012

Up!
Isso so acontece quando eu uso a TextDrawSetString sem o format.



Re: Nao aparece - Rodney Francalim - 02.12.2012

Quote:
Originally Posted by Don_Speed
Посмотреть сообщение


Nao se coloca isso dentro da swicth.
Nada a ver, mano. Pode-se colocar sim.

pawn Код:
forward AtualizarVelocimetro(playerid);
public AtualizarVelocimetro(playerid)
{
    static STR[30];
    format(STR, 30, "%i", GetPlayerSpeed(playerid));
    TextDrawSetString(PlayerInfo[playerid][Velocidade], STR);
    TextDrawShowForPlayer(playerid, PlayerInfo[playerid][Velocidade]);
   
    TextDrawSetString(PlayerInfo[playerid][KMH], "KMH");
    TextDrawShowForPlayer(playerid, PlayerInfo[playerid][KMH]);
   
    new vehicleid = GetPlayerVehicleID(playerid);
    Gasolina[vehicleid] -= 0.1;
    new Don[100];
    switch(Gasolina[vehicleid])
    {
           case 901 .. MAX_FUEL:format(Don, sizeof(Don),  "gasolina: ~g~IIIIIIIIII");
           case 801 .. 900:format(Don, sizeof(Don), "gasolina: ~g~IIIIIIIII~r~.");
           case 701 .. 800:format(Don, sizeof(Don), "gasolina: ~g~IIIIIIII~r~..");
           case 601 .. 700:format(Don, sizeof(Don), "gasolina: ~g~IIIIIII~r~...");
           case 501 .. 600:format(Don, sizeof(Don), "gasolina: ~g~IIIIII~r~....");
           case 401 .. 500:format(Don, sizeof(Don), "gasolina: ~g~IIIII~r~.....");
           case 301 .. 400:format(Don, sizeof(Don), "gasolina: ~g~IIII~r~......");
           case 201 .. 300:format(Don, sizeof(Don), "gasolina: ~g~III~r~.......");
           case 101 .. 200:format(Don, sizeof(Don), "gasolina: ~g~II~r~........");
           case 50 .. 100:format(Don, sizeof(Don), "gasolina: ~g~I~r~.........");
           case 0 .. 49 :
           {
                new mot, lu, alar, por, cap, porma, ob;
                GetVehicleParamsEx(vehicleid, mot, lu, alar, por, cap, porma, ob);
                SetVehicleParamsEx(vehicleid, 0, lu, alar, por, cap, porma, ob);
                format(Don, sizeof(Don), "gasolina: ~r~acabou");
               
           }
           TextDrawSetString(PlayerInfo[playerid][gasolina],Don);
           TextDrawShowForPlayer(playerid, PlayerInfo[playerid][gasolina]);
    }
   
    new Float:LATARIA;
    GetVehicleHealth(vehicleid, LATARIA);
    switch(LATARIA)
    {
           case 901 .. 1000:TextDrawSetString(PlayerInfo[playerid][Lataria], "lataria: ~g~IIIIIIIIII");
           case 801 .. 900 :TextDrawSetString(PlayerInfo[playerid][Lataria], "lataria: ~g~IIIIIIIII~r~.");
           case 701 .. 800:TextDrawSetString(PlayerInfo[playerid][Lataria], "lataria: ~g~IIIIIIII~r~..");
           case 601 .. 700:TextDrawSetString(PlayerInfo[playerid][Lataria], "lataria: ~g~IIIIIII~r~...");
           case 501 .. 600:TextDrawSetString(PlayerInfo[playerid][Lataria], "lataria: ~g~IIIIII~r~....");
           case 401 .. 500:TextDrawSetString(PlayerInfo[playerid][Lataria], "lataria: ~g~IIIII~r~.....");
           case 301 .. 400:TextDrawSetString(PlayerInfo[playerid][Lataria], "lataria: ~g~IIII~r~......");
           case 201 .. 300:TextDrawSetString(PlayerInfo[playerid][Lataria], "lataria: ~g~III~r~.......");
           case 101 .. 200:TextDrawSetString(PlayerInfo[playerid][Lataria], "lataria: ~g~II~r~........");
           case 51 .. 100:TextDrawSetString(PlayerInfo[playerid][Lataria], "lataria: ~g~I~r~.........");
           case 0 .. 50:
           {
                new mot, lu, alar, por, cap, porma, ob;
                GetVehicleParamsEx(vehicleid, mot, lu, alar, por, cap, porma, ob);
                SetVehicleParamsEx(vehicleid, 0, lu, alar, por, cap, porma, ob);
                TextDrawSetString(PlayerInfo[playerid][Lataria], "lataria: ~r~fundiu");

           }
           TextDrawShowForPlayer(playerid, PlayerInfo[playerid][Lataria]);
    }
    return 1;
}
@EDIT:
Se nгo der certo, substitua switch por if e else if