04.09.2017, 08:44
(
Последний раз редактировалось SoFahim; 04.09.2017 в 16:14.
)
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:
|
Step 1.
Make an object anywhere using the editor.
Quote:
|
PHP код:
CreateDynamicObject(18659, 1679.44336, -1698.81262, 14.57880, 0.00000, 0.00000, 180.00000); // We will modify it.
CreateDynamicObject(3335, 1679.29102, -1698.83044, 12.27670, 0.00000, 0.00000, 90.00000); //Realistic board.
Texture the objects for fit the area. [ I am doing my own, you can do as you want]
PHP код:
TempObject = CreateDynamicObject(3335, 1679.2910, -1698.8304, 12.2767, 0.0000, 0.0000, 90.0000); //Realistic board
SetDynamicObjectMaterial(TempObject, 0, 16093, "a51_ext", "ws_whitewall2_bottom", 0xFFFFFFFF);
SetDynamicObjectMaterial(TempObject, 2, 10765, "airportgnd_sfse", "black64", 0xFFFFFFFF);
//Define the modifiable object using a variable
TextEdit = CreateDynamicObject(18659, 1679.44336, -1698.81262, 14.57880, 0.00000, 0.00000, 180.00000); // We will modify it.
Step 3.
Make a command as you want.
PHP код:
CMD:note(playerid, params[])
{
return 1;
}
PHP код:
CMD:note(playerid, params[])
{
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", Text, FontSize)) //If player don't use /note %s %i
{
SendClientMessage(playerid, -1, "** *Usage*: /note [string][fontsize]");
return 1;
}
format(string, sizeof(string), "%s", text); //Setting the string format using format();
//replaced the string and FontSize
SetDynamicObjectMaterialText(TextEdit , 0, string, 90, "Arial", FontSize, 1, 0xFFFFFFFF, 0x0, 1);
Now, optional [ Color text ]
Same thing as Step 3 but the command will be using like this.
PHP код:
CMD:note(playerid, params[])
{
new string[24],
FontSize,
Text[24];
if(sscanf(params, "s[24]is[12]", text, amount, params)) //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", true, 5))
{
format(string, sizeof(string), "%s", Text);
SetDynamicObjectMaterialText(TextEdit , 0, string, 90, "Arial", FontSize, 1, 0xFFFFFFFF, 0x0, 1);
}
//if params have red color name.
else if(!strcmp(params, "red", true, 5))
{
format(string, sizeof(string), "%s", Text);
SetDynamicObjectMaterialText(TextEdit , 0, string, 90, "Arial", FontSize, 1, 0xFF008000, 0x0, 1);
}
//if params have golden color name.
else if(!strcmp(params, "golden", true, 5))
{
format(string, sizeof(string), "%s", Text);
SetDynamicObjectMaterialText(TextEdit , 0, string, 90, "Arial", FontSize, 1, 0xFFD78E10, 0x0, 1);
}
else
{
SendClientMessage(playerid, -1, "Pick a color name");
}
return 1;
}
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.