//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;
}
//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;
}
//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;
}
Teanta:
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);
}
TextDrawShowForPlayer(i, Text:DonVL[i]);
//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;
}