SA-MP Forums Archive
[Ajuda] Textdraws setstring - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] Textdraws setstring (/showthread.php?tid=582598)



Textdraws setstring - JuniorTheDM - 21.07.2015

Meu Codigo
PHP код:
//TOPO DA GM
forward info(playerid);
//OnGameModeInit
SetTimer("info",1000,1);
//OnPlayerConnect
        
INFO[2][playerid] = CreatePlayerTextDraw(playerid,510.000000360.000000"--");
        
PlayerTextDrawBackgroundColor(playerid,INFO[2][playerid], 255);
        
PlayerTextDrawFont(playerid,INFO[2][playerid], 1);
        
PlayerTextDrawLetterSize(playerid,INFO[2][playerid], 0.5000001.000000);
        
PlayerTextDrawColor(playerid,INFO[2][playerid], -1);
        
PlayerTextDrawSetOutline(playerid,INFO[2][playerid], 0);
        
PlayerTextDrawSetProportional(playerid,INFO[2][playerid], 1);
        
PlayerTextDrawSetShadow(playerid,INFO[2][playerid], 1);
        
PlayerTextDrawSetSelectable(playerid,INFO[2][playerid], 0);
//OnPlayerSpawn
         
PlayerTextDrawShow(playeridINFO[2][playerid]);
//Public Criada
public info(playerid)
{
    new 
str[128];
    
format(strsizeof(str), "~b~Matou:~w~ %s",DOF2::GetInt(String"Matou"));
    
PlayerTextDrawSetString(playeridINFO[2][playerid], str);

A TEXTDRAW NAO APARECE '-'


Re: Textdraws setstring - JPedro - 21.07.2015

Por que o timer?, tentar colocar isso no onplayerconnect

info(playerid); e apaga esse timer


Re: Textdraws setstring - IgorLuiz - 21.07.2015

Estб errado: PlayerTextDrawShow(playerid, INFO[2][playerid]);
Use: PlayerTextDrawShow(playerid, PlayerText:INFO[2][playerid]);


Tenta ae

PHP код:
// TOPO DA GM
forward info(playerid);
// OnGameModeInit
SetTimer("info",1000,1);
// OnPlayerConnect
        
INFO[2][playerid] = CreatePlayerTextDraw(playerid,510.000000360.000000"--");
        
PlayerTextDrawBackgroundColor(playerid,INFO[2][playerid], 255);
        
PlayerTextDrawFont(playerid,INFO[2][playerid], 1);
        
PlayerTextDrawLetterSize(playerid,INFO[2][playerid], 0.5000001.000000);
        
PlayerTextDrawColor(playerid,INFO[2][playerid], -1);
        
PlayerTextDrawSetOutline(playerid,INFO[2][playerid], 0);
        
PlayerTextDrawSetProportional(playerid,INFO[2][playerid], 1);
        
PlayerTextDrawSetShadow(playerid,INFO[2][playerid], 1);
        
PlayerTextDrawSetSelectable(playerid,INFO[2][playerid], 0);
// OnPlayerSpawn
         
PlayerTextDrawShow(playeridPlayerText:INFO[2][playerid]);
// Public Criada
public info(playerid)
{
    new 
str[128];
    
format(strsizeof(str), "~b~Matou:~w~ %s",DOF2::GetInt(String"Matou"));
    
PlayerTextDrawSetString(playeridINFO[2][playerid], str);




Re: Textdraws setstring - JuniorTheDM - 21.07.2015

Quote:
Originally Posted by IgorLuiz
Посмотреть сообщение
Estб errado: PlayerTextDrawShow(playerid, INFO[2][playerid]);
Use: PlayerTextDrawShow(playerid, PlayerText:INFO[2][playerid]);


Tenta ae

PHP код:
// TOPO DA GM
forward info(playerid);
// OnGameModeInit
SetTimer("info",1000,1);
// OnPlayerConnect
        
INFO[2][playerid] = CreatePlayerTextDraw(playerid,510.000000360.000000"--");
        
PlayerTextDrawBackgroundColor(playerid,INFO[2][playerid], 255);
        
PlayerTextDrawFont(playerid,INFO[2][playerid], 1);
        
PlayerTextDrawLetterSize(playerid,INFO[2][playerid], 0.5000001.000000);
        
PlayerTextDrawColor(playerid,INFO[2][playerid], -1);
        
PlayerTextDrawSetOutline(playerid,INFO[2][playerid], 0);
        
PlayerTextDrawSetProportional(playerid,INFO[2][playerid], 1);
        
PlayerTextDrawSetShadow(playerid,INFO[2][playerid], 1);
        
PlayerTextDrawSetSelectable(playerid,INFO[2][playerid], 0);
// OnPlayerSpawn
         
PlayerTextDrawShow(playeridPlayerText:INFO[2][playerid]);
// Public Criada
public info(playerid)
{
    new 
str[128];
    
format(strsizeof(str), "~b~Matou:~w~ %s",DOF2::GetInt(String"Matou"));
    
PlayerTextDrawSetString(playeridINFO[2][playerid], str);

Nao Deu Certo, Fiz oque voce pediu

Quote:
Originally Posted by JPedro
Посмотреть сообщение
Por que o timer?, tentar colocar isso no onplayerconnect

info(playerid); e apaga esse timer
tambem nao deu certo ;/


Re: Textdraws setstring - IgorLuiz - 21.07.2015

Testa ae

PHP код:
public OnGameModeInit()
{
    
SetTimer("info"10001);
    return 
1;

PHP код:
public OnPlayerConnect(playerid)
{
    
INFO[2][playerid] = CreatePlayerTextDraw(playerid,145.000000,347.000000,"_");
    
PlayerTextDrawUseBox(playeridINFO[2][playerid],1);
    
PlayerTextDrawBoxColor(playeridINFO[2][playerid],0x00000066);
    
PlayerTextDrawTextSize(playeridINFO[2][playerid],196.000000,14.000000);
    
PlayerTextDrawAlignment(playeridINFO[2][playerid],0);
    
PlayerTextDrawBackgroundColor(playeridINFO[2][playerid],0xffffffff);
    
PlayerTextDrawFont(playeridINFO[2][playerid],2);
    
PlayerTextDrawLetterSize(playeridINFO[2][playerid],0.199999,1.400000);
    
PlayerTextDrawColor(playeridINFO[2][playerid],0xffffffff);
    
PlayerTextDrawSetProportional(playeridINFO[2][playerid],1);
    
PlayerTextDrawSetShadow(playeridINFO[2][playerid],0);
    return 
1;

PHP код:
public OnPlayerSpawn(playerid)
{
    
PlayerTextDrawShow(playeridPlayerText:INFO[2][playerid]);
    return 
1;

PHP код:
forward info(playerid);
public 
info(playerid)
{
    new 
STR[128];
    
format(STRsizeof(STR), "~b~Matou: ~w~%d",DOF2::GetInt(String"Matou"));
    
PlayerTextDrawSetString(playeridINFO[2][playerid], STR);
    return 
1;




Re: Textdraws setstring - JuniorTheDM - 21.07.2015

deu certo cara muito obrigado +rep


Re: Textdraws setstring - humildadeforever - 21.07.2015

Para que utilizar timer? Pode-se utilizar a OnPlayerDeath. Mas se continuar com o timer, precisa mudar a funзгo para SetTimerEx e movк-la para a OnPlayerConnect ou dialog/comando de login, pois senгo irб bugar.


Re: Textdraws setstring - JuniorTheDM - 21.07.2015

Quote:
Originally Posted by humildadeforever
Посмотреть сообщение
Para que utilizar timer? Pode-se utilizar a OnPlayerDeath. Mas se continuar com o timer, precisa mudar a funзгo para SetTimerEx e movк-la para a OnPlayerConnect ou dialog/comando de login, pois senгo irб bugar.
Tirei o Settimer Mais Agora o Sistema nao Funfa .


Re: Textdraws setstring - humildadeforever - 21.07.2015

Quote:
Originally Posted by JuniorTheDM
Посмотреть сообщение
Tirei o Settimer Mais Agora o Sistema nao Funfa .
https://sampwiki.blast.hk/wiki/OnPlayerDeath
Vejamos...

PHP код:
new Matou[MAX_PLAYERS];
public 
OnPlayerDeath(playeridkilleridreason)
{
    if(
killerid != INVALID_PLAYER_ID
    {
        
Matou[killerid] ++;
        new 
str[128]; 
        
format(strsizeof(str), "~b~Matou:~w~ %d"Matou[killerid]); 
        
PlayerTextDrawSetString(killeridINFO[2][killerid], str); 
    }
    return 
1;
}
//ao carregar os dados do jogador
Matou[playerid] = DOF2_GetInt(String"Matou");
//para salvar
DOF2_SetInt(String"Matou",  Matou[playerid]); 
Desculpa qualquer erro, costumo digitar o cуdigo no pawno e colar aqui, mas digitei aqui mesmo e com pressa..

Quote:
Originally Posted by JuniorTheDM
Посмотреть сообщение
PHP код:
//OnPlayerConnect
SetTimerEx("info"1000false"i"playerid); 
й So Colocar ISSO LA ?
Sim...


Re: Textdraws setstring - JuniorTheDM - 21.07.2015

Vlw