On Screen Message
#1

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 код:
new Text:osm
PHP код:
CMD:osm(playeridparams[])
{
    new 
msg[128];
    new 
string[128];
    if(
PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playeridCOLOR_RED"Command not found on the server! /help");
    if(
sscanf(params,"s[128]",msg)) return SendClientMessage(playeridCOLOR_RED"Show a message for all players on screen: /osm [Message]");
    
osm TextDrawCreate(187.000,131.00,msg);
    
TextDrawFont(osm3);
    
TextDrawShowForAll(osm);
    
SetTimer("hideText",2000,false);
    return 
1;
}
public 
hideText()
{
    
TextDrawHideForAll(osm);
    return 
1;

Hope you understood.
Reply
#2

https://sampforum.blast.hk/showthread.php?tid=559801
Reply
#3

I don't want a filterscript we are here for learning
Reply
#4

Bump !
Reply
#5

Well. First create variable for Textdraw.

pawn Код:
new Text: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.
Reply
#6

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
Reply
#7

  1. 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.
  2. Set the textdraw's alignment to center.
  3. Enable the box and set its size according to how wide you want the text to be.
  4. If you don't want the box, make it invisible.
Reply
#8

Ok but how to resize the box i didn't find anything in wiki
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)