SA-MP Forums Archive
[Ajuda] Timer + TextDrawCreate - 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] Timer + TextDrawCreate (/showthread.php?tid=395377)



Timer + TextDrawCreate - AiaN - 26.11.2012

Olб!

Eu quero que quando o killerid matar o playerid apareзa um textdraw para o killerid e apуs 3 segundos o textdraw desapareзa.

Fiz o seguinte cуdigo:

pawn Код:
if(killerid == INVALID_PLAYER_ID)
    {
        SendDeathMessage(INVALID_PLAYER_ID, playerid, 53);
        ResetPlayerMoneyEx(playerid);
    }
    else
    {
        SendDeathMessage(killerid, playerid, reason);
        if(GetPlayerMoneyEx(playerid) > 0)
        {
            if(mVida[killerid] == 1)
            {
                if(GetPlayerMoneyEx(playerid) >= 1000)
                {
                    new string[128];

                    format(string, sizeof(string), "+$%i", GetPlayerMoneyEx(playerid));
                    TextDrawSetString(MoreMoney, string);
                    TextDrawShowForPlayer(killerid, MoreMoney);
                    GivePlayerMoneyEx(killerid, GetPlayerMoneyEx(playerid)-300);
                    ResetPlayerMoneyEx(playerid);
                    SetTimer("MoreMoney", 3000, false);
                }
                else
                {
                    new string[128];

                    format(string, sizeof(string), "+$%i", GetPlayerMoneyEx(playerid));
                    TextDrawSetString(MoreMoney, string);
                    TextDrawShowForPlayer(killerid, MoreMoney);
                    GivePlayerMoneyEx(killerid, GetPlayerMoneyEx(playerid));
                    ResetPlayerMoneyEx(playerid);
                }
            }
            else
            {
                new string[128];

                format(string, sizeof(string), "+$%i", GetPlayerMoneyEx(playerid));
                TextDrawSetString(MoreMoney, string);
                TextDrawShowForPlayer(killerid, MoreMoney);
                GivePlayerMoneyEx(killerid, GetPlayerMoneyEx(playerid));
                ResetPlayerMoneyEx(playerid);
            }
        }
    }
Mas o timer nгo й iniciado ou nгo estб executando o cуdigo, oque estб errado?

cуdigo dos timers:

pawn Код:
public mMoney(playerid)
{
    TextDrawHideForPlayer(playerid, MoreMoney);
    TextDrawSetString(MoreVida, "-$300");
    TextDrawShowForPlayer(playerid, MoreVida);
    SetTimer("MoreVida", 2000, true);
}

public MoreV(playerid)
{
    new Float:Vida;

    GetPlayerHealth(playerid, Vida);

    if(Vida <= 99)
    {
        SetPlayerHealth(playerid, Vida+15);
        GivePlayerMoney(playerid, -300);
    }

    TextDrawHideForPlayer(playerid, MoreVida);
}



Re: Timer + TextDrawCreate - Schocc - 26.11.2012

Coloque um print("xxxxxxxxxx");

na callbacks para ver se realmente nгo estasendo chamada


Re: Timer + TextDrawCreate - zSuYaNw - 26.11.2012

https://sampwiki.blast.hk/wiki/GameTextForPlayer


Re: Timer + TextDrawCreate - AiaN - 26.11.2012

Entгo Garfield, atй pensei em usar, mas acho que o GameTextForPlayer o texto fica no meio da tela, preciso que fique no canto da tela, no lado direito.

@Schocc , vou fazer isso, vou ver se consigo algum amigo para ir testar comigo, obrigado por me lembrar do debug.


Re: Timer + TextDrawCreate - Ouro - 26.11.2012

Quote:
Originally Posted by AiaN
Посмотреть сообщение
Entгo Garfield, atй pensei em usar, mas acho que o GameTextForPlayer o texto fica no meio da tela, preciso que fique no canto da tela, no lado direito.
Hб seis estilos de GameText.
Veja: https://sampwiki.blast.hk/wiki/GameTextStyle#Text_Styles


Re: Timer + TextDrawCreate - AiaN - 26.11.2012

Mas nenhum deles fica no canto direito da tela.


Re: Timer + TextDrawCreate - zSuYaNw - 26.11.2012

troque o timer por:
pawn Код:
SetTimer("MoreMoney", 3000, false, "i", killerid);



Re: Timer + TextDrawCreate - AiaN - 26.11.2012

Obrigado, assim que puder irei fazer o teste.

Olhando agora, percebi que o nome da public que o timer irб chamar nгo й a mesma da public criada, acho que й por isso que nгo estб dando certo.

Enfim, assim que puder irei testar.

Mudando completamente de assunto.. Alguйm sabe como colocar o pickup de vida e colete quando o killerid atira no jogador ? Como tem em alguns servidores de A/D ?!