[Ajuda] Velocimtro
#1

Estudei alguns velocimetros ate fazer esse.
Porem ele nao aparece.
pawn Код:
//no topo
new Text:DonVL
//gamemodeinit
DonVL = TextDrawCreate(284.5 ,372 , "Velocidade");
    TextDrawFont(DonVL , 3);
    TextDrawLetterSize(DonVL , 0.4, 2.8000000000000003);
    TextDrawColor(DonVL , 0x999999FF);
    TextDrawSetOutline(DonVL , false);
    TextDrawSetProportional(DonVL , true);
    TextDrawSetShadow(DonVL , 1);
    TextDrawUseBox(DonVL, 1);
    TextDrawBoxColor(DonVL, 0xB8C2FFAA);
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        TextDrawShowForPlayer(i, DonVL);
    }
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    SetTimer("DCarro",3,true);
    return 1;
}
forward DCarro(playerid,veiculo);
public DCarro(playerid,veiculo)
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        format(Don, sizeof(Don), "Velocidade: %i Km/h", GetPlayerSpeed(playerid));
        TextDrawSetString(DonVL, Don);
        TextDrawShowForPlayer(playerid, DonVL);
    }
    else
    {
        TextDrawDestroy(DonVL);
    }
    return true;
}
Ajuda ae
Reply
#2

pawn Код:
//no topo
new Text: DonVL[MAX_PLAYERS];

//OnPlayerConnect
DonVL[playerid] = TextDrawCreate(284.5 ,372 , "Velocidade");
TextDrawFont(DonVL[playerid], 3);
TextDrawLetterSize(DonVL[playerid], 0.4, 2.8000000000000003);
TextDrawColor(DonVL[playerid], 0x999999FF);
TextDrawSetOutline(DonVL[playerid], false);
TextDrawSetProportional(DonVL[playerid], true);
TextDrawSetShadow(DonVL[playerid], 1);
TextDrawUseBox(DonVL[playerid], 1);
TextDrawBoxColor(DonVL[playerid], 0xB8C2FFAA);

public OnPlayerStateChange(playerid, newstate, oldstate) {
    if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER) {
        format(Don, sizeof(Don), "Velocidade: %i Km/h", GetPlayerSpeed(playerid));
        TextDrawSetString(DonVL[playerid], Don);
    } else if(newstate != PLAYER_STATE_DRIVER) TextDrawHideForPlayer(playerid, DonVL[playerid]);
    return 1;
}
Reply
#3

Teanta:
pawn Код:
//no topo
new Text:DonVL
//gamemodeinit
DonVL = TextDrawCreate(284.5 ,372 , "Velocidade");
    TextDrawFont(DonVL , 3);
    TextDrawLetterSize(DonVL , 0.4, 2.8000000000000003);
    TextDrawColor(DonVL , 0x999999FF);
    TextDrawSetOutline(DonVL , false);
    TextDrawSetProportional(DonVL , true);
    TextDrawSetShadow(DonVL , 1);
    TextDrawUseBox(DonVL, 1);
    TextDrawBoxColor(DonVL, 0xB8C2FFAA);
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        TextDrawShowForPlayer(i, DonVL);
    }
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    SetTimer("DCarro",3,true);
    TextDrawShowForPlayer(playerid, DonVL);
    return 1;
}
forward DCarro(playerid,veiculo);
public DCarro(playerid,veiculo)
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        format(Don, sizeof(Don), "Velocidade: %i Km/h", GetPlayerSpeed(playerid));
        TextDrawSetString(DonVL, Don);
    }
    else
    {
        TextDrawDestroy(DonVL);
    }
    return true;
}
Reply
#4

Quote:
Originally Posted by Skun Fly
Посмотреть сообщение
Teanta:
pawn Код:
//no topo
new Text:DonVL
//gamemodeinit
DonVL = TextDrawCreate(284.5 ,372 , "Velocidade");
    TextDrawFont(DonVL , 3);
    TextDrawLetterSize(DonVL , 0.4, 2.8000000000000003);
    TextDrawColor(DonVL , 0x999999FF);
    TextDrawSetOutline(DonVL , false);
    TextDrawSetProportional(DonVL , true);
    TextDrawSetShadow(DonVL , 1);
    TextDrawUseBox(DonVL, 1);
    TextDrawBoxColor(DonVL, 0xB8C2FFAA);
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        TextDrawShowForPlayer(i, DonVL);
    }
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    SetTimer("DCarro",3,true);
    TextDrawShowForPlayer(playerid, DonVL);
    return 1;
}
forward DCarro(playerid,veiculo);
public DCarro(playerid,veiculo)
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        format(Don, sizeof(Don), "Velocidade: %i Km/h", GetPlayerSpeed(playerid));
        TextDrawSetString(DonVL, Don);
    }
    else
    {
        TextDrawDestroy(DonVL);
    }
    return true;
}
Velocidade й de Player para Player, isso vai buga!
Reply
#5

Nenhum funfo!
Reply
#6

Serб se tu por assim nгo vai n ? '-'


pawn Код:
for(new i=0; i<GetMaxPlayers(); i++)
    {
DonVL[i] = TextDrawCreate(284.5 ,372 , "Velocidade");
    TextDrawFont(DonVL [i], 3);
    TextDrawLetterSize(DonVL[i] , 0.4, 2.8000000000000003);
    TextDrawColor(DonVL [i], 0x999999FF);
    TextDrawSetOutline(DonVL[i] , false);
    TextDrawSetProportional(DonVL[i] , true);
    TextDrawSetShadow(DonVL[i], 1);
    TextDrawUseBox(DonVL[i], 1);
    TextDrawBoxColor(DonVL[i] ,0xB8C2FFAA);
}
pawn Код:
TextDrawShowForPlayer(i, Text:DonVL[i]);
Reply
#7

Apague esses cуdigos e coloque :


pawn Код:
//No Topo do GM:


new Text:Velocimetro[MAX_PLAYERS];
new TimerVelocimetro[MAX_PLAYERS];



//No OnGameModeInit:


for(new x = 0; x < MAX_PLAYERS; x++)
    {
        Velocimetro[x] = TextDrawCreate(284.5 ,372 , "Velocidade");
        TextDrawFont(Velocimetro[x], 3);
        TextDrawLetterSize(Velocimetro[x], 0.4, 2.8000000000000003);
        TextDrawColor(Velocimetro[x], 0x999999FF);
        TextDrawSetOutline(Velocimetro[x], false);
        TextDrawSetProportional(Velocimetro[x], true);
        TextDrawSetShadow(Velocimetro[x], 1);
        TextDrawUseBox(Velocimetro[x], 1);
        TextDrawBoxColor(Velocimetro[x], 0xB8C2FFAA);
    }



//No OnPlayerDisconnect:


KillTimer(TimerVelocimetro[playerid]);



//No OnPlayerStateChange:


if(newstate == PLAYER_STATE_DRIVER)
    {
        TimerVelocimetro[playerid] = SetTimerEx("AtualizarVelocimetro", 100, true, "n", playerid);
    }
    else if(oldstate == PLAYER_STATE_DRIVER)
    {
        KillTimer(TimerVelocimetro[playerid]);
        TextDrawHideForPlayer(playerid, Velocimetro[playerid]);
    }



//E, no Final do GM:


forward AtualizarVelocimetro(playerid);
public AtualizarVelocimetro(playerid)
{
    static STR[30];
    format(STR, 30, "Velocidade: %i Km/h", GetPlayerSpeed(playerid));
    TextDrawSetString(Velocimetro[playerid], STR);
    TextDrawShowForPlayer(playerid, Velocimetro[playerid]);
    return 1;
}


Espero ter ajudado .
Reply
#8

Quote:
Originally Posted by Don_Speed
Посмотреть сообщение
Nenhum funfo!
Tu fez coisa errada...
Reply
#9

Quote:
Originally Posted by paulor
Посмотреть сообщение
Tu fez coisa errada...
Avб , nao me diga isso !!!

@rjjj
Vlw
Reply
#10

Quote:
Originally Posted by Don_Speed
Посмотреть сообщение
Avб , nao me diga isso !!!

@rjjj
Vlw
Disse no meu, tu nгo usou corretamente, pois ele esta correto...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)