[Ajuda] TextDraw "%s te matou"
#1

Galera, alguem pode me ajuda com isso aqui? estou tentando criar uma textdraw que mostre o nome de quem te matou, acho que faзo tudo certo mais na hora de entrar no server a palavra nгo aparece. + REP
pawn Код:
new Text:tematou,

public OnGameModeInit()
{
    tematou = TextDrawCreate(00.000000, 000.000000, " ");
    TextDrawAlignment(tematou, 0);
    TextDrawBackgroundColor(tematou, 000);
    TextDrawFont(tematou, 0);
    TextDrawLetterSize(tematou, 0.000000, 0.000000);
    TextDrawColor(tematou, 0);
    TextDrawSetOutline(tematou, 0);
    TextDrawSetProportional(tematou, 0);
    TextDrawSetShadow(tematou, 0);
}

public OnPlayerDeath(playerid, killerid, reason)
{
    if(killerid != INVALID_PLAYER_ID)
    {
        new killernick[24];
        GetPlayerName(killerid, killernick, sizeof(killernick));
        new string[128];
        format(string, sizeof(string), "%s te matou", killernick);
        TextDrawShowForPlayer(playerid, tematou);
    }
}
Reply
#2

TextDrawShowForPlayer mostra o text draw para o jogador para alterar o texto vocк deve usar TextDrawSetString
Reply
#3

Colocando em prбtica o que o multi disse:
pawn Код:
new Text:tematou,

public OnGameModeInit()
{
    tematou = TextDrawCreate(00.000000, 000.000000, " ");
    TextDrawAlignment(tematou, 0);
    TextDrawBackgroundColor(tematou, 000);
    TextDrawFont(tematou, 0);
    TextDrawLetterSize(tematou, 0.000000, 0.000000);
    TextDrawColor(tematou, 0);
    TextDrawSetOutline(tematou, 0);
    TextDrawSetProportional(tematou, 0);
    TextDrawSetShadow(tematou, 0);
}

public OnPlayerDeath(playerid, killerid, reason)
{
    if(killerid != INVALID_PLAYER_ID)
    {
        new killernick[24];
        GetPlayerName(killerid, killernick, sizeof(killernick));
        new string[128];
        TextDrawHideForPlayer(playerid, tematou); // Evitar bug's, se der mais bug's remova.
        format(string, sizeof(string), "%s te matou", killernick);
        TextDrawSetString(tematou, string);
        TextDrawShowForPlayer(playerid, tematou);
    }
}
Reply
#4

Quote:
Originally Posted by MultiKill
Посмотреть сообщение
TextDrawShowForPlayer mostra o text draw para o jogador para alterar o texto vocк deve usar TextDrawSetString
vou dar uma olhada nisso, Obg!

Quote:
Originally Posted by CLANdok
Посмотреть сообщение
Colocando em prбtica o que o multi disse:
pawn Код:
new Text:tematou,

public OnGameModeInit()
{
    tematou = TextDrawCreate(00.000000, 000.000000, " ");
    TextDrawAlignment(tematou, 0);
    TextDrawBackgroundColor(tematou, 000);
    TextDrawFont(tematou, 0);
    TextDrawLetterSize(tematou, 0.000000, 0.000000);
    TextDrawColor(tematou, 0);
    TextDrawSetOutline(tematou, 0);
    TextDrawSetProportional(tematou, 0);
    TextDrawSetShadow(tematou, 0);
}

public OnPlayerDeath(playerid, killerid, reason)
{
    if(killerid != INVALID_PLAYER_ID)
    {
        new killernick[24];
        GetPlayerName(killerid, killernick, sizeof(killernick));
        new string[128];
        TextDrawHideForPlayer(playerid, tematou); // Evitar bug's, se der mais bug's remova.
        format(string, sizeof(string), "%s te matou", killernick);
        TextDrawSetString(tematou, string);
        TextDrawShowForPlayer(playerid, tematou);
    }
}
Jah tenho colocado TextDrawHideForPlayer na minha public AutoSpawn(playerid)
Reply
#5

Entгo nгo use, teste ae e diga se funcionou ou nгo.
Reply
#6

Quote:
Originally Posted by MultiKill
Посмотреть сообщение
TextDrawShowForPlayer mostra o text draw para o jogador para alterar o texto vocк deve usar TextDrawSetString
Era o TextDrawSetString que faltava, vlw ae cara.

Quote:
Originally Posted by CLANdok
Посмотреть сообщение
Entгo nгo use, teste ae e diga se funcionou ou nгo.
Sem o TextDrawHideForPlayer a textdraw demora um pouco pra ser destruida, e com ela destroi no momento que eu quiser
Reply
#7

Tenta Assim
pawn Код:
new Text:tematou,

public OnGameModeInit()
{
    tematou = TextDrawCreate(00.000000, 000.000000, " ");
    TextDrawAlignment(tematou, 0);
    TextDrawBackgroundColor(tematou, 000);
    TextDrawFont(tematou, 0);
    TextDrawLetterSize(tematou, 0.000000, 0.000000);
    TextDrawColor(tematou, 0);
    TextDrawSetOutline(tematou, 0);
    TextDrawSetProportional(tematou, 0);
    TextDrawSetShadow(tematou, 0);
}

public OnPlayerDeath(playerid, killerid, reason)
{
    if(killerid != INVALID_PLAYER_ID)
    {
        new killernick[24];
        GetPlayerName(killerid, killernick, sizeof(killernick));
        new string[128];
        TextDrawHideForPlayer(playerid, tematou); // Evitar bug's, se der mais bug's remova.
        format(string, sizeof(string), "%s te matou", killernick);
        TextDrawSetString(tematou, string);
        TextDrawShowForPlayer(playerid, tematou);
        SetTimerEx("Esconder",2000,false,"i",playerid);//Em 2 Segundos Chama O Public E O Textdraw Some Para O Player Morto
    }
}
forward Esconder(playerid);
public Esconder(playerid)
{
    TextDrawHideForPlayer(playerid, tematou);//Esconde A Textdraw
}
Reply
#8

By: wiki.sa-mp

NOTE: For certain callbacks, the value that is returned by the callback ('return x;') determines whether the callback will continue to be called in other scripts. For example; OnPlayerCommandText requires 0 to be returned if a command isn't found, so that the callback will search through the other loaded scripts for an existing command. Returning 1 signals that the command has been found and the callback does not require calling in other scripts. This is different for other callbacks such as OnPlayerConnect, in which 1 must be returned for it to be called in other scripts. This is not the case for any other callback.
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)