From 33988cbe4239fbeee0e3deaa980f7562a56ba18c Mon Sep 17 00:00:00 2001 From: Adib Date: Fri, 5 Jan 2024 19:31:07 +0330 Subject: [PATCH] Update some docs parameters (#808) * update AddMenuItem.md * update Create3DTextLabel.md * update CreateMenu.md * update CreatePlayer3DTextLabel.md * update CreatePlayerTextDraw.md * update GameTextForAll.md * update GameTextForPlayer.md * update PlayerTextDrawSetString.md * update SendClientMessage.md * update SendClientMessageToAll.md * update SendRconCommand.md * update SetMenuColumnHeader.md * update SetObjectMaterialText.md * update SetPlayerObjectMaterialText.md * update SetPVarString.md * update SetSVarString.md * update ShowPlayerDialog.md * update TextDrawCreate.md * update TextDrawSetString.md * update Update3DTextLabelText.md * update UpdatePlayer3DTextLabelText.md --- docs/scripting/functions/AddMenuItem.md | 11 +++-- docs/scripting/functions/Create3DTextLabel.md | 41 +++++++++++----- docs/scripting/functions/CreateMenu.md | 23 ++++----- .../functions/CreatePlayer3DTextLabel.md | 48 +++++++++++-------- .../functions/CreatePlayerTextDraw.md | 15 +++--- docs/scripting/functions/GameTextForAll.md | 21 ++++---- docs/scripting/functions/GameTextForPlayer.md | 21 +++++--- .../functions/PlayerTextDrawSetString.md | 14 ++++-- docs/scripting/functions/SendClientMessage.md | 23 +++++++-- .../functions/SendClientMessageToAll.md | 22 +++++++-- docs/scripting/functions/SendRconCommand.md | 10 ++-- .../functions/SetMenuColumnHeader.md | 11 +++-- .../functions/SetObjectMaterialText.md | 25 +++++----- docs/scripting/functions/SetPVarString.md | 27 +++++++---- .../functions/SetPlayerObjectMaterialText.md | 27 ++++++----- docs/scripting/functions/SetSVarString.md | 9 ++-- docs/scripting/functions/ShowPlayerDialog.md | 19 ++++---- docs/scripting/functions/TextDrawCreate.md | 13 ++--- docs/scripting/functions/TextDrawSetString.md | 14 ++++-- .../functions/Update3DTextLabelText.md | 11 +++-- .../functions/UpdatePlayer3DTextLabelText.md | 13 ++--- 21 files changed, 259 insertions(+), 159 deletions(-) diff --git a/docs/scripting/functions/AddMenuItem.md b/docs/scripting/functions/AddMenuItem.md index 2428b42a8..37f2d3c79 100644 --- a/docs/scripting/functions/AddMenuItem.md +++ b/docs/scripting/functions/AddMenuItem.md @@ -8,11 +8,12 @@ tags: ["menu"] Adds an item to a specified menu. -| Name | Description | -| ------- | -------------------------------- | -| menuid | The menu id to add an item to. | -| column | The column to add the item to. | -| title[] | The title for the new menu item. | +| Name | Description | +|------------------|--------------------------------------------| +| menuid | The menu id to add an item to. | +| column | The column to add the item to. | +| title[] | The title for the new menu item. | +| OPEN_MP_TAGS:... | Indefinite number of arguments of any tag. | ## Returns diff --git a/docs/scripting/functions/Create3DTextLabel.md b/docs/scripting/functions/Create3DTextLabel.md index fb2ebfbc7..74ecff201 100644 --- a/docs/scripting/functions/Create3DTextLabel.md +++ b/docs/scripting/functions/Create3DTextLabel.md @@ -10,16 +10,17 @@ tags: ["3dtextlabel"] Creates a 3D Text Label at a specific location in the world -| Name | Description | -| ------------ | ------------------------------------------------------------------------------- | -| text[] | The initial text string. | -| color | The text Color, as an integer or hex in RGBA color format | -| x | X-Coordinate | -| y | Y-Coordinate | -| z | Z-Coordinate | -| DrawDistance | The distance from where you are able to see the 3D Text Label | -| VirtualWorld | The virtual world in which you are able to see the 3D Text | -| testLOS | Test the line-of-sight so this text can't be seen through objects (true/false) | +| Name | Description | +|------------------|--------------------------------------------------------------------------------| +| text[] | The initial text string. | +| color | The text Color, as an integer or hex in RGBA color format | +| x | X-Coordinate | +| y | Y-Coordinate | +| z | Z-Coordinate | +| DrawDistance | The distance from where you are able to see the 3D Text Label | +| VirtualWorld | The virtual world in which you are able to see the 3D Text | +| testLOS | Test the line-of-sight so this text can't be seen through objects (true/false) | +| OPEN_MP_TAGS:... | Indefinite number of arguments of any tag. | ## Returns @@ -30,9 +31,27 @@ The ID of the newly created 3D Text Label, or INVALID_3DTEXT_ID if the 3D Text L ```c public OnGameModeInit() { - Create3DTextLabel("I'm at the coordinates:\n30.0, 40.0, 50.0", 0x008080FF, 30.0, 40.0, 50.0, 40.0, 0, false); + Create3DTextLabel("I'm at the coordinates:\n30.0, 40.0, 50.0", 0x008080FF, 30.0, 40.0, 50.0, 40.0, 0, false); return 1; } + +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/mark", true)) + { + new name[MAX_PLAYER_NAME]; + new Float:x, Float:y, Float:z; + new worldid; + + GetPlayerName(playerid, name, sizeof(name)); + GetPlayerPos(playerid, x, y, z); + worldid = GetPlayerVirtualWorld(playerid); + + Create3DTextLabel("%s marked this place", 0xFF0000FF, x, y, z, 15.0, worldid, false, name); + return 1; + } + return 0; +} ``` ## Notes diff --git a/docs/scripting/functions/CreateMenu.md b/docs/scripting/functions/CreateMenu.md index 62cc613cf..1a402a528 100644 --- a/docs/scripting/functions/CreateMenu.md +++ b/docs/scripting/functions/CreateMenu.md @@ -8,14 +8,15 @@ tags: ["menu"] Creates a menu. -| Name | Description | -| --------------- | ----------------------------------------------------------------------------------- | -| title[] | The title for the new menu. | -| columns | How many colums shall the new menu have. | -| Float:x | The X position of the menu (640x460 canvas - 0 would put the menu at the far left). | -| Float:y | The Y position of the menu (640x460 canvas - 0 would put the menu at the far top). | -| Float:col1width | The width for the first column. | -| Float:col2width | The width for the second column. | +| Name | Description | +|------------------|-------------------------------------------------------------------------------------| +| title[] | The title for the new menu. | +| columns | How many colums shall the new menu have. | +| Float:x | The X position of the menu (640x460 canvas - 0 would put the menu at the far left). | +| Float:y | The Y position of the menu (640x460 canvas - 0 would put the menu at the far top). | +| Float:col1width | The width for the first column. | +| Float:col2width | The width for the second column. | +| OPEN_MP_TAGS:... | Indefinite number of arguments of any tag. | ## Returns @@ -24,11 +25,11 @@ The ID of the new menu or -1 on failure. ## Examples ```c -new Menu:examplemenu; +new Menu:exampleMenu; public OnGameModeInit() { - examplemenu = CreateMenu("Your Menu", 2, 200.0, 100.0, 150.0, 150.0); + exampleMenu = CreateMenu("Example Menu", 2, 200.0, 100.0, 150.0, 150.0); return 1; } ``` @@ -37,7 +38,7 @@ public OnGameModeInit() :::tip -This function merely CREATES the menu - ShowMenuForPlayer must be used to show it. You can only create and access 2 columns (0 & 1). If the title's length is equal to or greater than 32 chars the title is truncated to 30 characters. +This function merely CREATES the menu - [ShowMenuForPlayer](ShowMenuForPlayer) must be used to show it. You can only create and access 2 columns (0 & 1). If the title's length is equal to or greater than 32 chars the title is truncated to 30 characters. ::: diff --git a/docs/scripting/functions/CreatePlayer3DTextLabel.md b/docs/scripting/functions/CreatePlayer3DTextLabel.md index 4b5c3c7ca..9311d63f9 100644 --- a/docs/scripting/functions/CreatePlayer3DTextLabel.md +++ b/docs/scripting/functions/CreatePlayer3DTextLabel.md @@ -10,18 +10,19 @@ tags: ["player", "3dtextlabel"] Creates a 3D Text Label only for a specific player -| Name | Description | -| --------------- | ------------------------------------------------------------------------------- | -| playerid | The player which should see the newly created 3DText Label. | -| text[] | The text to display. | -| color | The text color | -| x | X Coordinate (or offset if attached) | -| y | Y Coordinate (or offset if attached) | -| z | Z Coordinate (or offset if attached) | -| DrawDistance | The distance where you are able to see the 3D Text Label | -| attachedplayer | The player you want to attach the 3D Text Label to. (None: INVALID_PLAYER_ID) | -| attachedvehicle | The vehicle you want to attach the 3D Text Label to. (None: INVALID_VEHICLE_ID) | -| testLOS | 0/1 Test the line-of-sight so this text can't be seen through walls | +| Name | Description | +|------------------|---------------------------------------------------------------------------------| +| playerid | The player which should see the newly created 3DText Label. | +| text[] | The text to display. | +| color | The text color | +| x | X Coordinate (or offset if attached) | +| y | Y Coordinate (or offset if attached) | +| z | Z Coordinate (or offset if attached) | +| DrawDistance | The distance where you are able to see the 3D Text Label | +| attachedplayer | The player you want to attach the 3D Text Label to. (None: INVALID_PLAYER_ID) | +| attachedvehicle | The vehicle you want to attach the 3D Text Label to. (None: INVALID_VEHICLE_ID) | +| testLOS | 0/1 Test the line-of-sight so this text can't be seen through walls | +| OPEN_MP_TAGS:... | Indefinite number of arguments of any tag. | ## Returns @@ -30,15 +31,22 @@ The ID of the newly created Player 3D Text Label, or INVALID_3DTEXT_ID if the Pl ## Examples ```c -if (strcmp(cmd, "/playerlabel", true) == 0) +public OnPlayerCommandText(playerid, cmdtext[]) { - new - PlayerText3D: playerTextId, - Float: X, Float: Y, Float: Z; - - GetPlayerPos(playerid, X, Y, Z); - playerTextId = CreatePlayer3DTextLabel(playerid, "Hello\nI'm at your position", 0x008080FF, X, Y, Z, 40.0); - return 1; + if (!strcmp(cmdtext, "/playerlabel", true)) + { + new + PlayerText3D: playerTextId, + name[MAX_PLAYER_NAME], + Float: X, Float: Y, Float: Z; + + GetPlayerName(playerid, name, sizeof(name)); + GetPlayerPos(playerid, X, Y, Z); + + playerTextId = CreatePlayer3DTextLabel(playerid, "Hello %s!\nI'm at your position", 0x008080FF, X, Y, Z, 40.0, name); + return 1; + } + return 0; } ``` diff --git a/docs/scripting/functions/CreatePlayerTextDraw.md b/docs/scripting/functions/CreatePlayerTextDraw.md index 407221b74..80c791ddd 100644 --- a/docs/scripting/functions/CreatePlayerTextDraw.md +++ b/docs/scripting/functions/CreatePlayerTextDraw.md @@ -10,12 +10,13 @@ tags: ["player", "textdraw", "playertextdraw"] Creates a textdraw for a single player. This can be used as a way around the global text-draw limit. -| Name | Description | -| -------- | ----------------------------------------------- | -| playerid | The ID of the player to create the textdraw for | -| Float:x | X-Coordinate | -| Float:y | Y-Coordinate | -| text[] | The text in the textdraw. | +| Name | Description | +|------------------|-------------------------------------------------| +| playerid | The ID of the player to create the textdraw for | +| Float:x | X-Coordinate | +| Float:y | Y-Coordinate | +| text[] | The text in the textdraw. | +| OPEN_MP_TAGS:... | Indefinite number of arguments of any tag. | ## Returns @@ -31,7 +32,7 @@ new PlayerText:welcomeText[MAX_PLAYERS]; public OnPlayerConnect(playerid) { // First, create the textdraw - welcomeText[playerid] = CreatePlayerTextDraw(playerid, 320.0, 240.0, "Welcome to my SA-MP server"); + welcomeText[playerid] = CreatePlayerTextDraw(playerid, 320.0, 240.0, "Welcome to my OPEN.MP server"); // Now show it PlayerTextDrawShow(playerid, welcomeText[playerid]); diff --git a/docs/scripting/functions/GameTextForAll.md b/docs/scripting/functions/GameTextForAll.md index d7240d9ab..7edcf0f66 100644 --- a/docs/scripting/functions/GameTextForAll.md +++ b/docs/scripting/functions/GameTextForAll.md @@ -8,11 +8,12 @@ tags: [] Shows 'game text' (on-screen text) for a certain length of time for all players. -| Name | Description | -| -------------- | ----------------------------------------------------------------- | -| const string[] | The text to be displayed. | -| time | The duration of the text being shown in milliseconds. | -| style | The [style](../resources/gametextstyles) of text to be displayed. | +| Name | Description | +|------------------|-------------------------------------------------------------------| +| const string[] | The text to be displayed. | +| time | The duration of the text being shown in milliseconds. | +| style | The [style](../resources/gametextstyles) of text to be displayed. | +| OPEN_MP_TAGS:... | Indefinite number of arguments of any tag. | ## Returns @@ -26,13 +27,15 @@ public OnPlayerDeath(playerid, killerid, reason) // This example shows a large, white text saying "[playerName] has // passed away" on everyone's screen, after a player has died or // has been killed. It shows in text-type 3, for 5 seconds (5000 ms) - new name[ 24 ], string[ 64 ]; - GetPlayerName( playerid, name, 24 ); + new name[MAX_PLAYER_NAME], string[64]; + GetPlayerName(playerid, name, sizeof(name)); // Format the passed-away message properly, and show it to everyone: - format( string, sizeof(string), "~w~%s has passed away", name ); - GameTextForAll( string, 5000, 3 ); + format(string, sizeof(string), "~w~%s has passed away", name); + GameTextForAll(string, 5000, 3); + // PRO TIP: You don't need `format` in open.mp + GameTextForAll("~w~%s has passed away", 5000, 3, name); return 1; } ``` diff --git a/docs/scripting/functions/GameTextForPlayer.md b/docs/scripting/functions/GameTextForPlayer.md index 92a450798..00fd50948 100644 --- a/docs/scripting/functions/GameTextForPlayer.md +++ b/docs/scripting/functions/GameTextForPlayer.md @@ -8,12 +8,13 @@ tags: ["player"] Shows 'game text' (on-screen text) for a certain length of time for a specific player. -| Name | Description | -| -------------- | ----------------------------------------------------------------- | -| playerid | The ID of the player to show the gametext for. | -| const string[] | The text to be displayed. | -| time | The duration of the text being shown in milliseconds. | -| style | The [style](../resources/gametextstyles) of text to be displayed. | +| Name | Description | +|------------------|-------------------------------------------------------------------| +| playerid | The ID of the player to show the gametext for. | +| const string[] | The text to be displayed. | +| time | The duration of the text being shown in milliseconds. | +| style | The [style](../resources/gametextstyles) of text to be displayed. | +| OPEN_MP_TAGS:... | Indefinite number of arguments of any tag. | ## Returns @@ -27,6 +28,14 @@ Shows 'game text' (on-screen text) for a certain length of time for a specific p public OnPlayerDeath(playerid, killerid, reason) { GameTextForPlayer(playerid, "Wasted", 5000, 2); + + if (killerid != INVALID_PLAYER_ID) + { + new name[MAX_PLAYER_NAME]; + GetPlayerName(playerid, name, sizeof(name)); + + GameTextForPlayer(killerid, "~w~You killed ~r~%s", 3000, 3, name); + } return 1; } ``` diff --git a/docs/scripting/functions/PlayerTextDrawSetString.md b/docs/scripting/functions/PlayerTextDrawSetString.md index ee4f0501a..4c0e64038 100644 --- a/docs/scripting/functions/PlayerTextDrawSetString.md +++ b/docs/scripting/functions/PlayerTextDrawSetString.md @@ -10,11 +10,12 @@ tags: ["player", "textdraw", "playertextdraw"] Change the text of a player-textdraw. -| Name | Description | -| -------- | ------------------------------------------------- | -| playerid | The ID of the player who's textdraw string to set | -| text | The ID of the textdraw to change | -| string[] | The new string for the TextDraw | +| Name | Description | +|------------------|---------------------------------------------------| +| playerid | The ID of the player who's textdraw string to set | +| text | The ID of the textdraw to change | +| string[] | The new string for the TextDraw | +| OPEN_MP_TAGS:... | Indefinite number of arguments of any tag. | ## Returns @@ -51,6 +52,9 @@ public vhealth_td_update(playerid) format(tdstring, sizeof(tdstring), "Vehicle Health: %0f", vHealth); PlayerTextDrawSetString(playerid, pVehicleHealthTD[playerid], tdstring); // <<< Update the text to show the vehicle health + + // PRO TIP: You don't need `format` in open.mp + PlayerTextDrawSetString(playerid, pVehicleHealthTD[playerid], "Vehicle Health: %0f", vHealth); return 1; } diff --git a/docs/scripting/functions/SendClientMessage.md b/docs/scripting/functions/SendClientMessage.md index 87bd9e439..c9dd32440 100644 --- a/docs/scripting/functions/SendClientMessage.md +++ b/docs/scripting/functions/SendClientMessage.md @@ -8,11 +8,12 @@ tags: [] This function sends a message to a specific player with a chosen color in the chat. The whole line in the chatbox will be in the set color unless color embedding is used (0.3c or later). -| Name | Description | -| --------------- | ----------------------------------------------------- | -| playerid | The ID of the player to display the message to. | -| color | The color of the message (0xRRGGBBAA Hex format). | -| const message[] | The text that will be displayed (max 144 characters). | +| Name | Description | +|------------------|-------------------------------------------------------| +| playerid | The ID of the player to display the message to. | +| color | The color of the message (0xRRGGBBAA Hex format). | +| const message[] | The text that will be displayed (max 144 characters). | +| OPEN_MP_TAGS:... | Indefinite number of arguments of any tag. | ## Returns @@ -32,6 +33,18 @@ public OnPlayerConnect(playerid) SendClientMessage(playerid, -1, "This text is white."); return 1; } + +public OnPlayerDeath(playerid, killerid, reason) +{ + if (killerid != INVALID_PLAYER_ID) + { + new name[MAX_PLAYER_NAME]; + GetPlayerName(killerid, name, sizeof(name)); + + SendClientMessage(playerid, COLOR_RED, "%s killed you.", name); + } + return 1; +} ``` ## Notes diff --git a/docs/scripting/functions/SendClientMessageToAll.md b/docs/scripting/functions/SendClientMessageToAll.md index bedf3cc8d..16dc939f6 100644 --- a/docs/scripting/functions/SendClientMessageToAll.md +++ b/docs/scripting/functions/SendClientMessageToAll.md @@ -8,10 +8,11 @@ tags: [] Displays a message in chat to all players. This is a multi-player equivalent of SendClientMessage. -| Name | Description | -| --------------- | ------------------------------------------------- | -| color | The color of the message (0xRRGGBBAA Hex format). | -| const message[] | The message to show (max 144 characters). | +| Name | Description | +|------------------|---------------------------------------------------| +| color | The color of the message (0xRRGGBBAA Hex format). | +| const message[] | The message to show (max 144 characters). | +| OPEN_MP_TAGS:... | Indefinite number of arguments of any tag. | ## Returns @@ -28,6 +29,19 @@ public OnPlayerCommandText(playerid, cmdtext[]) SendClientMessageToAll(-1, "Hello!"); return 1; } + if (strcmp(cmdtext, "/time", true) == 0) + { + new + hours, + minutes, + seconds; + + gettime(hours, minutes, seconds); + + // Send current time message to everyone. + SendClientMessageToAll(-1, "Current time is %02d:%02d:%02d", hours, minutes, seconds); + return 1; + } return 0; } ``` diff --git a/docs/scripting/functions/SendRconCommand.md b/docs/scripting/functions/SendRconCommand.md index 7345dcea9..11fec213b 100644 --- a/docs/scripting/functions/SendRconCommand.md +++ b/docs/scripting/functions/SendRconCommand.md @@ -8,9 +8,10 @@ tags: ["administration"] Sends an RCON (Remote Console) command. -| Name | Description | -| --------- | -------------------------------- | -| command[] | The RCON command to be executed. | +| Name | Description | +|------------------|--------------------------------------------| +| command[] | The RCON command to be executed. | +| OPEN_MP_TAGS:... | Indefinite number of arguments of any tag. | ## Returns @@ -38,6 +39,9 @@ new szMapName[] = "Los Santos"; new szCmd[64]; format(szCmd, sizeof(szCmd), "mapname %s", szMapName); SendRconCommand(szCmd); + +// PRO TIP: You don't need `format` in open.mp +SendRconCommand("mapname %s", szMapName); ``` ## Related Functions diff --git a/docs/scripting/functions/SetMenuColumnHeader.md b/docs/scripting/functions/SetMenuColumnHeader.md index f1efad1b3..f75463136 100644 --- a/docs/scripting/functions/SetMenuColumnHeader.md +++ b/docs/scripting/functions/SetMenuColumnHeader.md @@ -8,11 +8,12 @@ tags: ["menu"] Sets the caption of a column in a menu. -| Name | Description | -| ------ | ----------------------------------------- | -| menuid | ID of the menu to change. | -| column | The column (0 or 1) to set the header of. | -| text[] | The caption text for the column. | +| Name | Description | +|------------------|--------------------------------------------| +| menuid | ID of the menu to change. | +| column | The column (0 or 1) to set the header of. | +| text[] | The caption text for the column. | +| OPEN_MP_TAGS:... | Indefinite number of arguments of any tag. | ## Returns diff --git a/docs/scripting/functions/SetObjectMaterialText.md b/docs/scripting/functions/SetObjectMaterialText.md index 025a6eb0e..6edc42a7c 100644 --- a/docs/scripting/functions/SetObjectMaterialText.md +++ b/docs/scripting/functions/SetObjectMaterialText.md @@ -10,18 +10,19 @@ tags: [] Replace the texture of an object with text. -| Name | Description | -| ------------- | --------------------------------------------------------------------------------------------- | -| objectid | The ID of the object to replace the texture of with text. | -| text | The text to show on the object. (MAX 2048 characters) | -| materialindex | The object's material index to replace with text. | -| materialsize | The [size](/docs/scripting/resources/materialtextsizes) of the material. | -| fontface | The font to use. | -| fontsize | The size of the text (MAX 255). | -| bold | Bold text. Set to 1 for bold, 0 for not. | -| fontcolor | The color of the text, in ARGB format. | -| backcolor | The background color, in ARGB format. | -| textalignment | The [alignment](/docs/scripting/resources/materialtextalignment) of the text (default: left). | +| Name | Description | +|------------------|-----------------------------------------------------------------------------------------------| +| objectid | The ID of the object to replace the texture of with text. | +| text[] | The text to show on the object. (MAX 2048 characters) | +| materialindex | The object's material index to replace with text. | +| materialsize | The [size](/docs/scripting/resources/materialtextsizes) of the material. | +| fontface | The font to use. | +| fontsize | The size of the text (MAX 255). | +| bold | Bold text. Set to 1 for bold, 0 for not. | +| fontcolor | The color of the text, in ARGB format. | +| backcolor | The background color, in ARGB format. | +| textalignment | The [alignment](/docs/scripting/resources/materialtextalignment) of the text (default: left). | +| OPEN_MP_TAGS:... | Indefinite number of arguments of any tag. | ## Returns diff --git a/docs/scripting/functions/SetPVarString.md b/docs/scripting/functions/SetPVarString.md index b3adbe448..85bc08919 100644 --- a/docs/scripting/functions/SetPVarString.md +++ b/docs/scripting/functions/SetPVarString.md @@ -8,11 +8,12 @@ tags: ["pvar"] Saves a string into a player variable. -| Name | Description | -| ------------ | ------------------------------------------------------- | -| playerid | The ID of the player whose player variable will be set. | -| varname | The name of the player variable. | -| string_value | The string you want to save in the player variable. | +| Name | Description | +|------------------|---------------------------------------------------------| +| playerid | The ID of the player whose player variable will be set. | +| varname[] | The name of the player variable. | +| string_value[] | The string you want to save in the player variable. | +| OPEN_MP_TAGS:... | Indefinite number of arguments of any tag. | ## Returns @@ -23,10 +24,18 @@ This function does not return any specific values. ```c public OnPlayerConnect(playerid) { - new h,m,s,str[50]; - gettime(h,m,s); // get the time - format(str,50,"Connected: %d:%d:%d",h,m,s); // create the string with the connect time - SetPVarString(playerid,"timeconnected",str); // save the string into a player variable + new + hours, + minutes, + seconds, + string[46]; + + gettime(hours, minutes, seconds); // get the time + format(string, sizeof(string), "Connected on %02d:%02d:%02d", hours, minutes, seconds); // create the string with the connect time + SetPVarString(playerid, "timeconnected", string); // save the string into a player variable + + // PRO TIP: You don't need `format` in open.mp + SetPVarString(playerid, "timeconnected", "Connected on %02d:%02d:%02d", hours, minutes, seconds); return 1; } ``` diff --git a/docs/scripting/functions/SetPlayerObjectMaterialText.md b/docs/scripting/functions/SetPlayerObjectMaterialText.md index 19de170b4..06f02522c 100644 --- a/docs/scripting/functions/SetPlayerObjectMaterialText.md +++ b/docs/scripting/functions/SetPlayerObjectMaterialText.md @@ -10,19 +10,20 @@ tags: ["player"] Replace the texture of a player object with text. -| Name | Description | -| ------------- | --------------------------------------------------------------------------------- | -| playerid | The ID of the player whose player object to set the text of. | -| objectid | The ID of the object on which to place the text. | -| text | The text to set. | -| materialindex | The material index to replace with text (DEFAULT: 0). | -| materialsize | The [size](../resources/materialtextsizes) of the material (DEFAULT: 256x128). | -| fontface | The font to use (DEFAULT: Arial). | -| fontsize | The size of the text (DEFAULT: 24) (MAX 255). | -| bold | Bold text. Set to 1 for bold, 0 for not (DEFAULT: 1). | -| fontcolor | The color of the text (DEFAULT: White). | -| backcolor | The background color (DEFAULT: None (transparent)). | -| textalignment | The [alignment](../resources/materialtextsizes) of the text (DEFAULT: Left). | +| Name | Description | +|------------------|--------------------------------------------------------------------------------| +| playerid | The ID of the player whose player object to set the text of. | +| objectid | The ID of the object on which to place the text. | +| text[] | The text to set. | +| materialindex | The material index to replace with text (DEFAULT: 0). | +| materialsize | The [size](../resources/materialtextsizes) of the material (DEFAULT: 256x128). | +| fontface | The font to use (DEFAULT: Arial). | +| fontsize | The size of the text (DEFAULT: 24) (MAX 255). | +| bold | Bold text. Set to 1 for bold, 0 for not (DEFAULT: 1). | +| fontcolor | The color of the text (DEFAULT: White). | +| backcolor | The background color (DEFAULT: None (transparent)). | +| textalignment | The [alignment](../resources/materialtextsizes) of the text (DEFAULT: Left). | +| OPEN_MP_TAGS:... | Indefinite number of arguments of any tag. | ## Returns diff --git a/docs/scripting/functions/SetSVarString.md b/docs/scripting/functions/SetSVarString.md index 19df3c271..b740aad88 100644 --- a/docs/scripting/functions/SetSVarString.md +++ b/docs/scripting/functions/SetSVarString.md @@ -10,10 +10,11 @@ tags: [] Set a string server variable. -| Name | Description | -| -------------- | -------------------------------- | -| varname[] | The name of the server variable. | -| string_value[] | The string to be set. | +| Name | Description | +|------------------|--------------------------------------------| +| varname[] | The name of the server variable. | +| string_value[] | The string to be set. | +| OPEN_MP_TAGS:... | Indefinite number of arguments of any tag. | ## Returns diff --git a/docs/scripting/functions/ShowPlayerDialog.md b/docs/scripting/functions/ShowPlayerDialog.md index 02f852d67..9f9d0920b 100644 --- a/docs/scripting/functions/ShowPlayerDialog.md +++ b/docs/scripting/functions/ShowPlayerDialog.md @@ -10,15 +10,16 @@ tags: ["player", "dialog"] Shows the player a synchronous (only one at a time) dialog box. -| Name | Description | -| --------- | --------------------------------------------------------------------------------------------------------------------------------------- | -| playerid | The ID of the player to show the dialog to. | -| dialogid | An ID to assign this dialog to, so responses can be processed. Max dialogid is 32767. Using negative values will close any open dialog. | -| style | The [style](../resources/dialogstyles) of the dialog. | -| caption[] | The title at the top of the dialog. The length of the caption can not exceed more than 64 characters before it starts to cut off. | -| info[] | The text to display in the main dialog. Use \n to start a new line and \t to tabulate. | -| button1[] | The text on the left button. | -| button2[] | The text on the right button. Leave it blank ( "" ) to hide it. | +| Name | Description | +|------------------|-----------------------------------------------------------------------------------------------------------------------------------------| +| playerid | The ID of the player to show the dialog to. | +| dialogid | An ID to assign this dialog to, so responses can be processed. Max dialogid is 32767. Using negative values will close any open dialog. | +| style | The [style](../resources/dialogstyles) of the dialog. | +| title[] | The title at the top of the dialog. The length of the caption can not exceed more than 64 characters before it starts to cut off. | +| body[] | The text to display in the main dialog. Use \n to start a new line and \t to tabulate. | +| button1[] | The text on the left button. | +| button2[] | The text on the right button. Leave it blank ( "" ) to hide it. | +| OPEN_MP_TAGS:... | Indefinite number of arguments of any tag. | ## Returns diff --git a/docs/scripting/functions/TextDrawCreate.md b/docs/scripting/functions/TextDrawCreate.md index b7479f2cc..9e737d892 100644 --- a/docs/scripting/functions/TextDrawCreate.md +++ b/docs/scripting/functions/TextDrawCreate.md @@ -8,11 +8,12 @@ tags: ["textdraw"] Creates a textdraw. Textdraws are, as the name implies, text (mainly - there can be boxes, sprites and model previews (skins/vehicles/weapons/objects too) that is drawn on a player's screens. See this page for extensive information about textdraws. -| Name | Description | -| ------- | -------------------------------------------------------- | -| Float:x | The X (left/right) coordinate to create the textdraw at. | -| Float:y | The Y (up/down) coordinate to create the textdraw at. | -| text[] | The text that will appear in the textdraw. | +| Name | Description | +|------------------|----------------------------------------------------------| +| Float:x | The X (left/right) coordinate to create the textdraw at. | +| Float:y | The Y (up/down) coordinate to create the textdraw at. | +| text[] | The text that will appear in the textdraw. | +| OPEN_MP_TAGS:... | Indefinite number of arguments of any tag. | ## Returns @@ -29,7 +30,7 @@ public OnGameModeInit() { // This line is used to create the textdraw. // Note: This creates a textdraw without any formatting. - gMyTextdraw = TextDrawCreate(240.0,580.0,"Welcome to my SA-MP server"); + gMyTextdraw = TextDrawCreate(240.0, 580.0, "Welcome to my OPEN.MP server"); return 1; } diff --git a/docs/scripting/functions/TextDrawSetString.md b/docs/scripting/functions/TextDrawSetString.md index d4fcc4b5d..bb59d67e9 100644 --- a/docs/scripting/functions/TextDrawSetString.md +++ b/docs/scripting/functions/TextDrawSetString.md @@ -8,10 +8,11 @@ tags: ["textdraw"] Changes the text on a textdraw. -| Name | Description | -| -------- | ------------------------------- | -| text | The TextDraw to change | -| string[] | The new string for the TextDraw | +| Name | Description | +|------------------|--------------------------------------------| +| text | The TextDraw to change | +| string[] | The new string for the TextDraw | +| OPEN_MP_TAGS:... | Indefinite number of arguments of any tag. | ## Returns @@ -35,8 +36,13 @@ public OnPlayerConnect(playerid) playerName[MAX_PLAYER_NAME]; GetPlayerName(playerid, playerName, sizeof playerName); + format(message, sizeof(message), "Welcome %s!", playerName); TextDrawSetString(gMyTextdraw, message); + + // PRO TIP: You don't need `format` in open.mp + TextDrawSetString(gMyTextdraw, "Welcome %s!", playerName); + TextDrawShowForPlayer(playerid, gMyTextdraw); return 1; } diff --git a/docs/scripting/functions/Update3DTextLabelText.md b/docs/scripting/functions/Update3DTextLabelText.md index f04a9f60d..ac548f39e 100644 --- a/docs/scripting/functions/Update3DTextLabelText.md +++ b/docs/scripting/functions/Update3DTextLabelText.md @@ -10,11 +10,12 @@ tags: ["3dtextlabel"] Updates a 3D Text Label text and color. -| Name | Description | -| --------- | ------------------------------------------------------------- | -| Text3D:id | The 3D Text Label you want to update. | -| color | The color the 3D Text Label should have from now on. | -| text[] | The new text which the 3D Text Label should have from now on. | +| Name | Description | +|------------------|---------------------------------------------------------------| +| Text3D:id | The 3D Text Label you want to update. | +| color | The color the 3D Text Label should have from now on. | +| text[] | The new text which the 3D Text Label should have from now on. | +| OPEN_MP_TAGS:... | Indefinite number of arguments of any tag. | ## Returns diff --git a/docs/scripting/functions/UpdatePlayer3DTextLabelText.md b/docs/scripting/functions/UpdatePlayer3DTextLabelText.md index 41516aa6d..6fd3a4fda 100644 --- a/docs/scripting/functions/UpdatePlayer3DTextLabelText.md +++ b/docs/scripting/functions/UpdatePlayer3DTextLabelText.md @@ -10,12 +10,13 @@ tags: ["player", "3dtextlabel"] Updates a player 3D Text Label's text and color -| Name | Description | -| --------------- | ------------------------------------------------------------- | -| playerid | The ID of the player for which the 3D Text Label was created. | -| PlayerText3D:id | The 3D Text Label you want to update. | -| color | The color the 3D Text Label should have from now on. | -| text[] | The new text which the 3D Text Label should have from now on. | +| Name | Description | +|------------------|---------------------------------------------------------------| +| playerid | The ID of the player for which the 3D Text Label was created. | +| PlayerText3D:id | The 3D Text Label you want to update. | +| color | The color the 3D Text Label should have from now on. | +| text[] | The new text which the 3D Text Label should have from now on. | +| OPEN_MP_TAGS:... | Indefinite number of arguments of any tag. | ## Returns