CreateBox -
Dripac - 16.05.2012
Hello everyone,
so i am releasing the include which i used for my server.
What is the include about?
- You can use this instead of GameTextForPlayer, so that means there will be a textdraw shown for some seconds (you can define it).
Download
pawn Код:
#include <a_samp>
#include <foreach>
new Text:ueberschrift[MAX_PLAYERS];
new Text:insidetext[MAX_PLAYERS];
static bool:fnc[1] = false;
public OnGameModeInit()
{
fnc[0] = (funcidx("CB_OnPlayerConnect") != -1);
CallLocalFunction("CB_OnGameModeInit", "");
}
#if defined _ALS_OnGameModeInit
#undef OnGameModeInit
#else
#define _ALS_OnGameModeInit
#endif
#define OnGameModeInit CB_OnGameModeInit
forward CB_OnGameModeInit();
public OnPlayerConnect(playerid)
{
if(fnc[0]) CallLocalFunction("CB_OnPlayerConnect", "i", playerid);
ueberschrift[playerid] = TextDrawCreate(501.000000, 222.000000, "info");
TextDrawBackgroundColor(ueberschrift[playerid], 50);
TextDrawFont(ueberschrift[playerid], 2);
TextDrawLetterSize(ueberschrift[playerid], 0.320000, 1.299999);
TextDrawColor(ueberschrift[playerid], -1);
TextDrawSetOutline(ueberschrift[playerid], 1);
TextDrawSetProportional(ueberschrift[playerid], 1);
TextDrawUseBox(ueberschrift[playerid], 1);
TextDrawBoxColor(ueberschrift[playerid], 6062591);
TextDrawTextSize(ueberschrift[playerid], 586.000000, 0.000000);
insidetext[playerid] = TextDrawCreate(501.000000, 237.000000, "text");
TextDrawBackgroundColor(insidetext[playerid], 50);
TextDrawFont(insidetext[playerid], 0);
TextDrawLetterSize(insidetext[playerid], 0.270000, 1.000000);
TextDrawColor(insidetext[playerid], -1);
TextDrawSetOutline(insidetext[playerid], 1);
TextDrawSetProportional(insidetext[playerid], 1);
TextDrawUseBox(insidetext[playerid], 1);
TextDrawBoxColor(insidetext[playerid], 150);
TextDrawTextSize(insidetext[playerid], 586.000000, 0.000000);
return 1;
}
#if defined _ALS_OnPlayerConnect
#undef OnPlayerConnect
#else
#define _ALS_OnPlayerConnect
#endif
#define OnPlayerConnect CB_OnPlayerConnect
forward CB_OnPlayerConnect(playerid);
stock CreateBox(playerid,header[],text[])
{
new string[128];
format(string, sizeof string,"%s",header);
TextDrawSetString(Text:ueberschrift[playerid],string);
TextDrawShowForPlayer(playerid,Text:ueberschrift[playerid]);
format(string, sizeof string,"%s",text);
TextDrawSetString(Text:insidetext[playerid],string);
TextDrawShowForPlayer(playerid,Text:insidetext[playerid]);
PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
SetPVarInt(playerid,"CreateBoxEx",1);
SetTimerEx("CloseBox", 5000, 0, "i", playerid);
return 1;
}
forward CloseBox(playerid);
public CloseBox(playerid)
{
TextDrawHideForPlayer(playerid,Text:ueberschrift[playerid]);
TextDrawHideForPlayer(playerid,Text:insidetext[playerid]);
return 1;
}
Copy the code and paste it in notepad, now save it as createbox.inc and put it in your includes folder which is located at the pawno application.
Alright, now you want to use it, right?
Here a command for testing:
pawn Код:
if(!strcmp(cmdtext, "/test", true))
{
CreateBox(playerid, "info", "Ich liebe alles auf dieser ~r~Welt ~n~~w~und meine ~g~Mutter ~w~am ~y~meisten");
return 1;
}
Result:
http://i46.tinypic.com/dpepaw.png
The box will dissapear in 5 seconds, to change it open the include and look for SetTimerEx, change 5000 to how much seconds you want. (5000 = 5 seconds)
HF
Re: CreateBox -
Jason_Dealley - 16.05.2012
Looks nice makes it much easy'r to script
Re: CreateBox -
Saad_ - 16.05.2012
Thanks for this looks good :P
Re: CreateBox -
HaZaRaS™ - 16.05.2012
that's it ...Ready nice and wonderfull and looks prett NYc ... keep up and +1
Re: CreateBox -
Niko_boy - 16.05.2012
well could be useful for making some attractive GameText's
Nice job