Skip to content

Commit

Permalink
Update some docs parameters (#808)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
adib-yg authored Jan 5, 2024
1 parent 55a5dde commit 33988cb
Show file tree
Hide file tree
Showing 21 changed files with 259 additions and 159 deletions.
11 changes: 6 additions & 5 deletions docs/scripting/functions/AddMenuItem.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
41 changes: 30 additions & 11 deletions docs/scripting/functions/Create3DTextLabel.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
23 changes: 12 additions & 11 deletions docs/scripting/functions/CreateMenu.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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;
}
```
Expand All @@ -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.

:::

Expand Down
48 changes: 28 additions & 20 deletions docs/scripting/functions/CreatePlayer3DTextLabel.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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;
}
```
Expand Down
15 changes: 8 additions & 7 deletions docs/scripting/functions/CreatePlayerTextDraw.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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]);
Expand Down
21 changes: 12 additions & 9 deletions docs/scripting/functions/GameTextForAll.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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;
}
```
Expand Down
21 changes: 15 additions & 6 deletions docs/scripting/functions/GameTextForPlayer.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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;
}
```
Expand Down
14 changes: 9 additions & 5 deletions docs/scripting/functions/PlayerTextDrawSetString.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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;
}

Expand Down
23 changes: 18 additions & 5 deletions docs/scripting/functions/SendClientMessage.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
22 changes: 18 additions & 4 deletions docs/scripting/functions/SendClientMessageToAll.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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;
}
```
Expand Down
Loading

0 comments on commit 33988cb

Please sign in to comment.