[Tutorial] Dynamic Text using Object.
#1


Hello there,
Most of you know how it works but a tutorial for new developers would be helpful.

If you need to know about the usage of this tutorial, please check this thread first. [ https://sampforum.blast.hk/showthread.php?tid=626942 ]


Okay, let's start!


Things you need:
Quote:
  • Map editor [ Any ]
  • Text editor and pawn compiler [ Any ]
  • A bit knowledge about SetDynamicObjectMaterialText
  • A perfect position for perfect use.
  • ZCMD [ or any]
  • Object index knowledge.
Work steps.

Step 1.

Make an object anywhere using the editor.
Quote:

Code:
PHP код:
CreateDynamicObject(186591679.44336, -1698.8126214.57880,   0.000000.00000180.00000); // We will modify it.
CreateDynamicObject(33351679.29102, -1698.8304412.27670,   0.000000.0000090.00000); //Realistic board. 
Step 2.
Texture the objects for fit the area. [ I am doing my own, you can do as you want]

PHP код:
    TempObject CreateDynamicObject(33351679.2910, -1698.830412.27670.00000.000090.0000); //Realistic board
    
SetDynamicObjectMaterial(TempObject016093"a51_ext""ws_whitewall2_bottom"0xFFFFFFFF);
    
SetDynamicObjectMaterial(TempObject210765"airportgnd_sfse""black64"0xFFFFFFFF);
    
//Define the modifiable object using a variable
    
TextEdit CreateDynamicObject(186591679.44336, -1698.8126214.57880,   0.000000.00000180.00000); // We will modify it. 
*Note : The object should be loaded using OnGameModeInit or OnFilterScriptInit

Step 3.
Make a command as you want.
PHP код:
CMD:note(playeridparams[])
{
  return 
1;

Now, doing it without any color [ default white ]

PHP код:
CMD:note(playeridparams[])
{
   new 
string[24], //For the text
          
FontSize//Size of the font that will be used for the text
          
Text[24]; //Detects if the line is text.
   
if(sscanf(params"s[24]i"TextFontSize)) //If player don't use /note %s %i
    
{
        
SendClientMessage(playerid, -1"** *Usage*: /note [string][fontsize]");
        return 
1;
     }
    
format(stringsizeof(string), "%s"text); //Setting the string format using format();
    //replaced the string and FontSize
    
SetDynamicObjectMaterialText(TextEdit 0string90"Arial"FontSize10xFFFFFFFF0x01); 
Perfect, you have successfully done it. Have fun and improve it as you want.

Now, optional [ Color text ]
Same thing as Step 3 but the command will be using like this.

PHP код:
CMD:note(playeridparams[])
{
    new 
string[24],
          
FontSize,
          
Text[24]; 
    if(
sscanf(params"s[24]is[12]"textamountparams)) //If player don't use /note%s %i %s
    
{
        
SendClientMessage(playerid, -1"** *Usage*: /note [string][fontsize] colorname");
        return 
1;
     }
        
//if params have white color name.
    
if(!strcmp(params"white"true5))
    {
         
format(stringsizeof(string), "%s"Text);
        
SetDynamicObjectMaterialText(TextEdit 0string90"Arial"FontSize10xFFFFFFFF0x01);
    }
        
//if params have red color name.
    
else if(!strcmp(params"red"true5))
    {
         
format(stringsizeof(string), "%s"Text);
        
SetDynamicObjectMaterialText(TextEdit 0string90"Arial"FontSize10xFF0080000x01);
    }
        
//if params have golden color name.
    
else if(!strcmp(params"golden"true5))
    {
         
format(stringsizeof(string), "%s"Text);
        
SetDynamicObjectMaterialText(TextEdit 0string90"Arial"FontSize10xFFD78E100x01);
    }
    else
    {
        
SendClientMessage(playerid, -1"Pick a color name");
    }
    return 
1;

Peace

Personal notes :
  • There maybe a more advanced option for this, I am not sure.
  • Tried dynamic color name type but it doesn't support
  • Feel free to give a suggestion for improving this simple command.
  • Have fun and make more advanced thing with this.
I will make a new tutorial with advance system.
Reply


Messages In This Thread
Dynamic Text using Object. - by SoFahim - 04.09.2017, 08:44
Re: Dynamic Text using Object. - by Zeth - 04.09.2017, 09:11
Re: Dynamic Text using Object. - by Vince - 04.09.2017, 12:17
Re: Dynamic Text using Object. - by ISmokezU - 04.09.2017, 12:36
Re: Dynamic Text using Object. - by Meller - 04.09.2017, 14:07
Re: Dynamic Text using Object. - by SoFahim - 04.09.2017, 16:12

Forum Jump:


Users browsing this thread: 1 Guest(s)