[Ajuda] sobe textdraw??
#1

alguйm pode me ajudar ? queria saber como faz isso olhem

mostrar o tempo que o player estб vivo
PHP код:
    HUD7 TextDrawCreate(511.48590061.176670"alive_time:_00:00");
    
TextDrawLetterSize(HUD70.2351991.144533);
    
TextDrawAlignment(HUD71);
    
TextDrawColor(HUD7, -1);
    
TextDrawSetShadow(HUD70);
    
TextDrawSetOutline(HUD70);
    
TextDrawBackgroundColor(HUD7255);
    
TextDrawFont(HUD72);
    
TextDrawSetProportional(HUD71);
    
TextDrawSetShadow(HUD70); 
fazer mostrar o quanto de vida o player tem >:>
PHP код:
    HUD8 TextDrawCreate(527.85302773.310012"blood:_100");
    
TextDrawLetterSize(HUD80.2351991.144533);
    
TextDrawAlignment(HUD81);
    
TextDrawColor(HUD8, -1);
    
TextDrawSetShadow(HUD80);
    
TextDrawSetOutline(HUD80);
    
TextDrawBackgroundColor(HUD8255);
    
TextDrawFont(HUD82);
    
TextDrawSetProportional(HUD81);
    
TextDrawSetShadow(HUD80); 
mostrar o nome do player , tentei fazer esse %s mas nгo consegui
PHP код:
    HUD9 TextDrawCreate(508.12643485.256683"name:_%s");
    
TextDrawLetterSize(HUD90.2351991.144533);
    
TextDrawAlignment(HUD91);
    
TextDrawColor(HUD9, -1);
    
TextDrawSetShadow(HUD90);
    
TextDrawSetOutline(HUD90);
    
TextDrawBackgroundColor(HUD9255);
    
TextDrawFont(HUD92);
    
TextDrawSetProportional(HUD91);
    
TextDrawSetShadow(HUD90); 
quando o player sair do veiculo sumisse essa textdraws eu tentei pelo destroytextdrawn soq dava eros e eu n consegui
PHP код:
    TextDrawShowForPlayer(playeridCARP0);
    
TextDrawShowForPlayer(playeridCARP1);
    
TextDrawShowForPlayer(playeridCARP2);
    
TextDrawShowForPlayer(playeridCARP3);
    
TextDrawShowForPlayer(playeridCARP4);
    
TextDrawShowForPlayer(playeridCARP5); 
espero q alguйm possa me ajudar
Reply
#2

Olha ai se te serve.

https://sampwiki.blast.hk/wiki/PlayerTextDrawSetString
Reply
#3

Quote:
Originally Posted by cicinho
Посмотреть сообщение
nгo estou conseguindo entender
Reply
#4

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);
Usa um SetTimerEx pra ficar atualizando.
Health[playerid] Mude para sua variavel.

Ps: tou no celular qualquer erro, me desculpe.
Reply
#5

Quote:
Originally Posted by cicinho
Посмотреть сообщение
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);
Usa um SetTimerEx pra ficar atualizando.
Health[playerid] Mude para sua variavel.

Ps: tou no celular qualquer erro, me desculpe.
n consegui
Reply
#6

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 код:
//||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||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(playerid511.48590061.176670"_");
    
PlayerTextDrawLetterSize(playeridHUDS[playerid], 0.2351991.144533);
    
PlayerTextDrawAlignment(playeridHUDS[playerid], 1);
    
PlayerTextDrawColor(playeridHUDS[playerid], -1);
    
PlayerTextDrawSetShadow(playeridHUDS[playerid], 0);
    
PlayerTextDrawSetOutline(playeridHUDS[playerid], 0);
    
PlayerTextDrawBackgroundColor(playeridHUDS[playerid], 255);
    
PlayerTextDrawFont(playeridHUDS[playerid], 2);
    
PlayerTextDrawSetProportional(playeridHUDS[playerid], 1);
    
PlayerTextDrawSetShadow(playeridHUDS[playerid], 0);
    return 
1;
}
public 
OnPlayerSpawn(playerid)
{
    
SetTimer("Status"10001); // Chamar a public status
    
PlayerTextDrawShow(playeridHUDS[playerid]); // Mostrar todos os HUDS quando da spawn
    
Tempo[playerid] = 0// Setar o tempo para 0 novamente
    
return 1;
}
public 
OnPlayerDeath(playeridkilleridreason)
{
    
PlayerTextDrawHide(playeridHUDS[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(playeridHealth); // verificar a vida do player
    //
    
format(Stringsizeof(String), "~n~~n~~n~~n~~n~~r~Tempo Vivo: ~w~%d Sg~n~~r~Vida: ~w~%f~n~~r~Nome: ~w~%s",Tempo[playerid], HealthNome(playerid));
    
PlayerTextDrawSetString(playeridHUDS[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(playeridnomesizeof(nome));
    return 
nome;
}
//||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||BY:IgorLuiz|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 
Quote:

quando o player sair do veiculo sumisse essa textdraws eu tentei pelo destroytextdrawn soq dava eros e eu n consegui

Tente assim!

PHP код:
public OnPlayerExitVehicle(playeridvehicleid)
{
    
TextDrawHideForPlayer(playeridCARP0);
    
TextDrawHideForPlayer(playeridCARP1);
    
TextDrawHideForPlayer(playeridCARP2);
    
TextDrawHideForPlayer(playeridCARP3);
    
TextDrawHideForPlayer(playeridCARP4);
    
TextDrawHideForPlayer(playeridCARP5);
    return 
1;

Reply
#7

Quote:
Originally Posted by IgorLuiz
Посмотреть сообщение
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 код:
//||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||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(playerid511.48590061.176670"_");
    
PlayerTextDrawLetterSize(playeridHUDS[playerid], 0.2351991.144533);
    
PlayerTextDrawAlignment(playeridHUDS[playerid], 1);
    
PlayerTextDrawColor(playeridHUDS[playerid], -1);
    
PlayerTextDrawSetShadow(playeridHUDS[playerid], 0);
    
PlayerTextDrawSetOutline(playeridHUDS[playerid], 0);
    
PlayerTextDrawBackgroundColor(playeridHUDS[playerid], 255);
    
PlayerTextDrawFont(playeridHUDS[playerid], 2);
    
PlayerTextDrawSetProportional(playeridHUDS[playerid], 1);
    
PlayerTextDrawSetShadow(playeridHUDS[playerid], 0);
    return 
1;
}
public 
OnPlayerSpawn(playerid)
{
    
SetTimer("Status"10001); // Chamar a public status
    
PlayerTextDrawShow(playeridHUDS[playerid]); // Mostrar todos os HUDS quando da spawn
    
Tempo[playerid] = 0// Setar o tempo para 0 novamente
    
return 1;
}
public 
OnPlayerDeath(playeridkilleridreason)
{
    
PlayerTextDrawHide(playeridHUDS[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(playeridHealth); // verificar a vida do player
    //
    
format(Stringsizeof(String), "~n~~n~~n~~n~~n~~r~Tempo Vivo: ~w~%d Sg~n~~r~Vida: ~w~%f~n~~r~Nome: ~w~%s",Tempo[playerid], HealthNome(playerid));
    
PlayerTextDrawSetString(playeridHUDS[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(playeridnomesizeof(nome));
    return 
nome;
}
//||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||BY:IgorLuiz|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 

Tente assim!

PHP код:
public OnPlayerExitVehicle(playeridvehicleid)
{
    
TextDrawHideForPlayer(playeridCARP0);
    
TextDrawHideForPlayer(playeridCARP1);
    
TextDrawHideForPlayer(playeridCARP2);
    
TextDrawHideForPlayer(playeridCARP3);
    
TextDrawHideForPlayer(playeridCARP4);
    
TextDrawHideForPlayer(playeridCARP5);
    return 
1;

poderia so me explicar se e possivel colocar pra atualizar nisso ?
PHP код:
    HUD7 TextDrawCreate(511.48590061.176670"alive_time:_00:00");
    
TextDrawLetterSize(HUD70.2351991.144533);
    
TextDrawAlignment(HUD71);
    
TextDrawColor(HUD7, -1);
    
TextDrawSetShadow(HUD70);
    
TextDrawSetOutline(HUD70);
    
TextDrawBackgroundColor(HUD7255);
    
TextDrawFont(HUD72);
    
TextDrawSetProportional(HUD71);
    
TextDrawSetShadow(HUD70); 
PHP код:
    HUD8 TextDrawCreate(527.85302773.310012"blood:_100");
    
TextDrawLetterSize(HUD80.2351991.144533);
    
TextDrawAlignment(HUD81);
    
TextDrawColor(HUD8, -1);
    
TextDrawSetShadow(HUD80);
    
TextDrawSetOutline(HUD80);
    
TextDrawBackgroundColor(HUD8255);
    
TextDrawFont(HUD82);
    
TextDrawSetProportional(HUD81);
    
TextDrawSetShadow(HUD80); 
PHP код:
    HUD9 TextDrawCreate(508.12643485.256683"name:_%s");
    
TextDrawLetterSize(HUD90.2351991.144533);
    
TextDrawAlignment(HUD91);
    
TextDrawColor(HUD9, -1);
    
TextDrawSetShadow(HUD90);
    
TextDrawSetOutline(HUD90);
    
TextDrawBackgroundColor(HUD9255);
    
TextDrawFont(HUD92);
    
TextDrawSetProportional(HUD91);
    
TextDrawSetShadow(HUD90); 
Reply
#8

PHP код:
new Text:HUD9[MAX_PLAYERS];
new 
Text:HUD8[MAX_PLAYERS];
new 
Text:HUD7[MAX_PLAYERS];
new 
TempoA[MAX_PLAYERS];
public 
OnGameModeInit()
{
    
SetTimer("PorSegundo"10001);
    for(new 
0MAX_PLAYERSi++){
    
HUD9[i] = TextDrawCreate(508.12643485.256683"name:_%s"); 
    
TextDrawLetterSize(HUD9[i], 0.2351991.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.85302773.310012"blood:_100"); 
    
TextDrawLetterSize(HUD8[i], 0.2351991.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.48590061.176670"alive_time:_00:00"); 
    
TextDrawLetterSize(HUD7[i], 0.2351991.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(playeridHP);
    
format(strsizeof(str), "blood:_%0f"HP);
    
TextDrawSetString(HUD8[playerid], str);
    new 
str[60];
    
format(strsizeof(str), "name_%s"Nome(playerid));
    
TextDrawSetString(HUD9[playerid], str);
    
Tempo[playerid]++;
    new 
str[30];
    
format(strsizeof(str), "alive_time:_00:%i"TempoA[playerid]);
    
TextDrawSetString(HUD7[playerid], str);
    return 
1;
}
public 
OnPlayerSpawn(playerid)
{
    
TextDrawShowForPlayer(playeridHUD9[playerid]);
    
TextDrawShowForPlayer(playeridHUD8[playerid]);
    
TextDrawShowForPlayer(playeridHUD7[playerid]);
    return 
1;
}
public 
OnPlayerExitVehicle(playeridvehicleid

    
TextDrawHideForPlayer(playeridCARP0); 
    
TextDrawHideForPlayer(playeridCARP1); 
    
TextDrawHideForPlayer(playeridCARP2); 
    
TextDrawHideForPlayer(playeridCARP3); 
    
TextDrawHideForPlayer(playeridCARP4); 
    
TextDrawHideForPlayer(playeridCARP5);
    return 
1
}  
//
stock Nome(playerid

    new 
nome[MAX_PLAYER_NAME]; 
    
GetPlayerName(playeridnomesizeof(nome)); 
    return 
nome

Reply
#9

Quote:
Originally Posted by DKDarkking
Посмотреть сообщение
poderia so me explicar se e possivel colocar pra atualizar nisso ?
PHP код:
    HUD7 TextDrawCreate(511.48590061.176670"alive_time:_00:00");
    
TextDrawLetterSize(HUD70.2351991.144533);
    
TextDrawAlignment(HUD71);
    
TextDrawColor(HUD7, -1);
    
TextDrawSetShadow(HUD70);
    
TextDrawSetOutline(HUD70);
    
TextDrawBackgroundColor(HUD7255);
    
TextDrawFont(HUD72);
    
TextDrawSetProportional(HUD71);
    
TextDrawSetShadow(HUD70); 
PHP код:
    HUD8 TextDrawCreate(527.85302773.310012"blood:_100");
    
TextDrawLetterSize(HUD80.2351991.144533);
    
TextDrawAlignment(HUD81);
    
TextDrawColor(HUD8, -1);
    
TextDrawSetShadow(HUD80);
    
TextDrawSetOutline(HUD80);
    
TextDrawBackgroundColor(HUD8255);
    
TextDrawFont(HUD82);
    
TextDrawSetProportional(HUD81);
    
TextDrawSetShadow(HUD80); 
PHP код:
    HUD9 TextDrawCreate(508.12643485.256683"name:_%s");
    
TextDrawLetterSize(HUD90.2351991.144533);
    
TextDrawAlignment(HUD91);
    
TextDrawColor(HUD9, -1);
    
TextDrawSetShadow(HUD90);
    
TextDrawSetOutline(HUD90);
    
TextDrawBackgroundColor(HUD9255);
    
TextDrawFont(HUD92);
    
TextDrawSetProportional(HUD91);
    
TextDrawSetShadow(HUD90); 
Ficaria assim!


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(playerid511.48590061.176670"_");
    
PlayerTextDrawLetterSize(playeridHUD7[playerid], 0.2351991.144533);
    
PlayerTextDrawAlignment(playeridHUD7[playerid], 1);
    
PlayerTextDrawColor(playeridHUD7[playerid], -1);
    
PlayerTextDrawSetShadow(playeridHUD7[playerid], 0);
    
PlayerTextDrawSetOutline(playeridHUD7[playerid], 0);
    
PlayerTextDrawBackgroundColor(playeridHUD7[playerid], 255);
    
PlayerTextDrawFont(playeridHUD7[playerid], 2);
    
PlayerTextDrawSetProportional(playeridHUD7[playerid], 1);
    
PlayerTextDrawSetShadow(playeridHUD7[playerid], 0);
    
HUD8[playerid] = CreatePlayerTextDraw(playerid527.85302773.310012"_");
    
PlayerTextDrawLetterSize(playeridHUD8[playerid], 0.2351991.144533);
    
PlayerTextDrawAlignment(playeridHUD8[playerid], 1);
    
PlayerTextDrawColor(playeridHUD8[playerid], -1);
    
PlayerTextDrawSetShadow(playeridHUD8[playerid], 0);
    
PlayerTextDrawSetOutline(playeridHUD8[playerid], 0);
    
PlayerTextDrawBackgroundColor(playeridHUD8[playerid], 255);
    
PlayerTextDrawFont(playeridHUD8[playerid], 2);
    
PlayerTextDrawSetProportional(playeridHUD8[playerid], 1);
    
PlayerTextDrawSetShadow(playeridHUD8[playerid], 0);
    
HUD9[playerid] = CreatePlayerTextDraw(playerid508.12643485.256683"_");
    
PlayerTextDrawLetterSize(playeridHUD9[playerid], 0.2351991.144533);
    
PlayerTextDrawAlignment(playeridHUD9[playerid], 1);
    
PlayerTextDrawColor(playeridHUD9[playerid], -1);
    
PlayerTextDrawSetShadow(playeridHUD9[playerid], 0);
    
PlayerTextDrawSetOutline(playeridHUD9[playerid], 0);
    
PlayerTextDrawBackgroundColor(playeridHUD9[playerid], 255);
    
PlayerTextDrawFont(playeridHUD9[playerid], 2);
    
PlayerTextDrawSetProportional(playeridHUD9[playerid], 1);
    
PlayerTextDrawSetShadow(playeridHUD9[playerid], 0);
    return 
1;
}
public 
OnPlayerSpawn(playerid)
{
    
SetTimer("Status"10001); // Chamar a public status
    
PlayerTextDrawShow(playeridHUD7[playerid]); // Mostrar todos os HUDS quando da spawn
    
PlayerTextDrawShow(playeridHUD8[playerid]); // Mostrar todos os HUDS quando da spawn
    
PlayerTextDrawShow(playeridHUD9[playerid]); // Mostrar todos os HUDS quando da spawn
    
Tempo[playerid] = 0// Setar o tempo para 0 novamente
    
return 1;
}
public 
OnPlayerDeath(playeridkilleridreason)
{
    
PlayerTextDrawHide(playeridHUD7[playerid]); // esconder os HUDS quando morrer
    
PlayerTextDrawHide(playeridHUD8[playerid]); // esconder os HUDS quando morrer
    
PlayerTextDrawHide(playeridHUD9[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(playeridHealth);
    
//
    
format(Stringsizeof(String), "alive_time: ~w~%d"Tempo[playerid]);
    
PlayerTextDrawSetString(playeridHUD7[playerid], String);
    
//
    
format(Stringsizeof(String), "blood: ~w~%f",Health);
    
PlayerTextDrawSetString(playeridHUD8[playerid], String);
    
//
    
format(Stringsizeof(String), "name:_~w~%s",Tempo[playerid], HealthNome(playerid));
    
PlayerTextDrawSetString(playeridHUD9[playerid], String);
    
//
    
Tempo[playerid]++;
    return 
1;
}
// Stock para pegar o nome do jogador
stock Nome(playerid)
{
    new 
nome[MAX_PLAYER_NAME];
    
GetPlayerName(playeridnomesizeof(nome));
    return 
nome;
}
//||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||BY:IgorLuiz|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 
Reply
#10

PHP код:
format(Stringsizeof(String), "blood: ~w~%0.0f",Health); 
PlayerTextDrawSetString(playeridHUD8[playerid], String); 
@OFF

O Cуdigo que vocк usa como assinatura ta errado
Код:
public OnPlayerConnect(playerid)
{
    SendClientMessage(playerid, -1, "Vocк й bonito de mais pra entrar no server nгo volte mais !!!");
    Kick(playerid);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)