[Ajuda] Gente , o que eu to fazendo errado ?
#1

Tф trabalhando o dia todo num velocнmetro , mais as coisas nгo vгo bem .
Nгo sei pegar a velocidade do carro , e o status da lataria , e jogar nas textdrawns .
Nada estб dando certo.

Por favor, olhem o cуdigo abaixo :

No topo do GM , tenho as variбveis das TextDrawns .


pawn Код:
new Text:Textdraw0;
new Text:Textdraw1;
new Text:Textdraw2;
Agora eu tenho as TextDrawns :
Public OnGameModeInit


pawn Код:
Textdraw0 = TextDrawCreate(507.000000, 426.000000, "Speed : KM/h");
    TextDrawBackgroundColor(Textdraw0, 255);
    TextDrawFont(Textdraw0, 1);
    TextDrawLetterSize(Textdraw0, 0.529999, 1.400000);
    TextDrawColor(Textdraw0, Branco);
    TextDrawSetOutline(Textdraw0, 0);
    TextDrawSetProportional(Textdraw0, 1);
    TextDrawSetShadow(Textdraw0, 1);

    Textdraw1 = TextDrawCreate(507.000000, 398.000000, "Lataria :");
    TextDrawBackgroundColor(Textdraw1, 255);
    TextDrawFont(Textdraw1, 1);
    TextDrawLetterSize(Textdraw1, 0.529999, 1.400000);
    TextDrawColor(Textdraw1, Branco);
    TextDrawSetOutline(Textdraw1, 0);
    TextDrawSetProportional(Textdraw1, 1);
    TextDrawSetShadow(Textdraw1, 1);

    Textdraw2 = TextDrawCreate(507.000000, 412.000000, "Carro :");
    TextDrawBackgroundColor(Textdraw2, 255);
    TextDrawFont(Textdraw2, 1);
    TextDrawLetterSize(Textdraw2, 0.529999, 1.400000);
    TextDrawColor(Textdraw2, Branco);
    TextDrawSetOutline(Textdraw2, 0);
    TextDrawSetProportional(Textdraw2, 1);
    TextDrawSetShadow(Textdraw2, 1);
Na public OnPlayerStateChange , eu tenho isso :

pawn Код:
if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
    {
        Poha = SetTimer("Vel", 100, true);
   
        TextDrawShowForPlayer(playerid, Textdraw0);
        TextDrawShowForPlayer(playerid, Textdraw1);
        TextDrawShowForPlayer(playerid, Textdraw2);
    }
   
    if(oldstate == PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_ONFOOT)
    {
        KillTimer(Poha);
   
        TextDrawHideForPlayer(playerid, Textdraw0);
        TextDrawDestroy(Textdraw0);
        TextDrawHideForPlayer(playerid, Textdraw1);
        TextDrawDestroy(Textdraw1);
        TextDrawHideForPlayer(playerid, Textdraw2);
        TextDrawDestroy(Textdraw2);
E Criei esse timer , para ir pegando as informaзхes , mais fiquei confuso , fiz algo errado .

pawn Код:
forward Vel(playerid);
public Vel(playerid)
{
    new
        Float: L,
        Stl[ 60 ]
    ;
   
    new
        Float: Vx,
        Float: Vy,
        Float: Vz
    ;
   
    GetVehicleHealth(GetPlayerVehicleID(playerid), L);
    format(Stl, sizeof(Stl), "%d", L);
//  SendClientMessage(playerid, Branco, Stl);
   
    GetVehicleVelocity(GetPlayerVehicleID(playerid), Vx, Vy, Vz);
   
    new
        Float: RPM
    ;
   
    RPM = floatsqroot(floatpower(Vx*100,2) + floatpower(Vy*100,2));
    RPM = floatsqroot(floatpower(RPM,2) + floatpower(Vz*100,2));
   
    new KcT[256];
    format(KcT,sizeof(KcT),"~g~Velocidade ~r~%dKM/H ",L);
    TextDrawSetString(Textdraw0, KcT);
    TextDrawShowForPlayer(playerid, Textdraw0);
   
    return floatround(RPM);
}
Na hora de compilar , nгo da nada . compila de boa , mais quando eu entro no carro , no jogo , a textdrawn da velocidade , (Textdraw0) nгo aparece .

E eu nгo sei formatar a Textdraw para que o valor apareзa nela , em fim ,
Um desastre !

Se alguem poder ajudar , pooxa , vou ficar muito grato .
Reply
#2

esse seu velocimetro ta muito ruim kk

pawn Код:
new
Poha[ MAX_PLAYERS];

//depois
Poha[ playerid ] = SetTimerEx("Vel", 100, true, "i" playerid);


KillTimer(Poha[ playerid ]);
se quiser eu fiz um velocimetro muito bacana de uma olhada tambйm

https://sampforum.blast.hk/showthread.php?tid=399026
Reply
#3

Pф cara , me ensina a fazer ?

Nгo quero copiar , namoral vei .
Reply
#4

UP alguйm me ensina por favor !
Reply
#5

cara eu n disse para vocк copiar mбs poderia ser um pouco mais esperto e estudar o que eu fiz e fazer no seu se tivesse procurado qualquer um e feito o que eu disse nгo teria criado o topico
й o que eu fazia quando era iniciante...

fica a dica..

mano tente seguir a logica do meu fs estude se preciso quebre a cabeзa e duvido ver possiveis proximos topicos de ajuda deste modo
Reply
#6

Nгo vou conseguir

:\
Reply
#7

Se acha que nгo vai conseguir, Niguem mais vai querer te ajudar!. Atй porque os scripters que aprenderam na raзa. Sabe o Tanto que estudarгo pra aprender;

E se vocк desistir, eu desisto de ajudar vocк;
Reply
#8

Quote:
Originally Posted by Duun
Посмотреть сообщение
Nгo vou conseguir

:\
mano tomara que ninguem te de o codigo desta vez se vc tentar entender o que estб acontecendo . olhando o fs que eu disse vocк vai consseguir e sentir um orgulho muito grande e assim vc inicia um bom e qualificado codigo.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)