SA-MP Forums Archive
Still not fixed - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Still not fixed (/showthread.php?tid=208401)



Still not fixed - bartje01 - 08.01.2011

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


Re: Still not fixed - bartje01 - 08.01.2011

How could this be so hard?


Re: Still not fixed - Mauzen - 08.01.2011

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


Re: Still not fixed - bartje01 - 08.01.2011

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;
}



Re: Still not fixed - Kwarde - 08.01.2011

Do you have somewhere at the top:

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



Re: Still not fixed - bartje01 - 08.01.2011

http://pastebin.com/3gLhvTHu

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


Re: Still not fixed - Kwarde - 08.01.2011

Quote:

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

Set the timer in OnGameModeInit. Try that first.


Re: Still not fixed - Backwardsman97 - 08.01.2011

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.


Re: Still not fixed - bartje01 - 08.01.2011

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


Re: Still not fixed - Joe Staff - 08.01.2011

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