SA-MP Forums Archive
[Include] InfoText TextDraw - 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: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] InfoText TextDraw (/showthread.php?tid=651121)



InfoText TextDraw - KayJ - 14.03.2018

InfoText TextDraw
About:
It's a simple include which is modified version of "[INC] TextDraw, Information Box." by Shadow(made in 2010).

Usage: How To Implement:
PHP код:
#include <infotext>
// IF USING IN FILTERSCRIPT
public OnFilterScriptInit()
{
    
OnShadowInit();
    return 
1;
}
// IF USING IN GAMEMODE
public OnGameModeInit()
{
    
OnShadowInit();
    return 
1;

How to Use:
PHP код:
public OnPlayerConnect(playerid// Welcoming a player showing textdraw (using format and string)
{
    new 
string[150];
    new 
pName[MAX_PLAYER_NAME];
    
GetPlayerName(playeridpNamesizeof(pName));
    
format(stringsizeof(string), "~y~Welcome ~y~~h~~h~%s!~N~~y~ID: ~y~~h~~h~%d~w~~N~~y~"pNameplayerid);
    
ShadInfoBoxForPlayer(playeridstring);
    return 
1;
}
public 
OnPlayerSpawn(playerid// Spawning player with message that he's spawned (without format and string)
{
    
ShadInfoBoxForPlayer(playerid"~r~Spawned!");
    return 
1;

Media:
Click Here (REF: T(DM)-V.I.P)

Note:
  1. There's no change in the position of TextDraw. (REF: Original Include)
  2. The TextDraw will automatically close after 15 seconds, you can change it by giving a value in the include:
    PHP код:
     #define CLOSETIMER 15000 // 1000 = 1 second 
  3. If you don't want it to hide, find remove these from include:
    PHP код:
    #define CLOSETIMER 15000
    SetTimerEx("CloseTextdraw"CLOSETIMERfalse"i"playerid); 
Color Source:
SA:MP Wikipedia > GameText

Download:
infotext.inc: Pastebin| RAW | Github


Re: InfoText TextDraw - Eatmysmoke - 14.03.2018

Quote:

SetTimerEx("CloseTextdraw", CLOSETIMER, true, "i", playerid);

Why?


Re: InfoText TextDraw - KayJ - 14.03.2018

Quote:
Originally Posted by Eatmysmoke
Посмотреть сообщение
Why?
In case it'll called again? I guess you can use it again when needed.


Re: InfoText TextDraw - Eatmysmoke - 14.03.2018

Quote:
Originally Posted by KayJ
Посмотреть сообщение
In case it'll called again? I guess you can use it again when needed.
In case it'll get called again?

I don't think you know how timers work correctly.

"true" means the timer will go on forever and every time the function is used another timer is set (useless) which is ruining everything up.


Re: InfoText TextDraw - StrikerZ - 14.03.2018

Quote:
Originally Posted by KayJ
Посмотреть сообщение
In case it'll called again? I guess you can use it again when needed.
PHP код:
SetTimerEx("CloseTextdraw"CLOSETIMERtrue"i"playerid); 
The same thing Smoke said, why is it set to true? It'll keep repeating the timer after the textdraw is hidden too.

EDIT: Looks like smoke posted earlier at the same time