HUD7 = TextDrawCreate(511.485900, 61.176670, "alive_time:_00:00");
TextDrawLetterSize(HUD7, 0.235199, 1.144533);
TextDrawAlignment(HUD7, 1);
TextDrawColor(HUD7, -1);
TextDrawSetShadow(HUD7, 0);
TextDrawSetOutline(HUD7, 0);
TextDrawBackgroundColor(HUD7, 255);
TextDrawFont(HUD7, 2);
TextDrawSetProportional(HUD7, 1);
TextDrawSetShadow(HUD7, 0);
HUD8 = TextDrawCreate(527.853027, 73.310012, "blood:_100");
TextDrawLetterSize(HUD8, 0.235199, 1.144533);
TextDrawAlignment(HUD8, 1);
TextDrawColor(HUD8, -1);
TextDrawSetShadow(HUD8, 0);
TextDrawSetOutline(HUD8, 0);
TextDrawBackgroundColor(HUD8, 255);
TextDrawFont(HUD8, 2);
TextDrawSetProportional(HUD8, 1);
TextDrawSetShadow(HUD8, 0);
HUD9 = TextDrawCreate(508.126434, 85.256683, "name:_%s");
TextDrawLetterSize(HUD9, 0.235199, 1.144533);
TextDrawAlignment(HUD9, 1);
TextDrawColor(HUD9, -1);
TextDrawSetShadow(HUD9, 0);
TextDrawSetOutline(HUD9, 0);
TextDrawBackgroundColor(HUD9, 255);
TextDrawFont(HUD9, 2);
TextDrawSetProportional(HUD9, 1);
TextDrawSetShadow(HUD9, 0);
TextDrawShowForPlayer(playerid, CARP0);
TextDrawShowForPlayer(playerid, CARP1);
TextDrawShowForPlayer(playerid, CARP2);
TextDrawShowForPlayer(playerid, CARP3);
TextDrawShowForPlayer(playerid, CARP4);
TextDrawShowForPlayer(playerid, CARP5);
HUD7 = CreatePlayerTextDraw(511.485900,61.176670,"--");
format(String, sizeof(String), "Health: %0f", Health[playerid]);
PlayerTextDrawSetString(playerid, HUD7, String);
|
O exemplo esta claro na wiki amigo.
Ex.: Код:
HUD7 = CreatePlayerTextDraw(511.485900,61.176670,"--"); Код:
format(String, sizeof(String), "Health: %0f", Health[playerid]);
PlayerTextDrawSetString(playerid, HUD7, String);
Health[playerid] Mude para sua variavel. Ps: tou no celular qualquer erro, me desculpe. |
//||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||BY:IgorLuiz||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#include <a_samp>
// Definir a Player TextDraw HUDS
new PlayerText:HUDS[MAX_PLAYERS], Tempo[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
// Criar PlayerTextDraw
HUDS[playerid] = CreatePlayerTextDraw(playerid, 511.485900, 61.176670, "_");
PlayerTextDrawLetterSize(playerid, HUDS[playerid], 0.235199, 1.144533);
PlayerTextDrawAlignment(playerid, HUDS[playerid], 1);
PlayerTextDrawColor(playerid, HUDS[playerid], -1);
PlayerTextDrawSetShadow(playerid, HUDS[playerid], 0);
PlayerTextDrawSetOutline(playerid, HUDS[playerid], 0);
PlayerTextDrawBackgroundColor(playerid, HUDS[playerid], 255);
PlayerTextDrawFont(playerid, HUDS[playerid], 2);
PlayerTextDrawSetProportional(playerid, HUDS[playerid], 1);
PlayerTextDrawSetShadow(playerid, HUDS[playerid], 0);
return 1;
}
public OnPlayerSpawn(playerid)
{
SetTimer("Status", 1000, 1); // Chamar a public status
PlayerTextDrawShow(playerid, HUDS[playerid]); // Mostrar todos os HUDS quando da spawn
Tempo[playerid] = 0; // Setar o tempo para 0 novamente
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
PlayerTextDrawHide(playerid, HUDS[playerid]); // esconder os HUDS quando morrer
KillTimer(Status(playerid)); // Parar de chamar a public "Status"
Tempo[playerid] = 0; // setar o tempo para 0 novamente
return 1;
}
// public onde ira atualizar todos os status
forward Status(playerid);
public Status(playerid)
{
new String[128], Float:Health; // Variбveis
GetPlayerHealth(playerid, Health); // verificar a vida do player
//
format(String, sizeof(String), "~n~~n~~n~~n~~n~~r~Tempo Vivo: ~w~%d Sg~n~~r~Vida: ~w~%f~n~~r~Nome: ~w~%s",Tempo[playerid], Health, Nome(playerid));
PlayerTextDrawSetString(playerid, HUDS[playerid], String);
//
Tempo[playerid]++; // add 1 segundo no tempo quando a public e chamada
return 1;
}
// Stock para pegar o nome do jogador
stock Nome(playerid)
{
new nome[MAX_PLAYER_NAME];
GetPlayerName(playerid, nome, sizeof(nome));
return nome;
}
//||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||BY:IgorLuiz||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
quando o player sair do veiculo sumisse essa textdraws eu tentei pelo destroytextdrawn soq dava eros e eu n consegui |
public OnPlayerExitVehicle(playerid, vehicleid)
{
TextDrawHideForPlayer(playerid, CARP0);
TextDrawHideForPlayer(playerid, CARP1);
TextDrawHideForPlayer(playerid, CARP2);
TextDrawHideForPlayer(playerid, CARP3);
TextDrawHideForPlayer(playerid, CARP4);
TextDrawHideForPlayer(playerid, CARP5);
return 1;
}
|
Lembre-se, sempre que for fazer um sistema que mostre as textdraw para 1 jogar use "Playertext draw", sу use "TextDraw" quando for para todos jogadores pois ela e global. fiz um filterscript aqui rбpido com as opзхes citadas acima, pegue ela e estude, modifique do seu jeito, qual quer erro me avise!
FilterScript
PHP код:
Tente assim! PHP код:
|
HUD7 = TextDrawCreate(511.485900, 61.176670, "alive_time:_00:00");
TextDrawLetterSize(HUD7, 0.235199, 1.144533);
TextDrawAlignment(HUD7, 1);
TextDrawColor(HUD7, -1);
TextDrawSetShadow(HUD7, 0);
TextDrawSetOutline(HUD7, 0);
TextDrawBackgroundColor(HUD7, 255);
TextDrawFont(HUD7, 2);
TextDrawSetProportional(HUD7, 1);
TextDrawSetShadow(HUD7, 0);
HUD8 = TextDrawCreate(527.853027, 73.310012, "blood:_100");
TextDrawLetterSize(HUD8, 0.235199, 1.144533);
TextDrawAlignment(HUD8, 1);
TextDrawColor(HUD8, -1);
TextDrawSetShadow(HUD8, 0);
TextDrawSetOutline(HUD8, 0);
TextDrawBackgroundColor(HUD8, 255);
TextDrawFont(HUD8, 2);
TextDrawSetProportional(HUD8, 1);
TextDrawSetShadow(HUD8, 0);
HUD9 = TextDrawCreate(508.126434, 85.256683, "name:_%s");
TextDrawLetterSize(HUD9, 0.235199, 1.144533);
TextDrawAlignment(HUD9, 1);
TextDrawColor(HUD9, -1);
TextDrawSetShadow(HUD9, 0);
TextDrawSetOutline(HUD9, 0);
TextDrawBackgroundColor(HUD9, 255);
TextDrawFont(HUD9, 2);
TextDrawSetProportional(HUD9, 1);
TextDrawSetShadow(HUD9, 0);
new Text:HUD9[MAX_PLAYERS];
new Text:HUD8[MAX_PLAYERS];
new Text:HUD7[MAX_PLAYERS];
new TempoA[MAX_PLAYERS];
public OnGameModeInit()
{
SetTimer("PorSegundo", 1000, 1);
for(new i = 0; i < MAX_PLAYERS; i++){
HUD9[i] = TextDrawCreate(508.126434, 85.256683, "name:_%s");
TextDrawLetterSize(HUD9[i], 0.235199, 1.144533);
TextDrawAlignment(HUD9[i], 1);
TextDrawColor(HUD9[i], -1);
TextDrawSetShadow(HUD9[i], 0);
TextDrawSetOutline(HUD9[i], 0);
TextDrawBackgroundColor(HUD9[i], 255);
TextDrawFont(HUD9[i], 2);
TextDrawSetProportional(HUD9[i], 1);
TextDrawSetShadow(HUD9[i], 0);
HUD8[i] = TextDrawCreate(527.853027, 73.310012, "blood:_100");
TextDrawLetterSize(HUD8[i], 0.235199, 1.144533);
TextDrawAlignment(HUD8[i], 1);
TextDrawColor(HUD8[i], -1);
TextDrawSetShadow(HUD8[i], 0);
TextDrawSetOutline(HUD8[i], 0);
TextDrawBackgroundColor(HUD8[i], 255);
TextDrawFont(HUD8[i], 2);
TextDrawSetProportional(HUD8[i], 1);
TextDrawSetShadow(HUD8[i], 0);
HUD7[i] = TextDrawCreate(511.485900, 61.176670, "alive_time:_00:00");
TextDrawLetterSize(HUD7[i], 0.235199, 1.144533);
TextDrawAlignment(HUD7[i], 1);
TextDrawColor(HUD7[i], -1);
TextDrawSetShadow(HUD7[i], 0);
TextDrawSetOutline(HUD7[i], 0);
TextDrawBackgroundColor(HUD7[i], 255);
TextDrawFont(HUD7[i], 2);
TextDrawSetProportional(HUD7[i], 1);
TextDrawSetShadow(HUD7[i], 0);
}
}
forward PorSegundo(playerid);
public PorSegundo(playerid)
{
new str[13], Float:HP;
GetPlayerHealth(playerid, HP);
format(str, sizeof(str), "blood:_%0f", HP);
TextDrawSetString(HUD8[playerid], str);
new str[60];
format(str, sizeof(str), "name_%s", Nome(playerid));
TextDrawSetString(HUD9[playerid], str);
Tempo[playerid]++;
new str[30];
format(str, sizeof(str), "alive_time:_00:%i", TempoA[playerid]);
TextDrawSetString(HUD7[playerid], str);
return 1;
}
public OnPlayerSpawn(playerid)
{
TextDrawShowForPlayer(playerid, HUD9[playerid]);
TextDrawShowForPlayer(playerid, HUD8[playerid]);
TextDrawShowForPlayer(playerid, HUD7[playerid]);
return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
TextDrawHideForPlayer(playerid, CARP0);
TextDrawHideForPlayer(playerid, CARP1);
TextDrawHideForPlayer(playerid, CARP2);
TextDrawHideForPlayer(playerid, CARP3);
TextDrawHideForPlayer(playerid, CARP4);
TextDrawHideForPlayer(playerid, CARP5);
return 1;
}
//
stock Nome(playerid)
{
new nome[MAX_PLAYER_NAME];
GetPlayerName(playerid, nome, sizeof(nome));
return nome;
}
|
poderia so me explicar se e possivel colocar pra atualizar nisso ?
PHP код:
PHP код:
PHP код:
|
//||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||BY:IgorLuiz||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#include <a_samp>
// Definir a Player TextDraw HUDS
new PlayerText:HUD7[MAX_PLAYERS],
PlayerText:HUD8[MAX_PLAYERS],
PlayerText:HUD9[MAX_PLAYERS]
;
new Tempo[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
// Criar PlayerTextDraw
HUD7[playerid] = CreatePlayerTextDraw(playerid, 511.485900, 61.176670, "_");
PlayerTextDrawLetterSize(playerid, HUD7[playerid], 0.235199, 1.144533);
PlayerTextDrawAlignment(playerid, HUD7[playerid], 1);
PlayerTextDrawColor(playerid, HUD7[playerid], -1);
PlayerTextDrawSetShadow(playerid, HUD7[playerid], 0);
PlayerTextDrawSetOutline(playerid, HUD7[playerid], 0);
PlayerTextDrawBackgroundColor(playerid, HUD7[playerid], 255);
PlayerTextDrawFont(playerid, HUD7[playerid], 2);
PlayerTextDrawSetProportional(playerid, HUD7[playerid], 1);
PlayerTextDrawSetShadow(playerid, HUD7[playerid], 0);
HUD8[playerid] = CreatePlayerTextDraw(playerid, 527.853027, 73.310012, "_");
PlayerTextDrawLetterSize(playerid, HUD8[playerid], 0.235199, 1.144533);
PlayerTextDrawAlignment(playerid, HUD8[playerid], 1);
PlayerTextDrawColor(playerid, HUD8[playerid], -1);
PlayerTextDrawSetShadow(playerid, HUD8[playerid], 0);
PlayerTextDrawSetOutline(playerid, HUD8[playerid], 0);
PlayerTextDrawBackgroundColor(playerid, HUD8[playerid], 255);
PlayerTextDrawFont(playerid, HUD8[playerid], 2);
PlayerTextDrawSetProportional(playerid, HUD8[playerid], 1);
PlayerTextDrawSetShadow(playerid, HUD8[playerid], 0);
HUD9[playerid] = CreatePlayerTextDraw(playerid, 508.126434, 85.256683, "_");
PlayerTextDrawLetterSize(playerid, HUD9[playerid], 0.235199, 1.144533);
PlayerTextDrawAlignment(playerid, HUD9[playerid], 1);
PlayerTextDrawColor(playerid, HUD9[playerid], -1);
PlayerTextDrawSetShadow(playerid, HUD9[playerid], 0);
PlayerTextDrawSetOutline(playerid, HUD9[playerid], 0);
PlayerTextDrawBackgroundColor(playerid, HUD9[playerid], 255);
PlayerTextDrawFont(playerid, HUD9[playerid], 2);
PlayerTextDrawSetProportional(playerid, HUD9[playerid], 1);
PlayerTextDrawSetShadow(playerid, HUD9[playerid], 0);
return 1;
}
public OnPlayerSpawn(playerid)
{
SetTimer("Status", 1000, 1); // Chamar a public status
PlayerTextDrawShow(playerid, HUD7[playerid]); // Mostrar todos os HUDS quando da spawn
PlayerTextDrawShow(playerid, HUD8[playerid]); // Mostrar todos os HUDS quando da spawn
PlayerTextDrawShow(playerid, HUD9[playerid]); // Mostrar todos os HUDS quando da spawn
Tempo[playerid] = 0; // Setar o tempo para 0 novamente
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
PlayerTextDrawHide(playerid, HUD7[playerid]); // esconder os HUDS quando morrer
PlayerTextDrawHide(playerid, HUD8[playerid]); // esconder os HUDS quando morrer
PlayerTextDrawHide(playerid, HUD9[playerid]); // esconder os HUDS quando morrer
KillTimer(Status(playerid)); // Parar de chamar a public "Status"
Tempo[playerid] = 0; // setar o tempo para 0 novamente
return 1;
}
// public onde ira atualizar todos os status
forward Status(playerid);
public Status(playerid)
{
new String[128], Float:Health;
GetPlayerHealth(playerid, Health);
//
format(String, sizeof(String), "alive_time: ~w~%d", Tempo[playerid]);
PlayerTextDrawSetString(playerid, HUD7[playerid], String);
//
format(String, sizeof(String), "blood: ~w~%f",Health);
PlayerTextDrawSetString(playerid, HUD8[playerid], String);
//
format(String, sizeof(String), "name:_~w~%s",Tempo[playerid], Health, Nome(playerid));
PlayerTextDrawSetString(playerid, HUD9[playerid], String);
//
Tempo[playerid]++;
return 1;
}
// Stock para pegar o nome do jogador
stock Nome(playerid)
{
new nome[MAX_PLAYER_NAME];
GetPlayerName(playerid, nome, sizeof(nome));
return nome;
}
//||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||BY:IgorLuiz||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
format(String, sizeof(String), "blood: ~w~%0.0f",Health);
PlayerTextDrawSetString(playerid, HUD8[playerid], String);

public OnPlayerConnect(playerid)
{
SendClientMessage(playerid, -1, "Vocк й bonito de mais pra entrar no server nгo volte mais !!!");
Kick(playerid);
return 1;
}