MessageBox stock? -
Jernu - 23.07.2013
I wanna know how to create a MessageBox textdraw that will show a transparent box and you can place text in there?
Example:
CMD:blah(playerid, params[])
{
MessageBox(playerid, time, title, text);
return 1;
}
title being the top bit of the box.
What I'm trying to find out is the stock and the textdraw.
Re: MessageBox stock? -
Antonio144 - 23.07.2013
There's a lovely include made by Universal called
uMessageBox that does exactly that.
Re: MessageBox stock? -
Jernu - 23.07.2013
There is.. Shame it doesn't work.
Re: MessageBox stock? -
RajatPawar - 23.07.2013
Alright, try
this then.
Re: MessageBox stock? -
Jernu - 23.07.2013
I don't want it like that.
I want it so you can do it like this(PS. Thats how I want the box):
MessageBox(playerid, title, message, time);
Re: MessageBox stock? -
RajatPawar - 23.07.2013
You can always make your own, it's not hard to make it, then. You could always go through my code and get the algorithm for making it. Happy scripting!
Re: MessageBox stock? -
Jernu - 23.07.2013
But how would I make the stock?
Re: MessageBox stock? -
Jernu - 23.07.2013
Okay, so I've got my textdraws but I dunno how to create the stock?
Re: MessageBox stock? -
ReVo_ - 23.07.2013
Код:
new PlayerText:__playerinfobox__;
new bool:__playeralreadyinbox__[MAX_PLAYERS];
new __playerhidetimer__[MAX_PLAYERS];
stock MessageBox(playerid, time, text, title)//time in ms
{
if (__playeralreadyinbox__[playerid]) {
// destroy old box
// kill old timers
PlayerTextDrawDestroy(playerid, __playerinfobox);
KillTimer (__playerhidetimer__[playerid]);
}
__playeralreadyinbox__ [playerid] = true;
// create here the player text, and save inside __playerinfobox__
__playerhidetimer__[playerid] = SetTimerEx("DestroyMessageBox", time, 0, "i", playerid);// if you want time in seconds, use time * 1000
}
forward DestroyMessageBox(playerid);
public DestroyMessageBox(playerid)
{
PlayerTextDrawDestroy(playerid, __playerinfobox);
__playeralreadyinbox__ [playerid] = false;
}
Timers:
https://sampwiki.blast.hk/wiki/SetTimerEx
Player Textdraws:
https://sampwiki.blast.hk/wiki/CreatePlayerTextDraw
Re: MessageBox stock? -
Jernu - 23.07.2013
I've made one:
pawn Код:
Textdraw0 = TextDrawCreate(494.000000, 128.000000, "Error:");
TextDrawBackgroundColor(Textdraw0, 255);
TextDrawFont(Textdraw0, 1);
TextDrawLetterSize(Textdraw0, 0.500000, 1.000000);
TextDrawColor(Textdraw0, -1);
TextDrawSetOutline(Textdraw0, 0);
TextDrawSetProportional(Textdraw0, 1);
TextDrawSetShadow(Textdraw0, 1);
TextDrawUseBox(Textdraw0, 1);
TextDrawBoxColor(Textdraw0, 255);
TextDrawTextSize(Textdraw0, 620.000000, -40.000000);
Textdraw1 = TextDrawCreate(494.000000, 140.000000, "string");
TextDrawBackgroundColor(Textdraw1, 255);
TextDrawFont(Textdraw1, 1);
TextDrawLetterSize(Textdraw1, 0.300000, 1.000000);
TextDrawColor(Textdraw1, -1);
TextDrawSetOutline(Textdraw1, 0);
TextDrawSetProportional(Textdraw1, 1);
TextDrawSetShadow(Textdraw1, 1);
TextDrawUseBox(Textdraw1, 1);
TextDrawBoxColor(Textdraw1, -871318750);
TextDrawTextSize(Textdraw1, 620.000000, 170.000000);
Stock&Timer:
pawn Код:
forward MessageBoxTimer(playerid);
public MessageBoxTimer(playerid)
{
TextDrawHideForPlayer(playerid, Text:Textdraw0);
TextDrawHideForPlayer(playerid, Text:Textdraw1);
return 1;
}
stock MessageBox(playerid, title[], message[], time)
{
TextDrawSetString(Textdraw0, title);
TextDrawSetString(Textdraw1, message);
TextDrawShowForPlayer(playerid, Text:Textdraw0);
TextDrawShowForPlayer(playerid, Text:Textdraw1);
SetTimer("MessageBoxTimer", time, 0);
return 1;
}
pawn Код:
CMD:test(playerid, params[])
{
MessageBox(playerid, "Test", "Testing", 5000);
return 1;
}
But the textdraws aren't showing and nothing is happening(no console errors or message IG)