SA-MP Forums Archive
Random TextDraws (A small problem, Nothing big) - 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)
+--- Thread: Random TextDraws (A small problem, Nothing big) (/showthread.php?tid=283393)



Random TextDraws (A small problem, Nothing big) - OleKristian95 - 14.09.2011

Hi
Hello everyone, the last hour I have been trying to learn how to make TextDraws and here is how far I've come 'til now.
It almost seem to work as it should but its 1 problem,
The first TextDraw (RTD2) appears just fine but when another one is about to appear it just disappear.
I hope someone can help me with this , I actually want to release it when Im done with it.
(It's very simple but its only my second one!)

Here is the code:
pawn Code:
// Credits (Do not remove or edit any of the credits!!!)
// fubar - Idea token from fubar's all_in_one filterscript.
// OleKristian95 - Made this filterscript

//---Includes---//
#include <a_samp>
//--------------//

//-------Forwards-------//
forward Random_Messages();
//----------------------//

//-Timer Define-//
new RTDS_Timer;
//--------------//
//--TextDraw Defines--//
     new Text:RTD1;
     new Text:RTD2;
//--------------------//

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Random TextDraws by OleKristian95");
    print("--------------------------------------\n");
   
    //The TextDraw Timer
   
    RTDS_Timer = SetTimerEx("Random_Messages",85000, 1, "i");
   
    //The TextDraw Messages + The TextDraw Boxes
   
    RTD1 = TextDrawCreate(0.000000,437.000000, "If you are new at this server please register, Type /Register [Password]");
    TextDrawUseBox(RTD1,1);
    TextDrawBoxColor(RTD1,0x00000066);
    TextDrawTextSize(RTD1,2000.000000,3600.000000);
    TextDrawAlignment(RTD1,1);
    TextDrawBackgroundColor(RTD1,0x00000066);
    TextDrawFont(RTD1,1);
    TextDrawLetterSize(RTD1,0.299999,1.000000);
    TextDrawColor(RTD1,0x00ff00cc);
    TextDrawSetOutline(RTD1,1);
    TextDrawSetProportional(RTD1,1);
    TextDrawSetShadow(RTD1,1);

    RTD2 = TextDrawCreate(0.000000,437.000000, "To see a list of this server's general commands, Type /Commands");
    TextDrawUseBox(RTD2,1);
    TextDrawBoxColor(RTD2,0x00000066);
    TextDrawTextSize(RTD2,2000.000000,3600.000000);
    TextDrawAlignment(RTD2,1);
    TextDrawBackgroundColor(RTD2,0x00000066);
    TextDrawFont(RTD2,1);
    TextDrawLetterSize(RTD2,0.299999,1.000000);
    TextDrawColor(RTD2,0x00ff00cc);
    TextDrawSetOutline(RTD2,1);
    TextDrawSetProportional(RTD2,1);
    TextDrawSetShadow(RTD2,1);
   
    return 1;
}

public OnFilterScriptExit(){

    KillTimer(RTDS_Timer);
   
    return 1;
}

public Random_Messages()
{
    new Random_Message=random(2);

    if (Random_Message == 0){
        //Hide TextDraws
        TextDrawHideForAll(RTD2);
        //Show TextDraw
        TextDrawShowForAll(RTD1);}

    else if (Random_Message == 1){
        //Hide TextDraws
        TextDrawHideForAll(RTD1);
        //Show TextDraw
        TextDrawShowForAll(RTD2);}
    return 1;
}
       
/* Copyright © 2011 OleKristian95 */



Re: Random TextDraws (A small problem, Nothing big) - Backwardsman97 - 14.09.2011

Well isn't that what you made it to do? Hide one, show another?

Also, you don't have to use SetTimerEx here.

pawn Code:
RTDS_Timer = SetTimerEx("Random_Messages", 85000, 1, "i");

//Can just be
RTDS_Timer = SetTimer("Random_Messages", 85000, 1);



Re: Random TextDraws (A small problem, Nothing big) - OleKristian95 - 14.09.2011

Quote:
Originally Posted by Backwardsman97
View Post
Well isn't that what you made it to do? Hide one, show another?

Also, you don't have to use SetTimerEx here.

pawn Code:
RTDS_Timer = SetTimerEx("Random_Messages", 85000, 1, "i");

//Can just be
RTDS_Timer = SetTimer("Random_Messages", 85000, 1);
It hides everything, ok thanks Ill edit that