text stringlengths 1 2.83M | id stringlengths 16 152 | metadata dict | __index_level_0__ int64 0 949 |
|---|---|---|---|
---
title: floatsqroot
description: Calculates the square root of given value.
tags: ["math", "floating-point"]
---
<LowercaseNote />
## Description
Calculates the square root of given value.
| Name | Description |
| ----------- | ------------------------------------------ |
| Float:value | The value to calculate the square root of. |
## Returns
The square root of the input value, as a float.
## Examples
```c
new Float:sqroot = floatsqroot(25.0); // Returns 5.0, because 5x5 = 25
```
## Notes
:::tip
This function raises a “domain” error if the input value is negative. You may use [floatabs](floatabs) to get the absolute (positive) value.
:::
## Related Functions
- [floatpower](floatpower): Raises given value to a power of exponent.
- [floatlog](floatlog): Get the logarithm of the float value.
| openmultiplayer/web/docs/scripting/functions/floatsqroot.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/floatsqroot.md",
"repo_id": "openmultiplayer",
"token_count": 279
} | 297 |
---
title: fwrite
description: Write text into a file.
tags: ["file management"]
---
<LowercaseNote />
## Description
Write text into a file.
| Name | Description |
| -------------- | ------------------------------------------------------- |
| File:handle | The handle of the file to write to (returned by fopen). |
| const string[] | The string of text to write in to the file. |
## Returns
The length of the written string as an integer.
## Examples
```c
// Open "file.txt" in "write only" mode
new File:handle = fopen("file.txt", io_write);
// Check, if file is open
if (handle)
{
// Success
// Write "I just wrote here!" into this file
fwrite(handle, "I just wrote here!");
// Close the file
fclose(handle);
}
else
{
// Error
print("Failed to open file \"file.txt\".");
}
```
<br />
```c
// Open "file.txt" in "read and write" mode
new File:handle = fopen("file.txt");
// Initialize "buf"
new buf[128];
// Check, if file is open
if (handle)
{
// Success
// Read the whole file
while(fread(handle, buf))
{
print(buf);
}
// Set the file pointer to the first byte
fseek(handle, _, seek_begin);
// Write "I just wrote here!" into this file
fwrite(handle, "I just wrote here!");
// Close the file
fclose(handle);
}
else
{
// Error
print("The file \"file.txt\" does not exists, or can't be opened.");
}
```
<br />
```c
// Open "file.txt" in "append only" mode
new File:handle = fopen("file.txt", io_append);
// Check, if file is open
if (handle)
{
// Success
// Append "This is a text.\r\n"
fwrite(handle, "This is a test.\r\n");
// Close the file
fclose(handle);
}
else
{
// Error
print("Failed to open file \"file.txt\".");
}
```
## Notes
:::tip
This functions writes to the file in UTF-8, which does not support some localized language symbols.
:::
:::warning
Using an invalid handle will crash your server! Get a valid handle by using [fopen](fopen) or [ftemp](ftemp).
:::
## Related Functions
- [fopen](fopen): Open a file.
- [fclose](fclose): Close a file.
- [ftemp](ftemp): Create a temporary file stream.
- [fremove](fremove): Remove a file.
- [fread](fread): Read a file.
- [fputchar](fputchar): Put a character in a file.
- [fgetchar](fgetchar): Get a character from a file.
- [fblockwrite](fblockwrite): Write blocks of data into a file.
- [fblockread](fblockread): Read blocks of data from a file.
- [fseek](fseek): Jump to a specific character in a file.
- [flength](flength): Get the file length.
- [fexist](fexist): Check, if a file exists.
- [fmatch](fmatch): Check, if patterns with a file name matches.
- [ftell](ftell): Get the current position in the file.
- [fflush](fflush): Flush a file to disk (ensure all writes are complete).
- [fstat](fstat): Return the size and the timestamp of a file.
- [frename](frename): Rename a file.
- [fcopy](fcopy): Copy a file.
- [filecrc](filecrc): Return the 32-bit CRC value of a file.
- [diskfree](diskfree): Returns the free disk space.
- [fattrib](fattrib): Set the file attributes.
- [fcreatedir](fcreatedir): Create a directory.
| openmultiplayer/web/docs/scripting/functions/fwrite.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/fwrite.md",
"repo_id": "openmultiplayer",
"token_count": 1166
} | 298 |
---
title: printf
description: Outputs a formatted string on the console (the server window, not the in-game chat).
tags: ["console"]
---
<LowercaseNote />
## Description
Outputs a formatted string on the console (the server window, not the in-game chat).
| Name | Description |
| -------------- | ----------------------------------------- |
| const format[] | The format string |
| {Float,\_}:... | Indefinite number of arguments of any tag |
## Returns
This function does not return any specific values.
## Format Specifiers
| Specifier | Meaning |
| --------- | --------------------------------------------- |
| %i | Integer |
| %d | Integer |
| %s | String |
| %f | Floating-point number |
| %c | ASCII character |
| %x | Hexadecimal number |
| %b | Binary number |
| %% | Literal '%' |
| %q | Escape a text for SQLite. (Added in 0.3.7 R2) |
The values for the placeholders follow in the exact same order as parameters in the call, i.e. `"I am %i years old"` - the `%i` will be replaced with an integer variable, which is the person's age.
You may optionally put a number between the `%` and the letter of the placeholder code. This number indicates the field width; if the size of the parameter to print at the position of the placeholder is smaller than the field width, the field is expanded with spaces. To cut the number of decimal places beeing shown of a float, you can add '.\<max number\>' between the `%` and the `f`, i.e. `%.2f`.
## Examples
```c
new number = 42;
printf("The number is %d.", number); // The number is 42.
new string[] = "simple message";
printf("This is a %s containing the number %d.", string, number); // This is a simple message containing the number 42.
new character = 64;
printf("I'm %c home", character); // I'm @ home
```
## Notes
:::warning
The format string or its output should not exceed 1024 characters. Anything beyond that length can lead to a server to crash.
:::
## Related Functions
- [print](print): Print a basic message to the server logs and console.
- [format](format): Format a string.
| openmultiplayer/web/docs/scripting/functions/printf.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/printf.md",
"repo_id": "openmultiplayer",
"token_count": 996
} | 299 |
---
title: strmid
description: Extract a range of characters from a string.
tags: ["string"]
---
<LowercaseNote />
## Description
Extract a range of characters from a string.
| Name | Description |
| ------------------------- | -------------------------------------------------------------------- |
| dest[] | The string to store the extracted characters in. |
| const source[] | The string from which to extract characters. |
| start | The position of the first character. |
| end | The position of the last character. |
| maxlength = sizeof (dest) | The length of the destination. (Will be the size of dest by default) |
## Returns
The number of characters stored in dest[]
## Examples
```c
new string[6];
strmid(string, "Extract 'HELLO' without the !!!!: HELLO!!!!", 34, 39); // string contains "HELLO"
```
## Related Functions
- [strcmp](strcmp): Compare two strings to check if they are the same.
- [strfind](strfind): Search for a string in another string.
- [strins](strins): Insert text into a string.
- [strlen](strlen): Get the length of a string.
- [strpack](strpack): Pack a string into a destination string.
- [strval](strval): Convert a string into an integer.
- [strcat](strcat): Concatenate two strings into a destination reference.
- [strdel](strdel): Delete part of a string.
| openmultiplayer/web/docs/scripting/functions/strmid.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/strmid.md",
"repo_id": "openmultiplayer",
"token_count": 615
} | 300 |
---
title: Component slots
---
:::info
The following car mod types can be used to work with the [GetVehicleComponentInSlot](../functions/GetVehicleComponentInSlot) function.
:::
| Slot | Definition |
|------|--------------------------|
| -1 | CARMODTYPE_NONE |
| 0 | CARMODTYPE_SPOILER |
| 1 | CARMODTYPE_HOOD |
| 2 | CARMODTYPE_ROOF |
| 3 | CARMODTYPE_SIDESKIRT |
| 4 | CARMODTYPE_LAMPS |
| 5 | CARMODTYPE_NITRO |
| 6 | CARMODTYPE_EXHAUST |
| 7 | CARMODTYPE_WHEELS |
| 8 | CARMODTYPE_STEREO |
| 9 | CARMODTYPE_HYDRAULICS |
| 10 | CARMODTYPE_FRONT_BUMPER |
| 11 | CARMODTYPE_REAR_BUMPER |
| 12 | CARMODTYPE_VENT_RIGHT |
| 13 | CARMODTYPE_VENT_LEFT |
| 14 | CARMODTYPE_FRONT_BULLBAR |
| 15 | CARMODTYPE_REAR_BULLBAR |
| openmultiplayer/web/docs/scripting/resources/Componentslots.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/resources/Componentslots.md",
"repo_id": "openmultiplayer",
"token_count": 435
} | 301 |
---
title: Vehicle Landing Gear States
description: Vehicle Landing Gear States
---
:::note
Vehicle landing gear states used by [GetVehicleLandingGearState](../functions/GetVehicleLandingGearState) and [GetPlayerLandingGearState](../functions/GetPlayerLandingGearState) functions.
:::
| Definition | ID |
|-------------------------|----|
| LANDING_GEAR_STATE_DOWN | 0 |
| LANDING_GEAR_STATE_UP | 1 |
| openmultiplayer/web/docs/scripting/resources/landinggearstate.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/resources/landinggearstate.md",
"repo_id": "openmultiplayer",
"token_count": 139
} | 302 |
---
title: "Pvar Types"
---
:::info
Types of player variables (also called pvar types) used in [Per-player variable system.](../../tutorials/perplayervariablesystem)
:::
| ID | Definition |
|----|-----------------------|
| 0 | PLAYER_VARTYPE_NONE |
| 1 | PLAYER_VARTYPE_INT |
| 2 | PLAYER_VARTYPE_STRING |
| 3 | PLAYER_VARTYPE_FLOAT |
| openmultiplayer/web/docs/scripting/resources/pvartypes.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/resources/pvartypes.md",
"repo_id": "openmultiplayer",
"token_count": 152
} | 303 |
---
title: Textdraws
description: As the name implies, a textdraw is text that is drawn on a player's screen.
sidebar_label: Textdraws
---
## What is a Textdraw?
As the name implies, a textdraw is text that is drawn on a player's screen. Unlike [client messages](../functions/SendClientMessage) or [gametext](../functions/GameTextForPlayer) however, textdraws can be shown on a player's screen for an indefinite period of time. Textdraws can be simple text on the screen such as a website address, or complex scripted dynamic textdraws such as progress bars.
This 'textdraw editor' tool can make designing textdraws much easier.
---
## Global Textdraws
Global textdraws can be created, then shown to all players. There is a [limit](../resources/Limits) as to how many can be created, though. This means if you have a server with 500 players, creating more than 4 textdraws per-player is not possible. That's where **player**-textdraws come in. See further down. Here is a list of all the functions related to **global** textdraws:
- [TextDrawCreate](../functions/TextDrawCreate): Create a textdraw.
- [TextDrawDestroy](../functions/TextDrawDestroy): Destroy a textdraw.
- [TextDrawColor](../functions/TextDrawColor): Set the color of the text in a textdraw.
- [TextDrawBoxColor](../functions/TextDrawBoxColor): Set the color of the box in a textdraw.
- [TextDrawBackgroundColor](../functions/TextDrawBackgroundColor): Set the background color of a textdraw.
- [TextDrawAlignment](../functions/TextDrawAlignment): Set the alignment of a textdraw.
- [TextDrawFont](../functions/TextDrawFont): Set the font of a textdraw.
- [TextDrawLetterSize](../functions/TextDrawLetterSize): Set the letter size of the text in a textdraw.
- [TextDrawTextSize](../functions/TextDrawTextSize): Set the size of a textdraw box.
- [TextDrawSetOutline](../functions/TextDrawSetOutline): Choose whether the text has an outline.
- [TextDrawSetShadow](../functions/TextDrawSetShadow): Toggle shadows on a textdraw.
- [TextDrawSetProportional](../functions/TextDrawSetProportional): Scale the text spacing in a textdraw to a proportional ratio.
- [TextDrawUseBox](../functions/TextDrawUseBox): Toggle if the textdraw has a box or not.
- [TextDrawSetString](../functions/TextDrawSetString): Set the text in an existing textdraw.
- [TextDrawShowForPlayer](../functions/TextDrawShowForPlayer): Show a textdraw for a certain player.
- [TextDrawHideForPlayer](../functions/TextDrawHideForPlayer): Hide a textdraw for a certain player.
- [TextDrawShowForAll](../functions/TextDrawShowForAll): Show a textdraw for all players.
- [TextDrawHideForAll](../functions/TextDrawHideForAll): Hide a textdraw for all players.
- [IsTextDrawVisibleForPlayer](../functions/IsTextDrawVisibleForPlayer): Checks if a textdraw is shown for the player.
- [IsValidTextDraw](../functions/IsValidTextDraw): Checks if a textdraw is valid.
- [TextDrawGetAlignment](../functions/TextDrawGetAlignment): Gets the text alignment of a textdraw.
- [TextDrawGetBackgroundColour](../functions/TextDrawGetBackgroundColour): Gets the background colour of a textdraw.
- [TextDrawGetBoxColour](../functions/TextDrawGetBoxColour): Gets the box colour of a textdraw.
- [TextDrawGetColour](../functions/TextDrawGetColour): Gets the text colour of a textdraw.
- [TextDrawGetFont](../functions/TextDrawGetFont): Gets the text font of a textdraw.
- [TextDrawGetLetterSize](../functions/TextDrawGetLetterSize): Gets the width and height of the letters.
- [TextDrawGetOutline](../functions/TextDrawGetOutline): Gets the thickness of a textdraw's text's outline.
- [TextDrawGetPos](../functions/TextDrawGetPos): Gets the position of a textdraw.
- [TextDrawGetPreviewModel](../functions/TextDrawGetPreviewModel): Gets the preview model of a 3D preview textdraw.
- [TextDrawGetPreviewRot](../functions/TextDrawGetPreviewRot): Gets the rotation and zoom of a 3D model preview textdraw.
- [TextDrawGetPreviewVehCol](../functions/TextDrawGetPreviewVehCol): Gets the preview vehicle colors of a 3D preview textdraw.
- [TextDrawGetPreviewVehicleColours](../functions/TextDrawGetPreviewVehicleColours): Gets the preview vehicle colours of a 3D preview textdraw.
- [TextDrawGetShadow](../functions/TextDrawGetShadow): Gets the size of a textdraw's text's shadow.
- [TextDrawGetString](../functions/TextDrawGetString): Gets the text of a textdraw.
- [TextDrawGetTextSize](../functions/TextDrawGetTextSize): Gets the X axis and Y axis of the textdraw.
- [TextDrawIsBox](../functions/TextDrawIsBox): Checks if a textdraw is box.
- [TextDrawIsProportional](../functions/TextDrawIsProportional): Checks if a textdraw is proportional.
- [TextDrawIsSelectable](../functions/TextDrawIsSelectable): Checks if a textdraw is selectable.
- [TextDrawSetPos](../functions/TextDrawSetPos): Sets the position of a textdraw.
- [TextDrawSetStringForPlayer](../functions/TextDrawSetStringForPlayer): Changes the text on a textdraw for a specific player.
---
## Player-textdraws
Player-textdraws are only created for one specific player. Up to 256 textdraws can be created PER-PLAYER. That's 128,000 on a server with 500 players. A little more than 2048. Player-textdraws should be used for things that are not 'static'. Do not use them to display a website address for example, but for a vehicle health indicator.
- [CreatePlayerTextDraw](../functions/CreatePlayerTextDraw): Create a player-textdraw.
- [PlayerTextDrawDestroy](../functions/PlayerTextDrawDestroy): Destroy a player-textdraw.
- [PlayerTextDrawColor](../functions/PlayerTextDrawColor): Set the color of the text in a player-textdraw.
- [PlayerTextDrawBoxColor](../functions/PlayerTextDrawBoxColor): Set the color of a player-textdraw's box.
- [PlayerTextDrawBackgroundColor](../functions/PlayerTextDrawBackgroundColor): Set the background color of a player-textdraw.
- [PlayerTextDrawAlignment](../functions/PlayerTextDrawAlignment): Set the alignment of a player-textdraw.
- [PlayerTextDrawFont](../functions/PlayerTextDrawFont): Set the font of a player-textdraw.
- [PlayerTextDrawLetterSize](../functions/PlayerTextDrawLetterSize): Set the letter size of the text in a player-textdraw.
- [PlayerTextDrawTextSize](../functions/PlayerTextDrawTextSize): Set the size of a player-textdraw box (or clickable area for [PlayerTextDrawSetSelectable](../functions/PlayerTextDrawSetSelectable)).
- [PlayerTextDrawSetOutline](../functions/PlayerTextDrawSetOutline): Toggle the outline on a player-textdraw.
- [PlayerTextDrawSetShadow](../functions/PlayerTextDrawSetShadow): Set the shadow on a player-textdraw.
- [PlayerTextDrawSetProportional](../functions/PlayerTextDrawSetProportional): Scale the text spacing in a player-textdraw to a proportional ratio.
- [PlayerTextDrawUseBox](../functions/PlayerTextDrawUseBox): Toggle the box on a player-textdraw.
- [PlayerTextDrawSetString](../functions/PlayerTextDrawSetString): Set the text of a player-textdraw.
- [PlayerTextDrawShow](../functions/PlayerTextDrawShow): Show a player-textdraw.
- [PlayerTextDrawHide](../functions/PlayerTextDrawHide): Hide a player-textdraw.
- [IsPlayerTextDrawVisible](../functions/IsPlayerTextDrawVisible): Checks if a player-textdraw is shown for the player.
- [IsValidPlayerTextDraw](../functions/IsValidPlayerTextDraw): Checks if a player-textdraw is valid.
- [PlayerTextDrawBackgroundColour](../functions/PlayerTextDrawBackgroundColour): Adjust the background colour of a player-textdraw.
- [PlayerTextDrawBoxColour](../functions/PlayerTextDrawBoxColour): Sets the colour of a textdraw's box (PlayerTextDrawUseBox ).
- [PlayerTextDrawColour](../functions/PlayerTextDrawColour): Sets the text colour of a player-textdraw.
- [PlayerTextDrawGetAlignment](../functions/PlayerTextDrawGetAlignment): Gets the text alignment of a player-textdraw.
- [PlayerTextDrawGetBackgroundColour](../functions/PlayerTextDrawGetBackgroundColour): Gets the background colour of a player-textdraw.
- [PlayerTextDrawGetBoxColour](../functions/PlayerTextDrawGetBoxColour): Gets the box colour of a player-textdraw.
- [PlayerTextDrawGetColour](../functions/PlayerTextDrawGetColour): Gets the text colour of a player-textdraw.
- [PlayerTextDrawGetFont](../functions/PlayerTextDrawGetFont): Gets the text font of a player-textdraw.
- [PlayerTextDrawGetLetterSize](../functions/PlayerTextDrawGetLetterSize): Gets the width and height of the letters.
- [PlayerTextDrawGetOutline](../functions/PlayerTextDrawGetOutline): Get the outline size on a player-textdraw.
- [PlayerTextDrawGetPos](../functions/PlayerTextDrawGetPos): Gets the position of a player-textdraw.
- [PlayerTextDrawGetPreviewModel](../functions/PlayerTextDrawGetPreviewModel): Gets the preview model of a 3D preview player-textdraw.
- [PlayerTextDrawGetPreviewRot](../functions/PlayerTextDrawGetPreviewRot): Gets the rotation and zoom of a 3D model preview player-textdraw.
- [PlayerTextDrawGetPreviewVehicleColours](../functions/PlayerTextDrawGetPreviewVehicleColours): Gets the preview vehicle colors of a 3D preview player-textdraw.
- [PlayerTextDrawGetShadow](../functions/PlayerTextDrawGetShadow): Get the shadow size on a player-textdraw.
- [PlayerTextDrawGetString](../functions/PlayerTextDrawGetString): Gets the text of a player-textdraw.
- [PlayerTextDrawGetTextSize](../functions/PlayerTextDrawGetTextSize): Gets the X axis and Y axis of the player-textdraw text size.
- [PlayerTextDrawIsBox](../functions/PlayerTextDrawIsBox): Checks if a player-textdraw is box.
- [PlayerTextDrawIsProportional](../functions/PlayerTextDrawIsProportional): Checks if a player-textdraw is proportional.
- [PlayerTextDrawIsSelectable](../functions/PlayerTextDrawIsSelectable): Checks if a player-textdraw is selectable.
- [PlayerTextDrawSetPos](../functions/PlayerTextDrawSetPos): Sets the position of a player-textdraw.
- [PlayerTextDrawSetPreviewVehicleColours](../functions/PlayerTextDrawSetPreviewVehicleColours): Set the color of a vehicle in a player-textdraw model preview (if a vehicle is shown).
---
## Variable Declaration
When creating a textdraw, you should always decide if the textdraw you're going to create has to be global (eg. your website address, global annoucement) or if it's going to differ per player (eg. kills, deaths, score).
### Global Textdraw
A global textdraw is the easiest to create and requires only one variable. This variable is needed to modify the textdraw and to show it to the players later on. The declaration for such a textdraw needs to be a global variable in most cases. The textdraw variable also needs to be prefixed with the _Text:_ tag and should be initialized with the value _Text:INVALID_TEXT_DRAW_. If you omit the initialization, the textdraw may conflict with others as you add more textdraws.
```c
new Text:gMyText = Text:INVALID_TEXT_DRAW;
```
### Per-Player Textdraw
A per-player textdraw is exactly the same as a regular 'global' textdraw, but only creates the textdraw for a single player.
This is useful for textdraws that are unique to each player, such as a 'stats' bar showing their kills or score.
This can be used to avoid going over the global-textdraw limit, as you can create 256 textdraws per player.
They are also easier to manage, as they automatically destroy themselves when the player disconnects.
```c
new PlayerText:gMyPlayerText = PlayerText:INVALID_TEXT_DRAW;
```
:::info
IMPORTANT NOTE: An array is still needed for the variable, as the ID of the textdraws may differ from player to player, as other players may have more or less textdraws created than the other.
:::
The function names only differ slightly, with 'TextDraw' becoming 'PlayerTextDraw', with one exception: [CreatePlayerTextDraw](../functions/CreatePlayerTextDraw) ('TextDrawSetString' becomes 'PlayerTextDrawSetString').
---
## Creating the Textdraw

Once you've declared a variable/array to store the ID of your textdraw(s) in, you can proceed to create the textdraw itself. For global textdraws that are always created, the code should be placed under [OnGameModeInit](../callbacks/OnGameModeInit). To create the textdraw, the function [TextDrawCreate](../functions/TextDrawCreate) must be used.
Note that this function merely creates the textdraw, other functions are used to modify it and to show it to the player(s).
**Parameters:**
TextDrawCreate(Float:x, Float:y, text[])
| Name | Description |
| ------ | -------------------------------------------- |
| x | X coordinate at which to create the textdraw |
| y | Y coordinate at which to create the textdraw |
| text[] | The text in the textdraw. |
**Return Values:**
The ID of the created textdraw
Let's proceed to create the textdraw:
```c
public OnGameModeInit()
{
gMyText = TextDrawCreate(320.0, 240.0, "Hello World!");
return 1;
}
```
We have created a textdraw in the center of the screen that says "Hello World!".
---
## Setting the font
There are 4 fonts available for textdraw text:

| ID | Info | Tips |
| --- | -------------------------------------------------------------- | ------------------------------------------------------ |
| 0 | The _San Andreas_ Font. | Use for header or titles, not a whole page. |
| 1 | Clear font that includes both upper and lower case characters. | Can be used for a lot of text. |
| 2 | Clear font, but includes only capital letters. | Can be used in various instances. |
| 3 | _GTA font_ | Retains quality when enlarged. Useful for large texts. |
As of SA-MP 0.3d, a new font (id 4) can be set. This is used in combination with the [TextDrawCreate](../functions/TextDrawCreate) and [TextDrawTextSize](../functions/TextDrawTextSize) functions to show a texture 'sprite' on the player's screen. We'll cover this later.
---
## Showing the textdraw
For this example, the textdraw has been created globally under OnGameModeInit and will be shown to player when they join the server.
To show a textdraw for a single player, the function [TextDrawShowForPlayer](../functions/TextDrawShowForPlayer) is used.
**Parameters:**
TextDrawShowForPlayer(playerid, Text:text)
| Name | Description |
| -------- | --------------------------------------------- |
| playerid | The ID of the player to show the textdraw for |
| text | The ID of the textdraw to show |
**Return Values:**
This function does not return any specific values.
The playerid is passed through OnPlayerConnect, and the text-draw ID is stored in the 'gMyText' variable.
```c
public OnGameModeInit()
{
gMyText = TextDrawCreate(320.0, 320.0, "Hello World!");
return 1;
}
public OnPlayerConnect(playerid)
{
TextDrawShowForPlayer(playerid, gMyText);
return 1;
}
```
---
## Assorted Tips
- Try to use whole number when specifying positions, this ensures the best compatibility on different resolutions.
- Fonts appear to look the best with an X to Y ratio of 1 to 4 (e.g. if x = 0.5 then y should be 2).
| openmultiplayer/web/docs/scripting/resources/textdraws.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/resources/textdraws.md",
"repo_id": "openmultiplayer",
"token_count": 4573
} | 304 |
---
title: Weather IDs
---
A list of weather IDs used by [SetWeather](../functions/SetWeather) and [SetPlayerWeather](../functions/SetPlayerWeather) functions.
| ID | Name | Type | Description (in singleplayer) |
| -- | ------------ | ---- | ---------------------------------- |
| 0 | EXTRASUNNY_LA | Blue skies | Los Santos specific weather |
| 1 | SUNNY_LA | Blue skies | Los Santos specific weather |
| 2 | EXTRASUNNY_SMOG_LA | Blue skies | Los Santos specific weather |
| 3 | SUNNY_SMOG_LA | Blue skies | Los Santos specific weather |
| 4 | CLOUDY_LA | Blue skies | Los Santos specific weather |
| 5 | SUNNY_SF | Blue skies | San Fierro specific weather |
| 6 | EXTRASUNNY_SF | Blue skies | San Fierro specific weather |
| 7 | CLOUDY_SF | Blue skies | San Fierro specific weather |
| 8 | RAINY_SF | Stormy | San Fierro specific weather |
| 9 | FOGGY_SF | Cloudy and foggy | San Fierro specific weather |
| 10 | SUNNY_VEGAS | Clear blue sky | Las Venturas specific weather |
| 11 | EXTRASUNNY_VEGAS | Heat waves | Las Venturas specific weather |
| 12 | CLOUDY_VEGAS | Dull, colourless | Las Venturas specific weather |
| 13 | EXTRASUNNY_COUNTRYSIDE | Dull, colourless | Countryside specific weather |
| 14 | SUNNY_COUNTRYSIDE | Dull, colourless | Countryside specific weather |
| 15 | CLOUDY_COUNTRYSIDE | Dull, colourless | Countryside specific weather |
| 16 | RAINY_COUNTRYSIDE | Dull, cloudy, rainy | Countryside specific weather |
| 17 | EXTRASUNNY_DESERT | Heat waves | Bone County specific weather |
| 18 | SUNNY_DESERT | Heat waves | Bone County specific weather |
| 19 | SANDSTORM_DESERT | Sandstorm | Bone County specific weather |
| 20 | UNDERWATER | Greenish, foggy | Used internally when camera is underwater |
| 21 | EXTRACOLOURS_1 | Very dark, gradiented skyline, purple | Weather used in interiors |
| 22 | EXTRACOLOURS_2 | Very dark, gradiented skyline, purple | Weather used in interiors |
There are 23 different weather IDs (0-22), the last two of which being the extra colour weather types. However, the game does not feature any range checking for weather IDs and thus you can use weather IDs upto 255. Values higher than 255 or lower than 0 are turned into remainder of the division by 256 (for example, weather ID 300 is the same as ID 44, because 300 % 256 = 44). Weather IDs 0-22 works correctly but other IDs result undefined behavior: strange effects such as pink sky and flashing textures during certain times.
:::note
- Some weathers appear very different at certain times. You can see [here](http://hotmist.ddo.jp/id/weather.html) what different weather types look like at different times.
- [GTA San Andreas weather gallery](https://dev.prineside.com/en/gtasa_weather_id/) explains the situation with weather IDs better than any words. You can also use it if you wish to view weathers at certain times and look for problematic weather that cause strange effects
:::
| openmultiplayer/web/docs/scripting/resources/weatherid.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/resources/weatherid.md",
"repo_id": "openmultiplayer",
"token_count": 827
} | 305 |
---
title: OnVehicleStreamIn
description: يتم استدعاء هذا الاستدعاء أو الكال باك عند تدفق سيارة بواسطة كلاينت اللاعب
tags: []
---
<VersionWarn name='callback' version='SA-MP 0.3.7' />
<div dir="rtl" style={{ textAlign: "right" }}>
## الوصف
يتم استدعاء هذا الاستدعاء أو الكال باك عند تدفق سيارة بواسطة كلاينت اللاعب
| الوصف | الإسم |
| ----------- | ------------------------------------------------------------ |
| vehicleid | ايدي السيارة الذي تم تدفقها للاعب. |
| forplayerid | هوية اللاعب الذي قام بتدفق السيارة |
## Returns
دائمًا يتم استدعاؤه أولاً في الفلترسكربتات.
## أمثلة
</div>
```c
public OnVehicleStreamIn(vehicleid, forplayerid)
{
new string[32];
format(string, sizeof(string), "You can now see vehicle %d.", vehicleid);
SendClientMessage(forplayerid, 0xFFFFFFFF, string);
return 1;
}
```
<div dir="rtl" style={{ textAlign: "right" }}>
## Notes
<TipNPCCallbacks/>
## الاستدعاءات او كالباكات ذات الصلة
قد تكون الاستدعاءات التالية مفيدة، حيث أنها ذات صلة بهذا الاستدعاء بطريقة أو بأخرى.
- [OnVehicleStreamOut](../callbacks/OnVehicleStreamOut): يتم استدعاؤه عندما يتم تدفق السبارة خارج كلاينت اللاعب.
- [OnPlayerStreamIn](../callbacks/OnPlayerStreamIn): يتم استدعاؤه عندما يتم تدفق لاعب آخر إلى كلاينت اللاعب.
- [OnPlayerStreamOut](../callbacks/OnPlayerStreamOut): يتم استدعاؤه عندما يتم تدفق لاعب آخر خارج كلاينت اللاعب.
</div>
| openmultiplayer/web/docs/translations/ar/scripting/callbacks/OnVehicleStreamIn.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/ar/scripting/callbacks/OnVehicleStreamIn.md",
"repo_id": "openmultiplayer",
"token_count": 977
} | 306 |
---
title: OnFilterScriptInit
description: Ovaj callback se poziva kada se filterskripta pokrenula.
tags: []
---
## Deskripcija
Ovaj callback se poziva kada se filterskripta pokrenula. Poziva se samo unutar filterskripte koja se pokreće.
## Primjeri
```c
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print("Filterskripta je pokrenuta.");
print("--------------------------------------\n");
return 1;
}
```
## Srodne Funkcije
| openmultiplayer/web/docs/translations/bs/scripting/callbacks/OnFilterScriptInit.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/callbacks/OnFilterScriptInit.md",
"repo_id": "openmultiplayer",
"token_count": 169
} | 307 |
---
title: OnPlayerEditAttachedObject
description: Ovaj callback je pozvan kada igrač napusti mod uređivanja prikvačenih objekata (attached object edition mode).
tags: ["player"]
---
## Deskripcija
Ovaj callback je pozvan kada igrač napusti mod uređivanja prikvačenih objekata (attached object edition mode).
| Ime | Deskripcija |
|------------------------|---------------------------------------------------------------|
| playerid | ID igrača koji je napustio mod uređivanja |
| EDIT_RESPONSE:response | 0 ako su prekinuli (ESC) ili 1 ako su kliknuli na save ikonu. |
| index | The index of the attached object (0-9) |
| modelid | Model prikvačenog objekta koji je uređen |
| boneid | Kost na kojoj se nalazi uređeni prikvačeni objekat |
| Float:fOffsetX | Ofset X prikvačenog objekta koji je editovan |
| Float:fOffsetY | Ofset Y prikvačenog objekta koji je editovan |
| Float:fOffsetZ | Ofset Z prikvačenog objekta koji je editovan |
| Float:fRotX | Rotacija X prikvačenog objekta koji je editovan |
| Float:fRotY | Rotacija Y prikvačenog objekta koji je editovan |
| Float:fRotZ | Rotacija Z prikvačenog objekta koji je editovan |
| Float:fScaleX | Skala X prikvačenog objekta koji je editovan |
| Float:fScaleY | Skala X prikvačenog objekta koji je editovan |
| Float:fScaleZ | Skala X prikvačenog objekta koji je editovan |
## Returns
1 - Spriječiti će da druge skripte primaju ovaj callback.
0 - Označava da će ovaj callback biti proslijeđen narednoj skripti.
Uvijek je pozvana prva u filterskripti.
## Primjeri
```c
enum attached_object_data
{
Float:ao_x,
Float:ao_y,
Float:ao_z,
Float:ao_rx,
Float:ao_ry,
Float:ao_rz,
Float:ao_sx,
Float:ao_sy,
Float:ao_sz
}
new ao[MAX_PLAYERS][MAX_PLAYER_ATTACHED_OBJECTS][attached_object_data];
// Podaci bi se trebali pohraniti u gornji niz kada su pridruženi priloženi objekti.
public OnPlayerEditAttachedObject(playerid, EDIT_RESPONSE:response, index, modelid, boneid, Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ, Float:fRotX, Float:fRotY, Float:fRotZ, Float:fScaleX, Float:fScaleY, Float:fScaleZ)
{
if (response)
{
SendClientMessage(playerid, COLOR_GREEN, "Uredjivanje zakacenog objekta sacuvano!");
ao[playerid][index][ao_x] = fOffsetX;
ao[playerid][index][ao_y] = fOffsetY;
ao[playerid][index][ao_z] = fOffsetZ;
ao[playerid][index][ao_rx] = fRotX;
ao[playerid][index][ao_ry] = fRotY;
ao[playerid][index][ao_rz] = fRotZ;
ao[playerid][index][ao_sx] = fScaleX;
ao[playerid][index][ao_sy] = fScaleY;
ao[playerid][index][ao_sz] = fScaleZ;
}
else
{
SendClientMessage(playerid, COLOR_RED, "Uredjivanje zakacenog objekta nije sacuvano!");
new i = index;
SetPlayerAttachedObject(playerid, index, modelid, boneid, ao[playerid][i][ao_x], ao[playerid][i][ao_y], ao[playerid][i][ao_z], ao[playerid][i][ao_rx], ao[playerid][i][ao_ry], ao[playerid][i][ao_rz], ao[playerid][i][ao_sx], ao[playerid][i][ao_sy], ao[playerid][i][ao_sz]);
}
return 1;
}
```
## Zabilješke
:::warning
Izdanja treba odbaciti ako je odgovor bio '0' (otkazan). To se mora učiniti spremanjem ofseta itd. U niz PRIJE korištenja EditAttachedObject.
:::
## Srodne Funkcije
- [EditAttachedObject](../functions/EditAttachedObject): Uredi prikvačeni objekat.
- [SetPlayerAttachedObject](../functions/SetPlayerAttachedObject): Prikvači objekat za igrača.
| openmultiplayer/web/docs/translations/bs/scripting/callbacks/OnPlayerEditAttachedObject.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/callbacks/OnPlayerEditAttachedObject.md",
"repo_id": "openmultiplayer",
"token_count": 1934
} | 308 |
---
title: OnPlayerRequestClass
description: Pozvano kada igrač promijeni klasu na odabiru klase (i kada se odabir klase prvi put pojavi).
tags: ["player"]
---
## Deskripcija
Pozvano kada igrač promijeni klasu na odabiru klase (i kada se odabir klase prvi put pojavi).
| Ime | Deskripcija |
| -------- | -------------------------------------------------------------------- |
| playerid | ID igrača koji je promijenio klasu. |
| classid | ID trenutne klase koja se pregledava (return-uje je AddPlayerClass). |
## Returns
Uvijek je pozvana prva u filterskripti.
## Primjeri
```c
public OnPlayerRequestClass(playerid,classid)
{
if (classid == 3 && !IsPlayerAdmin(playerid))
{
SendClientMessage(playerid, COLOR_RED, "Ovaj skin je samo za admine!");
return 0;
}
return 1;
}
```
## Zabilješke
:::tip
Ovaj callback je također pozvan kada igrač pritisne F4.
:::
## Srodne Funkcije
- [AddPlayerClass](../functions/AddPlayerClass.md): Dodaj klasu.
| openmultiplayer/web/docs/translations/bs/scripting/callbacks/OnPlayerRequestClass.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/callbacks/OnPlayerRequestClass.md",
"repo_id": "openmultiplayer",
"token_count": 487
} | 309 |
---
title: OnTrailerUpdate
description: Ovaj callback je pozvan kada igrač pošalje trailer update.
tags: []
---
## Deskripcija
Ovaj callback je pozvan kada igrač pošalje trailer update.
| Ime | Deskripcija |
| --------- | --------------------------------------- |
| playerid | ID igrača koji je poslao trailer update |
| vehicleid | Trailer koji biva ažuriran |
## Returns
0 - Prekida svako trailer ažuriranje da bude poslano ostalim igračima. Ažuriranje se i dalje šalje igraču za ažuriranje.
1 - Obrađuje trailer ažuriranje normalno i sinhronizira ga između svih igrača.
Uvijek je pozvan prvo u filterskriptama.
## Primjeri
```c
public OnTrailerUpdate(playerid, vehicleid)
{
DetachTrailerFromVehicle(GetPlayerVehicleID(playerid));
return 0;
}
```
## Zabilješke
:::warning
Ovaj callback poziva se vrlo često u sekundi po traileru.Trebali biste se suzdržati od provođenja intenzivnih proračuna ili intenzivnih operacija pisanja / čitanja fajlova u ovom callbacku.
:::
## Srodne Funkcije
- [GetVehicleTrailer](../functions/GetVehicleTrailer.md): Provjeri koji trailer vozilo vuče.
- [IsTrailerAttachedToVehicle](../functions/IsTrailerAttachedToVehicle.md): Provjeri da li je trailer prikvačen za vozilo.
- [AttachTrailerToVehicle](../functions/AttachTrailerToVehicle.md): Prikvači trailer za vozila.
- [DetachTrailerFromVehicle](../functions/DetachTrailerFromVehicle.md): Otkači trailer od vozila.
| openmultiplayer/web/docs/translations/bs/scripting/callbacks/OnTrailerUpdate.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/callbacks/OnTrailerUpdate.md",
"repo_id": "openmultiplayer",
"token_count": 607
} | 310 |
---
title: AttachObjectToVehicle
description: Prikvači objekat za vozilo.
tags: ["vehicle"]
---
## Deskripcija
Prikvači objekat za vozilo.
| Ime | Deskripcija |
| ------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| objectid | ID objekta kojeg želite prikvačiti za vozilo. Zapamtite da je ovo ID objekta, ne modela. Objekat prvo mora biti kreiran preko CreateObject. |
| vehicleid | ID vozila za koje želite prikvačiti objekat. |
| Float:OffsetX | Osa X pomaknuta od vozila do objekta za prikvačiti. |
| Float:OffsetY | Osa Y pomaknuta od vozila do objekta za prikvačiti. |
| Float:OffsetZ | Osa Z pomaknuta od vozila do objekta za prikvačiti. |
| Float:RotX | Pomak X rotacije za objekt. |
| Float:RotY | Pomak Y rotacije za objekt. |
| Float:RotZ | Pomak Z rotacije za objekt. |
## Returns
Ova funkcija ne returna(vraća) nikakve posebne vrijednosti.
## Primjeri
```c
new objectid = CreateObject(...);
new vehicleid = GetPlayerVehicleID(playerid);
AttachObjectToVehicle(objectid, vehicleid, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0);
```
## Zabilješke
:::tip
Objekat prvobitno mora biti kreiran.
:::
:::warning
Kada se vozilo uništi ili respawnuje, prikvačeni predmeti se neće uništiti s njim; ostat će stacionarni na mjestu na kojem je vozilo nestalo i biti ponovno će se prikvačiti na sljedeće vozilo kako bi zatražili ID vozila na koje su predmeti prikvačeni.
:::
## Related Functions
- [AttachObjectToPlayer](AttachObjectToPlayer): Prikvači objekat za igrača.
- [AttachObjectToObject](AttachObjectToObject): Prikvači objekat za objekat.
- [AttachPlayerObjectToPlayer](AttachPlayerObjectToPlayer): Prikvači player-objekat za igrača.
- [CreateObject](CreateObject): Kreiraj objekat.
- [DestroyObject](DestroyObject): Uništi objekat.
- [IsValidObject](IsValidObject): Provjerava da li je određeni objekat validan.
- [MoveObject](MoveObject): Pomjeri objekat.
- [StopObject](StopObject): Zaustavi objekat od kretanja.
- [SetObjectPos](SetObjectPos): Postavi poziciju objekta.
- [SetObjectRot](SetObjectRot): Postavi rotaciju objekta.
- [GetObjectPos](GetObjectPos): Lociraj objekat.
- [GetObjectRot](GetObjectRot): Provjeri rotaciju objekta.
- [CreatePlayerObject](CreatePlayerObject): Kreiraj objekat samo za jednog igrača.
- [DestroyPlayerObject](DestroyPlayerObject): Uništi player-objekat.
- [IsValidPlayerObject](IsValidPlayerObject): Provjerava da li je određeni player-objekat validan.
- [MovePlayerObject](MovePlayerObject): Pomjeri player objekat.
- [StopPlayerObject](StopPlayerObject): Zaustavi player-objekat od kretanja.
- [SetPlayerObjectPos](SetPlayerObjectPos): Postavi poziciju player-objekta.
- [SetPlayerObjectRot](SetPlayerObjectRot): Postavi rotaciju player-objekta.
- [GetPlayerObjectPos](GetPlayerObjectPos): Lociraj player objekat.
- [GetPlayerObjectRot](GetPlayerObjectRot): Provjeri rotaciju player-objekta.
| openmultiplayer/web/docs/translations/bs/scripting/functions/AttachObjectToVehicle.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/AttachObjectToVehicle.md",
"repo_id": "openmultiplayer",
"token_count": 1966
} | 311 |
---
title: Create3DTextLabel
description: Kreira 3D Text Label na određenoj lokaciji u svijetu.
tags: ["3dtextlabel"]
---
:::warning
Ova funkcija je dodana u SA-MP 0.3.a i ne radi u nižim verzijama!
:::
## Deskripcija
Kreira 3D Text Label na određenoj lokaciji u svijetu.
| Ime | Deskripcija |
| ------------ | -------------------------------------------------------------------------- |
| text[] | Početni tekstualni niz. |
| color | Boja texta, kao cjelobrojni ili hexadcimalni u RGBA formatu |
| x | X-Kordinata |
| y | Y-Kordinata |
| z | Z-Kordinata |
| DrawDistance | Udaljenost od mjesta na kojem možete vidjeti 3D text Label |
| VirtualWorld | Virtualni svijet u kojem je moguće vidjeti 3d Text |
| testLOS | 0/1 Testirajte vidokrug tako da se ovaj tekst ne može vidjeti kroz objekte |
## Returns
ID novokreiranog 3D Text Labela, ili INVALID_3DTEXT_ID ako je dostignut 3D Text Label limit (MAX_3DTEXT_GLOBAL).
## Primjeri
```c
public OnGameModeInit()
{
Create3DTextLabel("Ja sam na kordinatama:\n30.0, 40.0, 50.0", 0x008080FF, 30.0, 40.0, 50.0, 40.0, 0, 0);
return 1;
}
```
## Zabilješke
:::tip
drawdistance se čini da je mnogo manja prilikom spectateanja
:::
:::tip
Upotrijebite ugrađivanje boja za više boja u tekstu.
:::
:::warning
Ako je text[] prazan, server/clients pored teksta če možda crashati! Ako je virtualworld postavljen na -1 tekst se neće pojaviti.
:::
## Srodne Funkcije
- [Delete3DTextLabel](Delete3DTextLabel): Obriši 3D text label.
- [Attach3DTextLabelToPlayer](Attach3DTextLabelToPlayer): Prikvači 3D text label za igrača.
- [Attach3DTextLabelToVehicle](Attach3DTextLabelToVehicle): Prikvači 3D text label za vozilo.
- [Update3DTextLabelText](Update3DTextLabelText): Promijeni tekst 3D text labela.
- [CreatePlayer3DTextLabel](CreatePlayer3DTextLabel): Kreiraj 3D text label za jednog igrača.
- [DeletePlayer3DTextLabel](DeletePlayer3DTextLabel): Obriši igračev 3D text label.
- [UpdatePlayer3DTextLabelText](UpdatePlayer3DTextLabelText): Promijeni tekst igračevog 3D text labela.
| openmultiplayer/web/docs/translations/bs/scripting/functions/Create3DTextLabel.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/Create3DTextLabel.md",
"repo_id": "openmultiplayer",
"token_count": 1259
} | 312 |
---
title: DestroyMenu
description: Uništava navedeni meni.
tags: ["menu"]
---
## Deskripcija
Uništava navedeni meni.
| Ime | Deskripcija |
| ------ | ---------------------- |
| menuid | ID meni-a za uništiti |
## Returns
Tačno ukoliko je uspješno uništen, u protivnom netačno
## Primjeri
```c
new Menu:examplemenu;
examplemenu = CreateMenu("Your Menu", 2, 200.0, 100.0, 150.0, 150.0);
// ...
DestroyMenu(examplemenu);
```
## Srodne Funkcije
- [CreateMenu](CreateMenu): Kreiraj meni.
- [SetMenuColumnHeader](SetMenuColumnHeader): Postavi zaglavlje za jednu kolonu u meniju.
- [AddMenuItem](AddMenuItem): Dodaj artikal u meni.
- [OnPlayerSelectedMenuRow](../callbacks/OnPlayerSelectedMenuRow): Pozvano kada igrač odabere red u meniju.
- [OnPlayerExitedMenu](../callbacks/OnPlayerExitedMenu): Pozvano kada igrač napusti meni.
| openmultiplayer/web/docs/translations/bs/scripting/functions/DestroyMenu.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/DestroyMenu.md",
"repo_id": "openmultiplayer",
"token_count": 342
} | 313 |
---
title: EnablePlayerCameraTarget
description: Uključite ili isključite funkcije ciljanja kamere za igrača.
tags: ["player"]
---
:::warning
Ova funkcija je dodana u SA-MP 0.3.7 i ne radi u nižim verzijama!
:::
## Deskripcija
Uključite ili isključite funkcije ciljanja kamere za igrača. Po zadanim postavkama onemogućeno radi uštede propusnosti.
| Ime | Deskripcija |
| -------- | -------------------------------------------------------------------- |
| playerid | ID igrača za kojeg se uključuje/isključuje funkcija ciljanja kamere. |
| enable | 1 da uključite funkciju ciljanja kamere i 0 da je isključite. |
## Returns
1: Funkcija uspješno izvršena.
0: Funkcija neuspješno izvršena. Igrač nije konektovan.
## Primjeri
```c
public OnPlayerConnect(playerid)
{
EnablePlayerCameraTarget(playerid, 1);
return 1;
}
```
## Srodne Funkcije
- [GetPlayerCameraTargetVehicle](GetPlayerCameraTargetVehicle): Dobij ID vozila u kojeg igrač gleda.
- [GetPlayerCameraTargetPlayer](GetPlayerCameraTargetPlayer): Dobij ID igrača u kojeg igrač gleda.
- [GetPlayerCameraFrontVector](GetPlayerCameraFrontVector): Dobij prednji vektor kamere igrača.
| openmultiplayer/web/docs/translations/bs/scripting/functions/EnablePlayerCameraTarget.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/EnablePlayerCameraTarget.md",
"repo_id": "openmultiplayer",
"token_count": 524
} | 314 |
---
title: GangZoneHideForAll
description: GangZoneHideForAll sakriva gangzonu za sve igrače.
tags: ["gangzone"]
---
## Deskripcija
GangZoneHideForAll sakriva gangzonu za sve igrače.
| Ime | Deskripcija |
| ---- | --------------- |
| zone | Zone za skriti. |
## Returns
Ova funkcija ne returna (vraća) nikakve posebne vrijednosti.
## Primjeri
```c
new gGangZoneId;
gGangZoneId = GangZoneCreate(1248.011, 2072.804, 1439.348, 2204.319);
GangZoneHideForAll(gGangZoneId);
```
## Srodne Funkcije
- [GangZoneCreate](GangZoneCreate): Kreiraj gangzonu.
- [GangZoneDestroy](GangZoneDestroy): Uništi gang zonu.
- [GangZoneShowForPlayer](GangZoneShowForPlayer): Prikaži gang zonu za igrača.
- [GangZoneShowForAll](GangZoneShowForAll): Prikaži gang zonu za sve igrače.
- [GangZoneHideForPlayer](GangZoneHideForPlayer): Sakrij gangzonu za igrača.
- [GangZoneFlashForPlayer](GangZoneFlashForPlayer): Kreiraj bljeskalicu gang zone za igrača.
- [GangZoneFlashForAll](GangZoneFlashForAll): Kreiraj bljeskalicu gang zone za sve igrače.
- [GangZoneStopFlashForPlayer](GangZoneStopFlashForPlayer): Zaustavi gang zonu da bljeska za igrača.
- [GangZoneStopFlashForAll](GangZoneStopFlashForAll): Zaustavi gang zonu da bljeska za sve igrače.
| openmultiplayer/web/docs/translations/bs/scripting/functions/GangZoneHideForAll.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/GangZoneHideForAll.md",
"repo_id": "openmultiplayer",
"token_count": 512
} | 315 |
---
title: GetMaxPlayers
description: Returna maksimalni broj igrača koji se mogu pridružiti serveru, određeno varijablom servera 'maxplayers'
tags: ["player"]
---
## Deskripcija
Returna maksimalni broj igrača koji se mogu pridružiti serveru, postavljeno varijablom servera 'maxplayers' u server.cfg.
## Primjeri
```c
new str[128];
format(str, sizeof(str), "Na ovom serveru ima %i slotova!", GetMaxPlayers());
SendClientMessage(playerid, 0xFFFFFFFF, str);
```
## Bilješke
:::warning
Ova funkcija se ne može koristiti umjesto MAX_PLAYERS. Ne može se koristiti u vrijeme kompajlovanja (npr. za array sizes). MAX_PLAYERS uvijek treba redefinirati na ono što će biti var 'maxplayers' ili više. Pogledajte funkciju MAX_PLAYERS za više informacija.
:::
## Srodne Funkcije
- [GetPlayerPoolSize](GetPlayerPoolSize): Dobij najveći ID igrača koji je povezan na server.
- [IsPlayerConnected](IsPlayerConnected): Provjeri da li je igrač povezan na server.
| openmultiplayer/web/docs/translations/bs/scripting/functions/GetMaxPlayers.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/GetMaxPlayers.md",
"repo_id": "openmultiplayer",
"token_count": 376
} | 316 |
---
title: GetPlayerSurfingObjectID
description: Vraća ID objekta na kojem igrač surfa.
tags: ["player"]
---
## Deskripcija
Vraća ID objekta na kojem igrač surfa.
| Ime | Deskripcija |
| -------- | ---------------------------- |
| playerid | ID igrača za dobiti objekat. |
## Returns
ID objekta u pokretu kojim igrač surfuje. Ako igrač ne surfuje pokretnim objektom, vratit će INVALID_OBJECT_ID
## Primjeri
```c
/* kada igrač napše 'objectsurfing' u chat box, vidjeti će ovo.*/
public OnPlayerText(playerid, text[])
{
if (strcmp(text, "objectsurfing", true) == 0)
{
new
szMessage[30];
format(szMessage, sizeof(szMessage), "Ti surfaš na objektu #%d.", GetPlayerSurfingObjectID(playerid));
SendClientMessage(playerid, 0xA9C4E4FF, szMessage);
}
return 0;
}
```
## Srodne Funkcije
| openmultiplayer/web/docs/translations/bs/scripting/functions/GetPlayerSurfingObjectID.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/GetPlayerSurfingObjectID.md",
"repo_id": "openmultiplayer",
"token_count": 390
} | 317 |
---
title: GetSVarInt
description: Dobija cjelobrojnu vrijednost server varijable.
tags: []
---
:::warning
Ova funkcija je dodana u SA-MP 0.3.7 R2 i ne radi u nižim verzijama!
:::
## Deskripcija
Dobija cjelobrojnu vrijednost server varijable.
| Ime | Deskripcija |
| ------- | ----------------------------------------------------------------------------------- |
| varname | Ime server varijable (osjetljivo na mala i velika slova). Dodijeljeno u SetSVarInt. |
## Returns
Cijelobrojna vrijednost navedene varijable servera. I dalje će vraćati 0 ako varijabla nije postavljena.
## Primjeri
```c
// postavi "Version"
SetSVarInt("Version", 37);
// ispisati će verziju koju server ima
printf("Version: %d", GetSVarInt("Version"));
```
## Srodne Funkcije
- [SetSVarInt](SetSVarInt): Postavite cijeli broj za varijablu servera.
- [SetSVarString](SetSVarString): Postavite string za server varijablu.
- [GetSVarString](GetSVarString): Dobij prethodno postavljeni string iz server varijable.
- [SetSVarFloat](SetSVarFloat): Postavi float za server varijablu.
- [GetSVarFloat](GetSVarFloat): Dobij prethodno postavljeni float iz server varijable.
- [DeleteSVar](DeleteSVar): Obriši server varijablu.
| openmultiplayer/web/docs/translations/bs/scripting/functions/GetSVarInt.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/GetSVarInt.md",
"repo_id": "openmultiplayer",
"token_count": 539
} | 318 |
---
title: GetVehicleModelInfo
description: Dohvatite informacije o određenom modelu vozila, poput veličine ili položaja sjedala.
tags: ["vehicle"]
---
## Deskripcija
Dohvatite informacije o određenom modelu vozila, poput veličine ili položaja sjedala.
| Ime | Deskripcija |
| ------------ | ----------------------------------- |
| vehiclemodel | Model vozila za dobiti informacije. |
| infotype | Tip informacije za dobiti. |
| &Float:X | Float za pohraniti X vrijednost. |
| &Float:Y | Float za pohraniti Y vrijednost. |
| &Float:Z | Float za pohraniti Z vrijednost. |
## Returns
Informacije vozila su pohranjene u navedenim varijablama.
## Primjeri
```c
new
Float: x, Float: y, Float: z;
//Dobij veličinu modela 411 (Infernus)
GetVehicleModelInfo(411, VEHICLE_MODEL_INFO_SIZE, x, y, z);
//Ispiši "infernus je širok 2.3m, 5.7m dug i visok 1.3m" u konzolu
printf("infernus je širok %.1fm, %.1fm dug i visok %.1fm", X, Y, Z);
```
## Srodne Funkcije
- [GetVehicleModel](GetVehicleModel): Dobij ID modela vozila.
| openmultiplayer/web/docs/translations/bs/scripting/functions/GetVehicleModelInfo.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/GetVehicleModelInfo.md",
"repo_id": "openmultiplayer",
"token_count": 510
} | 319 |
---
title: HideMenuForPlayer
description: Sakriva meni za igrača.
tags: ["player", "menu"]
---
## Deskripcija
Sakriva meni za igrača.
| Ime | Deskripcija |
| -------- | ------------------------------------------------------------------------------------ |
| menuid | ID menija za sakriti. Vraćen od CreateMenu i proslijeđen do OnPlayerSelectedMenuRow. |
| playerid | ID igrača za kojeg će meni biti sakriven. |
## Returns
1: Funkcija uspješno izvršena.
0: Funkcija neuspješno izvršena.
## Primjeri
```c
if (strcmp(cmdtext, "/menuhide", true) == 0)
{
new Menu: myMenu = GetPlayerMenu(playerid);
HideMenuForPlayer(myMenu, playerid);
return 1;
}
```
## Zabilješke
:::tip
Ruši/crasha i server i igrača ako je dat nevažeći ID menija.
:::
## Srodne Funkcije
- [CreateMenu](CreateMenu): Kreiraj meni.
- [AddMenuItem](AddMenuItem): Dodaje artikal u određeni meni.
- [SetMenuColumnHeader](SetMenuColumnHeader): Postavi zaglavlje za jednu kolonu u meniju.
- [ShowMenuForPlayer](ShowMenuForPlayer): Prikaži meni za igrača.
| openmultiplayer/web/docs/translations/bs/scripting/functions/HideMenuForPlayer.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/HideMenuForPlayer.md",
"repo_id": "openmultiplayer",
"token_count": 539
} | 320 |
---
title: IsPlayerNPC
description: Provjerava ako je igrač pravi igrač ili NPC.
tags: ["player", "npc"]
---
## Deskripcija
Provjerava ako je igrač pravi igrač ili NPC.
| Ime | Deskripcija |
| -------- | ---------------------- |
| playerid | ID igrača za provjeru. |
## Returns
1: Igrač je NPC.
0: Igrač nije NPC (pravi je igrač).
## Primjeri
```c
public OnPlayerConnect(playerid)
{
if (IsPlayerNPC(playerid))
{
SendClientMessageToAll(-1, "NPC se konektovao!");
return 1;
}
// Drugi kod ovdje neće biti izvršen osim ako je igrač
}
```
## Srodne Funkcije
- [ConnectNPC](ConnectNPC): Konektujte NPC-a.
- [IsPlayerAdmin](IsPlayerAdmin): Provjerava da li je igrač prijavljen/ulogovan u RCON.
| openmultiplayer/web/docs/translations/bs/scripting/functions/IsPlayerNPC.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/IsPlayerNPC.md",
"repo_id": "openmultiplayer",
"token_count": 338
} | 321 |
---
title: ManualVehicleEngineAndLights
description: Koristite ovu funkciju prije nego što se bilo koji igrač poveže (OnGameModeInit) kako biste svim klijentima rekli da će skripta kontrolirati motore i svjetla vozila.
tags: ["vehicle"]
---
## Deskripcija
Koristite ovu funkciju prije nego što se bilo koji igrač poveže (OnGameModeInit) kako biste svim klijentima rekli da će skripta kontrolirati motore i svjetla vozila.Ovo sprečava da igra automatski uključuje/isključuje motor kada igrači ulaze/izlaze iz vozila i kada se farovi automatski pale kad je mrak.
## Primjeri
```c
public OnGameModeInit()
{
ManualVehicleEngineAndLights();
return 1;
}
```
## Zabilješke
:::tip
Ovu funkciju nije moguće preokrenuti nakon što je korištena. Morate ga koristiti ili ne koristiti.
:::
## Srodne Funkcije
- [SetVehicleParamsEx](SetVehicleParamsEx): Postavlja parametre vozila za sve igrače.
- [GetVehicleParamsEx](GetVehicleParamsEx): Dobij parametre vozila.
- [SetVehicleParamsForPlayer](SetVehicleParamsForPlayer): Postavi parametre vozila za igrača.
| openmultiplayer/web/docs/translations/bs/scripting/functions/ManualVehicleEngineAndLights.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/ManualVehicleEngineAndLights.md",
"repo_id": "openmultiplayer",
"token_count": 446
} | 322 |
---
title: PlayerSpectateVehicle
description: Postavlja igrača da spectate-a (nadgleda) neko vozilo.
tags: ["player", "vehicle"]
---
## Deskripcija
Postavlja igrača da spectate-a (nadgleda) neko vozilo. Njegova kamera će biti prikvačena za vozilo ako ga neko vozi.
| Ime | Deskripcija |
| --------------- | ------------------------------------------------------------------------------------------------------------------- |
| playerid | ID igrača koji će nadgledati vozilo. |
| targetvehicleid | ID vozila kojeg će igrač nadgledati. |
| mode | [Način/tip](../resources/spectatemodes). Općenito se može ostaviti prazno jer je prema zadanim postavkama 'normal'. |
## Returns
1: Funkcija uspješno izvršena. Imajte na umu da se uspjeh prijavljuje ako igrač nije u režimu gledatelja (TogglePlayerSpectating), ali ništa se neće dogoditi. TogglePlayerSpectating MORA se prvo koristiti.
0: Funkcija neuspješno izvršena. Igrač, vozilo ili oboje ne postoje.
## Primjeri
```c
TogglePlayerSpectating(playerid, 1);
PlayerSpectateVehicle(playerid, vehicleid);
```
## Zabilješke
:::warning
Red je KRITIČAN! Obavezno koristite TogglePlayerSpectating prije PlayerSpectateVehicle. Igrač i vozilo moraju biti u istom unutrašnjosti i virtualnom svijetu da bi ova funkcija radila ispravno.
:::
## Srodne Funkcije
- [PlayerSpectatePlayer](PlayerSpectatePlayer): Nadgledaj igrača.
- [TogglePlayerSpectating](TogglePlayerSpectating): Počni ili prekini spectate-ovati (nadgledati).
| openmultiplayer/web/docs/translations/bs/scripting/functions/PlayerSpectateVehicle.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/PlayerSpectateVehicle.md",
"repo_id": "openmultiplayer",
"token_count": 849
} | 323 |
---
title: PlayerTextDrawSetString
description: Promijeni tekst player-textdrawa.
tags: ["player", "textdraw", "playertextdraw"]
---
## Deskripcija
Promijeni tekst player-textdrawa.
| Ime | Deskripcija |
| -------- | ------------------------------------------- |
| playerid | ID igrača čijem textdrawu se mijenja tekst. |
| text | ID textdrawa za promijeniti. |
| string[] | Novi string za textdraw. |
## Returns
Ova funkcija ne returna (vraća) nikakve posebne vrijednosti.
## Primjeri
```c
new pVehicleHealthTimer[MAX_PLAYERS];
new PlayerText:pVehicleHealthTD[MAX_PLAYERS];
public OnPlayerStateChange(playerid, PLAYER_STATE:newstate, PLAYER_STATE:oldstate)
{
if (newstate == 2) // Ušao u vozilo kao vozač
{
pVehicleHealthTD[playerid] = CreatePlayerTextDraw(playerid, x, y, " ");
PlayerTextDrawShow(playerid, pVehicleHealthTD[playerid]);
// Postavite tajmer za ažuriranje textdrawa svake sekunde
pVehicleHealthTimer[playerid] = SetTimerEx("vhealth_td_update", 1000, true, "i", playerid);
}
if (oldstate == 2)
{
KillTimer(pVehicleHealthTD[playerid]);
PlayerTextDrawDestroy(playerid, pVehicleHealthTD[playerid]);
}
}
public vhealth_td_update(playerid)
{
new tdstring[32], Float:vHealth;
GetVehicleHealth(GetPlayerVehicleID(playerid), vHealth);
format(tdstring, sizeof(tdstring), "Vehicle Health: %0f", vHealth);
PlayerTextDrawSetString(playerid, pVehicleHealthTD[playerid], tdstring); // <<< Ažurirajte tekst da biste prikazali stanje vozila
return 1;
}
/*
NOTE: Ovaj primjer je isključivo u demonstracijske svrhe i nije zajamčeno da će raditi u igri. To je samo za prikaz upotrebe funkcije PlayerTextDrawSetString.
*/
```
## Zabilješke
:::tip
Ne morate ponovo prikazivati TextDraw da biste primijenili promjene.
:::
:::warning
Postoje ograničenja dužine stringova za textdraw! Pogledajte Ograničenja za više informacija.
:::
## Srodne Funkcije
- [CreatePlayerTextDraw](CreatePlayerTextDraw): Kreiraj player-textdraw.
- [PlayerTextDrawDestroy](PlayerTextDrawDestroy): Uništi player-textdraw.
- [PlayerTextDrawColor](PlayerTextDrawColor): Postavi boju teksta u player-textdrawu.
- [PlayerTextDrawBoxColor](PlayerTextDrawBoxColor): Postavi boju box-a od player-textdrawa.
- [PlayerTextDrawBackgroundColor](PlayerTextDrawBackgroundColor): Postavi boju pozadine player-textdrawa.
- [PlayerTextDrawAlignment](PlayerTextDrawAlignment): Postavi poravnanje player-textdrawa.
- [PlayerTextDrawFont](PlayerTextDrawFont): Postavi font player-textdrawa.
- [PlayerTextDrawLetterSize](PlayerTextDrawLetterSize): Postavi veličinu slova u tekstu player-textdrawa.
- [PlayerTextDrawTextSize](PlayerTextDrawTextSize): Postavi veličinu box-a player-textdrawa (ili dijela koji reaguje na klik za PlayerTextDrawSetSelectable).
- [PlayerTextDrawSetOutline](PlayerTextDrawSetOutline): Omogući/onemogući korišćenje outline-a za player-textdraw.
- [PlayerTextDrawSetShadow](PlayerTextDrawSetShadow): Postavi sjenu na player-textdraw.
- [PlayerTextDrawSetProportional](PlayerTextDrawSetProportional): Razmjeri razmak teksta u player-textdrawu na proporcionalni omjer.
- [PlayerTextDrawUseBox](PlayerTextDrawUseBox): Omogući/onemogući korišćenje box-a za player-textdraw.
- [PlayerTextDrawShow](PlayerTextDrawShow): Prikaži player-textdraw.
- [PlayerTextDrawHide](PlayerTextDrawHide): Sakrij player-textdraw.
| openmultiplayer/web/docs/translations/bs/scripting/functions/PlayerTextDrawSetString.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/PlayerTextDrawSetString.md",
"repo_id": "openmultiplayer",
"token_count": 1328
} | 324 |
---
title: SelectTextDraw
description: Prikaži miš i dozvoli igraču da selektuje textdraw.
tags: ["textdraw"]
---
## Deskripcija
Prikaži miš i dozvoli igraču da selektuje textdraw.
| Ime | Deskripcija |
| ---------- | ------------------------------------------------------------- |
| playerid | ID igrača koji može selektovati textdraw. |
| hovercolor | Boja textdrawa prilikom prelaska preko njega sa mišem (RGBA). |
## Returns
Ova funkcija ne returna (vraća) nikakve posebne vrijednosti.
## Primjeri
```c
public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp(cmdtext, "/tdselect", true))
{
SelectTextDraw(playerid, 0x00FF00FF); // Označite zeleno kada zadržite pokazivač iznad
SendClientMessage(playerid, 0xFFFFFFFF, "SERVER: Molimo selektujte textdraw!");
return 1;
}
return 0;
}
```
## Zabilješke
:::tip
TEKST će biti istaknut kada zadržite pokazivač, a NE okvir (ako je jedan prikazan).
:::
## Srodne Funkcije
- [CancelSelectTextDraw](CancelSelectTextDraw): Prekida selekciju textdrawa sa mišem.
- [TextDrawSetSelectable](TextDrawSetSelectable): Postavlja da li je textdraw klikljiv prilikom SelectTextDraw.
- [PlayerTextDrawSetSelectable](PlayerTextDrawSetSelectable): Postavlja da li je player-textdraw klikljiv prilikom SelectTextDraw.
- [OnPlayerClickTextDraw](../callbacks/OnPlayerClickTextDraw): Pozvano kada igrač klikne na textdraw.
- [OnPlayerClickPlayerTextDraw](../callbacks/OnPlayerClickPlayerTextDraw): Pozvano kada igrač klikne na player-textdraw.
| openmultiplayer/web/docs/translations/bs/scripting/functions/SelectTextDraw.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/SelectTextDraw.md",
"repo_id": "openmultiplayer",
"token_count": 680
} | 325 |
---
title: SetGravity
description: Postavi gravitaciju za sve igrače.
tags: []
---
## Deskripcija
Postavi gravitaciju za sve igrače.
| Ime | Deskripcija |
| ------------- | ----------------------------------------------------------------------------- |
| Float:gravity | Vrijednost na koju bi gravitacija trebala biti postavljena (između -50 i 50). |
## Returns
Ova funkcija uvijek returna (vraća) 1, čak i kada se neuspješno izvrši ako je gravitacija iznad limita (manja od -50 ili veća od +50).
## Primjeri
```c
public OnGameModeInit()
{
// Postavi gravitaciju kao na mjesecu
SetGravity(0.001);
return 1;
}
```
## Zabilješke
:::warning
Zadana gravitacija je 0.008.
:::
## Srodne Funkcije
- [GetGravity](GetGravity): Dobij trenutno postavljenu gravitaciju.
- [SetWeather](SetWeather): Postavite globalno vrijeme (weather).
- [SetWorldTime](SetWorldTime): Postavi globalno vrijeme servera.
| openmultiplayer/web/docs/translations/bs/scripting/functions/SetGravity.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/SetGravity.md",
"repo_id": "openmultiplayer",
"token_count": 442
} | 326 |
---
title: SetPlayerAttachedObject
description: Prikvači objekat na određenu kost igrača.
tags: ["player"]
---
## Deskripcija
Prikvači objekat na određenu kost igrača.
| Ime | Deskripcija |
| -------------- | ---------------------------------------------------------------------------------------- |
| playerid | ID igrača za prikvačiti objekat. |
| index | Index (slot) za dodijeliti objekat (0-9 od 0.3d, 0-4 u ranijim verzijama). |
| modelid | Model kojeg želite koristiti. |
| bone | [Kost](../resources/boneid) za koju želite prikvačiti objekat. |
| fOffsetX | (neobavezno) Pomak osi X za položaj objekta. |
| fOffsetY | (neobavezno) Pomak osi Y za položaj objekta. |
| fOffsetZ | (neobavezno) Pomak osi Z za položaj objekta. |
| fRotX | (neobavezno) Pomak osi X za rotaciju objekta. |
| fRotY | (neobavezno) Pomak osi Y za rotaciju objekta. |
| fRotZ | (neobavezno) Pomak osi Z za rotaciju objekta. |
| fScaleX | (optional) Pomak osi X za veličinu objekta. |
| fScaleY | (optional) Pomak osi Y za veličinu objekta. |
| fScaleZ | (optional) Pomak osi Z za veličinu objekta. |
| materialcolor1 | (optional) Primarna boja za postaviti objektu, kao cijeli broj ili hex u ARGB formatu. |
| materialcolor2 | (optional) Sekundarna boja za postaviti objektu, kao cijeli broj ili hex u ARGB formatu. |
## Returns
1 uspješno, 0 pri grešci.
## Primjeri
```c
public OnPlayerSpawn(playerid)
{
SetPlayerAttachedObject(playerid, 3, 1609, 2); // Prikvači kornjaču za playerid-evu glavu, in slou 3
// Primjer korištenja boja na objektu koje je prikvačen za igrača:
SetPlayerAttachedObject(playerid, 3, 19487, 2, 0.101, -0.0, 0.0, 5.50, 84.60, 83.7, 1.0, 1.0, 1.0, 0xFF00FF00);
// Prikvači bijeli šešir na glavu igrača i oboji ga u zeleno
return 1;
}
```
## Zabilješke
:::tip
Ova je funkcija odvojena od spremišta CreateObject / CreatePlayerObject.
:::
:::warning
U 0.3d verziji pa nadalje, 10 objekata se može prikvačiti za jednog igrača (index 0-9). U ranijim verzijama, limit je 5 (index 0-4).
:::
## Srodne Funkcije
- [RemovePlayerAttachedObject](RemovePlayerAttachedObject): Ukloni prikvačeni objekat sa igrača
- [IsPlayerAttachedObjectSlotUsed](IsPlayerAttachedObjectSlotUsed): Provjeri da li je objekat prikvačen za igrača u oređenom indexu.
- [EditAttachedObject](EditAttachedObject): Uredi prikvačeni objekat.
| openmultiplayer/web/docs/translations/bs/scripting/functions/SetPlayerAttachedObject.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/SetPlayerAttachedObject.md",
"repo_id": "openmultiplayer",
"token_count": 1733
} | 327 |
---
title: SetPlayerObjectMaterialText
description: Zamijeni teksturu player objekta sa tekstom.
tags: ["player"]
---
## Deskripcija
Zamijeni teksturu player objekta sa tekstom.
| Ime | Deskripcija |
| ------------- | ------------------------------------------------------------------------- |
| playerid | ID igrača čijem player-objektu želite promijeniti teksturu. |
| objectid | ID objekta na kojeg želite postaviti tekst. |
| text | Tekst za postaviti. |
| materialindex | Index materijala za zamijeniti sa tekstom (DEFAULT: 0). |
| materialsize | [Veličina](../resources/materialtextsizes) materijala (DEFAULT: 256x128). |
| fontface | Font za koristiti (DEFAULT: Arial). |
| fontsize | Veličina teksta (DEFAULT: 24) (MAX 255). |
| bold | Bold text. Postavi na 1 za bold (deblje), 0 za ne (DEFAULT: 1). |
| fontcolor | Boja teksta (DEFAULT: White). |
| backcolor | Boja pozadine (DEFAULT: Ništa (transparent)). |
| textalignment | [Poravnanje](../resources/materialtextsizes) teksta (DEFAULT: Left). |
## Returns
Ova funkcija ne returna (vraća) nikakve posebne vrijednosti.
## Primjeri
```c
if (strcmp("/text", cmdtext, true) == 0)
{
new myObject = CreatePlayerObject(playerid, 19353, 0, 0, 10, 0.0, 0.0, 90.0); // kreiraj objekat
SetPlayerObjectMaterialText(playerid, myObject, "SA-MP {FFFFFF}0.3{008500}e {FF8200}RC7", 0, OBJECT_MATERIAL_SIZE_256x128,\
"Arial", 28, 0, 0xFFFF8200, 0xFF000000, OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
// napiši "SA-MP 0.3e RC7" na objekat, sa narandžastom bojom fonta i crnom pozadinom
return 1;
}
```
## Zabilješke
:::tip
Ugradnja boja može se koristiti za više boja u tekstu.
:::
## Srodne Funkcije
- [SetObjectMaterialText](SetObjectMaterialText): Zamijeni teksturu objekta sa tekstom.
- [SetPlayerObjectMaterial](SetPlayerObjectMaterial): Zamijeni teksturu player objekta sa teksturom drugog modela iz igre.
## Filterskripte koje podržavaju teksturisanje/text
- Ultimate Creator od Nexius
- Texture Studio od \[uL\]Pottus
- Fusez's Map Editor od RedFusion
- Map Editor I od adri1
| openmultiplayer/web/docs/translations/bs/scripting/functions/SetPlayerObjectMaterialText.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/SetPlayerObjectMaterialText.md",
"repo_id": "openmultiplayer",
"token_count": 1198
} | 328 |
---
title: SetPlayerVirtualWorld
description: Postavite virtualni svijet igrača.
tags: ["player"]
---
## Deskripcija
Postavite virtualni svijet igrača. Mogu vidjeti samo one igrače i vozila koji su u istom svijetu.
| Ime | Deskripcija |
| -------- | ---------------------------------------- |
| playerid | ID igrača za postaviti virutalni svijet. |
| worldid | ID virtualnog svijeta za ubaciti igrača. |
## Returns
1: Funkcija uspješno izvršena.
0: Funkcija neuspješno izvršena. Ovo znači da igrač nije konektovan.
## Primjeri
```c
if (strcmp(cmdtext, "/world3", true) == 0)
{
SetPlayerVirtualWorld(playerid, 3);
return 1;
}
```
## Zabilješke
:::tip
Zadani virtualni svijet je 0.
:::
## Srodne Funkcije
- [GetPlayerVirtualWorld](GetPlayerVirtualWorld): Provjerava u kojem je igrač virtualnom svijetu.
- [SetVehicleVirtualWorld](SetVehicleVirtualWorld): Postavi virtualni svijet vozila.
| openmultiplayer/web/docs/translations/bs/scripting/functions/SetPlayerVirtualWorld.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/SetPlayerVirtualWorld.md",
"repo_id": "openmultiplayer",
"token_count": 395
} | 329 |
---
title: SetVehicleParamsEx
description: Postavlja parametre vozila za sve igrače.
tags: ["vehicle"]
---
## Deskripcija
Postavlja parametre vozila za sve igrače.
| Ime | Deskripcija |
| --------- | --------------------------------------------------------------------------------------- |
| vehicleid | ID vozila za postaviti parametre. |
| engine | Status motora. 0 - Ugašen, 1 - Upaljen. |
| lights | Status svjetla. 0 - Ugašena, 1 - Upaljena. |
| alarm | Status alarma vozila. Ako je uključen, alarm počinje. 0 - Ugašen, 1 - Upaljen. |
| doors | Status zaključavanja vrata. 0 - Otključana, 1 - Zaključana. |
| bonnet | Status haube (hood). 0 - Zatvorena, 1 - Otvorena. |
| boot | Status gepeka (boot). 0 - Zatvoren, 1 - Otvoren. |
| objective | Omogući/onemogući ciljnu (objective) strelicu iznad vozila. 0 - Onemogući, 1 - Omogući. |
## Returns
1: Funkcija uspješno izvršena.
0: Funkcija neuspješno izvršena. Ovo znači da vozilo ne postoji.
## Primjeri
```c
// Na vrhu naše skripte, deklarišemo globalnu varijablu
new
gVehicleAlarmTimer[MAX_VEHICLES] = {0, ...};
// Ako postavljate jedan parametar, trebali biste dobiti trenutne parametre kako se ne bi SVE promijenili
new
engine, lights, alarm, doors, bonnet, boot, objective;
// Negdje gdje kreirate vozilo..
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, VEHICLE_PARAMS_ON, lights, alarm, doors, bonnet, boot, objective); // SAMO parametar motora je promijenjen u VEHICLE_PARAMS_ON (1)
// Funkcija
SetVehicleParamsEx_Fixed(vehicleid, &engine, &lights, &alarm, &doors, &bonnet, &boot, &objective)
{
SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
if (alarm)
{
// Ubij tajmer, resetirajte identifikator tajmera, a zatim ga ponovo pokrenite ako je već bio pokrenut
KillTimer(gVehicleAlarmTimer[vehicleid]);
gVehicleAlarmTimer[vehicleid] = 0;
gVehicleAlarmTimer[vehicleid] = SetTimerEx("DisableVehicleAlarm", 20000, false, "d", vehicleid);
}
}
forward DisableVehicleAlarm(vehicleid);
public DisableVehicleAlarm(vehicleid)
{
new
engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
if (alarm == VEHICLE_PARAMS_ON)
{
SetVehicleParamsEx(vehicleid, engine, lights, VEHICLE_PARAMS_OFF, doors, bonnet, boot, objective);
}
// Reset the timer identifier
gVehicleAlarmTimer[vehicleid] = 0;
}
```
## Zabilješke
:::tip
Alarm se neće resetirati po završetku, morat ćete ga resetirati sami pomoću ove funkcije. Svjetla rade i danju (samo kada je omogućen ManualVehicleEngineAndLights).
:::
## Srodne Funkcije
- [GetVehicleParamsEx](GetVehicleParamsEx): Dobij parametre vozila.
- [SetVehicleParamsForPlayer](SetVehicleParamsForPlayer): Postavi parametre vozila za igrača.
- [UpdateVehicleDamageStatus](UpdateVehicleDamageStatus): Ažurirajte štetu na vozilu.
| openmultiplayer/web/docs/translations/bs/scripting/functions/SetVehicleParamsEx.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/SetVehicleParamsEx.md",
"repo_id": "openmultiplayer",
"token_count": 1583
} | 330 |
---
title: StartRecordingPlayerData
description: Počinje snimati pokrete igrača u datoteku, koju NPC može reproducirati.
tags: ["player"]
---
## Deskripcija
Počinje snimati pokrete igrača u datoteku, koju NPC može reproducirati.
| Ime | Deskripcija |
| ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| playerid | ID igrača za snimati. |
| recordtype | [Tip](../resources/recordtypes) snimke. |
| recordname[] | Ime datoteke koja će sadržavati snimljene podatke. Bit će spremljen u direktorij skript datoteka, s automatski dodanom .rec ekstenzijom, morat ćete datoteku premjestiti u npcmodes / snimke da biste je koristili za reprodukciju. |
## Returns
Ova funkcija ne returna (vraća) nikakve posebne vrijednosti.
## Primjeri
```c
if (!strcmp("/recordme", cmdtext))
{
if (GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
{
StartRecordingPlayerData(playerid, PLAYER_RECORDING_TYPE_ONFOOT, "MyFile");
}
else if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
StartRecordingPlayerData(playerid, PLAYER_RECORDING_TYPE_DRIVER, "MyFile");
}
SendClientMessage(playerid, 0xFFFFFFFF, "Svi vaši pokreti su sada zabilježeni!");
return 1;
}
```
## Srodne Funkcije
- [StopRecordingPlayerData](StopRecordingPlayerData): Zaustavlja snimanje podataka sa igrača.
| openmultiplayer/web/docs/translations/bs/scripting/functions/StartRecordingPlayerData.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/StartRecordingPlayerData.md",
"repo_id": "openmultiplayer",
"token_count": 1166
} | 331 |
---
title: TextDrawSetOutline
description: Postavlja debljinu outline-a od texta u textdrawu.
tags: ["textdraw"]
---
## Deskripcija
Postavlja debljinu outline-a od texta u textdrawu. TextDrawBackgroundColor se može koristiti kako biste promijenili boju.
| Ime | Deskripcija |
| ---- | -------------------------------------------------------- |
| text | ID textdrawa za postaviti debljinu outline-a. |
| size | Debljina outline-a, kao cijeli broj. 0 za bez outline-a. |
## Returns
Ova funkcija ne returna (vraća) nikakve posebne vrijednosti.
## Primjeri
```c
new Text: gMyTextdraw;
public OnGameModeInit()
{
gMyTextdraw = TextDrawCreate(100.0, 33.0, "Primjer Textdrawa");
TextDrawSetOutline(gMyTextdraw, 1);
return 1;
}
```
## Zabilješke
:::tip
Ukoliko želite promijeniti outline textdrawa koji je već prikazan, ne morate ga ponovno kreirati. Prosto koristite TextDrawShowForPlayer/TextDrawShowForAll nakon uređivanja i promjena će biti vidljiva.
:::
## Srodne Funkcije
- [TextDrawCreate](TextDrawCreate): Kreiraj textdraw.
- [TextDrawDestroy](TextDrawDestroy): Uništi textdraw.
- [TextDrawColor](TextDrawColor): Postavi boju teksta u textdrawu.
- [TextDrawBoxColor](TextDrawBoxColor): Postavi boju boxa u textdrawu.
- [TextDrawBackgroundColor](TextDrawBackgroundColor): Postavi boju pozadine textdrawa.
- [TextDrawAlignment](TextDrawAlignment): Postavi poravnanje textdrawa.
- [TextDrawFont](TextDrawFont): Postavi font textdrawa.
- [TextDrawLetterSize](TextDrawLetterSize): Postavi veličinu znakova teksta u textdrawu.
- [TextDrawTextSize](TextDrawTextSize): Postavi veličinu boxa u textdrawu.
- [TextDrawSetShadow](TextDrawSetShadow): Uključi/isključi sjene (shadows) na textdrawu.
- [TextDrawSetProportional](TextDrawSetProportional): Razmjestite razmak između teksta u texstdrawu na proporcionalni omjer.
- [TextDrawUseBox](TextDrawUseBox): Uključite ili isključite da li textdraw koristi box ili ne.
- [TextDrawSetString](TextDrawSetString): Postavi tekst u već postojećem textdrawu.
- [TextDrawShowForPlayer](TextDrawShowForPlayer): Prikaži textdraw za određenog igrača.
- [TextDrawHideForPlayer](TextDrawHideForPlayer): Sakrij textdraw za određenog igrača.
- [TextDrawShowForAll](TextDrawShowForAll): Prikaži textdraw za sve igrače.
- [TextDrawHideForAll](TextDrawHideForAll): Sakrij textdraw za sve igrače.
| openmultiplayer/web/docs/translations/bs/scripting/functions/TextDrawSetOutline.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/TextDrawSetOutline.md",
"repo_id": "openmultiplayer",
"token_count": 938
} | 332 |
---
title: UnBlockIpAddress
description: Deblokirajte IP adresu koja je prethodno bila blokirana pomoću BlockIpAddress.
tags: []
---
:::warning
Ova funkcija je dodana u SA-MP 0.3.z R2-2 i ne radi u nižim verzijama!
:::
## Deskripcija
Deblokirajte IP adresu koja je prethodno bila blokirana pomoću BlockIpAddress.
| Ime | Deskripcija |
| ---------- | -------------------------- |
| ip_address | IP addresa za deblokirati. |
## Returns
Ova funkcija ne returna (vraća) nikakve posebne vrijednosti.
## Primjeri
```c
public OnGameModeInit()
{
UnBlockIpAddress("127.0.0.1");
return 1;
}
```
## Srodne Funkcije
- [BlockIpAddress](BlockIpAddress): Block an IP address from connecting to the server for a set amount of time.
- [OnIncomingConnection](../callbacks/OnIncomingConnection): Pozvano kada igrač pokušava da se konektuje na server.
| openmultiplayer/web/docs/translations/bs/scripting/functions/UnBlockIpAddress.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/UnBlockIpAddress.md",
"repo_id": "openmultiplayer",
"token_count": 361
} | 333 |
---
title: fblockwrite
description: Zapišite podatke u datoteku u binarnom formatu, zanemarujući linijske kočnice i kodiranje.
tags: []
---
:::warning
Ova funkcija započinje malim slovom.
:::
## Deskripcija
Zapišite podatke u datoteku u binarnom formatu, zanemarujući linijske kočnice i kodiranje.
| Ime | Deskripcija |
| -------------------- | ----------------------------------------------------- |
| handle | Upravitelj datoteke za upotrebu, otvorila je fopen () |
| buffer | Upremnik za spremanje pročitanih podataka. |
| size = sizeof buffer | Broj ćelija za čitanje. |
## Returns
Ova funkcija ne returna (vraća) nikakve posebne vrijednosti.
## Primjeri
```c
// Definiraj "some_enum" (neki enum)
enum _:some_enum
{
some_data1,
some_data2[20],
Float:some_data3
}
// Deklariši "some_data" (neke podatke)
new some_data[some_enum];
// ...
// Otvori "file.bin" u "write only" modu (samo pisati)
new File:handle = fopen("file.bin", io_write);
// Provjeri ako je "file.bin" otvoren
if (handle)
{
// Uspješno
// Zapiši "some_data" u "file.bin"
fblockwrite(handle, some_data);
// Zatvori "file.bin"
fclose(handle);
}
else
{
// Error
print("Nesupješno otvaranje \"file.bin\".");
}
```
## Zabilješke
:::warning
Korištenje nevaljanog upravitelja srušit će vaš server! Nabavite važeći upravitelj pomoću fopen ili ftemp.
:::
## Srodne Funkcije
- [fopen](fopen): Otvori fajl/datoteku.
- [fclose](fclose): Zatvori fajl/datoteku.
- [ftemp](ftemp): Stvorite privremeni tok fajlova/datoteka.
- [fremove](fremove): Uklonite fajl/datoteku.
- [fwrite](fwrite): Piši u fajl/datoteku.
- [fread](fread): Čitaj fajl/datoteku.
- [fputchar](fputchar): Stavite znak u fajl/datoteku.
- [fgetchar](fgetchar): Dobijte znak iz fajla/datoteke.
- [fblockwrite](fblockwrite): Zapišite blokove podataka u fajl/datoteku.
- [fblockread](fblockread): Očitavanje blokova podataka iz fajla/datoteke.
- [fseek](fseek): Skoči na određeni znak u fajlu/datoteci.
- [flength](flength): Nabavite dužinu fajla/datoteke.
- [fexist](fexist): Provjeri da li datoteka postoji.
- [fmatch](fmatch): Provjeri podudaraju li se uzorci s nazivom datoteke.
| openmultiplayer/web/docs/translations/bs/scripting/functions/fblockwrite.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/fblockwrite.md",
"repo_id": "openmultiplayer",
"token_count": 1097
} | 334 |
---
title: floatsin
description: Uzmi sinus iz zadanog ugla.
tags: []
---
:::warning
Ova funkcija započinje malim slovom.
:::
## Deskripcija
Uzmi sinus iz zadanog ugla. Ulazni ugao može biti u radijanima, stupnjevima ili stupnjevima.
| Ime | Deskripcija |
| ----------- | ---------------------------------------------------------- |
| Float:value | Ugao iz kojeg se dobija sinus. |
| anglemode | Način kuta koji se koristi, ovisno o unesenoj vrijednosti. |
## Returns
Sinus unesene vrijednosti.
## Primjeri
```c
GetPosInFrontOfPlayer(playerid, Float:distance, &Float:x, &Float:y, &Float:z)
{
if (GetPlayerPos(playerid, x, y, z)) // ova funkcija vraća 0 ako Igrač nije konektiran.
{
new Float:z_angle;
GetPlayerFacingAngle(playerid, z_angle);
x += distance * floatsin(-z_angle, degrees); // uglovi u GTA idu suprotno od kazaljke na satu, tako da moramo preokrenuti dohvaćeni ugao
y += distance * floatcos(-z_angle, degrees);
return 1; // vratite 1 na uspjeh, stvarne koordinate vraćaju se referencom
}
return 0; // vratite 0 ako igrač nije povezan
}
```
## Zabilješke
:::warning
GTA / SA-MP u većini slučajeva koristi stupnjeve za uglove, na primjer GetPlayerFacingAngle. Stoga ćete najvjerojatnije htjeti koristiti način rada pod uglom 'stupnjeva', a ne radijane. Takođe imajte na umu da su uglovi u GTA suprotno kazaljkama na satu; 270° je istočno, a 90° zapadno. Jug je i dalje 180°, a sjever još uvijek 0° / 360°.
:::
## Srodne Funkcije
- [floattan](floattan): Dobijte tangentu iz određenog ugla.
- [floatcos](floatcos): Dobijte kosinus iz određenog ugla.
| openmultiplayer/web/docs/translations/bs/scripting/functions/floatsin.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/floatsin.md",
"repo_id": "openmultiplayer",
"token_count": 813
} | 335 |
---
title: getdate
description: Dobij trenutni datum servera koji će biti pohranjen u varijablama &year, &month i &day.
tags: []
---
<LowercaseNote />
## Deskripcija
Dobij trenutni datum servera koji će biti pohranjen u varijablama &year, &month i &day.
| Ime | Deskripcija |
| ------- | ----------------------------------------------------------- |
| year=0 | Varijabla za pohranjivanje godine, proslijeđena referencom. |
| month=0 | Varijabla za pohranjivanje mjeseca, proslijeđena referencom.|
| day=0 | Varijabla za pohranjivanje dana, proslijeđena referencom. |
## Returns
Broj dana od početka godine.
## Primjeri
```c
new Year, Month, Day, Days;
Days = getdate(Year, Month, Day);
printf("%02d/%02d/%d", Day, Month, Year);
printf("Broj dana od početka godine: %d", Days);
```
## Srodne Funkcije
- [gettime](gettime): Dobij trenutno vrijeme servera kao unix timestamp.
| openmultiplayer/web/docs/translations/bs/scripting/functions/getdate.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/getdate.md",
"repo_id": "openmultiplayer",
"token_count": 400
} | 336 |
---
title: sendstring
description: .
tags: []
---
:::warning
Ova funkcija započinje malim slovom.
:::
| openmultiplayer/web/docs/translations/bs/scripting/functions/sendstring.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/sendstring.md",
"repo_id": "openmultiplayer",
"token_count": 44
} | 337 |
---
title: uudecode
description: Dekodirajte UU kodirani string.
tags: []
---
:::warning
Ova funkcija započinje malim slovom.
:::
## Deskripcija
Dekodirajte UU kodirani string.
| Ime | Deskripcija |
| -------------- | --------------------------------------------------- |
| dest[] | Odredište za niz dekodiranog stringa. |
| const source[] | Izvorni string kodiran UU. |
| maxlength | Maksimalna dužina odredišta koja se može koristiti. |
## Returns
Ova funkcija ne returna (vraća) nikakve posebne vrijednosti.
## Primjeri
```c
uudecode(normalString, encodedString);
```
## Srodne Funkcije
- [uuencode](Uuencode): Kodirajte string u UU dekodirani string.
| openmultiplayer/web/docs/translations/bs/scripting/functions/uudecode.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/uudecode.md",
"repo_id": "openmultiplayer",
"token_count": 376
} | 338 |
---
title: DestroyVehicle
description: Löscht ein Fahrzeug.
tags: ["vehicle"]
---
## Beschreibung
Löscht ein Fahrzeug. Fahrzeug verschwindet sofort.
| Name | Beschreibung |
| --------- | --------------------------------- |
| vehicleid | Die ID des Fahrzeugs, das zerstört wird. |
## Rückgabe(return value)
1: Funktion erfolgreich ausgeführt.
0: Funktion fehlgeschlagen. Das Fahrzeug existiert nicht.
## Beispiele
```c
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(cmdtext, "/destroyveh", true) == 0)
{
new vehicleid = GetPlayerVehicleID(playerid);
DestroyVehicle(vehicleid);
return 1;
}
return 0;
}
```
## Ähnliche Funktionen
- [CreateVehicle](CreateVehicle): Erstelle ein Fahrzeug.
- [RemovePlayerFromVehicle](RemovePlayerFromVehicle): Wirft einen Spieler aus seinem Fahrzeug.
- [SetVehicleToRespawn](SetVehicleToRespawn): Respawnt ein Fahrzeug.
| openmultiplayer/web/docs/translations/de/scripting/functions/DestroyVehicle.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/de/scripting/functions/DestroyVehicle.md",
"repo_id": "openmultiplayer",
"token_count": 406
} | 339 |
---
título: OnGameModeInit
descripción: Este callback es desencadenado cuando el gamemode inicia.
tags: []
---
## Descripción
Este callback es desencadenado cuando el gamemode inicia.
## Ejemplos
```c
public OnGameModeInit()
{
print("Gamemode iniciado!");
return 1;
}
```
## Notas
:::tip
Esta función también puede ser usada en un filterscript para detectar si el gamemode cambia mediante comandos RCON como changemode o gmx, porque cambiando el gamemode no se recarga el filterscript.
:::
## Funciones Relacionadas
| openmultiplayer/web/docs/translations/es/scripting/callbacks/OnGameModeInit.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/es/scripting/callbacks/OnGameModeInit.md",
"repo_id": "openmultiplayer",
"token_count": 206
} | 340 |
---
título: OnPlayerEnterVehicle
descripción: Este callback se llama cuando un jugador comienza a entrar a un vehículo, o sea que el jugador aún no estará en el vehículo cuando este callback se llame.
tags: ["player", "vehicle"]
---
## Descripción
Este callback se llama cuando un jugador comienza a entrar a un vehículo, o sea que el jugador aún no estará en el vehículo cuando este callback se llame.
| Nombre | Descripción |
| ----------- | -------------------------------------------------------------------- |
| playerid | ID del jugador que intenta entrar a un vehículo. |
| vehicleid | ID del vehículo al que el jugador está intentando entrar. |
| ispassenger | 0 si está entrando como conductor. 1 si está entrando como pasajero. |
## Devoluciones
Siempre se llama primero en filterscripts.
## Ejemplos
```c
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
new string[128];
format(string, sizeof(string), "Estás entrando al vehículo %i", vehicleid);
SendClientMessage(playerid, 0xFFFFFFFF, string);
return 1;
}
```
## Notas
:::tip
Este callback es llamado cuando un jugador COMIENZA a entrar a un vehículo, no cuando este ENTRÓ realmente. Vea OnPlayerStateChange. Este callback es igualmente llamado si al jugador se le niega la entrada (ej. el auto está cerrado o lleno).
:::
## Funciones Relacionadas
- [PutPlayerInVehicle](../functions/PutPlayerInVehicle): Pone a un jugador adentro de un vehículo.
- [GetPlayerVehicleSeat](../functions/GetPlayerVehicleSeat): Comprueba en qué asiento está un jugador.
| openmultiplayer/web/docs/translations/es/scripting/callbacks/OnPlayerEnterVehicle.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/es/scripting/callbacks/OnPlayerEnterVehicle.md",
"repo_id": "openmultiplayer",
"token_count": 642
} | 341 |
---
título: OnPlayerSelectedMenuRow
descripción: Este callback se llama cuando un jugador selecciona un item de un menú (ShowMenuForPlayer).
tags: ["player", "menu"]
---
## Descripción
Este callback se llama cuando un jugador selecciona un item de un menú (ShowMenuForPlayer).
| Nombre | Descripción |
| -------- | ----------------------------------------------------------- |
| playerid | El ID del jugador que seleccionó un item en un menú. |
| row | El ID de la fila elegida. La primera fila es ID 0. |
## Devoluciones
Siempre se llama primero en el gamemode.
## Ejemplos
```c
new Menu:MyMenu;
public OnGameModeInit()
{
MyMenu = CreateMenu("Menú ejemplo", 1, 50.0, 180.0, 200.0, 200.0);
AddMenuItem(MyMenu, 0, "Item 1");
AddMenuItem(MyMenu, 0, "Item 2");
return 1;
}
public OnPlayerSelectedMenuRow(playerid, row)
{
if (GetPlayerMenu(playerid) == MyMenu)
{
switch(row)
{
case 0: print("Item 1 Seleccionado");
case 1: print("Item 2 Seleccionado");
}
}
return 1;
}
```
## Notas
:::tip
El ID del menú no se pasa a este callback. Debes usar GetPlayerMenu para determinar en cuál menú el jugador seleccionó un item.
:::
## Funciones Relacionadas
- [CreateMenu](../functions/CreateMenu): Crear un menú.
- [DestroyMenu](../functions/DestroyMenu): Destruir un menú.
- [AddMenuItem](../functions/AddMenuItem): Añade un item a un menú específico.
- [ShowMenuForPlayer](../functions/ShowMenuForPlayer): Muestra un menú a un jugador.
- [HideMenuForPlayer](../functions/HideMenuForPlayer): Oculta un menú a un jugador.
| openmultiplayer/web/docs/translations/es/scripting/callbacks/OnPlayerSelectedMenuRow.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/es/scripting/callbacks/OnPlayerSelectedMenuRow.md",
"repo_id": "openmultiplayer",
"token_count": 691
} | 342 |
---
título: OnVehicleMod
descripción: Este callback se llama cuando un vehículo es tuneado.
tags: ["vehicle"]
---
## Descripción
Este callback se llama cuando un vehículo es tuneado.
| Nombre | Descripción |
| ----------- | ------------------------------------------------------- |
| playerid | El ID del conductor del vehículo. |
| vehicleid | El ID del vehículo que es tuneado. |
| componentid | El ID del componente añadido al vehículo. |
## Devoluciones
1 - Prevendrá a otros filterscripts de recibir este callback.
0 - Indica que este callback será pasado al siguiente filterscript.
Siempre se llama primero en filterscripts.
## Ejemplos
```c
public OnVehicleMod(playerid, vehicleid, componentid)
{
printf("El vehículo %d fue modificado por ID %d con el id de componente %d",vehicleid, playerid,componentid);
if (GetPlayerInterior(playerid) == 0)
{
BanEx(playerid, "Hack de tuning"); // script Anti-tuning hacks
return 0; // Previene la mala modificación de ser sincronizada a otros jugadores.
//Probado y funciona incluso en servidores que te permiten modificar tu vehículo mediante comandos, menús, diálogos, etc.
}
return 1;
}
```
## Notas
:::tip
Este callback NO se llama por AddVehicleComponent.
:::
## Funciones Relacionadas
- [AddVehicleComponent](../functions/AddVehicleComponent): Añadir un componente a un vehículo.
- [OnEnterExitModShop](OnEnterExitModShop): Se llama cuando un jugador entra o sale de un taller de modificación.
- [OnVehiclePaintjob](OnVehiclePaintjob): Se llama cuando la capa de pintura de un auto cambia.
- [OnVehicleRespray](OnVehicleRespray): Se llama cuando un vehículo es repintado.
| openmultiplayer/web/docs/translations/es/scripting/callbacks/OnVehicleMod.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/es/scripting/callbacks/OnVehicleMod.md",
"repo_id": "openmultiplayer",
"token_count": 722
} | 343 |
---
title: OnGameModeExit
description: این کالبک با پایان یافتن gamemode یا از طریق 'gmx'، خاموش شدن سرور یا خارج شدن gamemode فرا خوانده می شود.
tags: []
---
<div dir="rtl" style={{ textAlign: "right" }}>
## توضیحات
این کالبک با پایان یافتن gamemode یا از طریق 'gmx'، خاموش شدن سرور یا خارج شدن gamemode فرا خوانده می شود.
## مثال ها
</div>
```c
public OnGameModeExit()
{
print("Gamemode be payan resid.");
return 1;
}
```
<div dir="rtl" style={{ textAlign: "right" }}>
## نکته ها
:::tip
این تابع همچنین میتواند در یک فیلتر اسکریپت مورد استفاده قرار گیرد تا تشخیص دهد که حالت gamemode با دستورات
مانند changemode یا gmx تغییر می کند، زیرا تغییر gamemode باعث بارگیری مجدد فیلتر اسکریپت نمی شود.
هنگام استفاده از OnGameModeExit همراه با دستور 'rcon gmx' به خاطر داشته باشید، احتمال بروز مشکلات برای کلاینت
وجود دارد. مثالی از این موارد فراخوانی های بیش از حد RemoveBuildingForPlayer هنگام OnGameModeExit است که منجر به به crash(خرابی) بیشتر کلاینت می شود. در صورت crash سرور یا از بین رفتن روند کار با روش های دیگر مانند استفاده از دستور Linux kill یا فشار دادن دکمه بستن روی کنسول Windows، این کالبک مجدد فرا خوانده نمی شود.
:::
## تابع های مرتبط
- [GameModeExit](../functions/GameModeExit): خارج شدن از gamemode جاری.
| openmultiplayer/web/docs/translations/fa/scripting/callbacks/OnGameModeExit.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fa/scripting/callbacks/OnGameModeExit.md",
"repo_id": "openmultiplayer",
"token_count": 1040
} | 344 |
---
title: "Keywords: Operators"
---
## `char`
ibabalik ng char ang bilang ng mga cell na kinakailangan upang hawakan ang ibinigay na bilang ng mga character sa isang naka-pack na string. I.e. ang bilang ng mga 4-byte na cell na kinakailangan upang humawak ng isang naibigay na bilang ng mga byte. Halimbawa:
```c
4 char
```
Returns 1.
```c
3 char
```
Returns 1 (Hindi pwedeng 3/4 ang variable).
```c
256 char
```
Returns 64 (256 divided by 4).
Ito ay karaniwang ginagamit sa mga variable na deklarasyon.
```c
new
someVar[40 char];
```
Gagawa ng isang array ng 10 cells na malaki.
Para sa karagdagang impormasyon sa naka-pack na mga string basahin ang pawn-lang.pdf.
## `defined`
Sinusuri kung mayroong isang simbolo. Karaniwang ginagamit sa #if statements:
```c
new
someVar = 5;
#if defined someVar
printf("%d", someVar);
#else
#error The variable 'someVar' isn't defined
#endif
```
Karamihan sa mga karaniwang ginagamit ito upang suriin kung ang isang tumutukoy ay tinukoy at makabuo ng code nang naaayon:
```c
#define FILTERSCRIPT
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
return 1;
}
#else
public OnGameModeInit()
{
return 1;
}
#endif
```
## `sizeof`
Ibinabalik ang laki sa ELEMENTS ng isang array:
```c
new
someVar[10];
printf("%d", sizeof (someVar));
```
Output:
```c
10
```
At:
```c
new
someVar[2][10];
printf("%d %d", sizeof (someVar), sizeof (someVar[]));
```
Gives:
```c
2 10
```
## `state`
Muli ito ay nauugnay sa PAWN autonoma code at sa gayon ay hindi saklaw dito.
## `tagof`
Nagbabalik ito ng isang numero na kumakatawan sa tag ng isang variable:
```c
new
someVar,
Float:someFloat;
printf("%d %d", tagof (someVar), tagof (someFloat));
```
Gives:
```c
-./,),(-*,( -1073741820
```
Alin ang isang bahagyang bug ngunit karaniwang nangangahulugang:
```c
0x80000000 0xC0000004
```
Upang suriin, halimbawa, kung ang isang variable ay isang float (na may tag na 'Float:'):
```c
new Float: fValue = 6.9;
new tag = tagof (fValue);
if (tag == tagof (Float:))
{
print("float");
}
else
{
print("not a float");
}
``` | openmultiplayer/web/docs/translations/fil/scripting/Language/Operators.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fil/scripting/Language/Operators.md",
"repo_id": "openmultiplayer",
"token_count": 901
} | 345 |
---
title: OnNPCExitVehicle
description: Ang callback na ito ay tinatawag kapag ang isang NPC ay umalis sa isang sasakyan.
tags: ["npc"]
---
## Description
Ang callback na ito ay tinatawag kapag ang isang NPC ay umalis sa isang sasakyan.
## Examples
```c
public OnNPCExitVehicle()
{
print("The NPC left the vehicle");
return 1;
}
```
## Related Callbacks
Maaaring maging kapaki-pakinabang ang mga sumusunod na callback, dahil nauugnay ang mga ito sa callback na ito sa isang paraan o iba pa.
- [OnNPCEnterVehicle](OnNPCEnterVehicle): Ang callback na ito ay tinatawag kapag ang isang NPC ay sumakay sa isang sasakyan. | openmultiplayer/web/docs/translations/fil/scripting/callbacks/OnNPCExitVehicle.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fil/scripting/callbacks/OnNPCExitVehicle.md",
"repo_id": "openmultiplayer",
"token_count": 236
} | 346 |
---
title: OnPlayerSpawn
description: Tinatawag ang callback na ito kapag nag-spawn ang isang player.
tags: ["player"]
---
## Description
Tinatawag ang callback na ito kapag nag-spawn ang isang player.(i.e. pagkatapos i-cal ang [SpawnPlayer](../functions/SpawnPlayer) function)
| Name | Description |
| -------- | ---------------------------------- |
| playerid | Ang ID ng player na nag-spawn |
## Returns
0 - Pipigilan ang ibang mga filterscript na matanggap ang callback na ito.
1 - Isinasaad na ang callback na ito ay ipapasa sa susunod na filterscript.
Palaging una itong tinatawag sa mga filterscript.
## Examples
```c
public OnPlayerSpawn(playerid)
{
new PlayerName[MAX_PLAYER_NAME],
string[40];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
format(string, sizeof(string), "%s has spawned successfully.", PlayerName);
SendClientMessageToAll(0xFFFFFFFF, string);
return 1;
}
```
## Notes
:::tip
Ang laro ay minsan ay nagbabawas ng \$100 mula sa mga manlalaro pagkatapos ng spawn.
:::
## Related Callbacks
Maaaring maging kapaki-pakinabang ang mga sumusunod na callback, dahil nauugnay ang mga ito sa callback na ito sa isang paraan o iba pa.
- [OnPlayerDeath](OnPlayerDeath): Tinatawag ang callback na ito kapag namatay ang isang player.
- [OnVehicleSpawn](OnVehicleSpawn): Ang callback na ito ay tinatawag kapag ang isang sasakyan ay respawn.
## Related Functions
Maaaring maging kapaki-pakinabang ang mga sumusunod na function, dahil nauugnay ang mga ito sa callback na ito sa isang paraan o iba pa.
- [SpawnPlayer](../functions/SpawnPlayer): Pilitin ang isang manlalaro na mag-spawn.
- [AddPlayerClass](../functions/AddPlayerClass): Mag add ng class.
- [SetSpawnInfo](../functions/SetSpawnInfo): I-set ang spawn setting para sa player. | openmultiplayer/web/docs/translations/fil/scripting/callbacks/OnPlayerSpawn.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fil/scripting/callbacks/OnPlayerSpawn.md",
"repo_id": "openmultiplayer",
"token_count": 646
} | 347 |
---
title: AllowAdminTeleport
description: Tutukuyin ng function na ito kung ang mga admin ng RCON ay mai-teleport sa kanilang waypoint kapag nagtakda sila ng isa.
tags: []
---
:::warning
Ang function na ito, mula sa 0.3d, ay hindi na ginagamit. Mangyaring tingnan [OnPlayerClickMap](../callbacks/OnPlayerClickMap).
:::
## Description
Tutukuyin ng function na ito kung ang mga admin ng RCON ay mai-teleport sa kanilang waypoint kapag nagtakda sila ng isa.
| Name | Description |
| ----- | --------------------------------------------- |
| allow | 0 upang huwag paganahin at 1 upang paganahin. |
## Returns
Ang function na ito ay hindi nagbabalik ng anumang partikular na halaga.
## Examples
```c
public OnGameModeInit()
{
AllowAdminTeleport(1);
// Iba pa
return 1;
}
```
## Related Functions
- [IsPlayerAdmin](IsPlayerAdmin): Sinusuri kung ang isang manlalaro ay naka-log in sa RCON.
- [AllowPlayerTeleport](AllowPlayerTeleport): I-toggle ang waypoint teleporting para sa mga manlalaro. | openmultiplayer/web/docs/translations/fil/scripting/functions/AllowAdminTeleport.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fil/scripting/functions/AllowAdminTeleport.md",
"repo_id": "openmultiplayer",
"token_count": 387
} | 348 |
---
title: ClearActorAnimations
description: I-clear ang anumang mga animation na inilapat sa isang aktor.
tags: []
---
<VersionWarn version='SA-MP 0.3.7' />
## Description
I-clear ang anumang mga animation na inilapat sa isang aktor.
| Name | Description |
| ------- | -------------------------------------------------------------------------- |
| actorid | Ang ID ng aktor (ni-return ni CreateActor) para i-clear ang mga animation. |
## Returns
1: Matagumpay na naisakatuparan ang function.
0: Nabigo ang function na isagawa. Ang aktor na tinukoy ay wala.
## Examples
```c
new gMyActor;
public OnGameModeInit()
{
gMyActor = CreateActor(...);
}
// Sa ibang lugar
ApplyActorAnimation(gMyActor, ...);
// Sa ibang lugar
ClearActorAnimations(gMyActor);
```
## Related Functions
- [ApplyActorAnimation](ApplyActorAnimation): Mag-apply ng animation sa isang actor. | openmultiplayer/web/docs/translations/fil/scripting/functions/ClearActorAnimations.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fil/scripting/functions/ClearActorAnimations.md",
"repo_id": "openmultiplayer",
"token_count": 344
} | 349 |
---
title: GetPlayerObjectModel
description: Kunin ang model ID ng isang player-object.
tags: ["player"]
---
<VersionWarn version='SA-MP 0.3.7' />
## Description
Kunin ang model ID ng isang player-object.
| Name | Description |
| -------- | ------------------------------------------------------------- |
| playerid | Ang ID ng player na player-object para makuha ang model |
| objectid | Ang ID ng player-object kung saan kukunin ang model ID |
## Returns
Ang model ID ng object ng player.
Kung wala ang player o object, mag rereturn ito -1 o 0 kung wala ang player o object.
## Examples
```c
new objectId = CreatePlayerObject(playerid, 1234, 0, 0, 0, 0, 0, 0);
new modelId = GetPlayerObjectModel(playerid, objectId);
```
## Related Functions
- [GetObjectModel](GetObjectModel): Kunin ang model ID ng isang object. | openmultiplayer/web/docs/translations/fil/scripting/functions/GetPlayerObjectModel.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fil/scripting/functions/GetPlayerObjectModel.md",
"repo_id": "openmultiplayer",
"token_count": 316
} | 350 |
---
title: SetPlayerSpecialAction
description: Ang function na ito ay nagbibigay-daan upang i-set ang mga player ng special action.
tags: ["player"]
---
## Description
Ang function na ito ay nagbibigay-daan upang i-set ang mga player ng special action.
| Name | Description |
| -------- | ---------------------------------------------------------------------- |
| playerid | Ang player na magsasagawa ng action. |
| actionid | Ang [action](../resources/specialactions) na dapat maisagawa. |
## Returns
1: Matagumpay na naisakatuparan ang function.
0: Nabigo ang function na isagawa. Nangangahulugan ito na ang manlalaro ay hindi konektado.
## Examples
```c
if (strcmp(cmd, "/handsup", true) == 0)
{
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_HANDSUP);
return 1;
}
```
## Notes
:::tip
Ang pag-alis ng mga jetpack mula sa mga player sa pamamagitan ng pagtatakda ng kanilang special action sa 0 ay nagiging sanhi ng tunog na mananatili hanggang kamatayan.
:::
## Related Functions
- [GetPlayerSpecialAction](GetPlayerSpecialAction): Kunin ang kasalukuyang special action ng player.
- [ApplyAnimation](ApplyAnimation): Maglapat ng animation sa isang player. | openmultiplayer/web/docs/translations/fil/scripting/functions/SetPlayerSpecialAction.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fil/scripting/functions/SetPlayerSpecialAction.md",
"repo_id": "openmultiplayer",
"token_count": 486
} | 351 |
---
title: floatcmp
description: Ang floatcmp ay maaaring gamitin upang ihambing ang mga halaga ng float sa bawat isa, upang mapatunayan ang paghahambing.
tags: ["math", "floating-point"]
---
<LowercaseNote />
## Description
Ang floatcmp ay maaaring gamitin upang ihambing ang mga halaga ng float sa bawat isa, upang mapatunayan ang paghahambing.
| Name | Description |
| ----- | ---------------------------------- |
| oper1 | Ang unang float value na ikukumpara |
| oper2 | Ang pangalawang float value na ikukumpara. |
## Returns
0 kung tumutugma ang value, 1 kung mas malaki ang unang value at -1 kung mas malaki ang 2nd value.
## Examples
```c
floatcmp(2.0, 2.0); // Nagbabalik ng 0 dahil tugma ang mga ito.
floatcmp(1.0, 2.0) // Nagbabalik -1 dahil mas malaki ang pangalawang value.
floatcmp(2.0, 1.0) // Nagbabalik ng 1 dahil mas malaki ang unang value.
``` | openmultiplayer/web/docs/translations/fil/scripting/functions/floatcmp.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fil/scripting/functions/floatcmp.md",
"repo_id": "openmultiplayer",
"token_count": 341
} | 352 |
---
title: Contribuer au rayonnement de open.MP
description: Contribuez, vous aussi, à améliorer la documentation fournie par open.MP et sa communauté.
---
Cette documentation s'adresse à tous ceux qui veulent contribuer au wiki de [open.mp](https://open.mp). Il vous suffit d'avoir du temps et libr et un [GitHub](https://github.com), peu importe si vous maîtrisez cet outil ou non.
Dans le cas où vous souhaitez vous voulez participer à la traduction du wiki, ouvrez un PR sur le fichier [`CODEOWNERS`](https://github.com/openmultiplayer/wiki/tree/master/CODEOWNERS) en ajoutant une ligne de la même façon que celles déjà écrites.
## Modifier, ajouter du contenu
### Ajouter du contenu via le navigateur
En parcourant le [Github « docs »](https://github.com/openmultiplayer/web/tree/master/docs) de open.MP, vous aurez un bouton "Add file"

Vous pourrez ainsi ajouter un fichier en Markdown.
Le fichier créer _doit_ avoir l'extension `.md` et contenir du Markdown.
Pour plus d'informations sur l'utilisation de Markdown, référez vous à [ce guide](https://guides.github.com/features/mastering-markdown/).
Dès que vous avez terminé votre rédaction, cliquez sur _"Propose new file"_ et un _Pull Request_ s'enverra pour un review.
### Git
Si vous voulez utiliser git, il faut que vous cloniez le wiki :
```sh
git clone https://github.com/openmultiplayer/web/tree/master/docs.git
```
Ouvrez-le dans votre éditeur de texte. D'aucuns recommanderaient Visual Studio, qui semble être l'outil le plus apprécié des développeurs tant il est pratique :

Cette extension peut être utile :
- [markdownlint](https://marketplace.visualstudio.com/items?itemName=DavidAnson.vscode-markdownlint) par David Anson - cette extension s'assure du bon format de votre Markdown. Elle prévient également les quelques erreurs sémantiques ou de forme. Tous les warnings ne sont pas utiles, mais ils sont des indices importants à ne pas négliger pour régler quelques difficultés.
## Notes, astuces et convetions
### Liens internes
Il convient d'utiliser les chemins d'accès plutôt qu'un lien direct.
- ❌
```md
[OnPlayerClickPlayer](https://www.open.mp/docs/scripting/callbacks/OnPlayerClickPlayer)
```
- ✔
```md
[OnPlayerClickPlayer](../callbacks/OnPlayerClickPlayer)
```
`../` permet de remonter d'un répertoire. Si le fichier que vous modifiez est dans le dossier `functions` et que vous renvoyez à un lien dans le dossier `callbacks`, utilisez `../` pour retourner au dossier `scripting/` et vous pourrez alors regagner le dossier `callbacks/` et donc viser le fichier _(sans indiquer l'extension `.md`).
### Images
Les images vont dans un sous-répertoire à l'intérieur de `/static /images`. Quand vous insérez une image avec un `! [] ()`, utilisez simplement `/images/` comme chemin de base _(pas besoin de `static`)_.
En cas de doute, lisez une autre page qui utilise des images et copiez la méthode.
### Metadonnées
La première chose à faire dans _chaque_ document, c'est d'insérer les métadonnées :
```mdx
---
title: Ma documentation
description: Documentation sur les burgers !
---
```
Chaque page doit contenir un titre et une description.
[Liste entière des métadonnées](https://v2.docusaurus.io/docs/markdown-features#markdown-headers).
### Titres
Ne créez pas de titres type `<h1>` avec un `#` comme cela se fait automatiquement. Le premier titre doit _toujours_ être : `##`.
- ❌
```md
# Mon titre
Nous traiterons aujourd'hui de ...
# Ma section
```
- ✔
```md
Nous traiterons aujourd'hui de ...
## Ma section
```
### Utilisez les balises `Code` pour les référenecs techniques.
Quand vous écrivez un paragraphe contenant des noms de fonction, des numéros, des expressions ou une notion de programmation, entourez la notion de \`guillemets obliques\`.
- ❌
> La fonction fopen [...] un tag type File: [...]
- ✔
> La fonction `fopen` [...] un tag type `File:` [...]
Dans l'exemple ci-dessus, `fopen` est un nom de fonction, donc il convient de l'entourer avec des guillemets obliques pour la distinguer des autres mots du langage courant.
### Tables
La structure de la table répond à des règles précises lorsque vous lui mettez des entêtes :
- ❌
```md
| | |
| ------- | ------------------------------------ |
| HP | État du véhicule |
| 650 | Bon état |
| 650-550 | Fumée blanche |
| 550-390 | Fumée grise |
| 390-250 | Fumée noire |
| < 250 | En feu (explosion imminente) |
```
- ✔
```md
| HP | État du véhicule |
| ------- | ------------------------------------ |
| 650 | Bon état |
| 650-550 | Fumée blanche |
| 550-390 | Fumée grise |
| 390-250 | Fumée noire |
| < 250 | En feu (explosion imminente) |
```
## Licence d'agrément
Le projet open.MP dispose, pour ses collaborateurs, d'une [licence d'agrément](https://cla-assistant.io/openmultiplayer/homepage).
Cela signifie simplement que vous acceptez de nous laisser utiliser votre travail et de le placer sous une licence open source. Lorsque vous ouvrez une Pull Request pour la première fois, le bot CLA-Assistant publiera un lien où vous pourrez signer l'accord.
| openmultiplayer/web/docs/translations/fr/meta/Contributing.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fr/meta/Contributing.md",
"repo_id": "openmultiplayer",
"token_count": 2250
} | 353 |
---
title: OnNPCDisconnect
description: Ce rappel est appelé lorsque le PNJ est déconnecté du serveur.
tags: ["npc"]
---
## Description
Ce rappel est appelé lorsque le PNJ est déconnecté du serveur.
| Nom | Description |
| ------------ | -------------------------------------------------------- |
| reason[] | La raison pour laquelle le bot s'est déconnecté du serveur |
## Exemples
```c
public OnNPCDisconnect(reason[])
{
printf("Déconnecté du serveur. %s", reason);
}
```
## Rappels Relatives
Les rappels suivants peuvent être utiles, car ils sont liés à ce rappel d'une manière ou d'une autre.
- [OnNPCConnect](OnNPCConnect): Ce rappel est appelé lorsque le PNJ se connecte avec succès au serveur.
- [OnPlayerDisconnect](OnPlayerDisconnect): Ce rappel est appelé lorsqu'un joueur quitte le serveur.
- [OnPlayerConnect](OnPlayerConnect): Ce rappel est appelé lorsqu'un joueur se connecte au serveur.
| openmultiplayer/web/docs/translations/fr/scripting/Callbacks/OnNPCDisconnect.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fr/scripting/Callbacks/OnNPCDisconnect.md",
"repo_id": "openmultiplayer",
"token_count": 371
} | 354 |
---
title: OnPlayerDeath
description: Cette callback est appelée quand le joueur est mort. Il peut s'agir aussi bien d'une mort par kill qu'une mort par suicide.
tags: ["player"]
---
## Paramètres
Cette callback est appelée quand le joueur est mort. Il peut s'agir aussi bien d'une mort par kill qu'une mort par suicide.
| Nom | Description |
|---------------------|--------------------------------------------------------------------|
| `int` playerid | ID du joueur mort |
| `int` killerid | ID du joueur qui kill le `playerid`, ou INVALID_PLAYER_ID à défaut |
| `int` WEAPON:reason | ID de la raison de la mort |
## Valeur de retour
Cette callback ne retourne rien, mais doit retourner quelque chose. Autrement dit, `return callback();` ne fonctionnera pas car la callback ne retourne rien, mais un return _(`return 1;` ou `return 0;`)_ doit être effectué dans la callback.
## Exemple
```c
new PlayerDeaths[MAX_PLAYERS];
new PlayerKills[MAX_PLAYERS];
public OnPlayerDeath(playerid, killerid, WEAPON:reason)
{
SendDeathMessage(killerid, playerid, reason); // Notification dans le killfeed
// Vérifie si le killerid est valide
if (killerid != INVALID_PLAYER_ID)
{
PlayerKills[killerid] ++;
}
// Ajoute une mort au playerid
PlayerDeaths[playerid] ++;
return 1;
}
```
## Astuces
:::tip
Les morts à raison d'une source de feu seront caractérisées par l'ID 37 (lance-flammes) ;
La raison pour les explosions avec une arme (RPG, grenade, ...) seront caractérisées par l'ID.
Il faut toujours vérifier que le `killerid` est valide avant d'utiliser SendDeathMessage. `INVALID_PLAYER_ID` est un `playerid` valide.
`playerid` est le seul à pouvoir appeler cette callback _(bon à savoir pour un anti fake death par exemple)_.
:::
:::warning
Vous DEVEZ vérifier que `killerid` est valide (pas INVALID_PLAYER_ID) avant de l'utiliser dans un array _(n'importe où en réalité)_, sinon le script OnPlayerDeath est susceptible de crash.
C'est parce que INVALID_PLAYER_ID est défini comme ayant la valeur '65535' que si un array a seulement MAX_PLAYERS comme élément le script OnPlayerDeath va crash _(vous tentez d'indexer au-delà de la limite MAX_PLAYERS)_.
:::
## Fonctions connexes
- [SendDeathMessage](../functions/SendDeathMessage): Ajoute un kill dans le killfeed.
- [SetPlayerHealth](../functions/SetPlayerHealth): Heal un joueur.
| openmultiplayer/web/docs/translations/fr/scripting/Callbacks/OnPlayerDeath.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fr/scripting/Callbacks/OnPlayerDeath.md",
"repo_id": "openmultiplayer",
"token_count": 1016
} | 355 |
---
title: OnPlayerLeaveCheckpoint
description: Cette callback est appelée quand un joueur quitte un checkpoint configuré pour lui avec SetPlayerCheckpoint.
tags: ["player", "checkpoint"]
---
## Paramètres
Cette callback est appelée quand un joueur quitte un checkpoint configuré pour lui avec [SetPlayerCheckpoint](../functions/SetPlayerCheckpoint). Seulement 1 checkpoint peut être mis.
| Nom | Description |
| -------------- | ------------------------------------------------ |
| `int` playerid | ID du joueur qui a quitté son checkpoint |
## Valeur de retour
Cette callback ne retourne rien, mais doit retourner quelque chose. Autrement dit, `return callback();` ne fonctionnera pas car la callback ne retourne rien, mais un return _(`return 1;` ou `return 0;`)_ doit être effectué dans la callback.
## Exemple
```c
public OnPlayerLeaveCheckpoint(playerid)
{
printf("Le joueur %i a quitté le checkpoint!", playerid);
return 1;
}
```
## Astuces
<TipNPCCallbacks />
## Fonctions connexes
- [SetPlayerCheckpoint](../functions/SetPlayerCheckpoint): Créer un checkpoint pour un joueur.
- [DisablePlayerCheckpoint](../functions/DisablePlayerCheckpoint): Désactive le checkpoint actuel du joueur.
- [IsPlayerInCheckpoint](../functions/IsPlayerInRaceCheckpoint): Vérifie si un joueur est un dans race checkpoint.
- [SetPlayerRaceCheckpoint](../functions/SetPlayerRaceCheckpoint): Créer un race checkpoint pour un joueur.
- [DisablePlayerRaceCheckpoint](../functions/DisablePlayerRaceCheckpoint): Désactive le race checkpoint actuel du joueur.
- [IsPlayerInRaceCheckpoint](../functions/IsPlayerInRaceCheckpoint): Vérifie si un joueur est dans un race checkpoint.
| openmultiplayer/web/docs/translations/fr/scripting/Callbacks/OnPlayerLeaveCheckpoint.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fr/scripting/Callbacks/OnPlayerLeaveCheckpoint.md",
"repo_id": "openmultiplayer",
"token_count": 576
} | 356 |
---
title: OnPlayerTakeDamage
description: Cette callback est appelée lorsqu'un joueur prends des degats.
tags: ["player"]
---
## Paramètres
Cette callback est appelée lorsqu'un joueur prends des degats..
| Nom | Description |
|-----------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------|
| `int` playerid | L'ID du joueur qui prends les dégats. |
| `int` issuerid | L'ID du joueur qui cause les dégats. Si il vaut INVALID_PLAYER_ID, le joueur les a infligés lui même. |
| `float` Float:amount | Le montant des dégats reçus _(vie et armure combinés)_. |
| `int` WEAPON:weaponid | L'ID de l'arme/la raison qui a causé les dégats. |
| `int` bodypart | La partie du corps qui s'est faite touchée. |
## Valeur de retour
**1** - Autorise la callback à être utilisée dans un autre script
**0** - La callback ne sera pas appelée dans les autres scripts
Elle est toujours appelée en premier dans le gamemode donc retourner **0** dans le gamemode bloquera la callback dans les filterscripts.
## Exemples
```c
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, WEAPON:weaponid, bodypart)
{
if(issuerid != INVALID_PLAYER_ID) // Si il ne se les inflige pas lui même
{
new
infoString[128],
weaponName[24],
victimName[MAX_PLAYER_NAME],
attackerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, victimName, sizeof (victimName));
GetPlayerName(issuerid, attackerName, sizeof (attackerName));
GetWeaponName(weaponid, weaponName, sizeof (weaponName));
format(infoString, sizeof(infoString), "%s a proféré %.0f dégats à %s, arme: %s", attackerName, amount, victimName, weaponName);
SendClientMessageToAll(-1, infoString);
}
return 1;
}
```
```c
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, WEAPON:weaponid, bodypart)
{
if(issuerid != INVALID_PLAYER_ID && weaponid == 34 && bodypart == 9)
{
//Tirez une fois dans la tête au sniper tue instantanément
SetPlayerHealth(playerid, 0.0);
}
return 1;
}
```
## Astuces
:::tip
Le weaponid retournera la raison 37 _(lance-flammes)_ de n'importe quelle source de feu _(par exemple molotov, 18)_.
Le weaponid retournera la raison 51 de n'importe quelle arme qui crée une explosion _(par exemple RPG, grenade)_.
Le montant est toujours le maximum de dégâts que l'arme peut faire, même si la santé restante est inférieure à ce maximum de dégâts. Ainsi, lorsqu'un joueur a 100,0 points de vie et se fait tirer dessus avec un Desert Eagle qui a une valeur de dégâts de 46,2, il faut 3 coups pour tuer ce joueur. Les 3 tirs montreront au final un montant de 46,2, même si lorsque le dernier coup frappe, le joueur n'a plus que 7,6 points de vie.
:::
:::warning
GetPlayerHealth et GetPlayerArmour renverront les anciens montants du joueur avant cette callback.
Vérifiez toujours si `issuerid` est valide avant de l'utiliser comme index de tableau.
:::
| openmultiplayer/web/docs/translations/fr/scripting/Callbacks/OnPlayerTakeDamage.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fr/scripting/Callbacks/OnPlayerTakeDamage.md",
"repo_id": "openmultiplayer",
"token_count": 1686
} | 357 |
---
title: OnVehicleSpawn
description: Cette callback est appelée lorsqu'un véhicule respawn (réapparaît).
tags: ["vehicle"]
---
:::warning
Cette callback est appelée **seulement** quand un véhicule **re**spawn ! [CreateVehicle](../functions/CreateVehicle) et AddStaticVehicle(Ex) n'appelleront PAS cette callback.
:::
## Paramètres
description: Cette callback est appelée lorsqu'un véhicule respawn _(réapparaît)_.
| Nom | Description |
| --------------- | ----------------------------------- |
| `int` vehicleid | L'ID du véhicule qui a spawné. |
## Valeur de retour
Cette fonction ne retourne pas de valeur spécifique.
## Exemple
```c
public OnVehicleSpawn(vehicleid)
{
printf("Vehicle %i spawn!",vehicleid);
return 1;
}
```
## Fonctions connexes
- [SetVehicleToRespawn](../functions/SetVehicleToRespawn): Respawn un véhicule.
- [CreateVehicle](../functions/CreateVehicle): Créer un vehicle.
| openmultiplayer/web/docs/translations/fr/scripting/Callbacks/OnVehicleSpawn.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fr/scripting/Callbacks/OnVehicleSpawn.md",
"repo_id": "openmultiplayer",
"token_count": 374
} | 358 |
---
title: OnFilterScriptInit
description: Ez a visszahívás egy filterszkript betöltése során kerül meghívásra.
tags: []
---
## Leírás
Ez a visszahívás egy filterszkript betöltése során kerül meghívásra. Csak abban a filterszkriptben lesz meghívva amelyik éppen betölt.
## Példák
```c
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print("A filterszkript betöltött!");
print("--------------------------------------\n");
return 1;
}
```
## Kapcsolodó visszahívások
Ezek a visszahívások hasznosak lehetnek mivel valamilyen módon kapcsolódik ehhez a visszahíváshoz.
- [OnFilterSciptExit](OnFilterScriptExit): Ezt a visszahívást akkor hívja meg amikor egy filterszkript leáll.
- [OnGameModeInit](OnGameModeInit): Ezt a visszahívást akkor hívja meg amikor egy játékmód elindul.
- [OnGameModeExit](OnGameModeExit): Ezt a visszahívást akkor hívja meg amikor egy játékmód leáll.
| openmultiplayer/web/docs/translations/hu/scripting/callbacks/OnFilterScriptInit.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/hu/scripting/callbacks/OnFilterScriptInit.md",
"repo_id": "openmultiplayer",
"token_count": 406
} | 359 |
---
title: OnClientMessage
description: Callback ini akan terpanggil ketika NPC melihat sebuah ClientMessage.
tags: []
---
## Deskripsi
Callback ini akan terpanggil ketika NPC melihat sebuah ClientMessage. Ini akan terjadi setiap fungsi SendClientMessageToAll digunakan dan setiap fungsi SendClientMessage di kirimkan kepada NPC. Callback ini tidak akan terpanggil ketika seseorang berkata sesuatu. Untuk versi seperti ini dengan player text, lihat NPC:OnPlayerText.
| Nama | Deskripsi |
| ------ | -------------------------- |
| color | Warna dari pesan tersebut. |
| text[] | Pesan yang sebenarnya. |
## Returns
Callback ini tidak mengelola pengembalian nilai.
## Contoh
```c
public OnClientMessage(color, text[])
{
if(strfind(text,"Saldo Bank: $0") != -1) SendChat("Aku kok miskin? :(");
}
```
## Fungsi Terkait
| openmultiplayer/web/docs/translations/id/scripting/callbacks/OnClientMessage.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/id/scripting/callbacks/OnClientMessage.md",
"repo_id": "openmultiplayer",
"token_count": 329
} | 360 |
---
title: OnPlayerDisconnect
description: Callback ini akan terpanggil ketika pemain keluar dari server.
tags: ["player"]
---
## Deskripsi
Callback ini akan terpanggil ketika pemain terputus dari server.
| Nama | Deskripsi |
| -------- | ------------------------------------------------------ |
| playerid | ID dari pemain yang terputus. |
| reason | ID dari alasan pemutusan koneksi. Lihat tabel dibawah. |
## Returns
0 - Akan melarang filterscript lain untuk menerima callback ini.
1 - Mengindikasikan bahwa callback ini akan dilanjutkan ke filtercript lain.
Selalu terpanggil pertama di filterscripts.
## Contoh
```c
public OnPlayerDisconnect(playerid, reason)
{
new
szString[64],
playerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);
new szDisconnectReason[3][] =
{
"Timeout/Crash",
"Quit",
"Kick/Ban"
};
format(szString, sizeof szString, "%s keluar dari server (%s).", playerName, szDisconnectReason[reason]);
SendClientMessageToAll(0xC4C4C4FF, szString);
return 1;
}
```
## Catatan
:::tip
Beberapa fungsi mungkin tidak dapat bekerja dengan benar ketika digunakan di dalam callback ini karena pemain sudah terputus ketika callback ini terpanggil. Ini artinya anda tidak bisa mendapatkan informasi yang tidak ambigu dari fungsi seperti GetPlayerIp dan GetPlayerPos.
:::
## Fungsi Terkait
| openmultiplayer/web/docs/translations/id/scripting/callbacks/OnPlayerDisconnect.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/id/scripting/callbacks/OnPlayerDisconnect.md",
"repo_id": "openmultiplayer",
"token_count": 622
} | 361 |
---
title: OnPlayerWeaponShot
description: Callback ini di panggil ketika seorang pemain melepaskan tembakan dari senjata.
tags: ["player"]
---
## Deskripsi
Callback ini dipanggil ketika pemain melepaskan tembakan dari senjata. Hanya senjata yang di dukung. Hanya drive-by penumpang yang di dukung (bukan drive-by pengemudi, dan bukan tembakan burung / pemburu).
| Nama | Deskripsi |
| -------- | --------------------------------------------------------------------------------------------------------- |
| playerid | ID pemain yang menembakkan senjata. |
| WEAPON:weaponid | ID dari [weapon](../resources/weaponids) yang di tembak oleh pemain. |
| BULLET_HIT_TYPE:hittype | [type](../resources/bullethittypes) Tersebut dari benda yang di tembakkan (tidak ada, pemain, kendaraan, atau (pemain) objek). |
| hitid | ID pemain, kendaraan atau objek yang tertabrak. |
| Float:fX | Koordinat X yang di tembak. |
| Float:fY | Koordinat Y yang di tembak. |
| Float:fZ | Koordinat Z yang di tembak. |
## Returns
0 - Mencegah peluru menyebabkan kerusakan.
1 - Membiarkan peluru menyebabkan kerusakan.
Itu selalu disebut pertama dalam filterscript sehingga mengembalikan 0 di sana juga memblokir skrip lain agar tidak melihatnya.
## Contoh
```c
public OnPlayerWeaponShot(playerid, WEAPON:weaponid, BULLET_HIT_TYPE:hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
new szString[144];
format(szString, sizeof(szString), "Senjata %i telah di tembakkan. hittype: %i hitid: %i pos: %f, %f, %f", weaponid, hittype, hitid, fX, fY, fZ);
SendClientMessage(playerid, -1, szString);
return 1;
}
```
## Catatan
:::tip
Callback ini hanya di panggil ketika kompensasi lag diaktifkan. Jika tipe hit adalah:
- `BULLET_HIT_TYPE_NONE`: parameter fX, fY dan fZ adalah koordinat normal, akan memberikan 0,0 untuk koordinat jika tidak ada yang terkena (misalnya objek jauh yang tidak dapat dijangkau oleh peluru);
- Others: fX, fY dan fZ adalah offset relatif kepada hitid.
:::
:::tip
[GetPlayerLastShotVectors](../functions/GetPlayerLastShotVectors) dapat digunakan dalam callback ini untuk informasi vektor peluru yang lebih detail.
:::
:::warning
Bug yang Diketahui:
- callback tidak dipanggil jika Anda menembak di kendaraan sebagai pengemudi atau jika Anda melihat ke belakang dengan bidikan di aktifkan (menembak di udara).
- Disebut sebagai `BULLET_HIT_TYPE_VEHICLE` dengan hitid yang benar (id kendaraan pemain yang dipukul) jika Anda menembak pemain yang berada di dalam kendaraan. Itu tidak akan disebut sebagai `BULLET_HIT_TYPE_PLAYER` sama sekali.
- Perbaikan sebagian di SA-MP 0.3.7: Jika data senjata palsu dikirim oleh pengguna jahat(chiter), klien pemain lain dapat membeku atau crash. Untuk mengatasi ini, periksa apakah weaponid yang di laporkan benar-benar dapat menembakkan peluru.
:::
## Fungsi Terkait
- [GetPlayerLastShotVectors](../functions/GetPlayerLastShotVectors): Mengambil vektor tembakan terakhir yang di tembakkan oleh pemain.
| openmultiplayer/web/docs/translations/id/scripting/callbacks/OnPlayerWeaponShot.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/id/scripting/callbacks/OnPlayerWeaponShot.md",
"repo_id": "openmultiplayer",
"token_count": 1672
} | 362 |
---
title: MoveObject
description: Memindahkan Object ke posisi baru dengan kecepatan yang ditentukan.
tags: []
---
## Deskripsi
Memindahkan Object ke posisi baru dengan kecepatan yang ditentukan. Pemain/kendaraan akan 'menjelajah' Object saat bergerak.
| Name | Description |
| ----------- | ------------------------------------------ |
| objectid | ID Object yang akan di pindahkan. |
| Float:X | Koordinat X untuk memindahkan Object ke. |
| Float:Y | Koordinat Y untuk memindahkan Object ke. |
| Float:Z | Koordinat Z untuk memindahkan Object ke. |
| Float:Speed | Kecepatan gerak Object (satuan per detik). |
| Float:RotX | Rotasi FINAL X (opsional). |
| Float:RotY | Rotasi FINAL Y (opsional). |
| Float:RotZ | Rotasi FINAL Z (opsional). |
## Returns
Waktu yang diperlukan benda untuk bergerak dalam milidetik.
## Contoh
```c
new gAirportGate; //Di suatu tempat di bagian atas skrip Anda
public OnGameModeInit()
{
gAirportGate = CreateObject(980, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(cmdtext, "/moveobject", true) == 0)
{
new
string[50],
moveTime = MoveObject(gAirportGate, 0, 0, 10, 2.00);
format(string, sizeof(string), "0bject akan selesai bergerak dalam %d milidetik", moveTime);
SendClientMessage(playerid, 0xFF000000, string);
return 1;
}
return 0;
}
```
## Catatan
:::warning
Function ini dapat digunakan untuk membuat Object berputar dengan lancar. Namun untuk mencapai ini, Object juga harus dipindahkan. Rotasi yang ditentukan adalah rotasi yang akan dimiliki Object setelah gerakan. Oleh karena itu Object tidak akan berputar ketika tidak ada gerakan yang diterapkan. Untuk contoh skrip, lihat skrip filter ferriswheel.pwn yang dibuat oleh Kye yang disertakan dalam paket server (SA-MP 0.3d ke atas). Untuk memahami sepenuhnya catatan di atas, Anda dapat (tetapi tidak terbatas pada) menaikkan posisi z sebesar (+0,001) dan kemudian (-0,001) setelah memindahkannya lagi, karena tidak mengubah X,Y atau Z tidak akan memutar Object.
:::
## Fungsi Terkait
- [CreateObject](CreateObject): Membuat suatu Object.
- [DestroyObject](DestroyObject): Menghapus suatu Object.
- [IsValidObject](IsValidObject): Memeriksa apakah Object tertentu valid.
- [IsObjectMoving](IsObjectMoving): Memeriksa apakah Object tersebut bergerak.
- [StopObject](StopObject): Menghentikan suatu Object agar tidak bergerak.
- [SetObjectPos](SetObjectPos): Mengatur posisi suatu Object.
- [SetObjectRot](SetObjectRot): Mengatur rotasi suatu Object.
- [GetObjectPos](GetObjectPos): Mencari Object.
- [GetObjectRot](GetObjectRot): Memeriksa rotasi suatu Object.
- [AttachObjectToPlayer](AttachObjectToPlayer): Menambahkan Object ke Player.
- [CreatePlayerObject](CreatePlayerObject): Membuat Object hanya untuk satu Player.
- [DestroyPlayerObject](DestroyPlayerObject): Menghapus suatu Object dari Player.
- [IsValidPlayerObject](IsValidPlayerObject): Memeriksa apakah Object Player tertentu valid.
- [MovePlayerObject](MovePlayerObject): Memindahkan Object Player.
- [StopPlayerObject](StopPlayerObject): Menghentikan Object Player agar tidak bergerak.
- [IsPlayerObjectMoving](IsPlayerObjectMoving): Memeriksa apakah Object Player bergerak.
- [SetPlayerObjectPos](SetPlayerObjectPos): Mengatur posisi Object Player.
- [SetPlayerObjectRot](SetPlayerObjectRot): Mengatur rotasi Object Player.
- [GetPlayerObjectPos](GetPlayerObjectPos): Mencari Object Player.
- [GetPlayerObjectRot](GetPlayerObjectRot): Memeriksa rotasi Object Player.
- [AttachPlayerObjectToPlayer](AttachPlayerObjectToPlayer): Menambahkan Object pemain ke Player.
| openmultiplayer/web/docs/translations/id/scripting/functions/MoveObject.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/id/scripting/functions/MoveObject.md",
"repo_id": "openmultiplayer",
"token_count": 1413
} | 363 |
---
id: boneid
title: "ID Bone (tulang pada bagian tubuh pemain)"
---
:::note
ID ini untuk digunakan dengan [SetPlayerAttachedObject](../functions/SetPlayerAttachedObject).
:::
| ID | Bone |
| --- | ----------------- |
| 1 | Tulang belakang |
| 2 | Kepala |
| 3 | Lengan kiri atas |
| 4 | Lengan kanan atas |
| 5 | Tangan kiri |
| 6 | Tangan kanan |
| 7 | Paha kiri |
| 8 | Paha kanan |
| 9 | Kaki kiri |
| 10 | Kaki kanan |
| 11 | Betis kanan |
| 12 | Betis kiri |
| 13 | Lengan kiri |
| 14 | Lengan kanan |
| 15 | Bahu kiri |
| 16 | Bahu kanan |
| 17 | Leher |
| 18 | Rahang |
| openmultiplayer/web/docs/translations/id/scripting/resources/boneid.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/id/scripting/resources/boneid.md",
"repo_id": "openmultiplayer",
"token_count": 402
} | 364 |
---
id: textalignments
title: Penjajaran Teks
description: Informasi tentang penjajaran teks
---
Informasi ini untuk digunakan dengan [SetObjectMaterialText](../functions/SetObjectMaterialText).
```c
OBJECT_MATERIAL_TEXT_ALIGN_LEFT 0
OBJECT_MATERIAL_TEXT_ALIGN_CENTER 1
OBJECT_MATERIAL_TEXT_ALIGN_RIGHT 2
```
| openmultiplayer/web/docs/translations/id/scripting/resources/textalignments.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/id/scripting/resources/textalignments.md",
"repo_id": "openmultiplayer",
"token_count": 121
} | 365 |
---
title: Pickup Guide
---
Tutorial singkat yang menjelaskan cara menggunakan pickups.
## Pengdeklarasian pickupid
Hal pertama kali yang harus dikerjakan saat membuat pickups adalah membuat sebuah tempat untuk menyimpan ID nya. Hal ini dapat dibuat didalam sebuah variabel global supaya nilainya dapat di tetapkan pada saat anda membuat pickup dan membaca nilai pickup, memanggil callback dengan nilai ID pickup tersebut. Untuk contohnya kita akan menggunakan contoh dengan nama "gMyPickup".
```c
new gMyPickup;
```
## Membuat pickup
Ada dua cara untuk membuat pickup. [CreatePickup](../scripting/functions/CreatePickup) dan [AddStaticPickup](../scripting/functions/AddStaticPickup). AddStaticPickup tidak me-return nilai ID nya saat nilainya dibuat, tidak dapat dihancurkan dan dapat digunakan dibawah OnGameModeInit, jadi untuk contoh kali ini kita akan menggunakan [CreatePickup](../scripting/functions/CreatePickup).
**Syntax untuk [CreatePickup](../scripting/functions/CreatePickup) adalah:**
**Parameters:**
| model | Model yang anda suka gunakan untuk pickup. |
| ------------ | ------------------------------------------------------------------------------------------------------ |
| type | Tipe pickup spawn, lihat lebih lanjut dibawah halaman ini. |
| Float:X | Koordinat titik X munculnya pickup. |
| Float:Y | Koordinat titik Y munculnya pickup. |
| Float:Z | Koordinat titik Z munculnya pickup. |
| Virtualworld | Virtual world ID pickupnya. Jika nilainya -1 maka akan menampilkan pickupnya di seluruh virtual world. |
Untuk contohnya kita akan membuat cash pickup di Grove Street.
Sekarang kita perlu untuk memilih model apa yang akan muncul di world, ada banyak model yang bisa dipilih, beberapa dilist di dalam external website [ini](https://dev.prineside.com/en/gtasa_samp_model_id), disini kita memilih model number 1274 dimana model tersebut adalah tanda dollar.
Pada akhirnya kita perlu sebuah [Type](../scripting/resources/pickuptypes) untuk pickupnya, pada halaman yang sama dengan pickup models ada list pickup types yang menggambarkan apa yang dilakukan oleh berbagai model. Kita mau supaya pickup ini menghilang saat di ambil pickupnya, jadi anda tidak bisa mengambilnya berkali-kali, tapi untuk memunculkannya setelah beberapa menit supaya bisa anda ambil kembali, type 2 bisa melakukan ini.
Pickups pada umumnya dibuat saat skrip berjalan, di [OnGameModeInit](../scripting/callbacks/OnGameModeInit) atau [OnFilterScriptInit](../scripting/callbacks/OnFilterScriptInit) tergantung pada tipe skripnya, namun semuanya dapat berjalan di function apa saja (untuk contohnya anda bisa membuat skrip weapon drop pada saat OnPlayerDeath untuk membuat weapon pickups).
jadi ini adalah code untuk membuat pickup kita, dan menyimpan ID nya di 'gMyPickup':
```c
gMyPickup = CreatePickup(1274, 2, 2491.7900, -1668.1653, 13.3438, -1);
```
### Memilih apa yang dilakukannya
Saat anda mengambil pickup, [OnPlayerPickUpPickup](../scripting/callbacks/OnPlayerPickUpPickup) dipanggil, memberikan playerid (player yang mengambil pickup) dan pickupid (ID pickup yang diambil).
Beberapa tipe pickup bekerja secara otomatis, jadi tidak perlu untuk melakukan apa apa didalam OnPlayerPickUpPickup. Cek laman [Pickup Types](../scripting/resources/pickuptypes) untuk info lebih lanjut.
Saat player mengambil pickup yang baru, kita mau memberi mereka $100, hal pertama untuk melakukannya adalah kita harus cek apakah dia pernah mengambil pickup dollar kita dan bukan pickup yang lain. Setelah kita selesai dengan hal tersebut, kita bisa berikan mereka $100:
```c
public OnPlayerPickUpPickup(playerid, pickupid)
{
// Cek apakah pickup ID yang di diambil adalah gMyPickup
if(pickupid == gMyPickup)
{
// Kirim Pesan kepada player
SendClientMessage(playerid, 0xFFFFFFFF, "You received $100!");
// Berikan player uangnya
GivePlayerMoney(playerid, 100);
}
// jika anda ingin menambah pickup lainnya, lakukan saja ini:
else if (pickupid == (some other pickup))
{
// Pickup lainnya, lakukan hal lainnya
}
return 1;
}
```
Selamat, anda sekarang sudah mengerti cara membuat dan menghandle pickups!
## Baca lebih lanjut
Anda dapat menggunakan plugin [Streamer](https://github.com/samp-incognito/samp-streamer-plugin) untuk membuat unlimited pickups dengan [CreateDynamicPickup](<https://github.com/samp-incognito/samp-streamer-plugin/wiki/Natives-(Pickups)>)
| openmultiplayer/web/docs/translations/id/tutorials/PickupGuide.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/id/tutorials/PickupGuide.md",
"repo_id": "openmultiplayer",
"token_count": 1941
} | 366 |
---
title: AddStaticVehicle
description: Dodaje „statyczny” pojazd (pojazdy są wstępnie ładowane dla graczy) do gamemodu.
tags: ["vehicle"]
---
## Opis
Dodaje „statyczny” pojazd (pojazdy są wstępnie ładowane dla graczy) do gamemodu.
| Nazwa | Opis |
| ---------------------------------------- | ----------------------------------- |
| modelid | ID modelu pojazdu. |
| Float:spawn_X | Koordynat X pojazdu. |
| Float:spawn_Y | Koordynat Y pojazdu. |
| Float:spawn_Z | Koordynat Z pojazdu. |
| Float:z_angle | Kierunek pojazdu (kąt). |
| [color1](../resources/vehiclecolorid.md) | ID pierwszego koloru. -1 to losowy. |
| [color2](../resources/vehiclecolorid.md) | ID drugiego koloru. -1 to losowy. |
## Zwracane wartości
ID stworzonego pojazdu (pomiędzy 1, a MAX_VEHICLES).
INVALID_VEHICLE_ID (65535) jeżeli pojazd nie został utworzony (osiągnięto limit pojazdów lub podano nieprawidłowe ID modelu).
## Przykłady
```c
public OnGameModeInit()
{
// Dodaje Hydrę do gry
AddStaticVehicle(520, 2109.1763, 1503.0453, 32.2887, 82.2873, 0, 1);
return 1;
}
```
## Powiązane funkcje
- [AddStaticVehicleEx](AddStaticVehicleEx.md): Dodaje statyczny pojazd z niestandardowym czasem respawnu.
- [CreateVehicle](CreateVehicle.md): Tworzy pojazd.
- [DestroyVehicle](DestroyVehicle.md): Kasuje pojazd.
| openmultiplayer/web/docs/translations/pl/scripting/functions/AddStaticVehicle.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/pl/scripting/functions/AddStaticVehicle.md",
"repo_id": "openmultiplayer",
"token_count": 866
} | 367 |
---
title: AttachTrailerToVehicle
description: Przyczepia jeden pojazd do drugiego jako przyczepa.
tags: ["vehicle"]
---
## Opis
Przyczepia jeden pojazd do drugiego jako przyczepa.
| Nazwa | Opis |
| --------- | ------------------------------------------- |
| trailerid | ID pojazdu, który będzie ciągnięty. |
| vehicleid | ID pojazdu, który będzie ciągnąć przyczepę. |
## Zwracane wartości
Ta funkcja zawsze zwraca 1, nawet jeśli żadne z podanych ID pojazdów nie jest prawidłowe.
## Przykłady
```c
new vehicleId = CreateVehicle(...);
new trailerId = CreateVehicle(...);
AttachTrailerToVehicle(trailerId, vehicleId);
```
## Uwagi
:::warning
Ta funkcja zadziała tylko wtedy, gdy obydwa pojazdy są widoczne dla gracza (zobacz [IsVehicleStreamedIn](IsVehicleStreamedIn)).
:::
## Powiązane funkcje
- [DetachTrailerFromVehicle](DetachTrailerFromVehicle.md): Odczepia przyczepę od pojazdu.
- [IsTrailerAttachedToVehicle](IsTrailerAttachedToVehicle.md): Sprawdza, czy przyczepa jest przyczepiona do pojazdu.
- [GetVehicleTrailer](GetVehicleTrailer.md): Podaje przyczepę ciągniętą aktualnie przez pojazd.
| openmultiplayer/web/docs/translations/pl/scripting/functions/AttachTrailerToVehicle.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/pl/scripting/functions/AttachTrailerToVehicle.md",
"repo_id": "openmultiplayer",
"token_count": 543
} | 368 |
---
title: OnDialogResponse
description: Esta callback é chamada quando um jogador responde a um dialog mostrado usando ShowPlayerDialog ao clicar em um botão, pressionar ENTER/ESC ou dar clique duplo em um item da lista. (se estiver usando o formato lista).
tags: []
---
## Descrição
Esta callback é chamada quando um jogador responde a um dialog mostrado usando ShowPlayerDialog ao clicar em um botão, pressionar ENTER/ESC ou dar clique duplo em um item da lista. (se estiver usando o formato lista).
| Parâmetro | Descrição |
| ----------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| playerid | O ID do jogador que respondeu ao dialog. |
| dialogid | O ID do dialog que foi respondido, conforme definido no ShowPlayerDialog. |
| response | 1 para o botão esquerdo e 0 para o botão direito (se for apenas um botão, sempre será 1) |
| listitem | O ID do item da lista selecionado pelo jogador (inicia 0) (apenas se estiver usando dialog no estilo de lista, caso contrário, será -1). |
| inputtext[] | O texto inserido no campo pelo jogador ou texto do item da lista que foi selecionado. |
## Retorno
É sempre chamado primeiro nas filterscripts, por isso, retornar 1 impede que as outras filterscripts o vejam.
## Exemplos
```c
// Define the dialog ID so we can handle responses
#define DIALOG_RULES 1
// In some command
ShowPlayerDialog(playerid, DIALOG_RULES, DIALOG_STYLE_MSGBOX, "Server Rules", "- No Cheating\n- No Spamming\n- Respect Admins\n\nDo you agree to these rules?", "Yes", "No");
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if (dialogid == DIALOG_RULES)
{
if (response) // Se clicarem em 'Yes' ou pressionarem ENTER
{
SendClientMessage(playerid, COLOR_GREEN, "Thank you for agreeing to the server rules!");
}
else // ESC pressionado ou Cancel clicado
{
Kick(playerid);
}
return 1; // Encontrando o dialog, retorna-se 1 para que os outros não sejam processados, Assim como OnPlayerCommandText.
}
return 0; // DEVE-SE retornar 0 aqui! Como em OnPlayerCommandText.
}
#define DIALOG_LOGIN 2
// Em algum comando
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Login", "Please enter your password:", "Login", "Cancel");
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if (dialogid == DIALOG_LOGIN)
{
if (!response) // ESC pressionado ou Cancel clicado
{
Kick(playerid);
}
else // Pressionando ENTER ou clicando no botão 'Login'
{
if (CheckPassword(playerid, inputtext))
{
SendClientMessage(playerid, COLOR_RED, "You are now logged in!");
}
else
{
SendClientMessage(playerid, COLOR_RED, "LOGIN FAILED.");
// Reapresenta o dialog de Login
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Login", "Please enter your password:", "Login", "Cancel");
}
}
return 1; // Encontrando o dialog, retorna-se 1 para que os outros não sejam processados, Assim como OnPlayerCommandText.
}
return 0; // DEVE-SE retornar 0 aqui! Como em OnPlayerCommandText.
}
#define DIALOG_WEAPONS 3
// Em um comando
ShowPlayerDialog(playerid, DIALOG_WEAPONS, DIALOG_STYLE_LIST, "Weapons", "Desert Eagle\nAK-47\nCombat Shotgun", "Select", "Close");
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if (dialogid == DIALOG_WEAPONS)
{
if (response) // Se clicar em 'Select' ou dar clique duplo na arma
{
// Give them the weapon
switch(listitem)
{
case 0: GivePlayerWeapon(playerid, WEAPON_DEAGLE, 14); // Entrega uma Deagle
case 1: GivePlayerWeapon(playerid, WEAPON_AK47, 120); // Entra uma AK-47
case 2: GivePlayerWeapon(playerid, WEAPON_SHOTGSPA, 28); // Entrega uma Combat Shotgun
}
}
return 1; // Encontrando o dialog, retorna-se 1 para que os outros não sejam processados, Assim como OnPlayerCommandText.
}
return 0; // DEVE-SE retornar 0 aqui! Como em OnPlayerCommandText.
}
#define DIALOG_WEAPONS 3
// Em um comando
ShowPlayerDialog(playerid, DIALOG_WEAPONS, DIALOG_STYLE_LIST, "Weapons",
"Weapon\tAmmo\tPrice\n\
M4\t120\t500\n\
MP5\t90\t350\n\
AK-47\t120\t400",
"Select", "Close");
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if (dialogid == DIALOG_WEAPONS)
{
if (response) // Se clicar em 'Select' ou usar clique duplo na arma
{
// Devolve uma arma
switch(listitem)
{
case 0: GivePlayerWeapon(playerid, WEAPON_M4, 120); // Entrega uma M4
case 1: GivePlayerWeapon(playerid, WEAPON_MP5, 90); // Entrega uma MP5
case 2: GivePlayerWeapon(playerid, WEAPON_AK47, 120); // Entrega uma AK-47
}
}
return 1; // Encontrando o dialog, retorna-se 1 para que os outros não sejam processados, Assim como OnPlayerCommandText.
}
return 0; // DEVE-SE retornar 0 aqui! Como em OnPlayerCommandText.
}
```
## Notes
:::dica
Parâmetros podem conter diferentes valores, baseados no estilo do dialog ([clique para mais exemplos](../resources/dialogstyles.md)).
:::
:::dica
É apropriado usar diferentes dialogids, se você tiver muitos.
:::
:::warning
Um dialog de jogador não é escondido ao reiniciar o gamemode, ocasionando em uma mensagem "Warning: PlayerDialogResponse PlayerId: 0 dialog ID doesn't match last sent dialog ID" se um jogador responder ao dialog após o reinício.
:::
## Funções Relacionadas
- [ShowPlayerDialog](../functions/ShowPlayerDialog.md): Show a dialog to a player.
| openmultiplayer/web/docs/translations/pt-BR/scripting/callbacks/OnDialogResponse.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/pt-BR/scripting/callbacks/OnDialogResponse.md",
"repo_id": "openmultiplayer",
"token_count": 2819
} | 369 |
---
title: OnPlayerClickPlayer
description: Chamado quando um jogador realiza um clique duplo em um jogador no placar.
tags: ["player"]
---
## Descrição
Chamado quando um jogador realiza um clique duplo em um jogador no placar.
| Nome | Descrição |
| --------------- | ---------------------------------------------- |
| playerid | O ID do jogador que clicou em outro no placar. |
| clickedplayerid | O ID do jogador que foi clicado. |
| source | A fonte do clique do jogador. |
## Retornos
1 - Irá previnir que outro filterscript receba esta callback.
0 - Indica que esta callback será passada para o próximo filterscript.
Sempre é chamada primeiro em filterscripts.
## Exemplos
```c
public OnPlayerClickPlayer(playerid, clickedplayerid, CLICK_SOURCE:source)
{
new message[32];
format(message, sizeof(message), "Você clicou no jogador %d", clickedplayerid);
SendClientMessage(playerid, 0xFFFFFFFF, message);
return 1;
}
```
## Notas
:::tip
Há atualmente apenas um 'source' (0 - CLICK_SOURCE_SCOREBOARD). A existência deste argumento sugere que mais 'sources' podem ser adicionadas no futuro.
:::
## Funções Relacionadas
- [OnPlayerClickTextDraw](OnPlayerClickTextDraw.md): Chamado quando um jogador clica em uma TextDraw.
| openmultiplayer/web/docs/translations/pt-BR/scripting/callbacks/OnPlayerClickPlayer.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/pt-BR/scripting/callbacks/OnPlayerClickPlayer.md",
"repo_id": "openmultiplayer",
"token_count": 523
} | 370 |
---
title: OnPlayerGiveDamageActor
description: Esta callback é chamada quando o jogador causa dano a um ator.
tags: ["player"]
---
<VersionWarnPT name='callback' version='SA-MP 0.3.7' />
## Descrição
Esta callback é chamada quando o jogador causa dano a um ator.
| Nome | Descrição |
|-----------------|-----------------------------------------------------------|
| playerid | ID do jogador que realizou o dano. |
| damaged_actorid | ID do ator que recebeu o dano. |
| Float:amount | A quantidade de vida/colete que o damaged_actorid perdeu. |
| WEAPON:weaponid | O motivo que causou o dano. |
| bodypart | A parte do corpo que foi acertada |
## Retorno
1 - Callback não será chamada em outros fillterscripts.
0 - Permite que essa callback seja chamada em outros filterscripts.
É sempre chamada primeiro em filterscripts então ao retornar 1 bloqueia outros filterscripts de vê-la.
## Exemplos
```c
public OnPlayerGiveDamageActor(playerid, damaged_actorid, Float:amount, WEAPON:weaponid, bodypart)
{
new string[128], attacker[MAX_PLAYER_NAME];
new weaponname[24];
GetPlayerName(playerid, attacker, sizeof (attacker));
GetWeaponName(weaponid, weaponname, sizeof (weaponname));
format(string, sizeof(string), "%s realizou %.0f de dano no ator de id %d, arma: %s", attacker, amount, damaged_actorid, weaponname);
SendClientMessageToAll(0xFFFFFFFF, string);
return 1;
}
```
## Notas
:::tip
Esta função não é chamada se o ator é posto como vulnerável (QUE É O PADRÃO). Veja a função [SetActorInvulnerable](../functions/SetActorInvulnerable).
:::
## Funções relacionadas
- [CreateActor](../functions/CreateActor): Cria um ator (NPC estático).
- [SetActorInvulnerable](../functions/SetActorInvulnerable): Coloca o actor como invulnerável.
- [SetActorHealth](../functions/SetActorHealth): Informa a vida de um ator.
- [GetActorHealth](../functions/GetActorHealth): Obtém a vida de um ator.
- [IsActorInvulnerable](../functions/IsActorInvulnerable): Verifica se um ator é invulnerável.
- [IsValidActor](../functions/IsValidActor): Verifica se o ID de um ator é válido.
## Callbacks relacionadas
- [OnActorStreamOut](OnActorStreamOut): Chamada quando um ator é removido da área visível por um jogador.
- [OnPlayerStreamIn](OnPlayerStreamIn): Chamada quando um jogador aparece na área visível de outro jogador.
| openmultiplayer/web/docs/translations/pt-BR/scripting/callbacks/OnPlayerGiveDamageActor.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/pt-BR/scripting/callbacks/OnPlayerGiveDamageActor.md",
"repo_id": "openmultiplayer",
"token_count": 998
} | 371 |
---
title: OnPlayerUpdate
description: Essa callback é executada quando o cliente/player faz o update do seu status para o servidor.
tags: ["player"]
---
## Descrição
Essa callback é executada quando o cliente/player faz o update do seu status para o servidor. É geralmente utilizada para criar callbacks customizadas para o cliente, das quais não são ativas no lado do servidor, tais como vida, colete, ou até mesmo troca de armas.
| Nome | Descrição |
| -------- | ------------------------------------------ |
| playerid | ID do jogador que está enviando o pacote. |
## Retornos
0 - Update do jogador não será replicado para os outros.
1 - Indica que o update do jogador deve ser processado e eviado para os outros jogadores.
É sempre executada primeiro nos filterscripts.
## Exemplos
```c
public OnPlayerUpdate(playerid)
{
new iCurWeap = GetPlayerWeapon(playerid); // Retorna a arma atual do jogador
if (iCurWeap != GetPVarInt(playerid, "iCurrentWeapon")) // Caso o mesmo tenha trocado de arma após o último update
{
// Vamos chamar a callback OnPlayerChangeWeapon
OnPlayerChangeWeapon(playerid, GetPVarInt(playerid, "iCurrentWeapon"), iCurWeap);
SetPVarInt(playerid, "iCurrentWeapon", iCurWeap);//Atualiza a váriavel da arma
}
return 1; // Envia o update para os outros jogadores.
}
stock OnPlayerChangeWeapon(playerid, oldweapon, newweapon)
{
new s[128],
oWeapon[24],
nWeapon[24];
GetWeaponName(oldweapon, oWeapon, sizeof(oWeapon));
GetWeaponName(newweapon, nWeapon, sizeof(nWeapon));
format(s, sizeof(s), "Você trocou sua arma de %s para %s!", oWeapon, nWeapon);
SendClientMessage(playerid, 0xFFFFFFFF, s);
}
public OnPlayerUpdate(playerid)
{
new Float:fHealth;
GetPlayerHealth(playerid, fHealth);
if (fHealth != GetPVarFloat(playerid, "faPlayerHealth"))
{
// A vida do jogador mudou desde o último update -> server, então obviamente foi atualizada.
// Vamos fazer uma checagem mais profunda para ver se o mesmo esta ganhando ou perdendo vida, anti-health cheat? ;)
if (fHealth > GetPVarFloat(playerid, "faPlayerHealth"))
{
/* Ele ganhou vida! Xitando? Escreva seu próprio script para saber como o player esta ganhando vida... */
}
else
{
/* Ele perdeu vida! */
}
SetPVarFloat(playerid, "faPlayerHealth", fHealth);
}
}
```
## Notas
<TipNPCCallbacksPT />
:::warning
Essa callback é executada, aproximadamente, 30 vezes por segundo, por jogador; Use a mesma somente caso saiba o que está fazendo (ou talvez seja mais importante saber para que ela NÃO DEVE SER USADA). A frequência que essa callback é executada varia dependendo da situação e do que o player está fazendo. Dirigir ou participar de um tiroteio vai fazer com que os updates aumentem drasticamente, diferente se o jogador estiver parado...
:::
| openmultiplayer/web/docs/translations/pt-BR/scripting/callbacks/OnPlayerUpdate.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/pt-BR/scripting/callbacks/OnPlayerUpdate.md",
"repo_id": "openmultiplayer",
"token_count": 1166
} | 372 |
---
title: AddCharModel
description: Adiciona um novo modelo de personagem personalizado para download. Os arquivos do modelo são armazenados em Documentos\GTA San Andreas User Files\SAMP\cache do jogador sob a pasta IP e Porta do Servidor em um arquivo no formato CRC.
tags: []
---
## Descrição
:::warning
Esta função foi implementada no SA-MP 0.3.DL-R1 e não funcionará em versões anteriores.
:::
Adiciona um novo modelo de personagem personalizado para download. Os arquivos do modelo serão armazenados em Documentos\GTA San Andreas User Files\SAMP\cache do jogador sob a pasta IP e Porta do Servidor em um arquivo no formato CRC.
| Nome | Descrição |
| ------- | -------------------------------------------------------------------------------------------------------------------------- |
| baseid | O ID do modelo da skin original a ser usado como base (personagens originais são usados caso o download falhar). |
| newid | O ID do modelo da nova skin. Varia entre 20001 a 30000 (10000 slots) para serem usados posteriormente com SetPlayerSkin. |
| dffname | Nome do arquivo de extensão .dff localizado na pasta do servidor de modelos por padrão (configuração artpath). |
| txdname | Nome do arquivo de textura de extensão .txd localizado na pasta do servidor de modelos por padrão (configuração artpath). |
## Retorno
1: A função foi executada com sucesso.
0: Falha ao executar a função.
## Exemplos
```c
public OnGameModeInit()
{
AddCharModel(305, 20001, "lvpdpc2.dff", "lvpdpc2.txd");
AddCharModel(305, 20002, "lapdpd2.dff", "lapdpd2.txd");
return 1;
}
```
```c
AddCharModel(305, 20001, "lvpdpc2.dff", "lvpdpc2.txd");
AddCharModel(305, 20002, "lapdpd2.dff", "lapdpd2.txd");
```
## Notas
:::tip
"useartwork" deve ser habilitado primeiro nas configurações do servidor para que essa função funcione.
:::
:::warning
Atualmente não há restrições sobre quando você pode chamar esta função, mas esteja ciente de que se você não chamá-los dentro de OnFilterScriptInit ou OnGameModeInit, você corre o risco de que alguns jogadores, que já estão no servidor, não tenham baixado os modelos.
:::
## Funções Relacionadas
- [SetPlayerSkin](../functions/SetPlayerSkin.md): Define a skin (personagem) de um jogador.
| openmultiplayer/web/docs/translations/pt-BR/scripting/functions/AddCharModel.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/pt-BR/scripting/functions/AddCharModel.md",
"repo_id": "openmultiplayer",
"token_count": 954
} | 373 |
---
title: AttachCameraToObject
description: Você pode usar esta função para anexar a câmera do jogador a objetos.
tags: []
---
## Descrição
Você pode usar esta função para anexar a câmera do jogador a objetos.
| Nome | Descrição |
| -------- | -------------------------------------------------------- |
| playerid | O ID do jogador que terá a sua câmera anexada ao objeto. |
| objectid | O ID do objeto que deseja anexar à câmera do jogador. |
## Retorno
Esta função não retorna nenhum valor específico.
## Exemplos
```c
public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp(cmdtext, "/attach", false))
{
new objectId = CreateObject(1245, 0.0, 0.0, 3.0, 0.0, 0.0, 0.0);
AttachCameraToObject(playerid, objectId);
SendClientMessage(playerid, 0xFFFFFFAA, "Sua câmera está agora anexada ao objeto.");
return 1;
}
return 0;
}
```
## Notas
:::tip
Você precisa criar o objeto primeiro, antes de tentar conectar uma câmera do jogador.
:::
## Funções Relacionadas
- [AttachCameraToPlayerObject](AttachCameraToPlayerObject.md): Anexa a câmera do jogador a um objeto de jogador (player-object).
| openmultiplayer/web/docs/translations/pt-BR/scripting/functions/AttachCameraToObject.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/pt-BR/scripting/functions/AttachCameraToObject.md",
"repo_id": "openmultiplayer",
"token_count": 520
} | 374 |
---
title: GangZoneHideForAll
description: Esconde uma gangzone de todos os jogadores.
tags: ["gangzone"]
---
## Descrição
Esconde uma gangzone de todos os jogadores.
| Nome | Descrição |
| ---- | --------------------------- |
| zone | A gangzone a ser escondida. |
## Retorno
Esta função não retorna nenhum valor específico.
## Exemplos
```c
new gGangZoneId;
gGangZoneId = GangZoneCreate(1248.011, 2072.804, 1439.348, 2204.319);
GangZoneHideForAll(gGangZoneId);
```
## Funções Relacionadas
- [GangZoneCreate](GangZoneCreate): Cria uma gangzone.
- [GangZoneDestroy](GangZoneDestroy): Destrói uma gangzone.
- [GangZoneShowForPlayer](GangZoneShowForPlayer): Mostra uma gangzone a um jogador.
- [GangZoneShowForAll](GangZoneShowForAll): Mostra uma gangzone para todos os jogadores.
- [GangZoneHideForPlayer](GangZoneHideForPlayer): Esconde uma gangzone a um jogador.
- [GangZoneFlashForPlayer](GangZoneFlashForPlayer): Faz uma gangzone piscar para um jogador.
- [GangZoneFlashForAll](GangZoneFlashForAll): Faz uma gangzone piscar para todos os jogadores.
- [GangZoneStopFlashForPlayer](GangZoneStopFlashForPlayer): Pare uma Gangzone de piscar para um jogador.
- [GangZoneStopFlashForAll](GangZoneStopFlashForAll): Pare uma Gangzone de piscar para todos os jogadores.
| openmultiplayer/web/docs/translations/pt-BR/scripting/functions/GangZoneHideForAll.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/pt-BR/scripting/functions/GangZoneHideForAll.md",
"repo_id": "openmultiplayer",
"token_count": 482
} | 375 |
---
title: GetPlayerMoney
description: Retorna a quantidade de dinheiro que um jogador possui.
tags: ["player"]
---
## Descrição
Retorna a quantidade de dinheiro que um jogador possui.
| Nome | Descrição |
| -------- | --------------------------------------------------- |
| playerid | O ID do jogador que se deseja verificar o dinheiro. |
## Retorno
A quantidade de dinheiro que o jogador possui.
## Exemplos
```c
public OnPlayerSpawn(playerid)
{
new string[32];
format(string, sizeof(string), "Seu dinheiro: $%i.", GetPlayerMoney(playerid));
SendClientMessage(playerid, 0xFFFFFFAA, string);
}
```
## Funções Relacionadas
- [GivePlayerMoney](GivePlayerMoney.md): Dá dinheiro a um jogador.
- [ResetPlayerMoney](ResetPlayerMoney.md): Define o dinheiro de um jogador para \$0.
| openmultiplayer/web/docs/translations/pt-BR/scripting/functions/GetPlayerMoney.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/pt-BR/scripting/functions/GetPlayerMoney.md",
"repo_id": "openmultiplayer",
"token_count": 322
} | 376 |
---
title: SpawnPlayer
description: (Re)Spawna um jogador.
tags: ["player"]
---
## Descrição
(Re)Spawna um jogador.
| Nome | Descrição |
| -------- | -------------------------- |
| playerid | O ID do jogador a spawnar. |
## Retorno
1: A função foi executada com sucesso.
0: A função falhou ao ser executada. Isso significa que o jogador não está conectado.
## Exemplos
```c
if (strcmp(cmdtext, "/spawn", true) == 0)
{
SpawnPlayer(playerid);
return 1;
}
```
## Notas
:::tip
Mata o jogador se ele tiver no veículo e depois ele spawna com uma garrafa na mão.
:::
## Funções Relacionadas
- [SetSpawnInfo](SetSpawnInfo.md): Define a configuração de spawn de um jogador.
- [AddPlayerClass](AddPlayerClass.md): Adiciona uma classe.
- [OnPlayerSpawn](../callbacks/OnPlayerSpawn.md): É chamado quando um jogador spawna.
| openmultiplayer/web/docs/translations/pt-BR/scripting/functions/SpawnPlayer.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/pt-BR/scripting/functions/SpawnPlayer.md",
"repo_id": "openmultiplayer",
"token_count": 341
} | 377 |
---
title: Modos de câmera
---
## Descrição
Lista de modos de câmeras que podem ser utilizados com [GetPlayerCameraMode](../functions/GetPlayerCameraMode.md).
:::note
Podem haver mais IDs utilizáveis escondidos no jogo e alguns IDs são usados para mais que uma situação.
:::
## Lista
| ID | Modo |
| --- | ------------------------------------------------------------------------------------------------------------------------------- |
| 3 | Train/tram camera. |
| 4 | Camera normal que segue o jogador. |
| 7 | Mira de Sniper. |
| 8 | Mira de uma Rocket Launcher. |
| 15 | Câmera Fixa (Não se move) - usada para Pay 'n' Spray, câmera de perseguição, shops de tunagem, entrando em construções, comprando comida, etc. |
| 16 | Câmera frontal do veículo, câmera lateral da bicicleta. |
| 18 | Carro normal (+skimmer+helicopter+airplane), diversas variações de distância. |
| 22 | Câmera normal do bote. |
| 46 | Câmera da mira de uma arma normal. |
| 51 | Mira de Heat-seeking Rocket Launcher. |
| 53 | Mirando qualquer outra ara. |
| 55 | Câmera drive-by de passageiros no veículo. |
| 56 | Câmera de perseguição: visão de helicoptero. |
| 57 | Câmera de perseguição: câmera no chão, zoom rápido. (Assim como o 56, mas no chão.) |
| 58 | Câmera de perseguição: Voo vertical que passa pelo veículo. |
| 59 | Câmera de perseguição (apenas para veículo aéreos): câmera no chão olhando para o veículo. |
| 62 | Câmera de perseguição (apenas para veículo aéreos): Voo vertical que passa pelo veículo. |
| 63 | Câmera de perseguição (apenas para veículo aéreos): Voo horizontal que passa pelo veículo. (similar com 58 e 62). |
| 64 | Câmera de perseguição (apenas para veículo aéreos): câmera focada no piloto, similar ao pressionar LOOK_BEHIND (olhar para trás) ao estar apé, mas em um veículo aéreo. |
| openmultiplayer/web/docs/translations/pt-BR/scripting/resources/cameramodes.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/pt-BR/scripting/resources/cameramodes.md",
"repo_id": "openmultiplayer",
"token_count": 2296
} | 378 |
---
title: OnDialogResponse
description: Acest callback este apelat atunci când un jucător răspunde unui dialog afișat prin ShowPlayerDialog, după apăsarea unui buton, apăsarea de ENTER/ESC sau dublu-click pe un element al unei liste (dacă s-a folosit un dialog de tip listă).
tags: []
---
## Descriere
Acest callback este apelat când un jucător răspunde unui dialog afișat prin ShowPlayerDialog, după apăsarea unui buton, apăsarea de ENTER/ESC sau dublu-click pe un element al unei liste (dacă s-a folosit un dialog de tip listă).
| Nume | Descriere |
| ----------- | ---------------------------------------------------------------------------------------------------------------------------- |
| playerid | ID-ul jucătorului care a răspuns dialogului. |
| dialogid | ID-ul dialogului căruia jucătorul i-a răspuns, atribuit în ShowPlayerDialog. |
| response | 1 pentru butonul din stânga, 0 pentru butonul din dreapta (dacă numai un buton este afișat atunci mereu 1) |
| listitem | ID-ul elementului din listă selectat (începe de la 0) (doar dacă s-a folosit un dialog de tip listă, altfel va fi mereu -1). |
| inputtext[] | Textul inserat de către jucător în căsuța de intrare, sau textul elementului din listă selectat. |
## Returnări
Mereu este apelat primul în filterscript-uri deci returnează 1 și blochează alte filterscript-uri din a vedea răspunsul.
## Exemple
```c
// Definim ID-ul dialogului pentru a putea prelucra răspunsurile
#define DIALOG_RULES 1
// În ceva comandă
ShowPlayerDialog(playerid, DIALOG_RULES, DIALOG_STYLE_MSGBOX, "Regulile server-ului", "- Fără coduri\n- Fără spam\n- Respectați Adminii\n\nEști de acord cu aces te reguli?", "Da", "Nu");
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if (dialogid == DIALOG_RULES)
{
if (response) // Dacă au apăsat pe 'Da' sau au apăsat ENTER
{
SendClientMessage(playerid, COLOR_GREEN, "Mulțumim pentru că ai acceptat regulile!");
}
else // Au apăsat ESC sau 'Nu'
{
Kick(playerid);
}
return 1; // Am folosit un dialog, deci returnăm 1. La fel ca OnPlayerCommandText.
}
return 0; // TREBUIE să returnezi 0 aici! La fel ca OnPlayerCommandText.
}
#define DIALOG_LOGIN 2
// În ceva comandă
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Login", "Introdu parola:", "Login", "Cancel");
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if (dialogid == DIALOG_LOGIN)
{
if (!response) // Dacă au apăsat pe butonul de 'Cancel' sau ESC
{
Kick(playerid);
}
else // Dacă au apăsat ENTER sau pe butonul de 'Login'
{
if (CheckPassword(playerid, inputtext))
{
SendClientMessage(playerid, COLOR_RED, "Ai fost autentificat cu success!");
}
else
{
SendClientMessage(playerid, COLOR_RED, "LOGIN FAILED.");
// Arată din nou dialogul de login
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Login", "Introdu parola:", "Login", "Cancel");
}
}
return 1; // Am folosit un dialog, deci returnăm 1. La fel ca OnPlayerCommandText.
}
return 0; // TREBUIE să returnezi 0 aici! La fel ca OnPlayerCommandText.
}
#define DIALOG_WEAPONS 3
// În ceva comandă
ShowPlayerDialog(playerid, DIALOG_WEAPONS, DIALOG_STYLE_LIST, "Weapons", "Desert Eagle\nAK-47\nCombat Shotgun", "Select", "Close");
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if (dialogid == DIALOG_WEAPONS)
{
if (response) // Dacă au apăsat pe butonul de 'Select' or sau au dat dublu-click pe o armă
{
// Give them the weapon
switch(listitem)
{
case 0: GivePlayerWeapon(playerid, WEAPON_DEAGLE, 14); // Le dăm desert eagle
case 1: GivePlayerWeapon(playerid, WEAPON_AK47, 120); // Le dăm un AK-47
case 2: GivePlayerWeapon(playerid, WEAPON_SHOTGSPA, 28); // Le dăm un Combat Shotgun
}
}
return 1; // Am folosit un dialog, deci returnăm 1. La fel ca OnPlayerCommandText.
}
return 0; // TREBUIE să returnezi 0 aici! La fel ca OnPlayerCommandText.
}
#define DIALOG_WEAPONS 3
// În ceva comandă
ShowPlayerDialog(playerid, DIALOG_WEAPONS, DIALOG_STYLE_LIST, "Weapons",
"Weapon\tAmmo\tPrice\n\
M4\t120\t500\n\
MP5\t90\t350\n\
AK-47\t120\t400",
"Select", "Close");
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if (dialogid == DIALOG_WEAPONS)
{
if (response) // Dacă au apăsat pe butonul de 'Select' or sau au dat dublu-click pe o armă
{
// Give them the weapon
switch(listitem)
{
case 0: GivePlayerWeapon(playerid, WEAPON_M4, 120); // Give them an M4
case 1: GivePlayerWeapon(playerid, WEAPON_MP5, 90); // Give them an MP5
case 2: GivePlayerWeapon(playerid, WEAPON_AK47, 120); // Give them an AK-47
}
}
return 1; // We handled a dialog, so return 1. Just like OnPlayerCommandText.
}
return 0; // You MUST return 0 here! Just like OnPlayerCommandText.
}
```
## Note
:::tip
Parametrii pot conține diferite valori, pe baza stilului dialogului ([click pentru mai multe exemple](../resources/dialogstyles.md)).
:::
:::tip
Ar fi frumos să folosești switch prin dialogids, dacă ai o grămadă.
:::
:::warning
Un dialog al unui jucător nu se ascunde când gamemode-ul se restartează, cauzând serverul să printeze "Warning: PlayerDialogResponse PlayerId: 0 dialog ID doesn't match last sent dialog ID" dacă un jucător a răspuns acestui dialog după restart.
:::
## Funcții asociate
- [ShowPlayerDialog](../functions/ShowPlayerDialog.md): Afișează un dialog unui jucător.
| openmultiplayer/web/docs/translations/ro/scripting/callbacks/OnDialogResponse.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/ro/scripting/callbacks/OnDialogResponse.md",
"repo_id": "openmultiplayer",
"token_count": 2942
} | 379 |
---
title: OnPlayerEditAttachedObject
description: Acest callback este apelat atunci când un jucător încheie modul de ediție a obiectelor atașate.
tags: ["player"]
---
## Descriere
Acest callback este apelat atunci când un jucător încheie modul de ediție a obiectelor atașate.
| Nume | Descriere |
|------------------------|--------------------------------------------------------------------------|
| playerid | ID-ul jucătorului care a încheiat modul ediție |
| EDIT_RESPONSE:response | 0 dacă au anulat (ESC) sau 1 dacă au făcut clic pe pictograma de salvare |
| index | Indexul obiectului atașat (0-9) |
| modelid | Modelul obiectului atașat care a fost editat |
| boneid | Osul obiectului atașat care a fost editat |
| Float:fOffsetX | Decalajul X pentru obiectul atașat care a fost editat |
| Float:fOffsetY | Decalajul Y pentru obiectul atașat care a fost editat |
| Float:fOffsetZ | Decalajul Z pentru obiectul atașat care a fost editat |
| Float:fRotX | Rotația X pentru obiectul atașat care a fost editat |
| Float:fRotY | Rotația Y pentru obiectul atașat care a fost editat |
| Float:fRotZ | Rotația Z pentru obiectul atașat care a fost editat |
| Float:fScaleX | Scara X pentru obiectul atașat care a fost editat |
| Float:fScaleY | Scara Y pentru obiectul atașat care a fost editat |
| Float:fScaleZ | Scara Z pentru obiectul atașat care a fost editat |
## Returnări
1 - Va împiedica alte scripturi să primească acest callback.
0 - Indică faptul că acest callback va fi transmis următorului script.
Este întotdeauna numit primul în filterscript-uri.
## Example
```c
enum attached_object_data
{
Float:ao_x,
Float:ao_y,
Float:ao_z,
Float:ao_rx,
Float:ao_ry,
Float:ao_rz,
Float:ao_sx,
Float:ao_sy,
Float:ao_sz
}
new ao[MAX_PLAYERS][MAX_PLAYER_ATTACHED_OBJECTS][attached_object_data];
// Datele ar trebui să fie stocate în matricea de mai sus atunci când obiectele atașate sunt atașate.
public OnPlayerEditAttachedObject(playerid, EDIT_RESPONSE:response, index, modelid, boneid, Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ, Float:fRotX, Float:fRotY, Float:fRotZ, Float:fScaleX, Float:fScaleY, Float:fScaleZ)
{
if (response)
{
SendClientMessage(playerid, COLOR_GREEN, "Ediția obiectului atașat a fost salvată.");
ao[playerid][index][ao_x] = fOffsetX;
ao[playerid][index][ao_y] = fOffsetY;
ao[playerid][index][ao_z] = fOffsetZ;
ao[playerid][index][ao_rx] = fRotX;
ao[playerid][index][ao_ry] = fRotY;
ao[playerid][index][ao_rz] = fRotZ;
ao[playerid][index][ao_sx] = fScaleX;
ao[playerid][index][ao_sy] = fScaleY;
ao[playerid][index][ao_sz] = fScaleZ;
}
else
{
SendClientMessage(playerid, COLOR_RED, "Ediția obiectului atașat nu a fost salvată.");
new i = index;
SetPlayerAttachedObject(playerid, index, modelid, boneid, ao[playerid][i][ao_x], ao[playerid][i][ao_y], ao[playerid][i][ao_z], ao[playerid][i][ao_rx], ao[playerid][i][ao_ry], ao[playerid][i][ao_rz], ao[playerid][i][ao_sx], ao[playerid][i][ao_sy], ao[playerid][i][ao_sz]);
}
return 1;
}
```
## Note
:::warning
Edițiile ar trebui eliminate dacă răspunsul a fost „0” (anulat). Acest lucru trebuie făcut prin stocarea offset-urilor etc. într-o matrice ÎNAINTE de a utiliza EditAttachedObject.
:::
## Funcții similare
- [EditAttachedObject](../functions/EditAttachedObject): Editați un obiect atașat.
- [SetPlayerAttachedObject](../functions/SetPlayerAttachedObject): Atașați un obiect unui jucător. | openmultiplayer/web/docs/translations/ro/scripting/callbacks/OnPlayerEditAttachedObject.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/ro/scripting/callbacks/OnPlayerEditAttachedObject.md",
"repo_id": "openmultiplayer",
"token_count": 2133
} | 380 |
---
title: OnPlayerRequestClass
description: Apelat atunci când un jucător schimbă clasa la selecția clasei (și când apare prima dată selecția clasei).
tags: ["player"]
---
## Descriere
Apelat atunci când un jucător schimbă clasa la selecția clasei (și când apare prima dată selecția clasei).
| Nume | Descriere |
| -------- | ------------------------------------------------------------------------ |
| playerid | ID-ul jucătorului care a schimbat clasa. |
| classid | ID-ul clasei curente care este vizualizată (returnat de AddPlayerClass). |
## Returnări
Este întotdeauna numit primul în filterscript-uri.
## Exemple
```c
public OnPlayerRequestClass(playerid,classid)
{
if (classid == 3 && !IsPlayerAdmin(playerid))
{
SendClientMessage(playerid, COLOR_RED, "Acest skin este doar pentru administratori!");
return 0;
}
return 1;
}
```
## Note
:::tip
Acest callback este apelat și atunci când un jucător apasă F4.
:::
## Funcții similare
- [AddPlayerClass](../functions/AddPlayerClass): Adăugați o clasă. | openmultiplayer/web/docs/translations/ro/scripting/callbacks/OnPlayerRequestClass.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/ro/scripting/callbacks/OnPlayerRequestClass.md",
"repo_id": "openmultiplayer",
"token_count": 531
} | 381 |
---
title: OnTrailerUpdate
description: Acest callback este apelat atunci când un jucător a trimis o actualizare a trailerului.
tags: []
---
## Descriere
Acest callback este apelat atunci când un jucător a trimis o actualizare a trailerului.
| Nume | Descriere |
| --------- | ---------------------------------------------- |
| playerid | ID-ul jucătorului care a trimis o actualizare a trailerului |
| vehicleid | Trailerul în curs de actualizare |
## Returnări
0 - Anulează orice actualizări ale trailerului pentru a fi trimise altor jucători. Actualizarea este încă trimisă jucătorului de actualizare.
1 - Procesează actualizarea trailerului ca de obicei și o sincronizează între toți jucătorii.
Este întotdeauna numit primul în filterscript-uri.
## Examples
```c
public OnTrailerUpdate(playerid, vehicleid)
{
DetachTrailerFromVehicle(GetPlayerVehicleID(playerid));
return 0;
}
```
## Note
:::warning
Acest apel invers este apelat foarte frecvent pe secundă pe remorcă. Ar trebui să vă abțineți de la implementarea unor calcule intensive sau operațiuni intensive de scriere/citire a fișierelor în acest apel invers.
:::
## Funcții similare
- [GetVehicleTrailer](../functions/GetVehicleTrailer): Verificați ce remorcă trage un vehicul.
- [IsTrailerAttachedToVehicle](../functions/IsTrailerAttachedToVehicle): Verificați dacă o remorcă este atașată la un vehicul.
- [AttachTrailerToVehicle](../functions/AttachTrailerToVehicle): Atașați o remorcă la un vehicul.
- [DetachTrailerFromVehicle](../functions/DetachTrailerFromVehicle): Detașați o remorcă de pe un vehicul. | openmultiplayer/web/docs/translations/ro/scripting/callbacks/OnTrailerUpdate.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/ro/scripting/callbacks/OnTrailerUpdate.md",
"repo_id": "openmultiplayer",
"token_count": 695
} | 382 |
---
title: Partile corpului
---
Se foloseste cu [OnPlayerGiveDamage](../callbacks/OnPlayerGiveDamags), [OnPlayerTakeDamage](../callbacks/OnPlayerTakeDamage) si [OnPlayerGiveDamageActor](../callbacks/OnPlayerGiveDamageActor).
| ID | Body Part |
| --- | -------------- |
| 3 | Piept |
| 4 | Poală |
| 5 | Bratul stang |
| 6 | Bratul drept |
| 7 | Piciorul stâng |
| 8 | Piciorul drept |
| 9 | Cap |
:::note Aceste ID-uri nu sunt confirmate 100% și nu sunt definite în niciun SA-MP include - trebuie să fie definite de scripter. Nu se știe dacă ID-urile 0, 1 și 2 au vreo utilizare. :::

| openmultiplayer/web/docs/translations/ro/scripting/resources/bodyparts.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/ro/scripting/resources/bodyparts.md",
"repo_id": "openmultiplayer",
"token_count": 300
} | 383 |
---
title: "Consolă la distanță (RCON)"
descripion: Administrare server de la distanță.
---
Remote Console este un prompt de comandă în care puteți utiliza comenzile RCON fără a fi nevoie să fiți în joc și pe server. De la 0.3b, consola de la distanță a fost eliminată din browserul serverului. De acum înainte va trebui să utilizați un alt mod de a accesa Remote RCON, așa cum se explică mai jos.
1. Deschideți un editor de text.
2. Scrieți în rândul următor: `rcon.exe IP PORT RCON-PASS` (Înlocuiți IP / PORT / PASS cu detaliile serverului)
3. Saveți fișierul ca `rcon.bat`
4. Introduceți fișierul în directorul GTA unde se află `rcon.exe`.
5. Executa `rcon.bat`
6. Introduceți comanda care vă place.

Notă: Nu este necesar să tastați `/rcon` înainte de comandă în browserul serverului și comenzile nu vor funcționa dacă faceți acest lucru. De exemplu, dacă doriți să resetați serverul, tastați doar `gmx` și apăsați Enter. Asta este tot ce trebuie să faci. Bucurați-vă
| openmultiplayer/web/docs/translations/ro/server/RemoteConsole.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/ro/server/RemoteConsole.md",
"repo_id": "openmultiplayer",
"token_count": 484
} | 384 |
# SA-MP wiki и документация open.mp
Добро пожаловать в SA-MP wiki, поддерживаемую командой open.mp, а также более широким SA-MP сообществом!
Этот сайт стремится предоставить доступный источник документации SA-MP и в конечном счёте open.mp, в который сообщество с легкостью может внести свой вклад.
## Исчезновение SA-MP wiki
К сожалению, SA-MP wiki была закрыта в конце сентября 2020 года, а затем восстановлена как недоступный для редактирования архив.
Увы, нам нужна помощь сообщества, чтобы перенести содержимое прошлой wiki в новый дом – сюда!
Если вы заинтересовались, то посетите [эту страницу](/meta/Contributing) для получения дополнительной информации.
Если у вас нет опыта использования GitHub или преобразования HTML, не волнуйтесь! Вы можете помочь, просто сообщив нам о проблемах (через [Discord](https://discord.gg/samp), [форум](https://forum.open.mp) или социальные сети) и, что самое главное, _распространив информацию о нас!_ Поэтому не забудьте добавить этот сайт в закладки и поделиться им со всеми, кого вы знаете, кому интересно, куда делась SA-MP wiki.
Мы приветствуем вклад в улучшение документации, а также написание учебников и руководств для общих задач, таких как создание простых модов, использование общих библиотек и плагинов. Если вы заинтересованы в участии, перейдите на [GitHub страницу](https://github.com/openmultiplayer/web).
| openmultiplayer/web/docs/translations/ru/index.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/ru/index.md",
"repo_id": "openmultiplayer",
"token_count": 1298
} | 385 |
---
title: Частые Проблемы
---
## Сервер мгновенно выключается при запуске
Чаще всего это вызвано ошибкой в server.cfg или .amx файл игрового режим отсутствует. Проверьте файл server_log.txt, причина должна быть указана внизу. Если нет, то проверьте файл crashinfo.txt. Лучшим решением для нахождения причины сбоя, будет использование плагина Crash Detect от Zeex/0x5A656578 ([ссылка на репозиторий](https://github.com/Zeex/samp-plugin-crashdetect)), который даёт намного больше такой отладочной информации, как номера строк, имена функций, значения передаваемых параметров и т.д. Если скрипт скомпилирован в режиме отладки (флаг -d3), то вы увидите больше информации о скрипте в окне вывода при компиляции.
## Сервер не работает - брандмауэр выключен
Вам нужно будет перенаправить свои порты, чтобы игроки могли присоединиться к вашему серверу. Вы можете перенаправить свои порты с помощью PF Port Checker. Скачать его можно по адресу: www.portforward.com если порты не перенаправлены, это означает, что вы должны открыть их в своем маршрутизаторе. Вы можете проверить список маршрутизаторов по адресу [http://portforward.com/english/routers/port_forwarding/routerindex.htm](http://portforward.com/english/routers/port_forwarding/routerindex.htm "http://portforward.com/english/routers/port_forwarding/routerindex.htm")
Там есть вся информация по перенаправлению портов.
## 'Packet was modified'
Обычно, ошибка выглядит следующим образом:
```
[hh:mm:ss] Packet was modified, sent by id: <id>, ip: <ip>:<port>
```
Она случается, когда у игрока случаются проблемы с соединением.
## 'Warning: client exceeded messageslimit'
Обычно, ошибка выглядит следующим образом:
```
Warning: client exceeded 'messageslimit' (1) <ip>:<port> (<count>) Limit: x/sec
```
Она случается, когда количество отправляемых клиентом сообщений в секунду превышает лимит сервера.
## 'Warning: client exceeded ackslimit'
Обычно, ошибка выглядит следующим образом:
```
Warning: client exceeded 'ackslimit' <ip>:<port> (<count>) Limit: x/sec
```
Она случается, когда количество отправляемых клиентом подтверждений (acks) в секунду превышает лимит сервера.
## 'Warning: client exceeded messageholelimit'
Обычно, ошибка выглядит следующим образом:
```
Warning: client exceeded 'messageholelimit' (<type>) <ip>:<port> (<count>) Limit: x
```
Она случается, когда количество отправляемых клиентом запросов 'messagehole' в секунду превышает лимит сервера.
## 'Warning: Too many out-of-order messages'
Обычно, ошибка выглядит следующим образом:
```
Warning: Too many out-of-order messages from player <ip>:<port> (<count>) Limit: x (messageholelimit)
```
Случается, 'когда сообщения, вышедшие из строя' ('out of order messages') используют настройку messageholelimit.
За подробностями перейдите [сюда](http://wiki.sa-mp.com/wiki/Controlling_Your_Server#RCON_Commands)
## Игроки постоянно получают ошибку "Unacceptable NickName" (Неприемлемый никнейм, ...), но их имена корректны
Если вы уверены, что используете приемлемое имя и сервер работает под управлением Windows, то попробуйте изменить параметр совместимости samp-server.exe на Windows 98, это должно исправить проблему после рестарта.
Серверы Windows с высоким временем работы (uptime) также могут вызвать эту проблему. Это было замечено на серверах, работающих около 50 дней бесперебойно. Чтобы решить эту проблему, требуется рестарт.
## `MSVCR___.dll`/`MSVCP___.dll` не найдены (`MSVCR___.dll`/`MSVCP___.dll` not found)
Эта проблема регулярно возникает на серверах Windows при попытке загрузить плагин, разработанный с использованием более высокой версии среды Visual C++, чем в настоящее время установлена на вашем компьютере. Чтобы исправить это, загрузите соответствующие библиотеки среды Microsoft Visual C++. Обратите внимание, что сервер SA-MP является 32-разрядным, поэтому вам также необходимо загрузить 32-разрядную (x86) версию среды, независимо от архитектуры. Версия среды выполнения, которая вам конкретно нужна, обозначается цифрами в имени файла (см. таблицу ниже), хотя установить их все не помешает. Эти библиотеки не наследуются, иными словами, вы не получите библиотеки от Visual C++ 2013, установив Visual C++ 2015, они независимы.
| Версия | Соответствующая библиотека |
| -------------- | --------------------------------------------- |
| 10.0 | Microsoft Visual C++ 2010 x86 Redistributable |
| 11.0 | Microsoft Visual C++ 2012 x86 Redistributable |
| 12.0 | Microsoft Visual C++ 2013 x86 Redistributable |
| 14.0 | Microsoft Visual C++ 2015 x86 Redistributable |
| openmultiplayer/web/docs/translations/ru/server/CommonServerIssues.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/ru/server/CommonServerIssues.md",
"repo_id": "openmultiplayer",
"token_count": 3723
} | 386 |
---
title: OnGameModeExit
description: Ta "callback" se pokliče, ko se "gamemode" izklopi prek 'gmx', kadar koli se strežnik izklopi, bodisi pod "GameModeExit"
tags: []
---
## Opis
Ta "callback" se pokliče, ko se "gamemode" izklopi prek 'gmx', kadar koli se strežnik izklopi, bodisi pod "GameModeExit"
## Primeri
```c
public OnGameModeExit()
{
print(""Gamemode" se ustavil.");
return 1;
}
```
## Opombe
:::tip
Ta funkcijo se lahko uporablja tudi znotraj "filterscript" da zazna, če "gamemode" spremenite z uporabo ukazov RCON, kot je "changemode" ali "gmx", ker sprememba "gamemode" se ne zažene znova "filterscript". Ko se uporablja "OnGameModeExit" skupaj z'rcon gmx' ukaz v konzoli, upoštevajte, da lahko v "client" obstajajo morebitne napake, kot primer tega je pretirano kliče `RemoveBuildingForPlayer` med `OnGameModeInit` kar lahko povzroči "client" odjemalca. Ta "callback" ne bo poklican, če se strežnik zruši ali če postopek ubijete z drugimi sredstvi, kot je ukaz Linux "kill" ali s pritiskom na gumb za zapiranje v konzoli Windows.
:::
## Povezane Funkcijo
- [GameModeExit](../functions/GameModeExit.md): Izklopite trenutn "GameMode".
| openmultiplayer/web/docs/translations/sl/scripting/callbacks/OnGameModeExit.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/sl/scripting/callbacks/OnGameModeExit.md",
"repo_id": "openmultiplayer",
"token_count": 500
} | 387 |
---
title: CreateExplosion
description: Kreira eksploziju na odredjenim koordinatama.
tags: []
---
## Opis
Kreira eksploziju na odredjenim koordinatama.
| Ime | Opis |
| ------------ | ----------------------- |
| Float:X | X koordinata eksplozije |
| Float:Y | Y koordinata eksplozije |
| Float:Z | Z koordinata eksplozije |
| type | Tip eksplozije |
| Float:radius | Velicina eksplozije |
## Uzvracanja
Ova funkcija uvek vraca 1, iako su tip eksplozije ili velicina nepravilni.
## Primeri
```c
public OnPlayerEnterCheckpoint(playerid)
{
// Uzima poziciju igraca
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
// Kreira eksploziju na koordinatama igraca
CreateExplosion(x, y, z, 12, 10.0);
return 1;
}
```
## Beleske
:::tip
Postoji limit koji ogranicava koliko igrac moze videti eksplozija odjednom. To je 10.
:::
## Srodne Funkcije
- [CreateExplosionForPlayer](CreateExplosionForPlayer.md): Kreira eksploziju koja je vidljiva samo jednom igracu.
| openmultiplayer/web/docs/translations/sr/scripting/functions/CreateExplosion.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/sr/scripting/functions/CreateExplosion.md",
"repo_id": "openmultiplayer",
"token_count": 500
} | 388 |
---
title: OnEnterExitModShop
description: Callback นี้ถูกเรียกเมื่อผู้เล่นเข้าหรือออกจากร้านแต่งรถยนต์
tags: []
---
## คำอธิบาย
Callback นี้ถูกเรียกเมื่อผู้เล่นเข้าหรือออกจากร้านแต่งรถยนต์
| ชื่อ | คำอธิบาย |
| ---------- | ------------------------------------------------------------ |
| playerid | ไอดีของผู้เล่นที่เข้าหรือออกจากร้านแต่งรถยนต์ |
| enterexit | 1 ถ้าผู้เล่นเข้าร้านหรือ 0 ถ้าพวกเขาออก |
| interiorid | ไอดีภายในของร้านแต่งรถยนต์ที่ผู้เล่นเข้ามา (หรือ 0 ถ้าออกไป) |
## ส่งคืน
มันถูกเรียกในฟิลเตอร์สคริปต์ก่อนเสมอ
## ตัวอย่าง
```c
public OnEnterExitModShop(playerid, enterexit, interiorid)
{
if (enterexit == 0) // หาก enterexit มีค่าเป็น 0 นั้นหมายถึงพวกเขากำลังจะออก
{
SendClientMessage(playerid, COLOR_WHITE, "รถสวยมาก! คุณถูกหักภาษีแล้ว $100");
GivePlayerMoney(playerid, -100);
}
return 1;
}
```
## บันทึก
:::warning
บั๊กที่รู้กัน: ผู้เล่นจะชนกันเมื่อพวกเขาเข้าไปในร้านแต่งรถยนต์เดียวกัน
:::
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- [AddVehicleComponent](../../scripting/functions/AddVehicleComponent.md): เพิ่ม Component ให้กับยานพาหนะ
| openmultiplayer/web/docs/translations/th/scripting/callbacks/OnEnterExitModShop.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/callbacks/OnEnterExitModShop.md",
"repo_id": "openmultiplayer",
"token_count": 1316
} | 389 |
---
title: OnPlayerRequestDownload
description: This callback is called when a player request for custom model downloads.
tags: ["player"]
---
:::warning
Callback นี้ถูกเพิ่มใน SA-MP 0.3.DL R1 และจะไม่ทำงานในเวอร์ชั่นก่อนหน้านี้!
:::
## คำอธิบาย
This callback is called when a player request for custom model downloads.
| Name | Description |
| -------- | -------------------------------------------------------- |
| playerid | The ID of the player that request custom model download. |
| type | The type of the request (see below). |
| crc | The CRC checksum of custom model file. |
## ส่งคืน
0 - Deny the download request
1 - Accept the download request
## ตัวอย่าง
```c
#define DOWNLOAD_REQUEST_EMPTY (0)
#define DOWNLOAD_REQUEST_MODEL_FILE (1)
#define DOWNLOAD_REQUEST_TEXTURE_FILE (2)
new baseurl[] = "https://files.sa-mp.com/server";
public OnPlayerRequestDownload(playerid, type, crc)
{
new fullurl[256+1];
new dlfilename[64+1];
new foundfilename=0;
if (!IsPlayerConnected(playerid)) return 0;
if (type == DOWNLOAD_REQUEST_TEXTURE_FILE) {
foundfilename = FindTextureFileNameFromCRC(crc,dlfilename,64);
}
else if (type == DOWNLOAD_REQUEST_MODEL_FILE) {
foundfilename = FindModelFileNameFromCRC(crc,dlfilename,64);
}
if (foundfilename) {
format(fullurl,256,"%s/%s",baseurl,dlfilename);
RedirectDownload(playerid,fullurl);
}
return 0;
}
```
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- [OnPlayerFinishedDownloading](../../scripting/callbacks/OnPlayerFinishedDownloading.md): Called when a player finishes downloading custom models.
| openmultiplayer/web/docs/translations/th/scripting/callbacks/OnPlayerRequestDownload.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/callbacks/OnPlayerRequestDownload.md",
"repo_id": "openmultiplayer",
"token_count": 820
} | 390 |
---
title: OnUnoccupiedVehicleUpdate
description: This callback is called when a player's client updates/syncs the position of a vehicle they're not driving.
tags: ["vehicle"]
---
## คำอธิบาย
This callback is called when a player's client updates/syncs the position of a vehicle they're not driving. This can happen outside of the vehicle or when the player is a passenger of a vehicle that has no driver.
| Name | Description |
| -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| vehicleid | The ID of the vehicle that's position was updated. |
| playerid | The ID of the player that sent a vehicle position sync update. |
| passenger_seat | The ID of the seat if the player is a passenger. 0=not in vehicle, 1=front passenger, 2=backleft 3=backright 4+ is for coach/bus etc. with many passenger seats. |
| new_x | The new X coordinate of the vehicle. |
| new_y | The new Y coordinate of the vehicle. |
| new_z | The new Z coordinate of the vehicle. |
| vel_x | The new X velocity of the vehicle. |
| vel_y | The new Y velocity of the vehicle. |
| vel_z | The new Z velocity of the vehicle. |
## ส่งคืน
It is always called first in filterscripts so returning 0 there also blocks other scripts from seeing it.
## ตัวอย่าง
```c
public OnUnoccupiedVehicleUpdate(vehicleid, playerid, passenger_seat, Float:new_x, Float:new_y, Float:new_z, Float:vel_x, Float:vel_y, Float:vel_z)
{
// Check if it moved far
if (GetVehicleDistanceFromPoint(vehicleid, new_x, new_y, new_z) > 50.0)
{
// Reject the update
return 0;
}
return 1;
}
```
## บันทึก
:::warning
This callback is called very frequently per second per unoccupied vehicle. You should refrain from implementing intensive calculations or intensive file writing/reading operations in this callback. GetVehiclePos will return the old coordinates of the vehicle before this update.
:::
## ฟังก์ชั่นที่เกี่ยวข้องกัน
| openmultiplayer/web/docs/translations/th/scripting/callbacks/OnUnoccupiedVehicleUpdate.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/callbacks/OnUnoccupiedVehicleUpdate.md",
"repo_id": "openmultiplayer",
"token_count": 1364
} | 391 |
---
title: AttachPlayerObjectToPlayer
description: The same as AttachObjectToPlayer but for objects which were created for player.
tags: ["player"]
---
## คำอธิบาย
The same as AttachObjectToPlayer but for objects which were created for player.
| Name | Description |
| ------------- | ------------------------------------------------------------------ |
| objectplayer | The id of the player which is linked with the object. |
| objectid | The objectid you want to attach to the player. |
| attachid | The id of the player you want to attach to the object. |
| Float:OffsetX | The distance between the player and the object in the X direction. |
| Float:OffsetY | The distance between the player and the object in the Y direction. |
| Float:OffsetZ | The distance between the player and the object in the Z direction. |
| Float:RotX | The X rotation. |
| Float:RotY | The Y rotation. |
| Float:RotZ | The Z rotation. |
## ส่งคืน
This function does not return any specific values.
## ตัวอย่าง
```c
AttachPlayerObjectToPlayer(objectplayer, objectid, attachplayer, 1.5, 0.5, 0, 0, 1.5, 2 );
```
## บันทึก
:::warning
This function was removed in SA-MP 0.3.
:::
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- [CreatePlayerObject](../../scripting/functions/CreateObject.md): Create an object for only one player.
- [DestroyPlayerObject](../../scripting/functions/DestroyObject.md): Destroy a player object.
- [IsValidPlayerObject](../../scripting/functions/IsValidObject.md): Checks if a certain player object is vaild.
- [MovePlayerObject](../../scripting/functions/MoveObject.md): Move a player object.
- [StopPlayerObject](../../scripting/functions/StopObject.md): Stop a player object from moving.
- [SetPlayerObjectRot](../../scripting/functions/SetPlayerObjectRot.md): Set the rotation of a player object.
- [GetPlayerObjectPos](../../scripting/functions/GetPlayerObjectPos.md): Locate a player object.
- [SetPlayerObjectPos](../../scripting/functions/SetPlayerObjectPos.md): Set the position of a player object.
- [GetPlayerObjectRot](../../scripting/functions/GetPlayerObjectRot.md): Check the rotation of a player object.
- [SetPlayerAttachedObject](../../scripting/functions/SetPlayerAttachedObject.md): Attach an object to a player
- [RemovePlayerAttachedObject](../../scripting/functions/RemovePlayerAttachedObject.md): Remove an attached object from a player
- [IsPlayerAttachedObjectSlotUsed](../../scripting/functions/IsPlayerAttachedObjectSlotUsed.md): Check whether an object is attached to a player in a specified index
- [CreateObject](../../scripting/functions/CreateObject.md): Create an object.
- [DestroyObject](../../scripting/functions/DestroyObject.md): Destroy an object.
- [IsValidObject](../../scripting/functions/IsValidObject.md): Checks if a certain object is vaild.
- [MoveObject](../../scripting/functions/MoveObject.md): Move a object.
- [StopObject](../../scripting/functions/StopObject.md): Stop an object from moving.
- [SetObjectPos](../../scripting/functions/SetObjectPos.md): Set the position of an object.
- [SetObjectRot](../../scripting/functions/SetObjectRot.md): Set the rotation of an object.
- [GetObjectPos](../../scripting/functions/GetObjectPos.md): Locate an object.
- [GetObjectRot](../../scripting/functions/GetObjectRot.md): Check the rotation of an object.
- [AttachObjectToPlayer](../../scripting/functions/AttachObjectToPlayer.md): Attach an object to a player.
| openmultiplayer/web/docs/translations/th/scripting/functions/AttachPlayerObjectToPlayer.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/AttachPlayerObjectToPlayer.md",
"repo_id": "openmultiplayer",
"token_count": 1341
} | 392 |
---
title: CreateActor
description: Create a static 'actor' in the world.
tags: []
---
:::warning
ฟังก์ชั่นนี้ถูกเพิ่มใน SA-MP 0.3.7 และจะไม่ทำงานในเวอร์ชั่นก่อนหน้านี้!
:::
## คำอธิบาย
Create a static 'actor' in the world. These 'actors' are like NPCs, however they have limited functionality. They do not take up server player slots.
| Name | Description |
| -------- | -------------------------------------------------- |
| modelid | The model ID (skin ID) the actor should have. |
| x | The X coordinate to create the actor at. |
| y | The Y coordinate to create the actor at. |
| z | The Z coordinate to create the actor at. |
| Rotation | The facing angle (rotation) for the actor to have. |
## ส่งคืน
The created Actor ID (start at 0).
INVALID_ACTOR_ID (65535) If the actor limit (1000) is reached.
## ตัวอย่าง
```c
new ActorCJ;
public OnGameModeInit()
{
// Create an actor (CJ) at Blueberry Acres (Center of SA map)
ActorCJ = CreateActor(0, 0.0, 0.0, 3.0, 0.0);
}
```
## บันทึก
:::tip
Actors are designed to just stand somewhere, for example cashiers and bartenders. They can perform animations (once or looping) using ApplyActorAnimation.
:::
:::warning
Actors are completely separate from NPCs. They do NOT use player IDs/slots on the server and CANNOT be handled like NPCs. Actors are limited to 1000 (MAX_ACTORS). Actors can be pushed by vehicles, use a timer to put them back at their positions. As of 0.3.7 R2 actors default to being invulnerable.
:::
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- [DestroyActor](../../scripting/functions/DestroyActor.md): Destroy an actor.
- [SetActorPos](../../scripting/functions/SetActorPos.md): Set the position of an actor.
- [GetActorPos](../../scripting/functions/GetActorPos.md): Get the position of an actor.
- [SetActorFacingAngle](../../scripting/functions/SetActorFacingAngle.md): Set the facing angle of an actor.
- [GetActorFacingAngle](../../scripting/functions/GetActorFacingAngle.md): Get the facing angle of an actor.
- [SetActorVirtualWorld](../../scripting/functions/SetActorVirtualWorld.md): Set the virtual world of an actor.
- [GetActorVirtualWorld](../../scripting/functions/GetActorVirtualWorld.md): Get the virtual world of an actor.
- [ApplyActorAnimation](../../scripting/functions/ApplyActorAnimation.md): Apply an animation to an actor.
- [ClearActorAnimations](../../scripting/functions/ClearActorAnimations.md): Clear any animations that are applied to an actor.
- [GetPlayerCameraTargetActor](../../scripting/functions/GetPlayerCameraTargetActor.md): Get the ID of the actor (if any) a player is looking at.
- [IsActorStreamedIn](../../scripting/functions/IsActorStreamedIn.md): Checks if an actor is streamed in for a player.
- [SetActorHealth](../../scripting/functions/SetActorHealth.md): Set the health of an actor.
- [GetActorHealth](../../scripting/functions/GetActorHealth.md): Gets the health of an actor.
- [SetActorInvulnerable](../../scripting/functions/SetActorInvulnerable.md): Set actor invulnerable.
- [IsActorInvulnerable](../../scripting/functions/IsActorInvulnerable.md): Check if actor is invulnerable.
- [IsValidActor](../../scripting/functions/IsValidActor.md): Check if actor id is valid.
- [GetActorPoolSize](../../scripting/functions/GetActorPoolSize.md): Gets the highest actorid created on the server.
- [GetPlayerTargetActor](../../scripting/functions/GetPlayerTargetActor.md): Gets id of an actor which is aimed by certain player.
- [OnActorStreamIn](../../scripting/callbacks/OnActorStreamIn.md): Called when an actor is streamed in by a player.
- [OnActorStreamOut](../../scripting/callbacks/OnActorStreamOut.md): Called when an actor is streamed out by a player.
- [OnPlayerGiveDamageActor](../../scripting/callbacks/OnPlayerGiveDamageActor.md): This callback is called when a player gives damage to an actor.
| openmultiplayer/web/docs/translations/th/scripting/functions/CreateActor.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/CreateActor.md",
"repo_id": "openmultiplayer",
"token_count": 1423
} | 393 |
---
title: DestroyObject
description: Destroys (removes) an object that was created using CreateObject.
tags: []
---
## คำอธิบาย
Destroys (removes) an object that was created using CreateObject.
| Name | Description |
| -------- | ---------------------------------------------------------- |
| objectid | The ID of the object to destroy. Returned by CreateObject. |
## ส่งคืน
This function does not return any specific values.
## ตัวอย่าง
```c
public OnObjectMoved(objectid)
{
DestroyObject(objectid);
return 1;
}
```
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- [CreateObject](../../scripting/functions/CreateObject.md): Create an object.
- [IsValidObject](../../scripting/functions/IsValidObject.md): Checks if a certain object is vaild.
- [MoveObject](../../scripting/functions/MoveObject.md): Move an object.
- [StopObject](../../scripting/functions/StopObject.md): Stop an object from moving.
- [SetObjectPos](../../scripting/functions/SetObjectPos.md): Set the position of an object.
- [SetObjectRot](../../scripting/functions/SetObjectRot.md): Set the rotation of an object.
- [GetObjectPos](../../scripting/functions/GetObjectPos.md): Locate an object.
- [GetObjectRot](../../scripting/functions/GetObjectRot.md): Check the rotation of an object.
- [AttachObjectToPlayer](../../scripting/functions/AttachObjectToPlayer.md): Attach an object to a player.
- [CreatePlayerObject](../../scripting/functions/CreatePlayerObject.md): Create an object for only one player.
- [DestroyPlayerObject](../../scripting/functions/DestroyPlayerObject.md): Destroy a player object.
- [IsValidPlayerObject](../../scripting/functions/IsValidPlayerObject.md): Checks if a certain player object is vaild.
- [MovePlayerObject](../../scripting/functions/MovePlayerObject.md): Move a player object.
- [StopPlayerObject](../../scripting/functions/StopPlayerObject.md): Stop a player object from moving.
- [SetPlayerObjectPos](../../scripting/functions/SetPlayerObjectPos.md): Set the position of a player object.
- [SetPlayerObjectRot](../../scripting/functions/SetPlayerObjectRot.md): Set the rotation of a player object.
- [GetPlayerObjectPos](../../scripting/functions/GetPlayerObjectPos.md): Locate a player object.
- [GetPlayerObjectRot](../../scripting/functions/GetPlayerObjectRot.md): Check the rotation of a player object.
- [AttachPlayerObjectToPlayer](../../scripting/functions/AttachPlayerObjectToPlayer.md): Attach a player object to a player.
| openmultiplayer/web/docs/translations/th/scripting/functions/DestroyObject.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/DestroyObject.md",
"repo_id": "openmultiplayer",
"token_count": 837
} | 394 |
---
title: EnableStuntBonusForAll
description: Enables or disables stunt bonuses for all players.
tags: []
---
## คำอธิบาย
Enables or disables stunt bonuses for all players. If enabled, players will receive monetary rewards when performing a stunt in a vehicle (e.g. a wheelie).
| Name | Description |
| ------ | ----------------------------------------------- |
| enable | 1 to enable stunt bonuses or 0 to disable them. |
## ส่งคืน
This function does not return any specific values.
## ตัวอย่าง
```c
public OnGameModeInit()
{
EnableStuntBonusForAll(0);
return 1;
}
```
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- [EnableStuntBonusForPlayer](../functions/EnableStuntBonusForPlayer): Toggle stunt bonuses for a player.
| openmultiplayer/web/docs/translations/th/scripting/functions/EnableStuntBonusForAll.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/EnableStuntBonusForAll.md",
"repo_id": "openmultiplayer",
"token_count": 325
} | 395 |
---
title: GangZoneHideForPlayer
description: Hides a gangzone for a player.
tags: ["player", "gangzone"]
---
## คำอธิบาย
Hides a gangzone for a player.
| Name | Description |
| -------- | ---------------------------------------------- |
| playerid | The ID of the player to hide the gangzone for. |
| zone | The ID of the zone to hide. |
## ส่งคืน
This function does not return any specific values.
## ตัวอย่าง
```c
new gangzone;
public OnGameModeInit()
{
gangzone = GangZoneCreate(1248.011, 2072.804, 1439.348, 2204.319);
return 1;
}
public OnPlayerSpawn(playerid)
{
GangZoneShowForPlayer(playerid, gangzone, 0xFF0000FF);
return 1;
}
public OnPlayerDeath(playerid, killerid, WEAPON:reason)
{
GangZoneHideForPlayer(playerid,gangzone);
return 1;
}
```
## ฟังก์ชั่นที่เกี่ยวข้องกัน
- [GangZoneCreate](../functions/GangZoneCreate): Create a gangzone.
- [GangZoneDestroy](../functions/GangZoneDestroy): Destroy a gangzone.
- [GangZoneShowForPlayer](../functions/GangZoneShowForPlayer): Show a gangzone for a player.
- [GangZoneShowForAll](../functions/GangZoneShowForAll): Show a gangzone for all players.
- [GangZoneHideForAll](../functions/GangZoneHideForAll): Hide a gangzone for all players.
- [GangZoneFlashForPlayer](../functions/GangZoneFlashForPlayer): Make a gangzone flash for a player.
- [GangZoneFlashForAll](../functions/GangZoneFlashForAll): Make a gangzone flash for all players.
- [GangZoneStopFlashForPlayer](../functions/GangZoneStopFlashForPlayer): Stop a gangzone flashing for a player.
- [GangZoneStopFlashForAll](../functions/GangZoneStopFlashForAll): Stop a gangzone flashing for all players.
| openmultiplayer/web/docs/translations/th/scripting/functions/GangZoneHideForPlayer.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/th/scripting/functions/GangZoneHideForPlayer.md",
"repo_id": "openmultiplayer",
"token_count": 681
} | 396 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.