On Screen Message -
nezo2001 - 01.02.2015
Hello, I hope u will understand me
Код HTML:
----------------------------------------------------------------------------------------------------------------
| My Screen
|
|
|
| I want the text to show here and if there
| Any maximum word make a new line
| Not to compelete to the end of the
| Screen like this
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------------------------------------
My command
PHP код:
CMD:osm(playerid, params[])
{
new msg[128];
new string[128];
if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_RED, "Command not found on the server! /help");
if(sscanf(params,"s[128]",msg)) return SendClientMessage(playerid, COLOR_RED, "Show a message for all players on screen: /osm [Message]");
osm = TextDrawCreate(187.000,131.00,msg);
TextDrawFont(osm, 3);
TextDrawShowForAll(osm);
SetTimer("hideText",2000,false);
return 1;
}
public hideText()
{
TextDrawHideForAll(osm);
return 1;
}
Hope you understood.
Re: On Screen Message -
HY - 01.02.2015
https://sampforum.blast.hk/showthread.php?tid=559801
Re: On Screen Message -
nezo2001 - 01.02.2015
I don't want a filterscript we are here for learning
Re: On Screen Message -
nezo2001 - 02.02.2015
Bump !
Re: On Screen Message -
HY - 02.02.2015
Well. First create variable for Textdraw.
Then, should create the Textdraw under
OnFilterScriptInit if you're using a Filterscript, or
OnGameModeInit() if you're using a Gamemode.
pawn Код:
public OnGameModeInit()
{
Textdraw = TextDrawCreate(........);
TextDrawSetFont(........);
// etc.
return 1;
}
More info:
- TextDrawCreate();
If you want Textdraw to be more preety, use an Textdraw Edtior, like:
iPLEOMAX's Textdraw Editor.
Then, create that command to make a screen announce and to set string of Textdraw.
pawn Код:
CMD:message(playerid, params[]) //Command Message. Change if you want.
{ // Open bracket.
new string[50]; // Variables.
if(isnull(params)) return SendClientMessage(playerid, -1, "{FF0000}USAGE: {FFFFFF}/Message [Text]"); // Use isnull(params) function, because it's more efficiently, and you check more faster if params are null.
if(!strlen(params)) return SendClientMessage(playerid, -1, "{FF0000}ERROR: {FFFFFF}You didn't write anything."); // Use this function strlen(params); to check if the player have writed something in params.
format(string, sizeof(string), "%s", params); // Formatting the params.
TextDrawSetString(Textdraw, string); // Set's params string to our created Textdraw.
TextDrawShowForAll(Textdraw); // Use this function to show created textdraw too all players.
return 1; // Return 1;
} // Close bracket.
Now, should work, and hope you understood and learned.
Can make a
/Hide command to hide that textdraw.
pawn Код:
CMD:hide(playerid, params[]) // Command hide.
{ // Open bracket.
TextDrawHideForAll(Textdraw); // Will hide textdraw for all players.
return 1; // Returns 1;
} // Close bracket.
Re: On Screen Message -
nezo2001 - 02.02.2015
lol , I made all of that i want to make a new line if the message increased of the maximum example:
The maximum is 20 so,
"Hello,This Is Test//For the osm command"
instead of "//" i want to make a new line so:
"Hello,This is Test
For the osm command" .
That is all
Re: On Screen Message -
Vince - 02.02.2015
- Create the textdraw with an X position of 320.0, the exact center of the screen. Y value may vary but probably something like 150.
- Set the textdraw's alignment to center.
- Enable the box and set its size according to how wide you want the text to be.
- If you don't want the box, make it invisible.
Re: On Screen Message -
nezo2001 - 02.02.2015
Ok but how to resize the box i didn't find anything in wiki