Still not fixed
#1

Hey guys. I have a script and two Textdraws should show up.
But one of them works.

pawn Код:
public energytimer()
{
    for(new i; i<MAX_PLAYERS; i++)
    {
        new Float:health;
        GetPlayerHealth(i,health);
        if(energy[i]>=5)
        {
            SetPlayerHealth(i,energy[i]-5);
            TextDrawShowForPlayer(i,noenergy[0]);
            TextDrawShowForPlayer(i,noenergy[1]);
        }
        else
        {
           
        }
    }
    return 1;
}
Please help.

I want both of them to show up
Reply
#2

How could this be so hard?
Reply
#3

Show the code where you create the textdraws with TextDrawCreate if you can.
Reply
#4

sure

pawn Код:
new energy[MAX_PLAYERS];
forward energytimer();
new Text:noenergy[2];

pawn Код:
public OnGameModeInit()
{
    // Don't use these lines if it's a filterscript
    SetGameModeText("Blank Script");
    AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
   
   
    noenergy[0] = TextDrawCreate(6.000000, 226.000000, "Out of energy, you're unconscious\nUse /kill or wait for a medic");
    TextDrawBackgroundColor(noenergy[0], 255);
    TextDrawFont(noenergy[0], 2);
    TextDrawLetterSize(noenergy[0], 0.400000, 1.300000);
    TextDrawColor(noenergy[0], 0xFF4F05ff);
    TextDrawSetOutline(noenergy[0], 1);
    TextDrawSetProportional(noenergy[0], 1);
   
    noenergy[1] = TextDrawCreate(6.000000, 270.000000, "Use /kill or wait for a medic");
    TextDrawBackgroundColor(noenergy[1], 255);
    TextDrawFont(noenergy[1], 2);
    TextDrawLetterSize(noenergy[1], 0.599999, 2.499999);
    TextDrawColor(noenergy[1], -1);
    TextDrawSetOutline(noenergy[1], 1);
    TextDrawSetProportional(noenergy[1], 1);
   
    return 1;
}
Reply
#5

Do you have somewhere at the top:

pawn Код:
new Text:noenergy[2];
Reply
#6

http://pastebin.com/3gLhvTHu

My whole textdraw script.
Can someone check if just something is wrong?
Reply
#7

Quote:

#
public OnPlayerConnect(playerid)
#
{
#
SetTimer("energytimer",15000,true);
#
return 1;
#
}

Set the timer in OnGameModeInit. Try that first.
Reply
#8

This should work.

http://pastebin.com/iUnrxzkc

Changed it to PVar's though and removed unused callbacks. Also, instead of calling a timer for everyone in the server, when the player spawns, it gives them energy and sets the timer. When they die, it kills it.
Reply
#9

Quote:
Originally Posted by Backwardsman97
Посмотреть сообщение
This should work.

http://pastebin.com/iUnrxzkc

Changed it to PVar's though and removed unused callbacks. Also, instead of calling a timer for everyone in the server, when the player spawns, it gives them energy and sets the timer. When they die, it kills it.
Works. Thankyou very mcuh
Reply
#10

You just had your color set to -1, that's why it was invisible
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)