text stringlengths 1 2.83M | id stringlengths 16 152 | metadata dict | __index_level_0__ int64 0 949 |
|---|---|---|---|
---
title: SetPlayerPickupType
description: Sets the type of a player-pickup.
tags: ["player", "pickup", "playerpickup"]
---
<VersionWarn version='omp v1.1.0.2612' />
## Description
Sets the type of a player-pickup.
| Name | Description |
|--------------------|-----------------------------------------------------|
| playerid | The ID of the player. |
| pickupid | The ID of the player-pickup. |
| type | The [pickup type](../resources/pickuptypes) to set. |
| bool:update = true | Update pickup for player. (true/false) |
## Returns
This function always returns **true**.
## Examples
```c
new PlayerPickup[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
PlayerPickup[playerid] = CreatePlayerPickup(playerid, 1242, 1, 2010.0979, 1222.0642, 10.8206, -1);
SetPlayerPickupType(playerid, PlayerPickup[playerid], 2);
return 1;
}
```
## Related Functions
- [CreatePlayerPickup](CreatePlayerPickup): Creates a pickup which will be visible to only one player.
- [DestroyPlayerPickup](DestroyPlayerPickup): Destroy a player-pickup.
- [IsValidPlayerPickup](IsValidPlayerPickup): Checks if a player-pickup is valid.
- [IsPlayerPickupStreamedIn](IsPlayerPickupStreamedIn): Checks if a player-pickup is streamed in for the player.
- [SetPlayerPickupPos](SetPlayerPickupPos): Sets the position of a player-pickup.
- [GetPlayerPickupPos](GetPlayerPickupPos): Gets the coordinates of a player-pickup.
- [SetPlayerPickupModel](SetPlayerPickupModel): Sets the model of a player-pickup.
- [GetPlayerPickupModel](GetPlayerPickupModel): Gets the model ID of a player-pickup.
- [GetPlayerPickupType](GetPlayerPickupType): Gets the type of a player-pickup.
- [SetPlayerPickupVirtualWorld](SetPlayerPickupVirtualWorld): Sets the virtual world ID of a player-pickup.
- [GetPlayerPickupVirtualWorld](GetPlayerPickupVirtualWorld): Gets the virtual world ID of a player-pickup.
| openmultiplayer/web/docs/scripting/functions/SetPlayerPickupType.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/SetPlayerPickupType.md",
"repo_id": "openmultiplayer",
"token_count": 733
} | 323 |
---
title: SetPlayerWorldBounds
description: Set the world boundaries for a player.
tags: ["player"]
---
## Description
Set the world boundaries for a player. Players can not go out of the boundaries (they will be pushed back in).
| Name | Description |
| ---------- | ---------------------------------------------------- |
| playerid | The ID of the player to set the world boundaries of. |
| Float:maxX | The maximum X coordinate the player can go to. |
| Float:minX | The minimum X coordinate the player can go to. |
| Float:maxY | The maximum Y coordinate the player can go to. |
| Float:minY | The minimum Y coordinate the player can go to. |
## Returns
This function does not return any specific values.
## Examples
```c
public OnPlayerSpawn(playerid)
{
SetPlayerWorldBounds(playerid, 20.0, 0.0, 20.0, 0.0);
return 1;
}
```
```
(North)
ymax
|----------|
| |
(West) xmin | | xmax (East)
| |
|----------|
ymin
(South)
```
## Notes
:::tip
A player's world boundaries can be reset by setting them to 20000.0000, -20000.0000, 20000.0000, -20000.0000. These are the default values. You can also use [ClearPlayerWorldBounds](ClearPlayerWorldBounds).
:::
:::warning
This function doesn't work in interiors!
:::
## Related Functions
- [ClearPlayerWorldBounds](ClearPlayerWorldBounds): Reset the player's world boundaries to default world boundaries.
- [GetPlayerWorldBounds](GetPlayerWorldBounds): Get a player's world boundaries.
- [GangZoneCreate](GangZoneCreate): Create a gangzone.
| openmultiplayer/web/docs/scripting/functions/SetPlayerWorldBounds.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/SetPlayerWorldBounds.md",
"repo_id": "openmultiplayer",
"token_count": 654
} | 324 |
---
title: SetVehicleParamsCarDoors
description: Allows you to open and close the doors of a vehicle.
tags: ["vehicle"]
---
<VersionWarn version='SA-MP 0.3.7' />
## Description
Allows you to open and close the doors of a vehicle.
| Name | Description |
| --------------- | ----------------------------------------------------------------------- |
| vehicleid | The ID of the vehicle to set the door state of |
| bool:frontLeft | The state of the driver's door. 1 to open, 0 to close. |
| bool:frontRight | The state of the passenger door. 1 to open, 0 to close. |
| bool:rearLeft | The state of the rear left door (if available). 1 to open, 0 to close. |
| bool:rearRight | The state of the rear right door (if available). 1 to open, 0 to close. |
## Returns
**true** - The function executed successfully.
**false** - The function failed to execute. This means the vehicle does not exist.
## Related Functions
- [GetVehicleParamsCarDoors](GetVehicleParamsCarDoors): Retrive the current state of a vehicle's doors.
- [SetVehicleParamsCarWindows](SetVehicleParamsCarWindows): Open and close the windows of a vehicle.
- [GetVehicleParamsCarWindows](GetVehicleParamsCarWindows): Retrive the current state of a vehicle's windows
| openmultiplayer/web/docs/scripting/functions/SetVehicleParamsCarDoors.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/SetVehicleParamsCarDoors.md",
"repo_id": "openmultiplayer",
"token_count": 478
} | 325 |
---
title: ShowNameTags
description: Toggle the drawing of nametags, health bars and armor bars above players.
tags: []
---
## Description
Toggle the drawing of nametags, health bars and armor bars above players.
| Name | Description |
| --------- | ---------------------------------------------------------- |
| bool:show | 'false' to disable, 'true' to enable (enabled by default). |
## Returns
This function does not return any specific values.
## Examples
```c
public OnGameModeInit()
{
// This will fully disable all player nametags
// (including health and armour bars)
ShowNameTags(false);
}
```
## Notes
:::warning
This function can only be used in [OnGameModeInit](OnGameModeInit). For other times, see [ShowPlayerNameTagForPlayer](ShowPlayerNameTagForPlayer).
:::
:::tip
You can also toggle player nametags via [config.json](../../server/config.json)
```json
"use_nametags": false,
```
:::
## Related Functions
- [DisableNameTagLOS](DisableNameTagLOS): Disable nametag Line-Of-Sight checking.
- [ShowPlayerNameTagForPlayer](ShowPlayerNameTagForPlayer): Show or hide a nametag for a certain player.
- [ShowPlayerMarkers](ShowPlayerMarkers): Decide if the server should show markers on the radar.
| openmultiplayer/web/docs/scripting/functions/ShowNameTags.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/ShowNameTags.md",
"repo_id": "openmultiplayer",
"token_count": 415
} | 326 |
---
title: TextDrawAlignment
description: Set the alignment of text in a text draw.
tags: ["textdraw"]
---
## Description
Set the alignment of text in a text draw.
| Parameter | Description |
| ------------------------- | --------------------------------------------------------------------------- |
| Text:textid | The ID of the textdraw to set the alignment of. |
| TEXT_DRAW_ALIGN:alignment | `TEXT_DRAW_ALIGN_LEFT` / `TEXT_DRAW_ALIGN_CENTER` / `TEXT_DRAW_ALIGN_RIGHT` |
## Returns
This function does not return any specific values.
## Examples
```c
/*
TEXT_DRAW_ALIGN_LEFT
TEXT_DRAW_ALIGN_CENTER
TEXT_DRAW_ALIGN_RIGHT
*/
new Text:gMyTextdraw;
public OnGameModeInit()
{
gMyTextdraw = TextDrawCreate(320.0, 425.0, "This is an example textdraw");
TextDrawAlignment(gMyTextdraw, TEXT_DRAW_ALIGN_CENTER); // Align the textdraw text in the center
return 1;
}
```
## Notes
:::warning
For alignment TEXT_DRAW_ALIGN_CENTER (center) the x and y values of TextSize need to be swapped, see notes at [TextDrawTextSize](TextDrawTextSize), also position coordinate become position of center of textdraw and not left/top edges.
:::
:::tip
If the textdraw is already shown, it must be re-shown ([TextDrawShowForAll](TextDrawShowForAll)/[TextDrawShowForPlayer](TextDrawShowForPlayer)) to show the changes of this function.
:::
## Related Functions
- [TextDrawCreate](TextDrawCreate): Create a textdraw.
- [TextDrawDestroy](TextDrawDestroy): Destroy a textdraw.
- [TextDrawGetAlignment](TextDrawGetAlignment): Gets the text alignment of a textdraw.
- [TextDrawColor](TextDrawColor): Set the color of the text in a textdraw.
- [TextDrawBoxColor](TextDrawBoxColor): Set the color of the box in a textdraw.
- [TextDrawBackgroundColor](TextDrawBackgroundColor): Set the background color of a textdraw.
- [TextDrawFont](TextDrawFont): Set the font of a textdraw.
- [TextDrawLetterSize](TextDrawLetterSize): Set the letter size of the text in a textdraw.
- [TextDrawTextSize](TextDrawTextSize): Set the size of a textdraw box.
- [TextDrawSetOutline](TextDrawSetOutline): Choose whether the text has an outline.
- [TextDrawSetShadow](TextDrawSetShadow): Toggle shadows on a textdraw.
- [TextDrawSetProportional](TextDrawSetProportional): Scale the text spacing in a textdraw to a proportional ratio.
- [TextDrawUseBox](TextDrawUseBox): Toggle if the textdraw has a box or not.
- [TextDrawSetString](TextDrawSetString): Set the text in an existing textdraw.
- [TextDrawShowForPlayer](TextDrawShowForPlayer): Show a textdraw for a certain player.
- [TextDrawHideForPlayer](TextDrawHideForPlayer): Hide a textdraw for a certain player.
- [TextDrawShowForAll](TextDrawShowForAll): Show a textdraw for all players.
- [TextDrawHideForAll](TextDrawHideForAll): Hide a textdraw for all players.
| openmultiplayer/web/docs/scripting/functions/TextDrawAlignment.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/TextDrawAlignment.md",
"repo_id": "openmultiplayer",
"token_count": 966
} | 327 |
---
title: TextDrawGetColour
description: Gets the text colour of a textdraw.
tags: ["textdraw"]
---
<VersionWarn version='omp v1.1.0.2612' />
## Description
Gets the text colour of a textdraw.
| Name | Description |
| ----------- | -------------------------------------------- |
| Text:textid | The ID of the textdraw to get the colour of. |
## Returns
Returns the text colour of the textdraw.
## Examples
```c
new Text:gMyTextdraw;
public OnGameModeInit()
{
gMyTextdraw = TextDrawCreate(123.0, 123.0, "Example");
TextDrawColour(gMyTextdraw, 0xFF0000FF);
new colour = TextDrawGetColour(gMyTextdraw);
// colour = 0xFF0000FF
return 1;
}
```
## Related Functions
- [TextDrawCreate](TextDrawCreate): Create a textdraw.
- [TextDrawDestroy](TextDrawDestroy): Destroy a textdraw.
- [TextDrawBoxColour](TextDrawBoxColour): Set the colour of the box in a textdraw.
- [TextDrawBackgroundColour](TextDrawBackgroundColour): Set the background colour of a textdraw.
- [TextDrawAlignment](TextDrawAlignment): Set the alignment of a textdraw.
- [TextDrawFont](TextDrawFont): Set the font of a textdraw.
- [TextDrawLetterSize](TextDrawLetterSize): Set the letter size of the text in a textdraw.
- [TextDrawTextSize](TextDrawTextSize): Set the size of a textdraw box.
- [TextDrawSetOutline](TextDrawSetOutline): Choose whether the text has an outline.
- [TextDrawSetShadow](TextDrawSetShadow): Toggle shadows on a textdraw.
- [TextDrawSetProportional](TextDrawSetProportional): Scale the text spacing in a textdraw to a proportional ratio.
- [TextDrawUseBox](TextDrawUseBox): Toggle if the textdraw has a box or not.
- [TextDrawSetString](TextDrawSetString): Set the text in an existing textdraw.
- [TextDrawShowForPlayer](TextDrawShowForPlayer): Show a textdraw for a certain player.
- [TextDrawHideForPlayer](TextDrawHideForPlayer): Hide a textdraw for a certain player.
- [TextDrawShowForAll](TextDrawShowForAll): Show a textdraw for all players.
- [TextDrawHideForAll](TextDrawHideForAll): Hide a textdraw for all players.
| openmultiplayer/web/docs/scripting/functions/TextDrawGetColour.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/TextDrawGetColour.md",
"repo_id": "openmultiplayer",
"token_count": 659
} | 328 |
---
title: TextDrawIsSelectable
description: Checks if a textdraw is selectable.
tags: ["textdraw"]
---
<VersionWarn version='omp v1.1.0.2612' />
## Description
Checks if a textdraw is selectable.
## Parameters
| Name | Description |
| ----------- | -------------------------------- |
| Text:textid | The ID of the textdraw to check. |
## Return Values
Returns **true** if the textdraw is selectable, otherwise **false**.
## Example Usage
```c
new Text:gMyTextdraw;
public OnGameModeInit()
{
gMyTextdraw = TextDrawCreate(100.0, 33.0, "Example TextDraw");
TextDrawTextSize(gMyTextdraw, 30.0, 10.0);
TextDrawSetSelectable(gMyTextdraw, true);
if (TextDrawIsSelectable(gMyTextdraw))
{
// Textdraw is selectable
}
else
{
// Textdraw is not selectable
}
return 1;
}
```
## Related Functions
- [TextDrawCreate](TextDrawCreate): Create a textdraw.
- [TextDrawDestroy](TextDrawDestroy): Destroy a textdraw.
- [TextDrawSetSelectable](TextDrawSetSelectable): Sets whether a textdraw can be selected (clicked on) or not.
- [TextDrawColor](TextDrawColor): Set the color of the text in a textdraw.
- [TextDrawBoxColor](TextDrawBoxColor): Set the color of the box in a textdraw.
- [TextDrawBackgroundColor](TextDrawBackgroundColor): Set the background color of a textdraw.
- [TextDrawAlignment](TextDrawAlignment): Set the alignment of a textdraw.
- [TextDrawFont](TextDrawFont): Set the font of a textdraw.
- [TextDrawLetterSize](TextDrawLetterSize): Set the letter size of the text in a textdraw.
- [TextDrawTextSize](TextDrawTextSize): Set the size of a textdraw box.
- [TextDrawSetOutline](TextDrawSetOutline): Choose whether the text has an outline.
- [TextDrawSetShadow](TextDrawSetShadow): Toggle shadows on a textdraw.
- [TextDrawSetProportional](TextDrawSetProportional): Scale the text spacing in a textdraw to a proportional ratio.
- [TextDrawUseBox](TextDrawUseBox): Toggle if the textdraw has a box or not.
- [TextDrawSetString](TextDrawSetString): Set the text in an existing textdraw.
- [TextDrawShowForPlayer](TextDrawShowForPlayer): Show a textdraw for a certain player.
- [TextDrawHideForPlayer](TextDrawHideForPlayer): Hide a textdraw for a certain player.
- [TextDrawShowForAll](TextDrawShowForAll): Show a textdraw for all players.
- [TextDrawHideForAll](TextDrawHideForAll): Hide a textdraw for all players.
| openmultiplayer/web/docs/scripting/functions/TextDrawIsSelectable.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/TextDrawIsSelectable.md",
"repo_id": "openmultiplayer",
"token_count": 768
} | 329 |
---
title: TextDrawUseBox
description: Toggle whether a textdraw uses a box or not.
tags: ["textdraw"]
---
## Description
Toggle whether a textdraw uses a box or not.
| Name | Description |
| -------------- | -------------------------------------------------- |
| Text:textid | The ID of the text textdraw to toggle the box of. |
| bool:enableBox | 'true' to show a box or 'false' to not show a box. |
## Returns
**true** - The function executed successfully.
**false** - The function failed to execute. This means the textdraw specified does not exist.
## Examples
```c
new Text:gMyTextdraw;
public OnGameModeInit()
{
gMyTextdraw = TextDrawCreate(100.0, 33.0, "Example TextDraw");
TextDrawUseBox(gMyTextdraw, true); // Toggle box ON
return 1;
}
```
## Notes
:::tip
If the textdraw is already shown, it must be re-shown ([TextDrawShowForAll](TextDrawShowForAll)/[TextDrawShowForPlayer](TextDrawShowForPlayer)) to show the changes of this function.
:::
## Related Functions
- [TextDrawCreate](TextDrawCreate): Create a textdraw.
- [TextDrawDestroy](TextDrawDestroy): Destroy a textdraw.
- [TextDrawIsBox](TextDrawIsBox): Checks if a textdraw is box.
- [TextDrawColor](TextDrawColor): Set the color of the text in a textdraw.
- [TextDrawBoxColor](TextDrawBoxColor): Set the color of the box in a textdraw.
- [TextDrawBackgroundColor](TextDrawBackgroundColor): Set the background color of a textdraw.
- [TextDrawAlignment](TextDrawAlignment): Set the alignment of a textdraw.
- [TextDrawFont](TextDrawFont): Set the font of a textdraw.
- [TextDrawLetterSize](TextDrawLetterSize): Set the letter size of the text in a textdraw.
- [TextDrawTextSize](TextDrawTextSize): Set the size of a textdraw box.
- [TextDrawSetOutline](TextDrawSetOutline): Choose whether the text has an outline.
- [TextDrawSetShadow](TextDrawSetShadow): Toggle shadows on a textdraw.
- [TextDrawSetProportional](TextDrawSetProportional): Scale the text spacing in a textdraw to a proportional ratio.
- [TextDrawSetString](TextDrawSetString): Set the text in an existing textdraw.
- [TextDrawShowForPlayer](TextDrawShowForPlayer): Show a textdraw for a certain player.
- [TextDrawHideForPlayer](TextDrawHideForPlayer): Hide a textdraw for a certain player.
- [TextDrawShowForAll](TextDrawShowForAll): Show a textdraw for all players.
- [TextDrawHideForAll](TextDrawHideForAll): Hide a textdraw for all players.
| openmultiplayer/web/docs/scripting/functions/TextDrawUseBox.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/TextDrawUseBox.md",
"repo_id": "openmultiplayer",
"token_count": 754
} | 330 |
---
title: VectorSize
description: Returns the norm (length) of the provided vector.
tags: ["math"]
---
## Description
Returns the norm (length) of the provided vector.
| Name | Description |
| ------- | ------------------------------------- |
| Float:x | The vector's magnitude on the X axis. |
| Float:y | The vector's magnitude on the Y axis. |
| Float:z | The vector's magnitude on the Z axis. |
## Returns
The norm (length) of the provided vector as a float.
## Examples
```c
stock Float:GetDistanceBetweenPoints(Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2)
{
return VectorSize(x1-x2, y1-y2, z1-z2);
}
```
## Related Functions
- [GetPlayerDistanceFromPoint](GetPlayerDistanceFromPoint): Get the distance between a player and a point.
- [GetVehicleDistanceFromPoint](GetVehicleDistanceFromPoint): Get the distance between a vehicle and a point.
- [floatsqroot](floatsqroot): Calculate the square root of a floating point value.
| openmultiplayer/web/docs/scripting/functions/VectorSize.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/VectorSize.md",
"repo_id": "openmultiplayer",
"token_count": 319
} | 331 |
---
title: existproperty
description: Check if a property exist.
tags: ["core", "property"]
---
<LowercaseNote />
## Description
Check if a property exist.
| Name | Description |
| ------ | --------------------------------------------------------------------------------------------------- |
| id | The virtual machine to use, you should keep this zero. *(optional=0)* |
| name[] | The property's name, you should keep this "". |
| value | The property's unique ID. Use the hash-function to calculate it from a string. *(optional=cellmin)* |
## Returns
True if the property exists and false otherwise.
## Examples
```c
if (existproperty(0, "", 123984334))
{
//the property exists, do something
}
```
## Notes
:::tip
It is recommended to use the PVars/SVars or GVar plugin instead of these natives for being very slow.
:::
## Related Functions
- [setproperty](setproperty): Set a property.
- [getproperty](getproperty): Get the value of a property.
- [deleteproperty](deleteproperty): Delete a property.
| openmultiplayer/web/docs/scripting/functions/existproperty.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/existproperty.md",
"repo_id": "openmultiplayer",
"token_count": 461
} | 332 |
---
title: floatcmp
description: floatcmp can be used to compare float values to each other, to validate the comparison.
tags: ["math", "floating-point"]
---
<LowercaseNote />
## Description
floatcmp can be used to compare float values to each other, to validate the comparison.
| Name | Description |
| ----------- | ---------------------------------- |
| Float:oper1 | The first float value to compare. |
| Float:oper2 | The second float value to compare. |
## Returns
**0** if value does match, **1** if the first value is bigger and **-1** if the 2nd value is bigger.
## Examples
```c
new value;
value = floatcmp(2.0, 2.0); // Returns 0 because they match.
value = floatcmp(1.0, 2.0); // Returns -1 because the second value is bigger.
value = floatcmp(2.0, 1.0); // Returns 1 because the first value is bigger.
```
| openmultiplayer/web/docs/scripting/functions/floatcmp.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/floatcmp.md",
"repo_id": "openmultiplayer",
"token_count": 274
} | 333 |
---
title: fputchar
description: Write one character to a file.
tags: ["file management"]
---
<LowercaseNote />
## Description
Write one character to a file.
| Name | Description |
| ----------- | ----------------------------------------------------------------------------- |
| File:handle | The File handle to use, earlier opened by fopen(). |
| value | The character to write into the file. |
| bool:utf8 | If `true`, write in UTF8 mode, otherwise in extended ASCII. (default: `true`) |
## Returns
This function does not return any specific values.
## Examples
```c
// Open "file.txt" in "write only" mode
new File:handle = fopen("file.txt", io_write);
if (handle)
{
// Success
// Write character "e" into "file.txt"
fputchar(handle, 'e', false);
// Close "file.txt"
fclose(handle);
}
else
{
// Error
print("Failed to open \"file.txt\".");
}
```
## Notes
:::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.
- [fwrite](fwrite): Write to a file.
- [fread](fread): Read 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/fputchar.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/fputchar.md",
"repo_id": "openmultiplayer",
"token_count": 839
} | 334 |
---
title: heapspace
description: Returns the amount of memory available for the heap/stack in bytes.
tags: ["core"]
---
<LowercaseNote />
## Description
Returns the amount of memory available for the heap/stack in bytes.
## Examples
```c
public OnGameModeInit()
{
printf("Heapspace: %i kilobytes", heapspace() / 1024);
return 1;
}
```
| openmultiplayer/web/docs/scripting/functions/heapspace.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/heapspace.md",
"repo_id": "openmultiplayer",
"token_count": 113
} | 335 |
---
title: strcat
description: This function concatenates (joins together) two strings into the destination string.
tags: ["string"]
---
<LowercaseNote />
## Description
This function concatenates (joins together) two strings into the destination string.
| Name | Description |
| ------------------------- | ---------------------------------------------------- |
| dest[] | The string to store the two concatenated strings in. |
| const source[] | The source string. |
| maxlength = sizeof (dest) | The maximum length of the destination. |
## Returns
The length of the new destination string.
## Examples
```c
new string[40] = "Hello";
strcat(string, " World!");
// The string is now 'Hello World!'
```
## Related Functions
- [strcmp](strcmp): Compare two strings to check if they are the same.
- [strfind](strfind): Search for a string in another string.
- [strdel](strdel): Delete part of a string.
- [strins](strins): Insert text into a string.
- [strlen](strlen): Get the length of a string.
- [strmid](strmid): Extract part of a string into another string.
- [strpack](strpack): Pack a string into a destination string.
- [strval](strval): Convert a string into an integer.
| openmultiplayer/web/docs/scripting/functions/strcat.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/strcat.md",
"repo_id": "openmultiplayer",
"token_count": 465
} | 336 |
---
title: uudecode
description: Decode an UU-encoded string.
tags: ["string", "encryption"]
---
<LowercaseNote />
## Description
Decode an UU-encoded string.
| Name | Description |
| ------------------------- | --------------------------------------------- |
| dest[] | The destination for the decoded string array. |
| const source[] | The UU-encoded source string. |
| maxlength = sizeof (dest) | The maximum length of dest that can be used. |
## Returns
This function does not return any specific values.
## Examples
```c
uudecode(normalString, encodedString);
```
## Related Functions
- [uuencode](uuencode): Encode a string to an UU-decoded string.
- [memcpy](memcpy): Copy bytes from one location to another.
| openmultiplayer/web/docs/scripting/functions/uudecode.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/uudecode.md",
"repo_id": "openmultiplayer",
"token_count": 315
} | 337 |
# The preprocessor
---
The first phase of compiling a pawn source file to the executable
P-code is “preprocessing”: a general purpose text filter that modifies/cleans up the text
before it is fed into the parser. The preprocessing phase removes comments,
strips out “conditionally compiled” blocks, processes the compiler directives
and performs find-&-replace operations on the text of the source file. The
compiler directives are summarized on page 117 and the text substitution
(“find-&-replace”) is the topic of this chapter.
The preprocessor is a process that is invoked on all source lines immediately
after they are read. No syntax checking is performed during the text substitu-
tions. While the preprocessor allows powerful tricks in the pawn language, it
is also easy to shoot yourself in the foot with it.
In this chapter, I will refer to the C/C⁺⁺ language on several occasions because
pawn’s preprocessor is similar to the one in C/C++. That said, the pawn
preprocessor is incompatible with the C/C⁺⁺ preprocessor.
The #define directive defines the preprocessor macros. Simple macros are:
```c
#define maxsprites 25
#define CopyRightString "(c) Copyright 2004 by me"
```
In the pawn script, you can then use them as you would use constants. For
example:
```c
#define maxsprites 25
#define CopyRightString "(c) Copyright 2004 by me"
main()
{
print( Copyright )
new sprites[maxsprites]
}
```
By the way, for these simple macros there are equivalent pawn constructs:
```c
const maxsprites = 25
stock const CopyRightString[] = "(c) Copyright 2004 by me"
```
These constant declarations have the advantage of better error checking and
the ability to create tagged constants. The syntax for a string
constant is an array variable that is declared both “const” and “stock”. The
const attribute prohibits any change to the string and the stock attribute makes
the declaration “disappear” if it is never referred to.
Substitution macros can take up to 10 parameters. A typical use for parame-
terized macros is to simulate tiny functions:
Listing: the “min” macro
```c
#define min(%1,%2) ((%1) < (%2) ? (%1) : (%2))
```
If you know C/C⁺⁺, you will recognize the habit of enclosing each argument
and the whole substitution expression in parentheses.
If you use the above macro in a script in the following way:
Listing: bad usage of the “min” macro
```c
new a = 1, b = 4
new min = min(++a,b)
```
the preprocessor translates it to:
```c
new a = 1, b = 4
new min = ((++a) < (b) ? (++a) : (b))
```
which causes “a” to possibly be incremented twice. This is one of the traps
that you can trip into when using substitution macros (this particular problem
is well known to C/C++ programmers). Therefore, it may be a good idea to
use a naming convention to distinguish macros from functions. In C/C⁺⁺ it is
common practice to write preprocessor macros in all upper case.
To show why enclosing macro arguments in parentheses is a good idea, consider
the macro:
```c
#define ceil_div(%1,%2) (%1 + %2 - 1) / %2
```
This macro divides the first argument by the second argument, but rounding
upwards to the nearest integer (the divide operator, “/”, rounds downwards).
If you use it as follows:
```c
new a = 5
new b = ceil_div(8, a - 2)
```
the second line expands to “new b = (8 + a - 2 - 1) / a - 2”,
which, considering the precedence levels of the pawn operators, leads to “b”
being set to zero (if “a” is 5). What you would have expected from looking at the
macro invocation is eight divided by three (“a - 2”), rounded upwards —
hence, that “b” would be set to the value 3. Changing the macro to enclose
each parameter in parentheses solves the problem. For similar reasons, it is
also advised to enclose the complete replacement text in parentheses. Below
is the ceil_div macro modified accordingly:
```c
#define ceil_div(%1,%2) ( ((%1) + (%2) - 1) / (%2) )
```
The pattern matching is subtler than matching strings that look like function
calls. The pattern matches text literally, but accepts arbitrary text where the
pattern specifies a parameter. You can create patterns like:
Listing: macro that translates a syntax for array access to a function call
```c
#define Object[%1] CallObject(%1)
```
When the expansion of a macro contains text that matches other macros, the
expansion is performed at invocation time, not at definition time. Thus the code:
```c
#define a(%1) (1+b(%1))
#define b(%1) (2\*(%1))
new c = a(8)
```
will evaluate to “new c = (1+(2\*(8)))”, even though the macro “b” was not
defined at the time of the definition of “a”.
The pattern matching is constrained to the following rules:
- There may be no space characters in the pattern. If you must match a space, you need to use the “\32;” escape sequence. The substitution text, on the other hand, may contain space characters. Due to the matching rules of the macro pattern (explained below), matching a space character is rarely needed.
- As evidenced in the preceding line, escape sequences may appear in the pattern (they are not very useful, though, except perhaps for matching a literal “%” character).
- The pattern may not end with a parameter; a pattern like “set:%1=%2” is illegal. If you wish to match with the end of a statement, you can add a semicolon at the end of the pattern. If semicolons are optional at the end of each statement, the semicolon will also match a newline in the source.
- The pattern must start with a letter, an underscore, or an “@” character The first part of the pattern that consists of alphanumeric characters (plus the “\_” and/“@”) is the “name” or the “prefix” of the macro. On the defined operator and the #undef directive, you specify the macro prefix.
- When matching a pattern, the preprocessor ignores white space between nonalphanumeric symbols and white space between an alphanumeric symbol and a non-alphanumeric one, with one exception: between two identical symbols, white space is not ignored. Therefore: `the pattern abc(+-) matches “abc ( + - )” the pattern abc(--) matches “abc ( -- )”` but does not match `“abc(- -)”`
- There are up to 10 parameters, denoted with a “%” and a single digit (1 to 9 and 0). The order of the parameters in a pattern is not important.
- The #define symbol is a parser directive. As with all parser directives, the pattern definition must fit on a single line. You can circumvent this with a “\” on the end of the line. The text to match must also fit on a single line.
Note that in the presence of (parameterized) macros, lines of source code may
not be what they appear: what looks like an array access may be “prepro
cessed” to a function call, and vice versa.
A host application that embeds the pawn parser may provide an option to let
you check the result of text substitution through macros. If you are using the
standard pawn toolset, you will find instructions of how to use the compiler
and run-time in the companion booklet “The pawn booklet — Implementor’s Guide”.
---
`Operator precedence: 110`
`Directives: 117`
---
[Go Back to Contents](00-Contents.md)
| openmultiplayer/web/docs/scripting/language/reference/05-The-preprocessor.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/language/reference/05-The-preprocessor.md",
"repo_id": "openmultiplayer",
"token_count": 2072
} | 338 |
---
title: Camera Cut Styles
---
:::info
Camera cut styles are used by natives such as [SetPlayerCameraLookAt](../functions/SetPlayerCameraLookAt), [InterpolateCameraPos](../functions/InterpolateCameraPos) and [InterpolateCameraLookAt](../functions/InterpolateCameraLookAt).
:::
## Cut Styles
| ID | Style | Description |
| -- | ---- | ------------------------------- |
| 1 | CAMERA_MOVE | The camera position and/or target will move to its new value over time. |
| 2 | CAMERA_CUT | The camera position and/or target will move to its new value instantly. |
| openmultiplayer/web/docs/scripting/resources/cameracutstyles.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/resources/cameracutstyles.md",
"repo_id": "openmultiplayer",
"token_count": 179
} | 339 |
---
title: File Seek Whence
description: File seek whence definitions. (fseek)
---
:::note
These definitions are used by [fseek](../functions/fseek).
:::
| Definition | Description |
| ------------ | --------------------------------------------------------------------------------------------------------------------- |
| seek_start | Set the file position relative to the start of the file (the position parameter must be positive). |
| seek_current | Set the file position relative to the current file position: the position parameter is added to the current position. |
| seek_end | Set the file position relative to the end of the file (parameter position must be zero or negative). |
| openmultiplayer/web/docs/scripting/resources/file-seek-whence.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/resources/file-seek-whence.md",
"repo_id": "openmultiplayer",
"token_count": 299
} | 340 |
---
title: Material Text Sizes
description: A list of Material Text Sizes.
---
:::info
There are two kinds of parameters for [SetObjectMaterialText](../functions/SetObjectMaterialText) - material text alignments and material text sizes. Text sizes are listed on this page.
:::
| Value | Definition |
| ----- | ------------------------------ |
| 10 | OBJECT_MATERIAL_SIZE_32x32 |
| 20 | OBJECT_MATERIAL_SIZE_64x32 |
| 30 | OBJECT_MATERIAL_SIZE_64x64 |
| 40 | OBJECT_MATERIAL_SIZE_128x32 |
| 50 | OBJECT_MATERIAL_SIZE_128x64 |
| 60 | OBJECT_MATERIAL_SIZE_128x128 |
| 70 | OBJECT_MATERIAL_SIZE_256x32 |
| 80 | OBJECT_MATERIAL_SIZE_256x64 |
| 90 | OBJECT_MATERIAL_SIZE_256x128 |
| 100 | OBJECT_MATERIAL_SIZE_256x256 |
| 110 | OBJECT_MATERIAL_SIZE_512x64 |
| 120 | OBJECT_MATERIAL_SIZE_512x128 |
| 130 | OBJECT_MATERIAL_SIZE_512x256 |
| 140 | OBJECT_MATERIAL_SIZE_512x512 |
| openmultiplayer/web/docs/scripting/resources/materialtextsizes.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/resources/materialtextsizes.md",
"repo_id": "openmultiplayer",
"token_count": 416
} | 341 |
---
title: Sound IDs
description: A list of sound IDs used by PlayerPlaySound.
---
Here you can find all of the sound IDs used by [PlayerPlaySound](../functions/PlayerPlaySound) function.
For [crime report sound IDs](../functions/PlayCrimeReportForPlayer) check [here](crimelist).
:::note
You have to use sound ID **0** to stop the sound ID that is currently playing.
:::
:::caution Since **0.3.7-R2**:
- Sound ID **1** can be used to disable the [interior 0 (default)](../functions/SetPlayerInterior) ambience track (wind noise). _Hint: it can help to create more realistically fake interiors._
- Sound ID **0** can be used additionally to return the game's normal outdoor ambience track.
:::
## 0.3.7-R2 sounds (found by Vince and BigETI)
```
2 - 59 police radio
66 - 134 radio adverts
135 - 136 Ventilation
137 Ammu-Nation interior
138 Area 51 interior
139 awards ceremony music
140 Disco (Rock)
141 Let's Get Ready to Bumble (Bee Bee Gone) music
142 same as 1185
143 Marco's Bistro music
144 Diner music
145 same as 1097
146 casino music
147 Disco (Electro)
148 Plane interior humming
149 same as 1183
150 same as 1068
151 Fan
152 Bar (outside?)
153 same as 1062
154 Ventilation
155, 156 plane interior humming
157 Disco (Hip-Hop)
158 Ventilation
159 - 160 Horse race
161 same as 1187
162 Disco (Hip-Hop)
163 Ventilation
164, 165 aircraft carrier lift
166 Riot
167 Rain
168 Plane interior
169 Stunt race
170 Strip club
171 Disco (Rock): Guns N' Roses - Welcome To The Jungle
172 Some dark theme
173 Conveyor belt?
174 Water
175 Disco
176 SA intro music
177 - 179 Disco
179 Lowrider challenge
180 Lowrider challenge
181 Lowrider challenge
182 mission passed theme / property bought
183 Mission passed
184 Voice line
185 - 314 Playback FM
315 - 469 K-ROSE
470 - 625 K-DST (534 Rod Stewart - Young hearts be free tonight)
626 - 668 Voice samples
669 girlfriend date failed music (''fuck you I won't do what you tell me'')
670 girlfriend date success music
671 - 766 Voice lines (743 - Big Smoke's order)
767 - 945 Bounce FM
946 - 999 SF-UR
```
---
:::note
These Sound IDs below only work since version 0.3d!
:::
You can find all available Sound IDs in the file located within your GTA San Andreas folder, at `/data/AudioEvents.txt`
#### Special Sound IDs
- 1000 - Disable helicopter sounds.
- 1001 - Enable helicopter sounds. (handy to fix heli sound bug)
## 0.3d Sound IDs (found by WackoX)
#### Police Radio
```
2200 - "Black"
2201 - "Blue"
2202 - "Brown"
2203 - "Copper"
2204 - "Custom"
2205 - "Customized"
2206 - "Dark"
2207 - "Gold"
2208 - "Green"
2209 - "Grey"
2210 - "Light"
2211 - "Pink"
2212 - "Red"
2213 - "Silver"
2214 - "White"
2400 - "Central"
2401 - "East"
2402 - "North"
2403 - "South"
2404 - "West"
2600 - "Head to a 10-"
2601 - "In a"
2602 - "In water"
2603 - "On a"
2604 - "On foot"
2605 - "Respond to a 10-"
2606 - "Suspect in water"
2607 - "Suspect last seen"
2608 - "We got a 10-"
2800 - "17 in"
2801 - "21 in"
2802 - "24 in"
2803 - "28 in"
2804 - "34 in"
2805 - "37 in"
2806 - "7 in"
2807 - "71 in"
2808 - "81 in"
2809 - "90 in"
2810 - "91 in"
2811-2813: a 10/attempt???
3000 - "2 Door"
3001 - "4 Door"
3002 - "Ambulance"
3003 - "Artic Cab"
3004 - "Beach Buggy"
3005 - "Bike"
3006 - "Boat"
3007 - "Buggy"
3008 - "Bulldozer"
3009 - "Bus"
3010 - "Camper Van"
3011 - "Coach"
3012 - "Combine Harvester"
3013 - "Compact"
3014 - "Convertible"
3015 - "Coupe"
3016 - "Cruiser"
3017 - "Firetruck"
3018 - "Forklift"
3019 - "Freight Train"
3020 - "Garbage Truck"
3021 - "Gas Tanker"
3022 - "Golf Car"
3023 - "Go Kart"
3024 - "Hearse"
3025 - "Helicopter"
3026 - "Hovercraft"
3027 - "Icecream Van"
3028 - "Jeep"
3029 - "Lawn Mower"
3030 - "Limo"
3031 - "Lowrider"
3032 - "Moped"
3033 - "Motorbike"
3034 - "Offroad"
3035 - "People Carrier"
3036 - "Pickup"
3037 - "Plane"
3038 - "Police Car"
3039 - "Police Van"
3040 - "Quad Bike"
3041 - "Rubber Dinghy"
3042 - "Sand Buggy"
3043 - "Sea Plane"
3044 - "Snowcat"
3045 - "Speedboat"
3046 - "Sport"
3047 - "Sports Car"
3048 - "Sports Bike"
3049 - "Station Wagon"
3050 - "SUV"
3051 - "Tank"
3052 - "Taxi"
3053 - "Tractor"
3054 - "Train"
3055 - "Tram"
3056 - "Truck"
3057 - "Van"
```
#### Casino Sounds
```
4200 - Bandit wheel start
4201 - Falling coints
4202 - Blip
4203 - Blip
```
#### Gym Guy
```
4800 - "Yo' you wanna learn some new moves?"
4801 - "Suit youself homes, but the streets are mean dude."
4802 - "Man you're an embarrassment, get yourselves some muscles first."
4803 - "Hey you wanna go around with me?"
4804 - "Yo' pay attention and you might learn something."
4805 - "Yo' charge in and batter yo opponent!"
4806 - "Make sure yo' opponent is down and out!"
4807 - "Never give your opponent time to recover."
```
#### Game Souds
```
5200 - Continuous buzz.
5201 - Bling
5202 - Bumblebee video game take damage
5203 - Bumblebee video game game over
5204 - Bumblebee video game firing sound
5205 - Bumblebee video game beep
5206 - Bumblebee video game death
```
#### Casino Woman
```
5400 - "Place your bets!"
5401 - "Place your bets ladies and gentlemen."
5402 - "An offer of credit has been made sir."
5403 - "The house is prepared to offer you credit sir."
5404 - "The house recognises sir's credit rating."
5405 - "Sir doesn't have sufficient money to back another bet."
5406 - "Sorry sir you do not have enough funds."
5407 - "You appear to have insufficient funds to continue betting."
5408 - "No more bets please!"
5409 - "No more bets ladies and gentlemen, please."
5410 - "No more bets people."
5411-5447: Roulette numbers, eg. "Black, 26!"
5448 - "You win!"
5449 - "You win sir well done."
5450 - "Congratulations sir!"
5451 - "Sorry sir, regulars only."
5452 - "The house does not recognize your limit at this table sir."
5453 - "Thank you sir have a nice day!"
5454 - "Thank you for playing sir!"
5455 - "One dollar pays out!"
5456 - "Two dollars pays out!"
5457 - "Five dollars pays out!"
5458 - "Ten dollars pays out."
5459 - "Twenty dollars pays out."
5460 - "Forty dollars pays out."
5461 - "Jackpot!"
5462 - "Another win for sir!"
5463 - "Congratulations sir, you're having quite a run."
5464 - "I hope sir's luck holds!"
```
#### Boat School
```
6200 - Seagulls
6201 - "Welcome to the boat school."
6202 - "To pass, you must achieve bronze or higher in all five tests."
6203 - "To view a demonstration of each test, please use the TV over there."
6204 - "Passing the test, will unlock the next test."
6205 - "You can come back and check you scores or take new tests, at any time."
```
#### Random/Extra
```
3200 - Air horn
3201 - Air horn (longer than previous one)
3400 - Air conditioning
3401 - Continuous ringing bell
3600 - Calling tone
3800 - Videotape (continuous)
4400 - Barber trimming hair (electric razor).
6000 - Blast door sliding
6001 - Repeating siren (repeats every 2 seconds).
6002 - Heavy door
6003 - Electricity (could be used for tazer)
6400 - Blip ('door buzzer' in game files)
6401 - Lift bell rings
39000 - "What would your mother think?"
39002 - "Filth like you always have to pay for sex!"
```
#### 0.3d Sound IDs
```
"ALDEA MALVADA" - 2000
"ANGEL PINE" - 2001
"ARCO DEL OESTE" - 2002
"AVISPA COUNTRY CLUB" - 2003
"BACK O BEYOND" - 2004
"BATTERY POINT" - 2005
"BAYSIDE" - 2006
"BAYSIDE MARINA" - 2007
"BAYSIDE TUNNEL" - 2008
"BEACON HILL" - 2009
"BLACKFIELD" - 2010
"BLACKFIELD CHAPEL" - 2011
"BLACKFIELD INTERSECTION" - 2012
"BLUEBERRY ACRES" - 2013
"BLUEBERRY" - 2014
"BONE COUNTY" - 2015
"CALIGULAS PALACE" - 2016
"CALTON HEIGHTS" - 2017
"CHINATOWN" - 2018
"CITY HALL" - 2019
"COME A LOT" - 2020
"COMMERCE" - 2021
"CONFERENCE CENTRE" - 2022
"CRANBERRY STATION" - 2023
"DILLIMORE" - 2024
"DOHERTY" - 2025
"DOWNTOWN" - 2026
"DOWNTOWN LOS SANTOS" - 2027
"EAST LOS SANTOS" - 2028
"EAST BEACH" - 2029
"EASTER BASIN" - 2030
"EASTER BAY AIRPORT" - 2031
"EASTER BAY BLUFFS CHEMICAL PLANT" - 2032
"EASTER TUNNEL" - 2033
"EL CASTILLO DEL DIABLO" - 2034
"EL CORONA" - 2035
"EL QUEBRADOS" - 2036
"ESPLANADE EAST" - 2037
"ESPLANADE NORTH" - 2038
"FALLEN TREE" - 2039
"FALLOW BRIDGE" - 2040
"FERN RIDGE" - 2041
"FINANCIAL" - 2042
"FISHERS LAGOON" - 2043
"FLINT COUNTY" - 2044
"FLINT INTERSECTION" - 2045
"FLINT RANGE" - 2046
"FLINT WATER" - 2047
"FORT CARSON" - 2048
"FOSTER VALLEY" - 2049
"FREDERICK BRIDGE" - 2050
"GANTON" - 2051
"GANT BRIDGE" - 2052
"GARCIA" - 2053
"GARVER BRIDGE" - 2054
"GLEN PARK" - 2055
"GREENGLASS COLLEGE" - 2056
"GREEN PALMS" - 2057
"HAMPTON BARNS" - 2058
"HANKYPANKY POINT" - 2059
"HARRY GOLD PARKWAY" - 2060
"HASHBERRY" - 2061
"HILLTOP FARM" - 2062
"HUNTER QUARRY" - 2063
"IDLEWOOD" - 2064
"JULIUS THRUWAY EAST" - 2065
"JULIUS THRUWAY NORTH" - 2066
"JULIUS THRUWAY SOUTH" - 2067
"JULIUS THRUWAY WEST" - 2068
"JUNIPER HILL" - 2069
"JUNIPER HOLLOW" - 2070
"KACC MILITARY FUELS" - 2071
"KINCAID BRIDGE" - 2072
"KINGS" - 2073
"LAS BARRANCAS" - 2074
"LAS BRUJAS" - 2075
"LAS PAYASADAS" - 2076
"LAST DIME MOTEL" - 2077
"LAS VENTURAS" - 2078
"LEAFY HOLLOW" - 2079
"LIL PROBE INN" - 2080
"LINDEN SIDE" - 2081
"LINDEN STATION" - 2082
"LITTLE MEXICO" - 2083
"LAS COLINAS" - 2084
"LOS FLORES" - 2085
"LOS SANTOS" - 2086
"LOS SANTOS INLET" - 2087
"LOS SANTOS INTERNATIONAL" - 2088
"LOS SEPULCROS" - 2089
"LAS VENTURAS AIRPORT" - 2090
"LVA FREIGHT DEPOT" - 2091
"MARINA" - 2092
"MARKET" - 2093
"MARKET STATION" - 2094
"MARTIN BRIDGE" - 2095
"MISSIONARY HILL" - 2096
"MONTGOMERY" - 2097
"MONTGOMERY INTERSECTION" - 2098
"MOUNT CHILLIAD" - 2099
"MULHOLLAND" - 2100
"MULHOLLAND INTERSECTION" - 2101
"NORTHSTAR ROCK" - 2102
"OCEAN DOCKS" - 2103
"OCEAN FLATS" - 2104
"OCTANE SPRINGS" - 2105
"OLD VENTURAS STRIP" - 2106
"OPEN OCEAN" - 2107
"PALLISADES" - 2108
"PALOMINO CREEK" - 2109
"PARADISO" - 2110
"PILGRAMS CREEK" - 2111
"PILSON INTERSECTIION" - 2112
"PLAYA DEL SEVILLE" - 2113
"PRICKLE PINE" - 2114
"QUEENS" - 2115
"RANDOLPH INDUSTRIAL ESTATE" - 2116
"RED COUNTY" - 2117
"REDSANDS EAST" - 2118
"REDSANDS WEST" - 2119
"REGULAR TOM" - 2120
"RICHMAN" - 2121
"ROCA ESCALANTE" - 2122
"ROCKSHORE EAST" - 2123
"ROCKSHORE WEST" - 2124
"RODEO" - 2125
"ROYALE CASINO" - 2126
"SAN ANDREAS SOUND" - 2127
"SAN FIERRO" - 2128
"SAN FIERRO BAY" - 2129
"SANTA FLORA" - 2130
"SANTA MARIA BEACH" - 2131
"SHADY CREEKS" - 2132
"SHERMAN RESERVOIR" - 2133
"SOBELL RAILYARDS" - 2134
"SPINYBED" - 2135
"STARFISH CASINO" - 2136
"SUNNYSIDE" - 2137
"TEMPLE" - 2138
"THE BIG EAR RADIOTELESCOPE" - 2139
"THE CAMELS TOE" - 2140
"THE CLOWNS POCKET" - 2141
"THE EMERALD ISLE" - 2142
"THE FARM" - 2143
"THE FOUR DRAGONS CASINO" - 2144
"THE HIGH ROLLER" - 2145
"THE MAKO SPAN" - 2146
"THE PANOPTICON" - 2147
"THE PINK SWAN" - 2148
"THE PIRATES IN MENS PANTS" - 2149
"THE SHERMAN DAM" - 2150
"THE VISAGE" - 2151
"TIERRA ROBADA" - 2152
"UNITY STATION" - 2153
"VALLE OCULTADO" - 2154
"VERDANT BLUFFS" - 2155
"VERDANT MEADOWS" - 2156
"VERONA BEACH" - 2157
"VINEWOOD" - 2158
"WHETSTONE" - 2159
"WHITEWOOD ESTATES" - 2160
"WILLOWFIELD" - 2161
"YELLOWBELL GOLF COURSE" - 2162
"YELLOWBELL STATION" - 2163
```
---
:::note
These Sound IDs work in every version!
:::
| Name | ID |
| ---------------------------------- | ------------ |
| SOUND_CEILING_VENT_LAND | 1002 |
| SOUND_BONNET_DENT | 1009 |
| SOUND_WHEEL_OF_FORTUNE_CLACKER | 1027 |
| SOUND_SHUTTER_DOOR_START | 1035 |
| SOUND_SHUTTER_DOOR_STOP | 1036 |
| SOUND_PARACHUTE_OPEN | 1039 |
| SOUND_AMMUNATION_BUY_WEAPON | 1052 |
| SOUND_AMMUNATION_BUY_WEAPON_DENIED | 1053 |
| SOUND_SHOP_BUY | 1054 |
| SOUND_SHOP_BUY_DENIED | 1055 |
| SOUND_RACE_321 | 1056 |
| SOUND_RACE_GO | 1057 |
| SOUND_PART_MISSION_COMPLETE | 1058 |
| SOUND_GOGO_TRACK_START | 1062 (music) |
| SOUND_GOGO_TRACK_STOP | 1063 (music) |
| SOUND_DUAL_TRACK_START | 1068 (music) |
| SOUND_DUAL_TRACK_STOP | 1069 (music) |
| SOUND_BEE_TRACK_START | 1076 (music) |
| SOUND_BEE_TRACK_STOP | 1077 (music) |
| SOUND_ROULETTE_ADD_CASH | 1083 |
| SOUND_ROULETTE_REMOVE_CASH | 1084 |
| SOUND_ROULETTE_NO_CASH | 1085 |
| SOUND_BIKE_PACKER_CLUNK | 1095 |
| SOUND_AWARD_TRACK_START | 1097 (music) |
| SOUND_AWARD_TRACK_STOP | 1098 (music) |
| SOUND_MESH_GATE_OPEN_START | 1100 |
| SOUND_MESH_GATE_OPEN_STOP | 1101 |
| SOUND_PUNCH_PED | 1130 |
| SOUND_AMMUNATION_GUN_COLLISION | 1131 |
| SOUND_CAMERA_SHOT | 1132 |
| SOUND_BUY_CAR_MOD | 1133 |
| SOUND_BUY_CAR_RESPRAY | 1134 |
| SOUND_BASEBALL_BAT_HIT_PED | 1135 |
| SOUND_STAMP_PED | 1136 |
| SOUND_CHECKPOINT_AMBER | 1137 |
| SOUND_CHECKPOINT_GREEN | 1138 |
| SOUND_CHECKPOINT_RED | 1139 |
| SOUND_CAR_SMASH_CAR | 1140 |
| SOUND_CAR_SMASH_GATE | 1141 |
| SOUND_OTB_TRACK_START | 1142 |
| SOUND_OTB_TRACK_STOP | 1143 |
| SOUND_PED_HIT_WATER_SPLASH | 1144 |
| SOUND_RESTAURANT_TRAY_COLLISION | 1145 |
| SOUND_SWEETS_HORN | 1147 |
| SOUND_MAGNET_VEHICLE_COLLISION | 1148 |
| SOUND_PROPERTY_PURCHASED | 1149 |
| SOUND_PICKUP_STANDARD | 1150 |
| SOUND_GARAGE_DOOR_START | 1153 |
| SOUND_GARAGE_DOOR_STOP | 1154 |
| SOUND_PED_COLLAPSE | 1163 |
| SOUND_SHUTTER_DOOR_SLOW_START | 1165 |
| SOUND_SHUTTER_DOOR_SLOW_STOP | 1166 |
| SOUND_RESTAURANT_CJ_PUKE | 1169 |
| SOUND_DRIVING_AWARD_TRACK_START | 1183 (music) |
| SOUND_DRIVING_AWARD_TRACK_STOP | 1184 |
| SOUND_BIKE_AWARD_TRACK_START | 1185 (music) |
| SOUND_BIKE_AWARD_TRACK_STOP | 1186 |
| SOUND_PILOT_AWARD_TRACK_START | 1187 (music) |
| SOUND_PILOT_AWARD_TRACK_STOP | 1188 |
| SOUND_SLAP | 1190 |
---
## Old list from jbeta
```
1002 weak hit
1009 crash
1020 constant machinery noise
1021 machinery
1022 motor, stopping
1027 weaker hit
1035 garage door opening
1039 Parachute opening noise (by Maxx)
1052 blip A
1053 blip B
1054 blip A (same as 1052)
1055 blip B (same as 1053)
1056 race: green light sound
1057 race: red light sound (start sound)
1058 selection sound
1062 \*Videogame music: Go Go Space Monkey\*
1068 \*Videogame music: Duality\*
1076 \*Videogame music: Let´s Get Ready to Bumble\*
1083 map: place a marker
1084 map: remove a marker
1085 blip C
1095 loud hit
1097 \*background music\*
1100 metallic fence rattle A
1101 metallic fence rattle B
1130 punch A
1131 hit wooden object?
1132 camera click
1133 Add Vehicle component sound (transfender)
1134 spray can
1135 hit
1136 punch B
1137 high-pitch blip A
1138 high-pitch blip A
1139 high-pitch blip A
1140 crash A
1141 crash B
1142 stadium background noise
1144 splash
1145 throw a satchel??
1147 car horn
1148 crash C
1149 blip (same as 1052?)
1150 selection sound
1153 garage door opening (same as 1035)
1159 explosion
1163 two-feet stomp (after jumping)
1165 bigger garage (hangar?) doors
1183 \*Driving school results music\*
1185 \*Bike and boat school results Music\*
1187 \*Flight school results music\*
1190 slap
```
```
39047 " where's my cellphone!! "
39051 " that's right put your hands there "
39052 " Holy fuck I've got my phone "
39074 " I'm listening ... "
39076 " Aha , real interesting "
50002 " Just Try Punk ! Just Try It ! "
50004 " You're My World Now ! "
50050 " Tell My Wife I Love Her "
50051 " I'm going in "
50052 " What The Hell ! "
50053 " Uh , My Coffee "
50094 " Wait Wait , think about what you're doing "
100001 " Come On , time is money "
100005 " Not This Car ! "
100006 " My boss is gonna kill me "
100007 " There goes another tip "
100008 " OH NO MAN ! "
100009 " Today couldn't get any worse "
100010 " This is not good "
100011 " You Idiot "
100012 " Look Out! "
100013 " What Are You Doing?! "
100014 " Heeeeey "
100015 " Oh Fuck "
100016 " What The Fuck "
100017 " Hey Man ! "
```
| openmultiplayer/web/docs/scripting/resources/sound-ids.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/resources/sound-ids.md",
"repo_id": "openmultiplayer",
"token_count": 7221
} | 342 |
---
title: OnObjectMoved
description: Ovaj callback se poziva kada je objekt pomjeren nakon MoveObject (kada se prestane kretati).
tags: []
---
## Deskripcija
Ovaj callback se poziva kada je objekt pomjeren nakon MoveObject (kada se prestane kretati).
| Ime | Deskripcija |
| -------- | --------------------------- |
| objectid | ID objekta koji je pomjeren |
## Returns
Callback OnObjectMoved uvijek je prvo pozvan u filterskriptama!
## Primjeri
```c
public OnObjectMoved(objectid)
{
printf("Objekat %d je završio svoje kretanje.", objectid);
return 1;
}
```
## Zabilješke
:::tip
SetObjectPos ne radi kada ga koristite u ovom callback-u. Kako biste popravili to, ponovo kreirajte objekat.
:::
## Srodne Funkcije
- [MoveObject](../functions/MoveObject.md): Pomjeri objekar.
- [MovePlayerObject](../functions/MovePlayerObject.md): Pomjeri player objekat.
- [IsObjectMoving](../functions/IsObjectMoving.md): Provjerite da li se objekat kreće.
- [StopObject](../functions/StopObject.md): Zaustavite objekat od kretanja.
- [OnPlayerObjectMoved](OnPlayerObjectMoved.md): Pozvan kada player-objekat prestane da se kreće.
| openmultiplayer/web/docs/translations/bs/scripting/callbacks/OnObjectMoved.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/callbacks/OnObjectMoved.md",
"repo_id": "openmultiplayer",
"token_count": 450
} | 343 |
---
title: OnPlayerFinishedDownloading
description: Ovaj callback je pozvan kada igrač dovrši preuzimanje custom modela.
tags: ["player"]
---
:::warning
Ova funkcija je dodana u SA-MP 0.3.DL R1 i ne radi u nižim verzijama!
:::
## Deskripcija
Ovaj callback je pozvan kada igrač dovrši preuzimanje custom modela. Za više informmacija o tome kako dodati custom modele u vaš server, pogledajte pogledajte nit izdanja i ovaj vodič.
| Ime | Deskripcija |
| ------------ | --------------------------------------------------------------------------------------- |
| playerid | ID igrača koji je dovršio preuzimanje custom modela. |
| virtualworld | ID virtualnog svijeta (virtual world) igrača koji je dovršio preuzimanje custom modela. |
## Returns
This callback does not handle returns.
## Primjeri
```c
public OnPlayerFinishedDownloading(playerid, virtualworld)
{
SendClientMessage(playerid, 0xffffffff, "Downloads finished.");
return 1;
}
```
## Zabilješke
:::tip
Ovaj callback je pozvan svaki put kada igrač promijeni virtualni svijet (virtual world), iako nema modela koji su prezentovani u tom virtualnom svijetu.
:::
## Srodne Funkcije
| openmultiplayer/web/docs/translations/bs/scripting/callbacks/OnPlayerFinishedDownloading.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/callbacks/OnPlayerFinishedDownloading.md",
"repo_id": "openmultiplayer",
"token_count": 527
} | 344 |
---
title: OnPlayerStreamIn
description: Ovaj callback je pozvan kada se igrač učita/pojavi u klijent nekog drugog igrača.
tags: ["player"]
---
## Deskripcija
Ovaj callback je pozvan kada se igrač učita/pojavi u klijent nekog drugog igrača.
| Ime | Deskripcija |
| ----------- | ------------------------------------------------- |
| playerid | ID igrača koji se učitao/pojavio. |
| forplayerid | ID igrača kod kojeg se prvi igrač učitao/pojavio. |
## Returns
Uvijek je pozvan prvo u filterskripti
## Primjeri
```c
public OnPlayerStreamIn(playerid, forplayerid)
{
new string[40];
format(string, sizeof(string), "Igrač %d se pojavio kod tebe (u tvom klijentu).", playerid);
SendClientMessage(forplayerid, 0xFFFFFFFF, string);
return 1;
}
```
## Zabilješke
:::tip
Ovaj callback pozvat će i NPC.
:::
## Srodne Funkcije
| openmultiplayer/web/docs/translations/bs/scripting/callbacks/OnPlayerStreamIn.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/callbacks/OnPlayerStreamIn.md",
"repo_id": "openmultiplayer",
"token_count": 413
} | 345 |
---
title: OnVehicleSirenStateChange
description: Ovaj callback je pozvan kada se uključi/isključi sirena vozila.
tags: ["vehicle"]
---
:::warning
Ova funkcija je dodana u SA-MP 0.3.7 i ne radi u nižim verzijama!
:::
## Deskripcija
Ovaj callback je pozvan kada se uključi/isključi sirena vozila.
| Ime | Deskripcija |
| --------- | ------------------------------------------------------ |
| playerid | ID igrača koji je uključio/isključio sirenu (vozač). |
| vehicleid | ID vozila u kojem je sirena uključena/isključena. |
| newstate | 0 ako je sirena isključena, 1 ako je sirena uključena. |
## Returns
1 - Spriječiti će da gamemode prima ovaj callback.
0 - Ukazuje da će ovaj callback biti proslijeđen do gamemodea.
Uvijek je pozvan prvo u filterskriptama.
## Primjeri
```c
public OnVehicleSirenStateChange(playerid, vehicleid, newstate)
{
if (newstate)
{
GameTextForPlayer(playerid, "~W~Sirena ~G~ukljucena", 1000, 3);
}
else
{
GameTextForPlayer(playerid, "~W~Sirena ~r~iskljucena", 1000, 3);
}
return 1;
}
```
## Zabilješke
:::tip
Ovaj callback je pozvan samo kada se sirena vozila uključi/isključi, NE kada upravljate sirenom tako što je držite.
:::
## Srodne Funkcije
- [GetVehicleParamsSirenState](../functions/GetVehicleParamsSirenState.md): Provjeri da li je sirena vozila uključena ili isključena
| openmultiplayer/web/docs/translations/bs/scripting/callbacks/OnVehicleSirenStateChange.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/callbacks/OnVehicleSirenStateChange.md",
"repo_id": "openmultiplayer",
"token_count": 660
} | 346 |
---
title: AllowPlayerTeleport
description: O(ne)mogući mogućnost teleportovanja igrača kada koristi desni klik na mapu.
tags: ["player"]
---
:::warning
Ova funkcija, kao u 0.3d, je zastarjela. Provjerite [OnPlayerClickMap](../callbacks/OnPlayerClickMap.md).
:::
## Deskripcija
O(ne)mogući mogućnost teleportovanja igrača kada koristi desni klik na mapu.
| Ime | Deskripcija |
| -------- | -------------------------------------- |
| playerid | ID igrača kojem je teleport dozvoljen. |
| allow | 1-omogući/dozvoli, 0-onemogući/zabrani |
## Returns
Ova funkcija ne return-a nikakve specifične vrijednosti.
## Primjeri
```c
public OnPlayerConnect( playerid )
{
// Dozvoljava mogućnost teleportovanja igrača kada koristi desni klik na mapu
// s obzirom da se ovo nalazi u OnPlayerConnect, ovo će biti primijenjeno na SVAKOG igrača
AllowPlayerTeleport( playerid, 1 );
}
```
## Zabilješke
:::warning
Ova funckija će raditi SAMO ako je funkcija [AllowAdminTeleport](AllowAdminTeleport.md) omogućena, i moraš biti admin.
:::
## Srodne Funkcije
- [AllowAdminTeleport](AllowAdminTeleport.md): O(ne)mogući teleportovanje po markerima za RCON admine.
| openmultiplayer/web/docs/translations/bs/scripting/functions/AllowPlayerTeleport.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/AllowPlayerTeleport.md",
"repo_id": "openmultiplayer",
"token_count": 515
} | 347 |
---
title: CallLocalFunction
description: Poziva javnu funkciju iz skripte u kojoj se koristi.
tags: []
---
## Deskripcija
Poziva javnu funkciju iz skripte u kojoj se koristi.
| Ime | Deskripcija |
| -------------- | --------------------------------------------- |
| function[] | Ime javne funkcije |
| format[] | Oznaka / format svake varijable |
| {Float,\_}:... | 'Neodređeni' broj argumenata bilo koje oznake |
## Returns
Ako funkcija postoji, vraća isto što i pozvana funkcija. Ako funkcija ne postoji, vraća 0.
## Primjeri
```c
forward publicFunc(number, Float:flt, const string[]);
public publicFunc(number, Float:flt, const string[])
{
printf("Received integer %i, float %f, string %s", number, flt, string);
return 1;
}
CallLocalFunction("publicFunc", "ifs", 420, 68.999999999, "Hello world");
```
## Zabilješke
:::warning
CallLocalFunction ruši server ako prosljeđuje prazan string.
:::
## Srodne Funkcije
- [CallRemoteFunction](CallRemoteFunction): Poziva funkciju u bilo kojoj učitanoj skripti.
| openmultiplayer/web/docs/translations/bs/scripting/functions/CallLocalFunction.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/CallLocalFunction.md",
"repo_id": "openmultiplayer",
"token_count": 491
} | 348 |
---
title: CreatePlayer3DTextLabel
description: Kreira 3D Text Label samo za jednog određenog igrača.
tags: ["player", "3dtextlabel"]
---
## Deskripcija
Kreira 3D Text Label samo za jednog određenog igrača.
| Ime | Deskripcija |
| --------------- | ----------------------------------------------------------------------------- |
| playerid | Igrač koji bi trebao vidjeti novokreirani 3D Text Label. |
| text[] | Tekst za prikazati. |
| color | Boja teksta. |
| x | X kordinata (ili pomak ako je priložen) |
| y | Y kordinata (ili pomak ako je priložen) |
| z | Z kordinata (ili pomak ako je priložen) |
| DrawDistance | Udaljenost od mjesta na kojem možete vidjeti 3D text label |
| attachedplayer | Igrač za kojeg žeite prikvačiti 3D text label. (Ako nema: INVALID_PLAYER_ID) |
| attachedvehicle | Vozilo za koje žeite prikvačiti 3D text label. (Ako nema: INVALID_VEHICLE_ID) |
| 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 Player 3D Text Label limit (MAX_3DTEXT_PLAYER).
## Primjeri
```c
if (strcmp(cmd, "/playerlabel", true) == 0)
{
new
PlayerText3D: playerTextId,
Float: X, Float: Y, Float: Z;
GetPlayerPos(playerid, X, Y, Z);
playerTextId = CreatePlayer3DTextLabel(playerid, "Cao\nja sam na tvojoj poziciji", 0x008080FF, X, Y, Z, 40.0);
return 1;
}
```
## Zabilješke
:::tip
drawdistance se čini da je mnogo manja prilikom spectateanja
:::
:::warning
Ako je text[] prazan, server/clients pored teksta če možda crashati!
:::
## Srodne Funkcije
- [Create3DTextLabel](Create3DTextLabel): Kreiraj 3D text label.
- [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.
- [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/CreatePlayer3DTextLabel.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/CreatePlayer3DTextLabel.md",
"repo_id": "openmultiplayer",
"token_count": 1342
} | 349 |
---
title: DisableMenu
description: Onemogući meni.
tags: ["menu"]
---
## Deskripcija
Onemogući meni.
| Ime | Deskripcija |
| ----------- | ----------------------------- |
| Menu:menuid | ID meni-a koji se onemogućava |
## Returns
Ova funkcija ne returna (vraća) nikakve posebne vrijednosti.
## Primjeri
```c
new WeaponMenu;
WeaponMenu = CreateMenu("Weapons", 1, 50.0, 180.0, 200.0, 200.0);
AddMenuItem(WeaponMenu, 0, "Rocket Launcher");
AddMenuItem(WeaponMenu, 0, "Flamethrower");
AddMenuItem(WeaponMenu, 0, "Minigun");
AddMenuItem(WeaponMenu, 0, "Grenades");
// Ispod OnPlayerCommandText
if (!strcmp(cmdtext, "/disableguns", true))
{
DisableMenu(WeaponMenu); //onemogućava oružje meni
return 1;
}
```
## Zabilješke
:::tip
Ruši se kada se proslijedi nevažeći ID meni-a.
:::
## Srodne Funkcije
- [CreateMenu](CreateMenu): Kreiraj meni.
- [DestroyMenu](DestroyMenu): Uništi meni.
- [AddMenuItem](AddMenuItem): Dodaj artikal u meni.
| openmultiplayer/web/docs/translations/bs/scripting/functions/DisableMenu.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/DisableMenu.md",
"repo_id": "openmultiplayer",
"token_count": 415
} | 350 |
---
title: FindTextureFileNameFromCRC
description: Pronađite postojeću prilagođenu datoteku teksture kože ili jednostavnog objekta.
tags: []
---
:::warning
Ova funkcija je dodana u SA-MP 0.3.DL R1 i ne radi u nižim verzijama!
:::
## Deskripcija
Pronađite postojeću prilagođenu datoteku teksture kože ili jednostavnog objekta. Datoteke modela se prema zadanim postavkama nalaze u direktoriju poslužitelja modela (postavka artpath).
| Ime | Deskripcija |
| ----------- | ---------------------------------------------------------------------- |
| crc | CRC kontrolna suma datoteke prilagođenog modela. |
| retstr[] | Niz u koji treba pohraniti .dff ime datoteke, proslijeđeno referencom. |
| retstr_size | Dužina niza koji treba pohraniti. |
## Returns
1: Funkcija uspješno izvršena.
0: Funkcija neuspješno izvršena.
## Srodne Funkcije
- [OnPlayerFinishedDownloading](../callbacks/OnPlayerFinishedDownloading): Pozvano kada igrač dovrši preuzimanje prilagođenih modela.
| openmultiplayer/web/docs/translations/bs/scripting/functions/FindTextureFileNameFromCRC.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/FindTextureFileNameFromCRC.md",
"repo_id": "openmultiplayer",
"token_count": 537
} | 351 |
---
title: GetActorHealth
description: Dobij health actora.
tags: ["actor"]
---
<VersionWarn version='SA-MP 0.3.7' />
## Deskripcija
Dobij health actora
| Ime | Deskripcija |
| ------------- | ------------------------------------------------------------------------------- |
| actorid | ID actora od kojeg uzimate health. |
| &Float:health | Float varijabla proslijeđena referencom u koju se pohranjuje health actora. |
## Returns
1 - uspješno
0 - neuspješno (tj. actor nije kreiran).
NAPOMENA: Health actora je pohranjen u navedenoj varijabli, a ne u returnanoj (povratnoj) vrijednosti.
## Primjeri
```c
new gMyActor;
public OnGameModeInit()
{
gMyActor = CreateActor(179, 316.1, -134.0, 999.6, 90.0); // Actor kao prodavač u Ammunation-u
SetActorHealth(gMyActor, 100);
new Float:actorHealth;
GetActorHealth(gMyActor, actorHealth);
printf("Actor ID %d ima %.2f health-a.", gMyActor, actorHealth);
return 1;
}
```
## Srodne Funkcije
- [CreateActor](CreateActor): Kreiranje actora (statički NPC).
- [SetActorHealth](SetActorHealth): Postavite health actoru.
- [SetActorInvulnerable](SetActorInvulnerable): Postavite actora da je neranjiv.
- [IsActorInvulnerable](IsActorInvulnerable): Provjerite da li je actor neranjiv.
| openmultiplayer/web/docs/translations/bs/scripting/functions/GetActorHealth.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/GetActorHealth.md",
"repo_id": "openmultiplayer",
"token_count": 579
} | 352 |
---
title: GetPVarInt
description: Dobiva vrijednost cijelog broja varijable igrača.
tags: ["pvar"]
---
## Deskripcija
Dobiva vrijednost cijelog broja varijable igrača.
| Ime | Deskripcija |
| -------- | ------------------------------------------------------------------------------------- |
| playerid | ID igrača za dobiti igračevu varijablu. |
| varname | Ime igračeve varijable (osjetljivo na velika i mala slova). Dodijeljeno u SetPVarInt. |
## Returns
Cjelobrojna vrijednost navedene varijable igrača. I dalje će vraćati 0 ako varijabla nije postavljena ili igrač ne postoji.
## Primjeri
```c
public OnPlayerDisconnect(playerid,reason)
{
printf("money: %d", GetPVarInt(playerid, "money")); // dobij sačuvanu vrijednost ('money')
// ispisati će 'money: amount'
return 1;
}
```
## Zabilješke
:::tip
Varijable se resetiraju tek nakon što se pozove OnPlayerDisconnect, tako da su vrijednosti i dalje dostupne u OnPlayerDisconnect.
:::
## Srodne Funkcije
- [SetPVarInt](SetPVarInt): Postavi cijeli broj za igračevu varijablu.
- [SetPVarString](SetPVarString): Postavi string za igračevu varijablu.
- [GetPVarString](GetPVarString): Dobij prethodno postavljeni string iz igračeve varijable.
- [SetPVarFloat](SetPVarFloat): Postavi float za igračevu varijablu.
- [GetPVarFloat](GetPVarFloat): Dobij prethodno postavljeni float iz igračeve varijable.
- [DeletePVar](DeletePVar): Ukloni igračevu varijablu.
| openmultiplayer/web/docs/translations/bs/scripting/functions/GetPVarInt.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/GetPVarInt.md",
"repo_id": "openmultiplayer",
"token_count": 708
} | 353 |
---
title: GetPlayerVehicleSeat
description: Saznaj u kojem je igrač sjedištu.
tags: ["player", "vehicle"]
---
## Deskripcija
Saznaj u kojem je igrač sjedištu.
| Ime | Deskripcija |
| -------- | -------------------------------------- |
| playerid | ID player you want to get the seat of. |
## Returns
ID sjedišta u kojem je igrač. -1 ako nije u vozilu, 0 ako je vozač, 1 ako je suvozač, i 2 i 3 su zadnja sjedišta.
## Primjeri
```c
if (strcmp(cmdtext, "/myseat", true) == 0)
{
new
playerSeat = GetPlayerVehicleSeat(playerid);
// Kako možete odbaciti svoje podatke.
if (playerSeat == 128)
{
return SendClientMessage(playerid, 0xFFFFFFFF, "Greška nas je spriječila da vratimo ID sjedala.");
}
new
message[14];
format(message, sizeof(message), "Tvoje sjedište: %i", playerSeat);
SendClientMessage(playerid, 0xFFFFFFFF, message);
return 1;
}
```
## Srodne Funkcije
- [GetPlayerVehicleID](GetPlayerVehicleID): Dobij ID vozila u kojem je igrač trenutno.
- [PutPlayerInVehicle](PutPlayerInVehicle): Postavi igrača u vozilo.
| openmultiplayer/web/docs/translations/bs/scripting/functions/GetPlayerVehicleSeat.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/GetPlayerVehicleSeat.md",
"repo_id": "openmultiplayer",
"token_count": 494
} | 354 |
---
title: GetServerVarAsInt
description: Dobij cjelobrojnu vrijednost server varijable.
tags: []
---
:::warning
This function, as of 0.3.7 R2, is deprecated. Please see GetConsoleVarAsInt
:::
## Deskripcija
Dobij cjelobrojnu vrijednost server varijable.
| Ime | Deskripcija |
| --------------- | ----------------------------------------------- |
| const varname[] | Ime cjelobrojne varijable za dobiti vrijednost. |
## Returns
Vrijednost navedene server varijable. 0 ako navedena varijabla servera nije cijeli broj ili ne postoji.
## Primjeri
```c
new serverPort = GetServerVarAsInt("port");
printf("Server Port: %i", serverPort);
```
## Zabilješke
:::tip
Napiši 'varlist' u server konzoli da prikažeš listu dostupnih server varijabli i njihovih tipova.
:::
## Srodne Funkcije
- [GetServerVarAsString](GetServerVarAsString): Dohvatite server varijablu kao string.
- [GetServerVarAsBool](GetServerVarAsBool): Dohvaćanje varijable poslužitelja kao logičke vrijednosti (boolean).
| openmultiplayer/web/docs/translations/bs/scripting/functions/GetServerVarAsInt.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/GetServerVarAsInt.md",
"repo_id": "openmultiplayer",
"token_count": 435
} | 355 |
---
title: GetVehicleRotationQuat
description: Vraća rotaciju vozila na svim osama kao kvaternion.
tags: ["vehicle"]
---
## Deskripcija
Vraća rotaciju vozila na svim osama kao kvaternion.
| Ime | Deskripcija |
| --------- | --------------------------------------------------------------------------------- |
| vehicleid | ID vozila za dobiti njegovu rotaciju. |
| &Float:w | Float varijabla za pohraniti prvi kvarterionski ugao, proslijeđeno referencom. |
| &Float:x | Float varijabla za pohraniti srugi kvarterionski ugao, proslijeđeno referencom. |
| &Float:y | Float varijabla za pohraniti treći kvarterionski ugao, proslijeđeno referencom. |
| &Float:z | Float varijabla za pohraniti četvrti kvarterionski ugao, proslijeđeno referencom. |
## Returns
1: Funkcija uspješno izvršena.
0: Funkcija neuspješno izvršena. Ovo znači da navedeno vozilo ne postoji.
Rotacija vozila pohranjena je u navedenim varijablama.
## Zabilješke
:::tip
Ne postoji 'set' varijacija ove funkcije; ne možete podesiti rotaciju vozila (osim Z ugla). Ova funkcija može vratiti netačne vrijednosti za nenaseljena vozila. Razlog je taj što se treći red matrice interne rotacije vozila ošteti ako se ažurira dok je nenastanjen.
:::
## Srodne Funkcije
- [GetVehicleZAngle](GetVehicleZAngle): Provjerite trenutni ugao vozila.
- [GetVehicleRotation](GetVehicleRotation): Nabavite rotacijska vozila na XYZ osi.
| openmultiplayer/web/docs/translations/bs/scripting/functions/GetVehicleRotationQuat.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/GetVehicleRotationQuat.md",
"repo_id": "openmultiplayer",
"token_count": 705
} | 356 |
---
title: IsObjectMoving
description: Provjerava da li se zadati objectid kreće.
tags: []
---
## Deskripcija
Provjerava da li se zadati objectid kreće.
| Ime | Deskripcija |
| -------- | ------------------------------------------------ |
| objectid | Objectid kojeg želite provjeriti da li se kreće. |
## Returns
1 ako se objekat kreće, 0 ako ne.
## Primjeri
```c
if (IsObjectMoving(objectid))
{
StopObject(objectid);
}
```
## Srodne Funkcije
- [MoveObject](MoveObject): Pomjeri objekat.
- [StopObject](StopObject): Zaustavi objekat od kretanja.
- [OnObjectMoved](../callbacks/OnObjectMoved): Pozvano kada se objekat prestane kretati.
| openmultiplayer/web/docs/translations/bs/scripting/functions/IsObjectMoving.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/IsObjectMoving.md",
"repo_id": "openmultiplayer",
"token_count": 285
} | 357 |
---
title: IsValidObject
description: Provjerava da li je navedeni ID objekta postojeći.
tags: []
---
## Deskripcija
Provjerava da li je navedeni ID objekta postojeći.
| Ime | Deskripcija |
| -------- | ------------------------------------ |
| objectid | ID objekta za provjeriti postojanje. |
## Returns
1: Objekat postoji.
0: Objekat ne postoji.
## Primjeri
```c
if (IsValidObject(objectid))
{
DestroyObject(objectid);
}
```
## Zabilješke
:::warning
Ovo je provjera da li objekt postoji, a ne da li je model valjan.
:::
## Srodne Funkcije
- [CreateObject](CreateObject): Kreiraj objekat.
- [DestroyObject](DestroyObject): Uništi objekat.
- [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.
- [AttachObjectToPlayer](AttachObjectToPlayer): Prikvači objekat za igrača.
- [CreatePlayerObject](CreatePlayerObject): Kreiraj objekat za samo jednog igrača.
- [DestroyPlayerObject](DestroyPlayerObject): Uništi player objekat.
- [IsValidPlayerObject](IsValidPlayerObject): Provjeri 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.
- [AttachPlayerObjectToPlayer](AttachPlayerObjectToPlayer): Prikvači player objekat za igrača.
| openmultiplayer/web/docs/translations/bs/scripting/functions/IsValidObject.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/IsValidObject.md",
"repo_id": "openmultiplayer",
"token_count": 676
} | 358 |
---
title: NetStats_GetIpPort
description: Nabavite IP adresu i port igrača.
tags: []
---
## Deskripcija
Nabavite IP adresu i port igrača.
| Ime | Deskripcija |
| ----------- | ------------------------------------------------------------ |
| playerid | ID igrača za dobiti IP i port. |
| ip_port[] | Niz stringa za pohraniti IP i port, proslijeđeno referencom. |
| ip_port_len | Maksimalna dužina IP/port. 22 je preporučljivo. |
## Returns
IP i port uređaja pohranjeni su u navedenom nizu.
## Primjeri
```c
public OnPlayerCommandText(playerid,cmdtext[])
{
if (!strcmp(cmdtext, "/ipandport"))
{
new dest[22];
NetStats_GetIpPort(playerid, dest, sizeof(dest));
new szString[144];
format(szString, sizeof(szString), "Tvoj trenutni IP i port je: %s.", dest);
SendClientMessage(playerid, -1, szString);
}
return 1;
}
```
## Srodne Funkcije
- [GetPlayerIp](GetPlayerIp): Dobij IP igrača.
- [GetPlayerNetworkStats](GetPlayerNetworkStats): Dobija mrežne statistike igrača i pohranjuje ih u string.
- [GetNetworkStats](GetNetworkStats): Dobija mrežne statistike servera i sprema ih u string.
- [NetStats_GetConnectedTime](NetStats_GetConnectedTime): Dobij vrijeme za kojeg je igrač povezan na server.
- [NetStats_MessagesReceived](NetStats_MessagesReceived): Dohvatite broj mrežnih poruka koje je server primio od igrača.
- [NetStats_BytesReceived](NetStats_BytesReceived): Dohvatite količinu informacija (u bajtovima) koju je poslužitelj primio od igrača.
- [NetStats_MessagesSent](NetStats_MessagesSent): Dohvatite broj mrežnih poruka koje je server poslao igraču.
- [NetStats_BytesSent](NetStats_BytesSent): Dohvatite količinu informacija (u bajtovima) koje je poslužitelj poslao uređaju za reprodukciju.
- [NetStats_MessagesRecvPerSecond](NetStats_MessagesRecvPerSecond): Dohvatite broj mrežnih poruka koje je poslužitelj primio od igrača u posljednjoj sekundi.
- [NetStats_PacketLossPercent](NetStats_PacketLossPercent): Dobijte packet loss procenat igrača.
- [NetStats_ConnectionStatus](NetStats_ConnectionStatus): Dohvatite status veze igrača.
| openmultiplayer/web/docs/translations/bs/scripting/functions/NetStats_GetIpPort.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/NetStats_GetIpPort.md",
"repo_id": "openmultiplayer",
"token_count": 949
} | 359 |
---
title: PlayerTextDrawHide
description: Sakrij player-textdraw za igrača kojem je kreiran.
tags: ["player", "textdraw", "playertextdraw"]
---
## Deskripcija
Sakrij player-textdraw za igrača kojem je kreiran.
| Ime | Deskripcija |
| -------- | ------------------------------ |
| playerid | ID igrača za sakriti textdraw. |
| text | ID textdrawa za sakriti. |
## Returns
Ova funkcija ne returna (vraća) nikakve posebne vrijednosti.
## Primjeri
```c
public OnPlayerDisconnect(playerid)
{
PlayerTextDrawHide(playerid, gWelcomeText[playerid]);
}
```
## Srodne Funkcije
- [PlayerTextDrawShow](PlayerTextDrawShow): Prikaži player-textdraw.
- [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.
- [PlayerTextDrawSetString](PlayerTextDrawSetString): Postavi tekst player-textdrawa.
| openmultiplayer/web/docs/translations/bs/scripting/functions/PlayerTextDrawHide.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/PlayerTextDrawHide.md",
"repo_id": "openmultiplayer",
"token_count": 734
} | 360 |
---
title: RemovePlayerAttachedObject
description: Ukloni prikvačeni objekat sa igrača.
tags: ["player"]
---
## Deskripcija
Ukloni prikvačeni objekat sa igrača.
| Ime | Deskripcija |
| -------- | ------------------------------------------------------------------ |
| playerid | ID igrača od kojeg treba ukloniti prikvačeni objekat. |
| index | Index objekta za ukloniti (postavljen sa SetPlayerAttachedObject). |
## Returns
1 uspješno, 0 pri grešci.
## Primjeri
```c
public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strmp(cmdtext, "/remao", true)) // Ukloni prikvačene objekte
{
for(new i=0; i<MAX_PLAYER_ATTACHED_OBJECTS; i++)
{
if (IsPlayerAttachedObjectSlotUsed(playerid, i)) RemovePlayerAttachedObject(playerid, i);
}
return 1;
}
return 0;
}
```
## Srodne Funkcije
- [SetPlayerAttachedObject](SetPlayerAttachedObject): Prikvači objekat za igrača
- [IsPlayerAttachedObjectSlotUsed](IsPlayerAttachedObjectSlotUsed): Provjeri da li je objekat prikvačen za igrača u oređenom indexu.
| openmultiplayer/web/docs/translations/bs/scripting/functions/RemovePlayerAttachedObject.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/RemovePlayerAttachedObject.md",
"repo_id": "openmultiplayer",
"token_count": 501
} | 361 |
---
title: SendRconCommand
description: Šalje RCON (Remote Console) komandu.
tags: ["administration"]
---
## Deskripcija
Šalje RCON (Remote Console) komandu.
| Ime | Deskripcija |
| --------- | ------------------------- |
| command[] | RCON komanda za izvršiti. |
## Returns
Ova funkcija uvijek returna (vraća) 1.
## Zabilješke
:::warning
- Ne podržava login, zbog nedostatka 'playerid' parametra.
- 'password 0' će ukloniti lozinku servera ako je postavljena.
- Ova funkcija će rezultirati da se OnRconCommand pozove.
:::
## Primjeri
```c
SendRconCommand("gmx");
// Ovo je skriptana verzija korištenja "/rcon gmx" u igri.
// GMX ponovno pokreće game mode.
// Primjer koristeći format()
new szMapName[] = "Los Santos";
new szCmd[64];
format(szCmd, sizeof(szCmd), "mapname %s", szMapName);
SendRconCommand(szCmd);
```
## Srodne Funkcije
- [IsPlayerAdmin](IsPlayerAdmin): Provjerava da li je igrač prijavljen/ulogovan u RCON.
## Srodni Callback-ovi (Povratni pozivi)
- [OnRconCommand](../callbacks/OnRconCommand): Pozvano kada se pošalje RCON komanda.
- [OnRconLoginAttempt](../callbacks/OnRconLoginAttempt): Pozvano kada se napravi pokušaj pristupa ulogovanja u RCON.
| openmultiplayer/web/docs/translations/bs/scripting/functions/SendRconCommand.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/SendRconCommand.md",
"repo_id": "openmultiplayer",
"token_count": 514
} | 362 |
---
title: SetObjectRot
description: Postavi rotaciju objekta na tri ose (X, Y i Z).
tags: []
---
## Deskripcija
Postavi rotaciju objekta na tri ose (X, Y i Z).
| Ime | Deskripcija |
| ---------- | --------------------------------- |
| objectid | ID objekta za postaviti rotaciju. |
| Float:RotX | X rotacija. |
| Float:RotY | Y rotacija. |
| Float:RotZ | Z rotacija. |
## Returns
Ova funkcija uvijek returna (vraća) 1, bilo da objekat ne postoji.
## Primjeri
```c
SetObjectRot(objectid, 45, 90, 180);
```
## Srodne Funkcije
- [CreateObject](CreateObject): Kreiraj objekat.
- [DestroyObject](DestroyObject): Uništi objekat.
- [IsValidObject](IsValidObject): Provjeri da li je određeni objekat validan.
- [MoveObject](MoveObject): Pomjeri objekat.
- [StopObject](StopObject): Zaustavi objekat od kretanja.
- [SetObjectPos](SetObjectPos): Postavi poziciju objekta.
- [GetObjectPos](GetObjectPos): Lociraj objekat.
- [GetObjectRot](GetObjectRot): Provjeri rotaciju objekta.
- [AttachObjectToPlayer](AttachObjectToPlayer): Prikvači objekat za igrača.
- [CreatePlayerObject](CreatePlayerObject): Kreiraj objekat za samo jednog igrača.
- [DestroyPlayerObject](DestroyPlayerObject): Uništi player objekat.
- [IsValidPlayerObject](IsValidPlayerObject): Provjeri 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.
- [AttachPlayerObjectToPlayer](AttachPlayerObjectToPlayer): Prikvači player objekat za igrača.
| openmultiplayer/web/docs/translations/bs/scripting/functions/SetObjectRot.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/SetObjectRot.md",
"repo_id": "openmultiplayer",
"token_count": 750
} | 363 |
---
title: SetPlayerFacingAngle
description: Postavi smjer gledanja igrača (Z rotacija).
tags: ["player"]
---
## Deskripcija
Postavi smjer gledanja igrača (Z rotacija).
| Ime | Deskripcija |
| --------- | -------------------------------------- |
| playerid | ID igrača za postaviti smjer gledanja. |
| Float:ang | Ugao pod kojim će igrač gledati. |
## Returns
1: Funkcija uspješno izvršena.
0: Funkcija neuspješno izvršena. Navedeni igrač ne postoji.
## Primjeri
```c
SetPlayerFacingAngle( playerid, 0 ); // Igrač gleda sjeverno
```
```
sjever (0)
|
(90) zapad- -istok (270) (Dobro za zapamtiti: Nikad ne jedite isjeckanu pšenicu)
|
south (180)
```
## Zabilješke
:::warning
Uglovi su obrnuti u GTA:SA; 90 stepeni bi bilo istočno u stvarnom svijetu, ali u GTA:SA 90 stepeni je zapravo zapad. Sjever i Jug su i dalje 0/360 i 180. Da biste to pretvorili, jednostavno napravite kut od 360.
:::
## Srodne Funkcije
- [GetPlayerFacingAngle](GetPlayerFacingAngle): Provjeri gdje igrač gleda.
- [SetPlayerPos](SetPlayerPos): Postavite poziciju igrača.
| openmultiplayer/web/docs/translations/bs/scripting/functions/SetPlayerFacingAngle.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/SetPlayerFacingAngle.md",
"repo_id": "openmultiplayer",
"token_count": 541
} | 364 |
---
title: SetPlayerRaceCheckpoint
description: Kreira race (trkački) checkpoint.
tags: ["player", "checkpoint", "racecheckpoint"]
---
## Deskripcija
Kreira race (trkački) checkpoint. Kada igrač uđe u njega, callback OnPlayerEnterRaceCheckpoint se poziva.
| Ime | Deskripcija |
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| playerid | ID igrača za postaviti race checkpoint. |
| type | Tip checkpointa. 0-Normal, 1-Finish, 2-Ništa(checkpoint bez ičeg na sebi), 3-Air normal, 4-Air finish, 5-Air (rotira se i zaustavi), 6-Air (povećava se, smanjuje i nestaje), 7-Air (ljulja se prema dolje i gore), 8-Air (ljulja se gore-dolje). |
| Float:x | X-kordinata. |
| Float:y | Y-kordinata. |
| Float:z | Z-kordinata. |
| Float:nextx | X-kordinata sljedeće točke, za strelicu usmjerenu prema pravcu. |
| Float:nexty | Y-kordinata sljedeće točke, za strelicu usmjerenu prema pravcu. |
| Float:nextz | Z-kordinata sljedeće točke, za strelicu usmjerenu prema pravcu. |
| Float:size | Veličina (promjer) checkpointa. |
## Returns
1: Funkcija uspješno izvršena.
0: Funkcija neuspješno izvršena. Ovo znači da navedeni igrač ne postoji.
## Primjeri
```c
//Iz Yagu-ove trkačke filterskripte, (c) by Yagu
public SetRaceCheckpoint(playerid, Airrace, target, next)
{
if (next == -1 && Airrace == 0)
SetPlayerRaceCheckpoint(playerid,1,RaceCheckpoints[target][0],RaceCheckpoints[target][1],RaceCheckpoints[target][2],
0.0,0.0,0.0,CPsize);
else if (next == -1 && Airrace == 1)
SetPlayerRaceCheckpoint(playerid,4,RaceCheckpoints[target][0],RaceCheckpoints[target][1],RaceCheckpoints[target][2],
0.0,0.0,0.0,CPsize);
else if (Airrace == 1)
SetPlayerRaceCheckpoint(playerid,3,RaceCheckpoints[target][0],RaceCheckpoints[target][1],RaceCheckpoints[target][2],
RaceCheckpoints[next][0],RaceCheckpoints[next][1],RaceCheckpoints[next][2],CPsize);
else
SetPlayerRaceCheckpoint(playerid,0,RaceCheckpoints[target][0],RaceCheckpoints[target][1],RaceCheckpoints[target][2],
RaceCheckpoints[next][0],RaceCheckpoints[next][1],RaceCheckpoints[next][2],CPsize);
}
```
## Zabilješke
:::warning
Race checkpointi su asinhroni, što znači da se odjednom može prikazivati samo jedan. Za 'streamovanje' race checkpointa (pokažite ih samo kad su igrači dovoljno blizu), upotrijebite streamer za provjeru checkpointa.
:::
## Srodne Funkcije
- [SetPlayerCheckpoint](SetPlayerCheckpoint): Kreiraj checkpoint za igrača.
- [DisablePlayerCheckpoint](DisablePlayerCheckpoint): Onemogući igračev trenutni checkpoint.
- [IsPlayerInCheckpoint](IsPlayerInCheckpoint): Provjeri da li je igrač u checkpointu.
- [DisablePlayerRaceCheckpoint](DisablePlayerRaceCheckpoint): Onemogući igračev trenutni race checkpoint.
- [IsPlayerInRaceCheckpoint](IsPlayerInRaceCheckpoint): Provjeri da li je igrač u race checkpointu.
- [OnPlayerEnterCheckpoint](../callbacks/OnPlayerEnterCheckpoint): Pozvano kada igrač uđe u checkpoint.
- [OnPlayerLeaveCheckpoint](../callbacks/OnPlayerLeaveCheckpoint): Pozvano kada igrač napusti checkpoint.
- [OnPlayerEnterRaceCheckpoint](../callbacks/OnPlayerEnterRaceCheckpoint): Pozvano kada igrač uđe u race checkpoint.
- [OnPlayerLeaveRaceCheckpoint](../callbacks/OnPlayerLeaveRaceCheckpoint): Pozvano kada igrač napusti race checkpoint.
| openmultiplayer/web/docs/translations/bs/scripting/functions/SetPlayerRaceCheckpoint.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/SetPlayerRaceCheckpoint.md",
"repo_id": "openmultiplayer",
"token_count": 3241
} | 365 |
---
title: SetSpawnInfo
description: Ova funkcija se može koristiti za promijeniti spawn informacije određenog igrača.
tags: []
---
## Deskripcija
Ova funkcija se može koristiti za promijeniti spawn informacije određenog igrača. Ona omogućava da automatski postaviš nekome spawn oružje, njihov tim, skin ili spawn poziciju, normalno se koristi u slučaju miniigara ili automatskih spawn sistema. Ova funkcija je sigurnija od crasha u odnosu na SetPlayerSkin u OnPlayerSpawn i/ili OnPlayerRequestClass, iako je ovo ispravljeno u 0.2.
| Ime | Deskripcija |
| -------------- | --------------------------------------------------------- |
| playerid | ID igrača kojem želite postaviti spawn informacije. |
| team | Team-ID odabranog igrača. |
| skin | Skin s kojim će se igrač spawnovati. |
| Float:X | X-kordinata igračeve spawn pozicije. |
| Float:Y | Y-kordinata igračeve spawn pozicije. |
| Float:Z | Z-kordinata igračeve spawn pozicije. |
| Float:rotation | Smjer u kojem igrač treba da gleda nakon što se spawnuje. |
| weapon1 | Prvo spawn-oružje za igrača. |
| weapon1_ammo | Količina streljiva za primarni spawnweapon. |
| weapon2 | Drugo spawn-oružje za igrača. |
| weapon2_ammo | Količina streljiva za sekundarni spawnweapon. |
| weapon3 | Treće spawn-oružje za igrača. |
| weapon3_ammo | Količina streljiva za treći spawnweapon. |
## Returns
Ova funkcija ne returna (vraća) nikakve posebne vrijednosti.
## Primjeri
```c
public OnPlayerRequestClass(playerid, classid)
{
// Ovo je jednostavan primjer koji demonstrira kako spawnovati igrala automatski sa
// CJ skinom, koji je broj 0. Igrač će se spawnovati u Las Venturasu sa
// 36 Sawnoff-Shotgun i 150 Tec9 metaka.
SetSpawnInfo( playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 26, 36, 28, 150, 0, 0 );
}
```
## Srodne Funkcije
- [SetPlayerSkin](SetPlayerSkin): Postavi skin igraču.
- [SetPlayerTeam](SetPlayerTeam): Postavi tim igrača.
- [SpawnPlayer](SpawnPlayer): Natjeraj igrača da se spawnuje.
| openmultiplayer/web/docs/translations/bs/scripting/functions/SetSpawnInfo.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/SetSpawnInfo.md",
"repo_id": "openmultiplayer",
"token_count": 1188
} | 366 |
---
title: SetWeather
description: Postavite vrijeme (weather) za sve igrače.
tags: []
---
## Deskripcija
Postavite vrijeme (weather) za sve igrače.
| Ime | Deskripcija |
| --------- | ------------------------------------------------------- |
| weatherid | [Vrijeme/weather](../resources/weatherid) za postaviti. |
## Returns
Ova funkcija ne returna (vraća) nikakve posebne vrijednosti.
## Primjeri
```c
if (!strcmp(cmdtext, "/sandstorm", true))
{
SetWeather(19);
return 1;
}
```
## Zabilješke
:::tip
Ako je omogućen TogglePlayerClock, vrijeme će se polahko mijenjati s vremenom, umjesto da se promijeni trenutno. U igri postoje samo važeći 21 vremenski ID (0 - 20), ali igra nema bilo kakav oblik provjere dometa.
:::
## Srodne Funkcije
- [SetPlayerWeather](SetPlayerWeather): Postavite vrijeme (weather) igrača.
- [SetGravity](SetGravity): Postavite globalnu gravitaciju.
| openmultiplayer/web/docs/translations/bs/scripting/functions/SetWeather.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/SetWeather.md",
"repo_id": "openmultiplayer",
"token_count": 411
} | 367 |
---
title: TextDrawBackgroundColor
description: Prilagođava boju pozadine područja za textdraw (obris / sjena - NE okvir).
tags: ["textdraw"]
---
## Deskripcija
Prilagođava boju pozadine područja za textdraw (obris / sjena - NE box. Za boju boxa, pogledajte TextDrawBoxColor).
| Ime | Deskripcija |
| ----- | ---------------------------------------- |
| text | ID textdrawa za postaviti boju pozadine. |
| color | Boja koja će biti postavljena. |
## Returns
Ova funkcija ne returna (vraća) nikakve posebne vrijednosti.
## Primjeri
```c
new Text: gMyTextdraw;
public OnGameModeInit()
{
gMyTextdraw = TextDrawCreate(320.0, 425.0, "Ovo je primjer textdrawa");
TextDrawUseBox(gMyTextdraw, 1);
TextDrawBackgroundColor(gMyTextdraw, 0xFFFFFFFF); // Postavlja pozadinu MyTextdraw-a u bijelu
return 1;
}
```
## Zabilješke
:::tip
Ako je TextDrawSetOutline korišten sa veličinom > 0, boja outline-a će se uklopiti sa bojom korištenom u TextDrawBackgroundColor. Mijenjanjem vrijednosti boje se čini kao da mijenja boju korištenu u TextDrawColor.
:::
:::tip
Ukoliko želite promijeniti boju pozadine 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.
- [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.
- [TextDrawSetOutline](TextDrawSetOutline): Odluči da li da tekst ima outline.
- [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/TextDrawBackgroundColor.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/TextDrawBackgroundColor.md",
"repo_id": "openmultiplayer",
"token_count": 1075
} | 368 |
---
title: TextDrawSetString
description: Mijenja tekst na textdrawu.
tags: ["textdraw"]
---
## Deskripcija
Mijenja tekst na textdrawu.
| Ime | Deskripcija |
| -------- | ------------------------ |
| text | textdraw za izmijeniti. |
| string[] | Novi string za textdraw. |
## Returns
Ova funkcija ne returna (vraća) nikakve posebne vrijednosti.
## Primjeri
```c
new Text: gMyTextdraw;
public OnGameModeInit()
{
gMyTextdraw = TextDrawCreate(1.0, 5.6, "Cao, kako si?");
return 1;
}
public OnPlayerConnect(playerid)
{
new
message[64],
playerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, playerName, sizeof playerName);
format(message, sizeof(message), "Dobrodosao %s!", playerName);
TextDrawSetString(gMyTextdraw, message);
TextDrawShowForPlayer(playerid, gMyTextdraw);
return 1;
}
```
## Zabilješke
:::warning
Postoje ograničenja za dužinu textdraw stringova - pogledaj ovdje za više informacija.
:::
## 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.
- [TextDrawSetOutline](TextDrawSetOutline): Odluči da li da tekst ima outline.
- [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.
- [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/TextDrawSetString.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/TextDrawSetString.md",
"repo_id": "openmultiplayer",
"token_count": 916
} | 369 |
---
title: asin
description: .
tags: []
---
:::warning
Ova funkcija započinje malim slovom.
:::
## Deskripcija
Dobijte obrnutu vrijednost sinusnog luka u radijanima.
| Ime | Deskripcija |
| ----------- | ---------------------- |
| Float:value | the input in arc sine. |
## Returns
Vrijednost čiji se sinusni luk izračunava u intervalu [-1, + 1]. Ako je argument izvan ovog intervala, pojavljuje se greška domene.
## Primjeri
```c
//Sinusni luk od 0.500000 je 30.000000 stepeni.
public OnGameModeInit()
{
new Float:param, Float:result;
param = 0.5;
result = asin (param) * 180.0 / PI;
printf ("Sinusni luk od %f je %f stepeni\n", param, result);
return 0;
}
```
## Srodne Funkcije
- [floatsin](floatsin): Uzmite sinus iz određenog ugla.
- [floatcos](floatcos): Uzmite kosinus iz određenog ugla.
- [floattan](floattan): Uzmite tangentu pod određenim uglom.
| openmultiplayer/web/docs/translations/bs/scripting/functions/asin.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/asin.md",
"repo_id": "openmultiplayer",
"token_count": 401
} | 370 |
---
title: floatadd
description: Dodaje dva floata zajedno.
tags: []
---
:::warning
Ova funkcija započinje malim slovom.
:::
## Deskripcija
Dodaje dva floata zajedno. Ova je funkcija suvišna jer standardni operater (+) radi istu stvar.
| Ime | Deskripcija |
| ------------- | ------------ |
| Float:Number1 | Prvi float. |
| Float:Number2 | Drugi float. |
## Returns
Zbir dva zadana float.
## Primjeri
```c
public OnGameModeInit()
{
new Float:Number1 = 2, Float:Number2 = 3; //Deklarira dva plovka, Number1 (2) i Number2 (3)
new Float:Sum;
Sum = floatadd(Number1, Number2); //Sprema zbroj (= 2 + 3 = 5) broja1 i broja2 u float "Zbir"
return 1;
}
```
## Srodne Funkcije
- [Floatsub](Floatsub): Oduzima dva floata.
- [Floatmul](Floatmul): Množi dva floata.
- [Floatdiv](Floatdiv): Dijeli float sa drugim.
| openmultiplayer/web/docs/translations/bs/scripting/functions/floatadd.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/floatadd.md",
"repo_id": "openmultiplayer",
"token_count": 370
} | 371 |
---
title: format
description: Formatira string tako da sadrži varijable i druge stringove unutar njega.
tags: []
---
:::warning
Ova funkcija započinje malim slovom.
:::
## Deskripcija
Formatira string tako da sadrži varijable i druge stringove unutar njega.
| Ime | Deskripcija |
| -------------- | -------------------------------------------- |
| output[] | String za izlaz rezultata u |
| len | Izlaz maksimalne dužine koje može sadržavati |
| format[] | Format stringa |
| {Float,\_}:... | Neodređeni broj argumenata bilo koje oznake |
## Returns
Ova funkcija ne returna (vraća) nikakve posebne vrijednosti.
## Specifikatori formata
| Specifikator | Značenje |
| ------------ | ----------------------------------------------- |
| %i | Neoznačeni(Unsigned) cijeli broj |
| %d | Označeni(Signed) cijeli broj |
| %s | String |
| %f | Floating-point broj |
| %c | ASCII karakter |
| %x | Hexadecimalni broj |
| %b | Binarni broj |
| %% | Literal(Doslovno) '%' |
| %q | Izbjegnite tekst za SQLite. (Dodano u 0.3.7 R2) |
Vrijednosti rezerviranih mjesta slijede se potpuno istim redoslijedom kao i parametri u pozivu, tj. "Imam% i godine" - `%i` će biti zamijenjena cjelobrojnom varijablom, što je dob osobe.
Po želji možete staviti broj između `%` i slovo koda rezerviranog mjesta. Ovaj broj označava širinu polja; ako je veličina parametra za ispis na mjestu rezerviranog mjesta manja od širine polja, polje se proširuje razmacima. Da biste smanjili broj decimalnih mjesta koja se prikazuju na plovku, možete dodati '.\ <max number\>' između `%` i `f`, tj. `%.2f`.
## Primjeri
```c
new result[128];
new number = 42;
format(result,sizeof(result), "Broj je %i.",number); //-> The number is 42.
new string[]= "simple message";
format(result,sizeof(result), "Ovo je %s koji sadrži broj %i.", string, number);
// Ovo je jednostavna poruka koja sadrži broj 42.
new string[64];
format(string,sizeof(string),"Vaš rezultat je: %d",GetPlayerScore(playerid));
SendClientMessage(playerid,0xFFFFFFAA,string);
new hour, minute, second, string[32];
gettime(hour, minute, second);
format(string, sizeof(string), "Vrijeme je %02d:%02d:%02d.", hour, minute, second); // Ispisati će nešto kao 09:45:02
SendClientMessage(playerid, -1, string);
new string[35];
format(string,sizeof(string),"43% mojih majica je crno.","%%");
SendClientMessage(playerid,0xFFFFFAA,string);
```
## Zabilješke
:::warning
Ova funkcija ne podržava spakovane stringove.
:::
## Srodne Funkcije
- [print](print): Ispišite osnovnu poruku u zapisnike poslužitelja i konzolu.
- [printf](printf): Ispišite formatiranu poruku u zapise poslužitelja i konzolu.
| openmultiplayer/web/docs/translations/bs/scripting/functions/format.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/format.md",
"repo_id": "openmultiplayer",
"token_count": 1560
} | 372 |
---
title: listenport
description: .
tags: []
---
:::warning
Ova funkcija započinje malim slovom.
:::
| openmultiplayer/web/docs/translations/bs/scripting/functions/listenport.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/listenport.md",
"repo_id": "openmultiplayer",
"token_count": 44
} | 373 |
---
title: strins
description: Umetni string u drugi string.
tags: []
---
:::warning
Ova funkcija započinje malim slovom.
:::
## Deskripcija
Umetni string u drugi string.
| Ime | Deskripcija |
| ----------------------- | -------------------------------------------- |
| string[] | String u kojeg želite umetnuti substr. |
| const substr[] | String kojeg želite umetnuti u drugi string. |
| pos | Pozicija za početak umetanja. |
| maxlength=sizeof string | Maksimalna veličina za unijeti. |
## Returns
Ova funkcija ne returna (vraća) nikakve posebne vrijednosti.
## Primjeri
```c
// Dodaj [AFK] tag na početak igračevog imena
new playerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);
if (strlen(playerName) <= 18)
{
strins(playerName, "[AFK]", 0);
}
SetPlayerName(playerid, playerName);
// WARNING: Igrači sa imenom koji imaju 20+ karaktea ne mogu imati [AFK] tag, to če činiti njihovo ime velikim 25 karatkera a limit je 24.
```
## Srodne Funkcije
- [strcmp](strcmp): Uporedi dva stringa kako bi provjerio da li su isti.
- [strfind](strfind): Pretraži string u drugom stringu.
- [strdel](strdel): Obriši dio stringa.
- [strlen](strlen): Dobij dužinu stringa.
- [strmid](strmid): Izdvoji dio stringa u drugi string.
- [strpack](strpack): Upakuj string u odredišni string.
- [strval](strval): Pretvori string u cijeli broj.
- [strcat](strcat): Spojite dva stringa u odredišnu referencu.
| openmultiplayer/web/docs/translations/bs/scripting/functions/strins.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/strins.md",
"repo_id": "openmultiplayer",
"token_count": 701
} | 374 |
---
title: Vrste Pogodaka Mecima
---
:::info
Ova stranica sadrži sve tipove pogodaka mecima koje koristi [OnPlayerWeaponShot](../callbacks/OnPlayerWeaponShot).
:::
---
| Vrijednost | Definicija |
| ---------- | ----------------------------- |
| 0 | BULLET_HIT_TYPE_NONE |
| 1 | BULLET_HIT_TYPE_PLAYER |
| 2 | BULLET_HIT_TYPE_VEHICLE |
| 3 | BULLET_HIT_TYPE_OBJECT |
| 4 | BULLET_HIT_TYPE_PLAYER_OBJECT |
---
:::caution
BULLET_HIT_TYPE_PLAYER je također pozvan za NPC-ove. Ovaj callback ignorira aktore i detektuje ih kao BULLET_HIT_TYPE_NONE.
:::
| openmultiplayer/web/docs/translations/bs/scripting/resources/bullethittypes.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/resources/bullethittypes.md",
"repo_id": "openmultiplayer",
"token_count": 342
} | 375 |
---
title: OnDialogResponse
description: Dieses Callback wird ausgeführt wenn ein Spieler einem Dialog antwortet(benutzt), indem er einen der Buttons drückt, Enter/ESC drückt oder ein List-Item per Doppelklick auswählt(List Style Dialog).
tags: [Pickup]
---
## Beschreibung
Dieses Callback wird ausgeführt wenn ein Spieler einem Dialog antwortet(benutzt), indem er einen der Buttons drückt, Enter/ESC drückt oder ein List-Item per Doppelklick auswählt(Dialog: List-Style)
| Name | Beschreibung |
| ----------- | ----------------------------------------------------------------------------------------------------------------------- |
| playerid | ID des Spielers der den Dialog benutzt. |
| dialogid | ID des Dialogs der vom Spieler genutzt wird, zugewiesen in ShowPlayerDialog. |
| response | 1 für den linken Button 0 für den rechten Button (Gibt es nur einen Button, dann immer 1) |
| listitem | ID des ausgewählten List-Items (Start bei 0) (Nur bei List-Style Dialogen, ansonsten -1). |
| inputtext[] | Der vom Spieler eingefügte Text oder Text des ausgewählten List-Items. |
## Rückgabe(return value)
Wird in Filterscripts immer zuerst ausgeführt. Bei Nutzung von return 1 können andere Filterscripts es nicht erkennen.
## Beispiele
```c
// Definieren der Dialog ID, mit der wie Antworten bearbeiten können
#define DIALOG_REGELN 1
// In einem Befehl
ShowPlayerDialog(playerid, DIALOG_REGELN, DIALOG_STYLE_MSGBOX, "Server Regeln", "- Kein Cheaten\n- Kein Spamming\n- Respektiere die Admins\n\nAkzeptierst du die Regeln?", "Ja", "Nein");
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if (dialogid == DIALOG_REGELN)
{
if (response) // Bei klicken von 'Ja' oder drücken von Enter
{
SendClientMessage(playerid, COLOR_GREEN, "Du hast die Serverregeln akzeptiert!");
}
else // Bei ESC oder klickne von 'Nein'
{
Kick(playerid);
}
return 1; // Wir haben den Dialog durchgeführt, also return 1. Genau wie bei OnPlayerCommandText.
}
return 0; // Hier muss return 0 stehen! Genau wie bei OnPlayerCommandText.
}
#define DIALOG_LOGIN 2
// In einem Befehl
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Login", "Bitte gebe dein Passwort ein:", "Login", "Abbruch");
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if (dialogid == DIALOG_LOGIN)
{
if (!response) // Bei Klick von 'Abbruch' oder ESC
{
Kick(playerid);
}
else // Bei Klick von 'Login' oder Enter
{
if (CheckPassword(playerid, inputtext))
{
SendClientMessage(playerid, COLOR_RED, "Du bist jetzt eingeloggt!");
}
else
{
SendClientMessage(playerid, COLOR_RED, "Login fehlgeschlagen.");
// Den Dialog erneut anzeigen, da einloggen fehlgeschlagen
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Login", "Bitte gebe dein Passwort ein:", "Login", "Abbruch");
}
}
return 1; // Wir haben den Dialog durchgeführt, also return 1. Genau wie bei OnPlayerCommandText.
}
return 0; // Hier muss return 0 stehen! Genau wie bei OnPlayerCommandText.
}
#define DIALOG_WAFFEN 3
// In einem Befehl
ShowPlayerDialog(playerid, DIALOG_WAFFEN, DIALOG_STYLE_LIST, "Waffen", "Desert Eagle\nAK-47\nCombat Shotgun", "Wählen", "Schließen");
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if (dialogid == DIALOG_WAFFEN)
{
if (response) // Wenn 'Wählen' geklickt oder eine Waffe per Doppelklick gewählt wurde
{
// Die gewählte Waffe geben
switch(listitem)
{
case 0: GivePlayerWeapon(playerid, WEAPON_DEAGLE, 14); // Gibt dem Spieler eine Desert Eagle
case 1: GivePlayerWeapon(playerid, WEAPON_AK47, 120); // Gibt dem Spieler eine AK-47
case 2: GivePlayerWeapon(playerid, WEAPON_SHOTGSPA, 28); // Gibt dem Spieler eine Combat Shotgun
}
}
return 1; // Wir haben den Dialog durchgeführt, also return 1. Genau wie bei OnPlayerCommandText.
}
return 0; // Hier muss return 0 stehen! Genau wie bei OnPlayerCommandText.
}
#define DIALOG_WAFFEN 3
// In einem Command
ShowPlayerDialog(playerid, DIALOG_WAFFEN, DIALOG_STYLE_LIST, "Waffen",
"Waffe\tMunition\tPreis\n\
M4\t120\t500\n\
MP5\t90\t350\n\
AK-47\t120\t400",
"Wählen", "Schließen");
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if (dialogid == DIALOG_WAFFEN)
{
if (response) // Wenn 'Wählen' geklickt oder eine Waffe per Doppelklick gewählt wurde
{
// Die gewählte Waffe geben
switch(listitem)
{
case 0: GivePlayerWeapon(playerid, WEAPON_M4, 120); // Gibt dem Spieler eine M4
case 1: GivePlayerWeapon(playerid, WEAPON_MP5, 90); // Gibt dem Spieler eine MP5
case 2: GivePlayerWeapon(playerid, WEAPON_AK47, 120); // Gibt dem Spieler eine AK-47
}
}
return 1; // Wir haben den Dialog durchgeführt, also return 1. Genau wie bei OnPlayerCommandText.
}
return 0; // Hier muss return 0 stehen! Genau wie bei OnPlayerCommandText.
}
```
## Anmerkungen
:::tip
Parameter können unterschiedliche Werte enthalten, abhängig vom Dialog Style ([Klicke hier für Beispiele](../resources/dialogstyles)).
:::
:::tip
Es ist sinnvoll zwischen bei `VIELEN` Dialogen zwischen den einzelnen Dialog IDs zu switchen.
:::
:::warning
Der Dialog eines Spielers wird nicht versteckt, wenn der Gamemode neustarte, weshalb der Server folgende Warnung anzeigt, wenn der Spieler nach dem Neustart den Dialog nutzt: "Warning: PlayerDialogResponse PlayerId: 0 dialog ID doesn't match last sent dialog ID".
:::
## Ähnliche Funktionen
- [ShowPlayerDialog](../functions/ShowPlayerDialog): Zeige einem Spieler einen Dialog.
| openmultiplayer/web/docs/translations/de/scripting/callbacks/OnDialogResponse.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/de/scripting/callbacks/OnDialogResponse.md",
"repo_id": "openmultiplayer",
"token_count": 2930
} | 376 |
---
título: OnActorStreamIn
descripción: Este callback se llama cuando un actor es cargado (se hace visible) por el cliente de un jugador.
tags: []
---
<VersionWarnES name='callback' version='SA-MP 0.3.7' />
## Descripción
Este callback se llama cuando un actor es cargado (se hace visible) por el cliente de un jugador.
| Nombre | Descripción |
| ----------- | ------------------------------------------------------------- |
| actorid | El ID del actor que está siendo transmitido por el jugador. |
| forplayerid | El ID del jugador que está transmitiendo al actor. |
## Devoluciones
Siempre se llama primero en filterscripts.
## Ejemplos
```c
public OnActorStreamIn(actorid, forplayerid)
{
new string[40];
format(string, sizeof(string), "El actor %d está siendo transmitido a tu jugador.", actorid);
SendClientMessage(forplayerid, 0xFFFFFFFF, string);
return 1;
}
```
## Notas
<TipNPCCallbacksES />
## Funciones Relacionadas
| openmultiplayer/web/docs/translations/es/scripting/callbacks/OnActorStreamIn.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/es/scripting/callbacks/OnActorStreamIn.md",
"repo_id": "openmultiplayer",
"token_count": 397
} | 377 |
---
título: OnPlayerClickTextDraw
descripción: Este callback se llama cuando un jugador clickea en un textdraw o cancela el modo de selección con la tecla ESC.
tags: ["player", "textdraw"]
---
## Descripción
Este callback se llama cuando un jugador clickea en un textdraw o cancela el modo de selección con la tecla ESC.
| Name | Description |
| --------- | ----------------------------------------------------------------------------- |
| playerid | The ID of the player that clicked on the textdraw. |
| clickedid | The ID of the clicked textdraw. INVALID_TEXT_DRAW if selection was cancelled. |
## 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
new Text:gTextDraw;
public OnGameModeInit()
{
gTextDraw = TextDrawCreate(10.000000, 141.000000, "MyTextDraw");
TextDrawTextSize(gTextDraw,60.000000, 20.000000);
TextDrawAlignment(gTextDraw,0);
TextDrawBackgroundColor(gTextDraw,0x000000ff);
TextDrawFont(gTextDraw,1);
TextDrawLetterSize(gTextDraw,0.250000, 1.000000);
TextDrawColor(gTextDraw,0xffffffff);
TextDrawSetProportional(gTextDraw,1);
TextDrawSetShadow(gTextDraw,1);
TextDrawSetSelectable(gTextDraw, 1);
return 1;
}
public OnPlayerKeyStateChange(playerid, KEY:newkeys, KEY:oldkeys)
{
if (newkeys == KEY_SUBMISSION)
{
TextDrawShowForPlayer(playerid, gTextDraw);
SelectTextDraw(playerid, 0xFF4040AA);
}
return 1;
}
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
if (clickedid == gTextDraw)
{
SendClientMessage(playerid, 0xFFFFFFAA, "Clickeaste en un textdraw.");
CancelSelectTextDraw(playerid);
return 1;
}
return 0;
}
```
## Notas
:::warning
El area clickeable está definida por TextDrawTextSize. Los parámetors X y Y pasados a esta función no deben ser cero o negativos. No uses CancelSelectTextDraw incondicionalmente dentro de este callback. Esto resultará en un loop infinito.
:::
## Funciones Relacionadas
- [OnPlayerClickPlayerTextDraw](OnPlayerClickPlayerTextDraw): Se llama cuando un jugador clickea en un player-textdraw.
- [OnPlayerClickPlayer](OnPlayerClickPlayer): Se llama cuando un jugador clickea en otro.
| openmultiplayer/web/docs/translations/es/scripting/callbacks/OnPlayerClickTextDraw.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/es/scripting/callbacks/OnPlayerClickTextDraw.md",
"repo_id": "openmultiplayer",
"token_count": 942
} | 378 |
---
título: OnPlayerKeyStateChange
descripción: Este callback se llama cuando el estado de alguna tecla soportada cambia (presionada/soltada).
tags: ["player"]
---
## Descripción
Este callback se llama cuando el estado de alguna tecla [soportada](../resources/keys) cambia (presionada/soltada).<br/>Las teclas direccionales no desencadenan OnPlayerKeyStateChange (arriba, abajo, izquierda, derecha).
| Nombre | Descripción |
| -------- | --------------------------------------------------------------------------------------------------------------- |
| playerid | El ID del jugador que presionó o soltó una tecla. |
| newkeys | Un mapa (máscara de bits) de las teclas actualmente presionadas. - [ver acá](../resources/keys). |
| oldkeys | Un mapa (máscara de bits) de las teclas presionadas previo al cambio actual - [ver acá](../resources/keys). |
## Devoluciones
- Este callback no controla devoluciones.
- Siempre se llama primero en el gamemode.
## Notas
:::info
Este callback también puede ser llamado por NPC.
:::
:::tip
Las teclas direccionales no desencadenan OnPlayerKeyStateChange (arriba, abajo, izquierda, derecha).<br/>Estas sólo pueden ser detectadas con [GetPlayerKeys](../functions/GetPlayerKeys) (en [OnPlayerUpdate](../callbacks/OnPlayerUpdate) o en un timer).
:::
## Funciones Relacionadas
#test
- [GetPlayerKeys](../functions/GetPlayerKeys): Comprueba qué teclas está apretando un jugador.
## Información adicional
### Introducción
Este callback es llamado cuando un jugador presiona o suelta una de las teclas soportadas (vea [Teclas](../resources/keys)).<br/> Las teclas que son compatibles no son las teclas actuales del teclado, sino las teclas funcionales mapeadas del GTA San Andreas, esto quiere decir que, por ejemplo, no podés detectar cuando alguien presiona la <strong>barra espaciadora</strong>, pero sí podés detectar cuando este presiona su tecla la tecla de correr, (que puede, o no, ser asignada a la barra espaciadora (así es por defecto en el juego)).
### Parámetros
Los parámetros de esta funcion son una lista de todas las teclas actualmente siendo presionadas y todas las teclas presionadas hace un momento. Este callback es llamado cuando el estado de la tecla cambia (esto será, cuando una tecla sea sea presionada o soltada) y pasa los estados de todas las teclas antes y después de este cambio. Esta información puede ser usada para ver exáctamente que pasó pero las variables no pueden ser usadas directamente de la misma manera como parámetros a otras funciones. Para reducir el número de variables un solo BIT es usado para representar una tecla, esto quiere decir que una variable puede contener múltiples teclas al mismo tiempo y comparar los valores simplemente no va a funcionar siempre.
### Cómo no comprobar una tecla
Vamos a suponer que querés detectar cuando un jugador presiona el botón DISPARO, el código obvio sería:
```c
if (newkeys == KEY_FIRE)
```
Este código puede funcionar en su testeo, pero es incorrecto y su testeo es insuficiente. Probá agachandote y presionando disparo - tu código ya no va a funcionar como antes. ¿Por qué? Esto es porque 'newkeys' ya no es lo mismo que 'KEY_FIRE', en este caso el valor será 'KEY_FIRE' COMBINADO CON 'KEY_CROUCH'.
### Cómo comprobar una tecla correctamente
Entonces, si la variable puede contener múltiples teclas al mismo tiempo, ¿cómo comprobamos por una en específico? La respuesta es enmascaramiento de bits. Cada tecla tiene su propio bit en la variable (algunas teclas tienen el mismo bit, pero estas son teclas a pie/en vehículo, entonces nunca podrán ser presionadas al mismo tiempo) y necesitás comprobar por un solo bit:
```c
if (newkeys & KEY_FIRE)
```
Notese que el uso de un solo <strong>&</strong> es correcto - este es un bitwise AND (operador de manipulación de bits), no un AND lógico, que es como se llama el operador de los dos signos <strong>&&</strong>.
Ahora si probás este código va a funcionar mientras estés agachando o parado cuando apretes la tecla/botón de disparo. Sin embargo acá sigue un ligero problema - el personaje disparará hasta que dejes de presionar la tecla. OnPlayerKeyStateChange se llama cada vez que hay un cambio en las teclas y este código funciona mientras que la tecla de disparo es presionada. Si presionas disparar el código será desencadenado, y si esta tecla es retenida y presionas agacharse - este código se desencadenará de nuevo porque una tecla (agacharse) cambió su estado y disparo aún sigue presionado. ¿Cómo detectamos cuando una tecla es presionada por primera vez, pero sin desencadenar el callback de nuevo cuando sigue presionada y otra tecla diferente cambia?
### Cómo comprobar si una tecla ha sido presionada
Acá es cuando entra "oldkeys". Para comprobar si una tecla fue presionada necesitas primero verificar si esta está como valor en "newkeys" - lo que significa que fue presionada, y entonces comprobar si esta tecla NO está en "oldkeys" - lo que quiere decir que esta sólo se ha presionado. El siguiente código hace lo anterior mencionado:
```c
if ((newkeys & KEY_FIRE) && !(oldkeys & KEY_FIRE))
```
Esto SOLO será verdadero cuando la tecla DISPARO sea presionada una sola vez, y no cuando se mantenga y otra tecla cambie su estado.
### Cómo comprobar si una tecla se liberó/dejó de presionarse
Exactamente el mismo concepto que antes, pero dado vuelta.
```c
if ((oldkeys & KEY_FIRE) && !(newkeys & KEY_FIRE))
```
### Cómo comprobar múltiples teclas
Si querés comprobar por jugadores PRESIONANDO agacharse y disparando el siguiente código funcionará correctamente:
```c
if ((newkeys & KEY_FIRE) && (newkeys & KEY_CROUCH))
```
Sin embargo si querés detectar cuando el jugador presiona por primera vez disparar y se agacha el siguiente código NO funcionará. Este funcionará si el jugador presiona las dos teclas al mismo tiempo exactamente, pero si estas están fraccionadamente afuera del mismo desencadenamiento (mucho menos de medio segundo desde que se apretó la primer tecla en cuestión), este no funcionará:
```c
if ((newkeys & KEY_FIRE) && !(oldkeys & KEY_FIRE) && (newkeys & KEY_CROUCH) && !(oldkeys & KEY_CROUCH))
```
¿Por qué no? Esto es porque OnPlayerKeyStateChange se llama cada vez que una simple tecla cambia su estado. Entonces si el jugador presiona "KEY_FIRE" - OnPlayerKeyStateChange es llamado con "KEY_FIRE" en "newkeys" y no en "oldskeys", entonces presiona "KEY_CROUCH" - OnPlayerKeyStateChange es llamado con "KEY_CROUCH" y "KEY_FIRE" en "newkeys" pero "KEY_FIRE" es ahora también en "oldkeys" como si ya fue presionado, entonces "!(oldkeys & KEY_FIRE)" fallará. Afortunadamente la solución es muy simple (de hecho más simple que el código original):
```c
if ((newkeys & (KEY_FIRE | KEY_CROUCH)) == (KEY_FIRE | KEY_CROUCH) && (oldkeys & (KEY_FIRE | KEY_CROUCH)) != (KEY_FIRE | KEY_CROUCH))
```
Esto puede parecer complicado, pero comprueba que ambas teclas estén en "newkeys" y que no estén en "oldkeys", si una de ellas está en "oldkeys" no importa ya que ambas no estaban. Todas estas cosas pueden ser muy simplificadas con macros (defines).
## Simplificación
### Detectar una tecla sosteniendose/hundiéndose
El macro:
```c
// HOLDING(keys)
#define HOLDING(%0) \
((newkeys & (%0)) == (%0))
```
Sosteniendo una tecla:
```c
if (HOLDING( KEY_FIRE ))
```
Sosteniendo múltiples teclas:
```c
if (HOLDING( KEY_FIRE | KEY_CROUCH ))
```
### Detectando una tecla pulsada una sola vez
El macro:
```c
// PRESSED(keys)
#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
```
Una tecla pulsada:
```c
if (PRESSED( KEY_FIRE ))
```
Múltiples teclas pulsadas:
```c
if (PRESSED( KEY_FIRE | KEY_CROUCH ))
```
### Detectar si un jugador está presionando una tecla actualmente
El macro:
```c
// PRESSING(keyVariable, keys)
#define PRESSING(%0,%1) \
(%0 & (%1))
```
Presionando una tecla:
```c
if (PRESSING( newkeys, KEY_FIRE ))
```
Presionando múltiples teclas:
```c
if (PRESSING( newkeys, KEY_FIRE | KEY_CROUCH ))
```
### Detectando una tecla liberada
El macro:
```c
// RELEASED(keys)
#define RELEASED(%0) \
(((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))
```
Una tecla liberada:
```c
if (RELEASED( KEY_FIRE ))
```
Múltiples teclas liberadas:
```c
if (RELEASED( KEY_FIRE | KEY_CROUCH ))
```
## Ejemplos
### Añadiendo nitro x10 al vehículo del jugador cuando presiona disparar
```c
public OnPlayerKeyStateChange(playerid, KEY:newkeys, KEY:oldkeys)
{
if (PRESSED(KEY_FIRE))
{
if (IsPlayerInAnyVehicle(playerid))
{
AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
}
}
return 1;
}
```
### Super salto
```c
public OnPlayerKeyStateChange(playerid, KEY:newkeys, KEY:oldkeys)
{
if (PRESSED(KEY_JUMP))
{
new
Float:x,
Float:y,
Float:z;
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(playerid, x, y, z + 10.0);
}
return 1;
}
```
### God mode mientras se sostiene 'KEY_ACTION'
```c
new
Float:gPlayerHealth[MAX_PLAYERS];
#if !defined INFINITY
#define INFINITY (Float:0x7F800000)
#endif
public OnPlayerKeyStateChange(playerid, KEY:newkeys, KEY:oldkeys)
{
if (PRESSED(KEY_ACTION))
{
// El jugador presionó la tecla de acción, guardamos su
// salud anterior para restaurarla posteriormente.
GetPlayerHealth(playerid, gPlayerHealth[playerid]);
SetPlayerHealth(playerid, INFINITY);
}
else if (RELEASED(KEY_ACTION))
{
// Dejó de presionar la tecla de acción - restauramos
// su antigua salud de nuevo.
SetPlayerHealth(playerid, gPlayerHealth[playerid]);
}
return 1;
}
```
### Explicación
No necesitas preocuparte de CÓMO se hace, sólo que así es. HOLDING detecta si está presionando una tecla (o teclas), independientemente de si la estaban presionando antes, PRESSED detecta si solo se presionó la tecla y RELEASED detecta si acaba de soltar una tecla. Sin embargo si querés saber más - sigue leyendo.
La razón por la que necesitas hacerlo de esta manera, no solo usando & o ==, es detectar exactamente las teclas que desea mientras ignora otras que pueden o no estar presionadas. En binario KEY_SPRINT es:
```
0b00001000
```
y KEY_JUMP es:
```
0b00100000
```
Si solo estuviéramos usando & y OnPlayerKeyStateChange es llamado por un jugador presionando "salto" podríamos obtener el siguiente código:
```
newkeys = 0b00100000
wanted = 0b00101000
ANDed = 0b00100000
```
El AND de los dos números no es 0, por lo que el resultado es verdadero, que no es lo que queremos.
Si usamos == los dos números claramente no son iguales, entonces la verificación fallaría, eso es lo que queremos.
Si el jugador estuviera presionando "saltar", "correr" y agacharse, tendríamos el siguiente código:
```
newkeys = 0b00101010
wanted = 0b00101000
ANDed = 0b00101000
```
La versión con AND es la misma que las claves requeridas y tampoco es 0, por lo que dará la respuesta correcta, sin embargo, los dos números originales no son iguales, por lo que == fallará. En ambos ejemplos, uno de los dos resultó en la respuesta correcta y el otro en la incorrecta. Si comparamos el primero usando & e == tenemos:
```
newkeys = 0b00100000
wanted = 0b00101000
ANDed = 0b00100000
```
Obviamente, "wanted" y AND no son lo mismo, por lo que la verificación falla, lo cual es correcto, para el segundo ejemplo:
```
newkeys = 0b00101010
wanted = 0b00101000
ANDed = 0b00101000
```
"wanted" y AND son lo mismo, por lo que compararlos devolverá verdadero, lo cual nuevamente es correcto.
Por lo tanto, al usar este método, podemos verificar con precisión si se presionaron ciertas teclas e ignorar todas las demás teclas. Las "oldkeys" lo usan en su verificación! - En lugar de == para asegurarse de que las teclas no fueron presionadas previamente, así sabemos que una de ellas fue presionada.
| openmultiplayer/web/docs/translations/es/scripting/callbacks/OnPlayerKeyStateChange.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/es/scripting/callbacks/OnPlayerKeyStateChange.md",
"repo_id": "openmultiplayer",
"token_count": 4672
} | 379 |
---
título: OnPlayerUpdate
descripción: Este callback se llama cada vez que un cliente/jugador actualiza su estado con el servidor.
tags: ["player"]
---
## Descripción
Este callback se llama cada vez que un cliente/jugador actualiza su estado con el servidor. A menudo de usa para crear callbacks personalizados para detectar actualizaciones en el cliente que no son rastreadas activamente por el servidor, como las actualizaciones de salud o chaleco o jugadores cambiando de armas.
| Nombre | Descripción |
| -------- | -------------------------------------------------------- |
| playerid | El ID del jugador que envió un paquete de actualización. |
## 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 OnPlayerUpdate(playerid)
{
new iCurWeap = GetPlayerWeapon(playerid); // Devuelve el arma en mano actual del jugador
if (iCurWeap != GetPVarInt(playerid, "iCurrentWeapon")) // Si cambió de arma desde la última actualización
{
// Vamos a llamar un callback nombrado OnPlayerChangeWeapon
OnPlayerChangeWeapon(playerid, GetPVarInt(playerid, "iCurrentWeapon"), iCurWeap);
SetPVarInt(playerid, "iCurrentWeapon", iCurWeap); //Actualizamos la variable de arma al jugador
}
return 1; // Envía esta actualización a otros jugadores
}
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), "Cambiaste del arma %s a %s!", oWeapon, nWeapon);
SendClientMessage(playerid, 0xFFFFFFFF, s);
}
public OnPlayerUpdate(playerid)
{
new Float:fHealth;
GetPlayerHealth(playerid, fHealth);
if (fHealth != GetPVarFloat(playerid, "faPlayerHealth"))
{
// La salud del jugador cambió desde la última actualización con el servidor, así que obviamente eso es lo actualizado.
// Hagamos mas comprobaciones para ver si aumentó o disminuyó de salud, anti-health cheat? ;)
if (fHealth > GetPVarFloat(playerid, "faPlayerHealth"))
{
/* El aumentó su salud! Usando cheats? Escribe tus propios scripts aquí para expresar de qué manera el jugador ganó salud */
}
else
{
/* Él perdió salud! */
}
SetPVarFloat(playerid, "faPlayerHealth", fHealth);
}
}
```
## Notes
<TipNPCCallbacksES />
:::warning
Este callback se llama, en promedio, 30 veces por segundo, por cada jugador; sólo usalo cuando sepas para que sirve (o más importante, para lo que no está pensado). La frecuencia con la que se llama este callback varía por cada jugador, dependiendo qué está haciendo el jugador. Conduciendo o disparando desencadenará muchas mas actualizaciones que estando quieto.
:::
## Funciones Relacionadas
| openmultiplayer/web/docs/translations/es/scripting/callbacks/OnPlayerUpdate.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/es/scripting/callbacks/OnPlayerUpdate.md",
"repo_id": "openmultiplayer",
"token_count": 1168
} | 380 |
---
title: AddStaticVehicle
description: Añade un vehículo 'estático' (los modelos están pre-cargados para los jugadores) al modo de juego.
tags: ["vehículo, vehicle"]
---
## Descripción
Añade un vehículo 'estático' (los modelos están pre-cargados para los jugadores) al modo de juego.
| Nombre | Descripción |
| ---------------------------------------- | -------------------------------------- |
| modelid | El ID del modelo para el vehículo. |
| Float:spawn_X | La coordenada X para el vehículo. |
| Float:spawn_Y | La coordenada Y para el vehículo. |
| Float:spawn_Z | La coordenada Z para el vehículo. |
| Float:z_angle | Dirección del vehículo - ángulo. |
| [color1](../resources/vehiclecolorid) | El ID del color primario. -1 para aleatorio. |
| [color2](../resources/vehiclecolorid) | El ID del color secundario. -1 para aleatorio. |
## Devoluciones
El ID del vehículo creado (entre 1 y MAX_VEHICLES).
INVALID_VEHICLE_ID (65535) si el vehículo no fue creado (se alcanzó el límite de vehículos o se pasó un ID de modelo de vehículo no válido).
## Ejemplos
```c
public OnGameModeInit() {
// Añadir un Hydra al juego
AddStaticVehicle(520, 2109.1763, 1503.0453, 32.2887, 82.2873, 0, 1);
return 1;
}
```
## Funciones Relacionadas
- [AddStaticVehicleEx](AddStaticVehicleEx): Añadir un vehículo estático con tiempo de reaparición personalizado.
- [CreateVehicle](CreateVehicle): Crear un vehículo.
- [DestroyVehicle](DestroyVehicle): Destruir un vehículo.
| openmultiplayer/web/docs/translations/es/scripting/functions/AddStaticVehicle.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/es/scripting/functions/AddStaticVehicle.md",
"repo_id": "openmultiplayer",
"token_count": 794
} | 381 |
---
title: SendClientMessageToAll
description: یک پیام را برای همه بازیکن ها نشان میدهد.
tags: []
---
<div dir="rtl" style={{ textAlign: "right" }}>
## توضیحات
یک پیام را برای همه بازیکن ها نشان میدهد. این معادل چند نفره SendClientMessage است.
| Name | Description |
| --------------- | ------------------------------------------------- |
| color | رنگ پیام (0xRRGGBBAA Hex format). |
| const message[] | متنی که نمایش داده می شود (حداکثر 144 کاراکتر). |
## مقادیر بازگشتی
این تابع همیشه true را بررمی گرداند. (1).
## مثال ها
</div>
```c
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(cmdtext, "/helloworld", true) == 0)
{
// Ferestadan payam baraye hame
SendClientMessageToAll(-1, "Hello!");
return 1;
}
return 0;
}
```
<div dir="rtl" style={{ textAlign: "right" }}>
## نکته ها
:::warning
بدون فرمت رشته ای که ارسال می شود ، از استفاده از مشخص کننده های فرمت در پیام های خود خودداری کنید. در غیر این صورت منجر به crash(خرابی) می شود.
:::
## تابع های مرتبط
- [SendClientMessage](SendClientMessage): فرستادن پیام برای یک بازیکن خاص.
- [SendPlayerMessageToAll](SendPlayerMessageToAll) | openmultiplayer/web/docs/translations/fa/scripting/functions/SendClientMessageToAll.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fa/scripting/functions/SendClientMessageToAll.md",
"repo_id": "openmultiplayer",
"token_count": 822
} | 382 |
---
title: OnEnterExitModShop
description: This callback is called when a player enters or exits a mod shop.
tags: []
---
## Deskripsyon
Ang callback na ito ay na cacall kapag ang player ay pumasok o umalis mula sa mod shop.
| Pangalan | Deskripsyong |
| ---------- | ---------------------------------------------------------------------------- |
| playerid | Ang ID ng player na pumasok o umalis ng mod shop |
| enterexit | 1 kapag ang player ay pumasok o 0 kapag ang player ay umalis mula sa modshop |
| interiorid | Ang Interior ID ng modshop na pinasukan ng player (0 kapag umaalis) |
## Returns
Lagi itong na cacall una sa mga filterscript.
## Mga Halimbawa
```c
public OnEnterExitModShop(playerid, enterexit, interiorid)
{
if (enterexit == 0) // if enterexit == 0 kapag umaalis mula sa mod shop.
{
SendClientMessage(playerid, COLOR_WHITE, "Nice car! You have been taxed $100.");
GivePlayerMoney(playerid, -100);
}
return 1;
}
```
## Mga Dapat Unawain
:::warning
Mga Kadalasang Bugs: Nag bubungguan ang mga players kapag parehas na pumasok sa mod shop.
:::
## Mga Kaugnay na Functions
- [AddVehicleComponent](../functions/AddVehicleComponent.md): Maglagay ng component sa sasakyan.
| openmultiplayer/web/docs/translations/fil/scripting/callbacks/OnEnterExitModShop.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fil/scripting/callbacks/OnEnterExitModShop.md",
"repo_id": "openmultiplayer",
"token_count": 534
} | 383 |
---
title: OnPlayerClickPlayerTextDraw
description: This callback is called when a player clicks on a player-textdraw.
tags: ["player", "textdraw", "playertextdraw"]
---
## Deskripsyon
Ang callback na ito ay natatawag kapag ang player ay pumindot sa isang player-textdraw. Hindi ito natatawag kapag ang player ay nag cancel gamit ang (ESC)
| Pangalan | Deskripsyon |
| ------------ | ------------------------------------------------------- |
| playerid | Ang ID ng player na pumindot sa textdraw |
| playertextid | Ang ID ng player-textdraw na pinindot ng player |
## Returns
Lagi itong natatawag una sa mga filterscript kaya kapag nag return 1 ay ibloblock nito ang ibang script mula sa pagtingin dito.
## Mga Halimbawa
```c
new PlayerText:gPlayerTextDraw[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
// Paggawa ng textdraw
gPlayerTextDraw[playerid] = CreatePlayerTextDraw(playerid, 10.000000, 141.000000, "MyTextDraw");
PlayerTextDrawTextSize(playerid, gPlayerTextDraw[playerid], 60.000000, 20.000000);
PlayerTextDrawAlignment(playerid, gPlayerTextDraw[playerid],0);
PlayerTextDrawBackgroundColor(playerid, gPlayerTextDraw[playerid],0x000000ff);
PlayerTextDrawFont(playerid, gPlayerTextDraw[playerid], 1);
PlayerTextDrawLetterSize(playerid, gPlayerTextDraw[playerid], 0.250000, 1.000000);
PlayerTextDrawColor(playerid, gPlayerTextDraw[playerid], 0xffffffff);
PlayerTextDrawSetProportional(playerid, gPlayerTextDraw[playerid], 1);
PlayerTextDrawSetShadow(playerid, gPlayerTextDraw[playerid], 1);
// Gawing napipindot
PlayerTextDrawSetSelectable(playerid, gPlayerTextDraw[playerid], 1);
// Ipakita sa player
PlayerTextDrawShow(playerid, gPlayerTextDraw[playerid]);
return 1;
}
public OnPlayerKeyStateChange(playerid, KEY:newkeys, KEY:oldkeys)
{
if (newkeys == KEY_SUBMISSION)
{
SelectTextDraw(playerid, 0xFF4040AA);
}
return 1;
}
public OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid)
{
if (playertextid == gPlayerTextDraw[playerid])
{
SendClientMessage(playerid, 0xFFFFFFAA, "Pinindot mo ang textdraw.");
CancelSelectTextDraw(playerid);
return 1;
}
return 0;
}
```
## Mga dapat tandaan
:::warning
Kapag ang player ay pinindot ang ESC para i cancel ang textdraw, OnPlayerClickTextDraw ay matatawag kasama ang ID na `INVALID_TEXT_DRAW`. OnPlayerClickPlayerTextDraw ay hindi rin matatawag.
:::
## Mga Kaugnay na Functions
- [PlayerTextDrawSetSelectable](../functions/PlayerTextDrawSetSelectable.md): I set depende kung ang player-textdraw ay napipindot tungo sa SelectTextDraw.
- [OnPlayerClickTextDraw](../callbacks/OnPlayerClickTextDraw.md): Natatawag kapag ang player ay pumindot sa isang textdraw.
- [OnPlayerClickPlayer](../callbacks/OnPlayerClickPlayer.md): Natatawag kapag ang player ay pinindot ang ibang player.
| openmultiplayer/web/docs/translations/fil/scripting/callbacks/OnPlayerClickPlayerTextDraw.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fil/scripting/callbacks/OnPlayerClickPlayerTextDraw.md",
"repo_id": "openmultiplayer",
"token_count": 1074
} | 384 |
---
title: AddMenuItem
description: Magdagdag ng item sa isang tinutukoy na menu.
tags: ["menu"]
---
## Description
Adds an item to a specified menu.
| Name | Description |
| ------- | ---------------------------------------- |
| menuid | Ang menu id upang magdagdag ng item. |
| column | Ang column kung saan idaragdag ang item. |
| title[] | Ang pamagat para sa bagong item sa menu. |
## Returns
Ang index ng row kung saan idinagdag ang item na ito.
## Examples
```c
new Menu:gExampleMenu;
public OnGameModeInit()
{
gExampleMenu = CreateMenu("Your Menu", 2, 200.0, 100.0, 150.0, 150.0);
AddMenuItem(gExampleMenu, 0, "item 1");
AddMenuItem(gExampleMenu, 0, "item 2");
return 1;
}
```
## Notes
:::tip
Nag-crash kapag naipasa ang isang di-wastong ID ng menu. Maaari ka lang magkaroon ng 12 item sa bawat menu (ang ika-13 ay mapupunta sa kanang bahagi ng header ng pangalan ng column (kulay), ika-14 at mas mataas na hindi ipinapakita). Maaari ka lamang gumamit ng 2 column (0 at 1). Maaari ka lamang magdagdag ng 8 color code sa bawat isang item (~r~, ~g~ atbp.). Ang maximum na haba ng item sa menu ay 31 simbolo.
:::
## Related Functions
- [CreateMenu](CreateMenu): Gumawa ng menu.
- [SetMenuColumnHeader](SetMenuColumnHeader): Itakda ang header para sa isa sa mga column sa isang menu.
- [DestroyMenu](DestroyMenu): Sirain ang menu.
- [OnPlayerSelectedMenuRow](../callbacks/OnPlayerSelectedMenuRow): Tinatawag kapag ang manlalaro ay pumili ng isang row sa menu.
- [OnPlayerExitedMenu](../callbacks/OnPlayerExitedMenu): Tinatawag kapag umalis ang manlalaro sa menu.
| openmultiplayer/web/docs/translations/fil/scripting/functions/AddMenuItem.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fil/scripting/functions/AddMenuItem.md",
"repo_id": "openmultiplayer",
"token_count": 601
} | 385 |
---
title: AttachCameraToObject
description: Maaari mong gamitin ang function na ito upang ikabit ang player camera sa mga bagay.
tags: []
---
## Description
Maaari mong gamitin ang function na ito upang ikabit ang player camera sa mga bagay.
| Name | Description |
| -------- | -------------------------------------------------------------------- |
| playerid | Ang ID ng player kung saan ikakabit ang iyong camera sa bagay. |
| objectid | Ang object id na gusto mong ilakip ang player camera. |
## Returns
Ang function na ito ay hindi nagbabalik ng anumang partikular na halaga.
## Examples
```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, "Your camera is attached on object now.");
return 1;
}
return 0;
}
```
## Notes
:::tip
Kailangan mo munang gumawa ng object, bago subukang mag-attach ng player camera.
:::
## Related Functions
- [AttachCameraToPlayerObject](AttachCameraToPlayerObject): Ilagay ang camera ng player sa isang object ng player. | openmultiplayer/web/docs/translations/fil/scripting/functions/AttachCameraToObject.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fil/scripting/functions/AttachCameraToObject.md",
"repo_id": "openmultiplayer",
"token_count": 493
} | 386 |
---
title: EnableVehicleFriendlyFire
description: Paganahin ang friendly fire para sa mga sasakyan ng team.
tags: ["vehicle"]
---
## Description
Paganahin ang friendly fire para sa mga sasakyan ng team. Hindi masisira ng mga manlalaro ang mga sasakyan ng mga kasamahan sa koponan (Dapat gamitin ang SetPlayerTeam!).
## Examples
```c
public OnGameModeInit()
{
EnableVehicleFriendlyFire();
return 1;
}
```
## Related Functions
- [SetPlayerTeam](SetPlayerTeam): Magtakda ng koponan ng manlalaro. | openmultiplayer/web/docs/translations/fil/scripting/functions/EnableVehicleFriendlyFire.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fil/scripting/functions/EnableVehicleFriendlyFire.md",
"repo_id": "openmultiplayer",
"token_count": 178
} | 387 |
---
title: Kick
description: I-kick ang isang manlalaro mula sa server. Kakailanganin nilang umalis sa laro at muling kumonekta kung nais nilang magpatuloy sa paglalaro.
tags: ["administration"]
---
## Description
I-kick ang isang manlalaro mula sa server. Kakailanganin nilang umalis sa laro at muling kumonekta kung nais nilang magpatuloy sa paglalaro.
| Name | Description |
| -------- | ----------------------------- |
| playerid | Ang ID ng player na I-kick. |
## Returns
Ang function na ito ay palaging nagbabalik ng 1, kahit na ang function ay nabigong isagawa (ang tinukoy ng player ay hindi umiiral).
## Notes
:::warning
Ang anumang aksyon na direktang ginawa bago ang Kick() (tulad ng pagpapadala ng mensahe gamit ang SendClientMessage) ay hindi makakarating sa player. Dapat gumamit ng timer para maantala ang pag-kick.
:::
## Examples
```c
// Upang magpakita ng mensahe (hal. dahilan) para sa player bago isara ang koneksyon
// kailangan mong gumamit ng timer para gumawa ng pagkaantala. Ang pagkaantala na ito ay kailangan lang ng ilang millisecond ang haba,
// ngunit ang halimbawang ito ay gumagamit ng isang buong segundo para lamang maging ligtas.
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(cmdtext, "/kickme", true) == 0)
{
// I-kick ang manlalaro kung sino man ang gumamit ng command na ito.
// Una, bigyan sila ng mensahe.
SendClientMessage(playerid, 0xFF0000FF, "You have been kicked!");
// I-kick na ang manlalaro sa susunod na segundo.
SetTimerEx("DelayedKick", 1000, false, "i", playerid);
return 1;
}
return 0;
}
forward DelayedKick(playerid);
public DelayedKick(playerid)
{
Kick(playerid);
return 1;
}
```
## Related Functions
- [Ban](Ban): I-ban ang manlalaro mula sa paglalaro sa server.
- [BanEx](BanEx): I-ban ang manlalaro mula sa paglalaro sa server na may kasamang dahilan. | openmultiplayer/web/docs/translations/fil/scripting/functions/Kick.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fil/scripting/functions/Kick.md",
"repo_id": "openmultiplayer",
"token_count": 739
} | 388 |
---
title: ShowNameTags
description: I-toggle ang drawing ng mga nametag, health bar at armor bar sa itaas ng mga manlalaro.
tags: []
---
## Description
I-toggle ang drawing ng mga nametag, health bar at armor bar sa itaas ng mga manlalaro.
| Name | Description |
| ------- | ----------------------------------------------- |
| enabled | 0 upang huwag paganahin, 1 upang paganahin (pinagana bilang default).|
## Returns
Ang function na ito ay hindi nagbabalik ng anumang value.
## Examples
```c
public OnGameModeInit()
{
// Ito ay ganap na hindi paganahin ang lahat ng mga nametag ng manlalaro
// (kabilang ang mga health at armor bar)
ShowNameTags(0);
}
```
## Notes
:::warning
Magagamit lang ang function na ito sa OnGameModeInit. Para sa ibang pagkakataon, tingnan ang ShowPlayerNameTagForPlayer.
:::
## Related Functions
- [DisableNameTagLOS](DisableNameTagLOS): I-disable ang nametag na Line-Of-Sight checking.
- [ShowPlayerNameTagForPlayer](ShowPlayerNameTagForPlayer): Magpakita o magtago ng nametag para sa isang partikular na manlalaro.
- [ShowPlayerMarkers](ShowPlayerMarkers): Magpasya kung dapat magpakita ang server ng mga marker sa radar. | openmultiplayer/web/docs/translations/fil/scripting/functions/ShowNameTags.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fil/scripting/functions/ShowNameTags.md",
"repo_id": "openmultiplayer",
"token_count": 437
} | 389 |
---
title: floatstr
description: Kino-convert ang isang string sa isang float.
tags: ["string", "floating-point"]
---
<LowercaseNote />
## Description
Converts a string to a float.
| Name | Description |
| ------ | ----------------------------------- |
| string | Ang string na i-convert sa isang float. |
## Returns
Ang hiniling na value ng float.
## Examples
```c
new before[4] = "6.9"; // ISANG STRING na may hawak na FLOAT.
SetPlayerPos(playerid, 0, 0, floatstr(before));
```
## Related Functions
- [floatround](floatround): I-convert ang float sa isang integer (rounding).
- [float](float): I-convert ang isang integer sa isang float. | openmultiplayer/web/docs/translations/fil/scripting/functions/floatstr.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fil/scripting/functions/floatstr.md",
"repo_id": "openmultiplayer",
"token_count": 234
} | 390 |
---
title: OnClientMessage
description: Cette callback est appelée chaque fois qu'un NPC voit un ClientMessage.
tags: [NPC, ClientMessage, SendClientMessageToAll, ]
---
## Paramètres
Cette callback est appelée chaque fois qu'un NPC voit un ClientMessage. Ce sera le cas à chaque fois qu’une fonction SendClientMessageToAll est utilisée et à chaque fois qu’une fonction SendClientMessage est envoyée vers le NPC. Cette callback ne sera pas appelée quand un joueur dit quelque chose (voir NPC:OnPlayerText pour une version avec les joueurs).
| Nom | Description |
| ------ | ------------------------------- |
| `int` color | Couleur du ClientMessage. |
| `string` text[] | Le message. |
## Valeur de retour
Aucun return.
## Exemple
```c
public OnClientMessage(color, text[])
{
if (strfind(text,"Solde bancaire : $0") != -1)
{
SendClientMessage(playerid, -1, "Je suis pauvre :(");
}
}
```
## Fonctions connexes
| openmultiplayer/web/docs/translations/fr/scripting/Callbacks/OnClientMessage.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fr/scripting/Callbacks/OnClientMessage.md",
"repo_id": "openmultiplayer",
"token_count": 401
} | 391 |
---
title: OnPickupStreamIn
description: Ce rappel est appelé lorsqu'un objet à récupérer entre dans la portée visuelle d'un joueur.
tags: ["player"]
---
<VersionWarn name='callback' version='omp v1.1.0.2612' />
## Description
Ce rappel est appelé lorsqu'un objet à récupérer entre dans la portée visuelle d'un joueur.
| Nom | Description |
|-----------|-----------------------------------------------------------------------------|
| pickupid | L'ID de l'objet à récupérer, retourné par [CreatePickup](../functions/CreatePickup) |
| playerid | L'ID du joueur pour lequel l'objet à récupérer entre dans la portée visuelle. |
## Retours
Il est toujours appelé en premier dans le gamemode.
## Exemples
```c
new g_PickupHealth;
public OnGameModeInit()
{
g_PickupHealth = CreatePickup(1240, 2, 2009.8474, 1218.0459, 10.8175);
return 1;
}
public OnPickupStreamIn(pickupid, playerid)
{
if (pickupid == g_PickupHealth)
{
printf("g_PickupHealth est diffusé en continu pour l'ID du joueur %d", playerid);
}
return 1;
}
```
## Rappels Relatives
Les rappels suivants peuvent être utiles, car ils sont liés à ce rappel d'une manière ou d'une autre.
- [OnPlayerPickUpPickup](OnPlayerPickUpPickup): Appelé lorsqu'un joueur ramasse un objet à récupérer.
- [OnPickupStreamOut](OnPickupStreamOut): Appelé lorsqu'un objet à récupérer quitte la portée visuelle d'un joueur.
## Fonctions Relatives
Les fonctions suivantes peuvent être utiles, car elles sont liées à ce rappel d'une manière ou d'une autre.
- [CreatePickup](../functions/CreatePickup): Crée un objet à récupérer.
- [DestroyPickup](../functions/DestroyPickup): Détruit un objet à récupérer.
| openmultiplayer/web/docs/translations/fr/scripting/Callbacks/OnPickupStreamIn.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fr/scripting/Callbacks/OnPickupStreamIn.md",
"repo_id": "openmultiplayer",
"token_count": 728
} | 392 |
---
title: OnPlayerEnterRaceCheckpoint
description: Cette callback est appelée quand un joueur est entré dans un race checkpoint.
tags: ["player", "checkpoint", "racecheckpoint"]
---
## Paramètres
Cette callback est appelée quand un joueur est entré dans un race checkpoint.
| Nom | Description |
| -------------- | ----------------------------------------------- |
| `int` playerid | Le joueur qui est entré dans le race 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 OnPlayerEnterRaceCheckpoint(playerid)
{
printf("Le joueur %d entre dans la course !", playerid);
return 1;
}
```
## Astuces
<TipNPCCallbacks />
## Fonctions connexes
- [SetPlayerCheckpoint](../functions/SetPlayerCheckpoint): Créer un checkpoint pour un joueur.
- [DisablePlayerCheckpoint](../functions/DisablePlayerCheckpoint): Désactive le checkpoint du joueur.
- [IsPlayerInCheckpoint](../functions/IsPlayerInCheckpoint): Vérifie si un joueur est dans un checkpoint.
- [SetPlayerRaceCheckpoint](../functions/SetPlayerRaceCheckpoint): Créer un race checkpoint pour le joueur.
- [DisablePlayerRaceCheckpoint](../functions/DisablePlayerRaceCheckpoint): Désactive le race checkpoint du joueur.
- [IsPlayerInRaceCheckpoint](../functions/IsPlayerInRaceCheckpoint): Vérifie si un joueur est dans un race checkpoint.
| openmultiplayer/web/docs/translations/fr/scripting/Callbacks/OnPlayerEnterRaceCheckpoint.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fr/scripting/Callbacks/OnPlayerEnterRaceCheckpoint.md",
"repo_id": "openmultiplayer",
"token_count": 532
} | 393 |
---
title: OnPlayerRequestClass
description: Appelée lorsqu'un joueur change de classe dans la sélection de classe.
tags: ["player"]
---
## Paramètres
Appelée lorsqu'un joueur change de classe dans la sélection de classe.
| Nom | Description |
| -------------- | ----------------------------------------------------------------------------------------------------------- |
| `int` playerid | L'ID du joueur qui change de classe |
| `int` classid | La classe que visionne actuellement le joueur (retournée par [AddPlayerClass](../functions/AddPlayerClass). |
## Valeur de retour
Retourner **0** va empêcher le joueur de changer de classe.
## Exemple
```c
public OnPlayerRequestClass(playerid,classid)
{
if (classid == 3 && !IsPlayerAdmin(playerid))
{
SendClientMessage(playerid, COLOR_RED, "Ce skin est seulement pour les admins !");
return 0;
}
return 1;
}
```
## Astuces
:::tip
Cette callback est aussi appelée quand un joueur presse F4.
:::
## Fonctions connexes
- [AddPlayerClass](../functions/AddPlayerClass): Ajoute une classe.
| openmultiplayer/web/docs/translations/fr/scripting/Callbacks/OnPlayerRequestClass.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fr/scripting/Callbacks/OnPlayerRequestClass.md",
"repo_id": "openmultiplayer",
"token_count": 550
} | 394 |
---
title: OnScriptCash
description: Ce rappel est déclenché lorsque quelque chose dans le jeu, comme les casinos, donne de l'argent au joueur.
tags: ["player"]
---
:::warning
Ce rappel NE FONCTIONNE PAS.
:::
## Description
Ce rappel est déclenché lorsque quelque chose dans le jeu, comme les casinos, donne de l'argent au joueur.
| Nom | Description |
|----------|----------------------------------------------------|
| playerid | L'ID du joueur qui a reçu de l'argent du jeu |
| amount | Le montant d'argent donné ou retiré |
| source | L'origine de l'argent |
## Retours
Inconnu car cette fonction ne fonctionne actuellement pas.
## Exemples
```c
// Imaginaire :
public OnScriptCash(playerid, amount, source)
{
if (source == SCRIPT_CASH_CASINO)
{
SendClientMessage(playerid, -1, "Vous avez gagné $%d au casino !", amount);
}
else if (source == SCRIPT_CASH_VENDING_MACHINE)
{
SendClientMessage(playerid, -1, "Vous avez acheté un soda à la machine distributrice pour $%d", amount);
}
return 1;
}
```
## Fonctions Relatives
Les fonctions suivantes pourraient être utiles, car elles sont liées à ce rappel d'une manière ou d'une autre.
- [GetPlayerMoney](../functions/GetPlayerMoney): Récupère le montant d'argent qu'un joueur possède.
| openmultiplayer/web/docs/translations/fr/scripting/Callbacks/OnScriptCash.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fr/scripting/Callbacks/OnScriptCash.md",
"repo_id": "openmultiplayer",
"token_count": 592
} | 395 |
---
title : AddSimpleModel
description: Ajoute un nouveau modèle d'objet simple personnalisé à télécharger.
tags: []
---
<VersionWarn version='SA-MP 0.3.DL R1' />
## Description
Ajoute un nouveau modèle d'objet simple personnalisé à télécharger. Les fichiers modèles seront stockés dans le dossier Documents\GTA San Andreas User Files\SAMP\cache du lecteur sous le dossier IP et port du serveur dans un nom de fichier au format CRC.
| Nom | Description |
| ------------ | -------------------------------------------------- --------------------------------------------------------------------------------------------------- |
| virtualworld | L'identifiant du monde virtuel sur lequel rendre le modèle disponible. Utilisez -1 pour tous les mondes. |
| baseid | ID de modèle d'objet de base à utiliser (objet d'origine à utiliser lorsque le téléchargement échoue). |
| newid | Le nouvel ID de modèle d'objet allait de -1000 à -30000 (29000 emplacements) pour être utilisé ultérieurement avec CreateObject ou CreatePlayerObject. |
| dffname | Nom du fichier de collision de modèles .dff situé dans le dossier du serveur de modèles par défaut (paramètre artpath) |
| txdname | Nom du fichier de texture de modèle .txd situé dans le dossier du serveur de modèles par défaut (paramètre artpath). |
## Retour
1 : La fonction s'est exécutée avec succès.
0 : La fonction n'a pas pu s'exécuter.
## Exemples
```c
public OnGameModeInit()
{
AddSimpleModel(-1, 19379, -2000, "wallzzz.dff", "wallzzz.txd");
return 1;
}
```
```c
AddSimpleModel(-1, 19379, -2000, "wallzzz.dff", "wallzzz.txd");
```
## Remarques
:::tip
`useartwork` doit d'abord être activé dans les paramètres du serveur pour que cela fonctionne Lorsque virtualworld est défini, les modèles seront téléchargés une fois que le joueur entrera dans le monde spécifique
:::
:::warning
Il n'y a actuellement aucune restriction sur le moment où vous pouvez appeler cette fonction, mais sachez que si vous ne les appelez pas dans OnFilterScriptInit/OnGameModeInit, vous courez le risque que certains joueurs, qui sont déjà sur le serveur, n'aient pas téléchargé les modèles.
:::
## Fonctions associées
- [OnPlayerFinishedDownloading](../callbacks/OnPlayerFinishedDownloading): appelé lorsqu'un joueur a fini de télécharger des modèles personnalisés.
| openmultiplayer/web/docs/translations/fr/scripting/functions/AddSimpleModel.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fr/scripting/functions/AddSimpleModel.md",
"repo_id": "openmultiplayer",
"token_count": 1145
} | 396 |
---
title: OnIncomingConnection
description: Callback ini akan terpanggil ketika sebuah IP address mencoba untuk koneksi kedalam server.
tags: []
---
## Deskripsi
Callback ini akan terpanggil ketika sebuah IP address mencoba untuk koneksi kedalam server. Untuk memblokir koneksi yang ingin masuk, gunakan BlockIpAddress.
| Nama | Deskripsi |
| ------------ | ------------------------------------------------- |
| playerid | ID dari pemain yang mencoba untuk koneksi |
| ip_address[] | IP address dari pemain yang mencoba untuk koneksi |
| port | Port dari pembuat koneksi |
## 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 OnIncomingConnection(playerid, ip_address[], port)
{
printf("Pemain ID %d mencoba untuk koneksikan kedalam server [IP/Port: %s:%i]", playerid, ip_address, port);
return 1;
}
```
## Fungsi Terkait
- [BlockIpAddress](../functions/BlockIpAddress.md): Blokir sebuah IP Address untuk mengkoneksi kedalam server dalam waktu yang ditentukan.
- [UnBlockIpAddress](../functions/UnBlockIpAddress.md): Membuka Blokir sebuah IP Address yang sebelumnya di blokir.
| openmultiplayer/web/docs/translations/id/scripting/callbacks/OnIncomingConnection.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/id/scripting/callbacks/OnIncomingConnection.md",
"repo_id": "openmultiplayer",
"token_count": 552
} | 397 |
---
title: OnPlayerPickUpPickup
description: Callback ini dipanggil ketika pemain mengambil pickup yang dibuat dengan CreatePickup.
tags: ["player"]
---
## Deskripsi
Callback ini dipanggil ketika pemain mengambil pickup yang dibuat dengan CreatePickup.
| Nama | Deskripsi |
| -------- | ------------------------------------------ |
| playerid | ID pemain yang mengambil pickup. |
| pickupid | ID pickup, dikembalikan oleh CreatePickup. |
## Returns
Selalu terpanggil pertama di gamemode.
## Contoh
```c
new pickup_Cash;
new pickup_Health;
public OnGameModeInit()
{
pickup_Cash = CreatePickup(1274, 2, 0.0, 0.0, 9.0);
pickup_Health = CreatePickup(1240, 2, 0.0, 0.0, 9.0);
return 1;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
if (pickupid == pickup_Cash)
{
GivePlayerMoney(playerid, 1000);
}
else if (pickupid == pickup_Health)
{
SetPlayerHealth(playerid, 100.0);
}
return 1;
}
```
## Fungsi Terkait
- [CreatePickup](../functions/CreatePickup): Membuat sebuah pickup.
- [DestroyPickup](../functions/DestroyPickup): Menghancurkan sebuah pickup.
| openmultiplayer/web/docs/translations/id/scripting/callbacks/OnPlayerPickUpPickup.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/id/scripting/callbacks/OnPlayerPickUpPickup.md",
"repo_id": "openmultiplayer",
"token_count": 480
} | 398 |
---
title: CreateObject
description: Membuat Object pada koordinat tertentu di dalam game.
tags: []
---
## Deskripsi
Membuat Object pada koordinat tertentu di dalam game.
| Name | Description |
| ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| modelid | Model Object yang ingin di buat. |
| Float:X | Cordinat X untuk membuat suatu Object. |
| Float:Y | Cordinat Y untuk membuat suatu Object. |
| Float:Z | Cordinat Z untuk membuat suatu Object. |
| Float:rX | Rotasi X untuk membuat suatu Object. |
| Float:rY | Rotasi Y untuk membuat suatu Object. |
| Float:rZ | Rotasi Z untuk membuat suatu Object. |
| Float:DrawDistance | (optional) Jarak yang San Andreas untuk Object di. 0.0 akan menyebabkan objek dirender pada jarak defaultnya. |
## Contoh
```c
public OnGameModeInit()
{
CreateObject(2587, 2001.195679, 1547.113892, 14.283400, 0.0, 0.0, 96.0); // Object akan dirender pada jarak defaultnya.
CreateObject(2587, 2001.195679, 1547.113892, 14.283400, 0.0, 0.0, 96.0, 300.0); // Object akan dirender pada 300,0 unit.
return 1;
}
```
## Catatan
:::tip
Ada batas 1000 Object (MAX_OBJECTS). Untuk menghindari batasan ini, Anda dapat menggunakan streamer.
:::
## Fungsi Terkait
- [DestroyObject](DestroyObject): Menghapus suatu Object.
- [IsValidObject](IsValidObject): Memeriksa apakah Object tertentu valid.
- [MoveObject](MoveObject): Memindahkan suatu Object.
- [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.
- [SetObjectMaterialText](SetObjectMaterialText): Mengganti tekstur Object dengan teks.
- [SetObjectMaterial](SetObjectMaterial): Mengganti tekstur suatu Object dengan tekstur dari model lain di dalam game.
- [CreatePlayerObject](CreatePlayerObject): Membuat Object hanya untuk satu pemain.
- [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.
- [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.
- [SetPlayerObjectMaterialText](SetPlayerObjectMaterialText): Replace tekstur Object Player dengan teks.
- [SetPlayerObjectMaterial](SetPlayerObjectMaterial): Mengganti tekstur Object Player dengan tekstur dari model lain dalam game.
| openmultiplayer/web/docs/translations/id/scripting/functions/CreateObject.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/id/scripting/functions/CreateObject.md",
"repo_id": "openmultiplayer",
"token_count": 2182
} | 399 |
---
title: strcat
description: Fungsi ini menggabungkan dua buah string menjadi sebuah string.
tags: ["string"]
---
<LowercaseNote />
## Deskripsi
Fungsi ini menggabungkan dua buah string menjadi sebuah string.
| Nama | Deskripsi |
| --------------------- | ----------------------------------------- |
| dest[] | Hasil dari string yang akan digabungkan. |
| const source[] | String awal. |
| maxlength=sizeof dest | Panjang maksimum dari hasil penggabungan. |
## Returns
Panjang dari Hasil string yang telah digabungkan.
## Contoh
```c
new string[40] = "Hello";
strcat(string, " World!");
// string nya menjadi 'Hello World!'
```
## Fungsi Terkait
- [strcmp](strcmp): Membanding dua string untuk mengecek apakah mereka sama.
- [strfind](strfind): Mencari sebuah string di string lainnya.
- [strdel](strdel): Menghapus bagian dari sebuah string.
- [strins](strins): Memasukkan teks kedalam sebuah string.
- [strlen](strlen): Mendapatkan panjang dari sebuah string.
- [strmid](strmid): Mengekstrak bagian dari sebuah string ke string lainnya.
- [strpack](strpack): Membungkus sebuah string menjadi string baru.
- [strval](strval): Mengkonversi sebuah string menjadi integer.
| openmultiplayer/web/docs/translations/id/scripting/functions/strcat.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/id/scripting/functions/strcat.md",
"repo_id": "openmultiplayer",
"token_count": 532
} | 400 |
---
id: mapiconstyles
title: Gaya Ikon Peta
description: Daftar Gaya Ikon Peta
---
| ID | Konstanta | Ada penanda cekpoin? | Jangkauan radar peta |
| --- | ------------------------- | -------------------- | ---------------------------------------------- |
| 0 | MAPICON_LOCAL | Tidak | Hanya jarak dekat |
| 1 | MAPICON_GLOBAL | Tidak | Muncul pada tepi radar, selama dalam jangkauan |
| 2 | MAPICON_LOCAL_CHECKPOINT | Ya | Hanya jarak dekat |
| 3 | MAPICON_GLOBAL_CHECKPOINT | Ya | Muncul pada tepi radar, selama dalam jangkauan |
## Fungsi Terkait
- [SetPlayerMapIcon](/docs/scripting/functions/SetPlayerMapIcon): Membuat sebuah mapicon untuk player.
| openmultiplayer/web/docs/translations/id/scripting/resources/mapiconstyles.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/id/scripting/resources/mapiconstyles.md",
"repo_id": "openmultiplayer",
"token_count": 432
} | 401 |
# Wikipedia SA-MP i dokumentacja open.mp
Witamy na wikipedii SA-MP, utrzymywanej przez zespół open.mp i szerszą społeczność SA-MP!
Ta strona ma na celu zapewnienie łatwo dostępnego,
łatwego do współtworzenia źródła dokumentacji dla SA-MP oraz, docelowo, open.mp.
## Wikipedia SA-MP została wyłączona
Niestety, wikipedia SA-MP została wyłączona pod koniec września - chociaż większość jej zawartości można znaleźć w publicznym archiwum internetowym.
Niestety, potrzebujemy pomocy społeczności, aby przenieść zawartość starej wikipedii do jej nowego domu, tutaj!
Jeśli jesteś zainteresowany, sprawdź [tę stronę](/docs/meta/Contributing) po więcej informacji.
Jeśli nie masz doświadczenia w używaniu GitHuba lub konwersji HTML, nie martw się! Możesz pomóc, po prostu informując nas o problemach (poprzez [Discord](https://discord.gg/samp), [forum](https://forum.open.mp) lub media społecznościowe) i najważniejsza rzecz: _rozpowszechnianie informacji!_ Więc pamiętaj, aby założyć tę stronę i podzielić się nią z każdym, kogo znasz i kto zastanawia się, gdzie podziała się wikipedia SA-MP.
Chętnie zawitamy poprawki do dokumentacji, jak również tutoriale i przewodniki do typowych zadań, takich jak tworzenie prostych gamemodów i używanie popularnych bibliotek i pluginów. Jeśli jesteś zainteresowany współtworzeniem dokumentacji, udaj się na stronę [GitHub](https://github.com/openmultiplayer/web).
| openmultiplayer/web/docs/translations/pl/index.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/pl/index.md",
"repo_id": "openmultiplayer",
"token_count": 690
} | 402 |
---
title: ApplyAnimation
description: Włącza animację graczowi.
tags: []
---
## Opis
Włącza animację graczowi.
| Nazwa | Opis |
| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| playerid | ID gracza, któremu chcesz włączyć animację. |
| animlib[] | Biblioteka, z której ma być zastosowana animacja. |
| animname[] | Nazwa animacji, która ma zostać zastosowana (z powyższej biblioteki). |
| fDelta | Prędkość odtwarzania animacji (używaj 4.1). |
| loop | Jeżeli jest ustawione na 1, animacja będzie zapętlona. Jeżeli jest ustawione na 0, animacja zostanie odtworzona tylko raz. |
| lockx | Jeżeli jest ustawione na 0, gracz wróci do swojego starego koordynatu X po skończeniu animacji (w przypadku animacji, które poruszają graczem, np. chodzenie). 1 nie przywróci go do starej pozycji. |
| locky | Tak samo jak powyżej, tyle że dla osi Y. Wartość powinna być taka sama, jak przy poprzednim parametrze. |
| freeze | Ustawienie tego na 1 zamrozi gracza po ukończeniu animacji. 0 tego nie zrobi. |
| time | Timer w milisekundach. Dla nieskończonej pętli powinien być ustawiony na 0. |
| forcesync | Ustawienie tego na 1 powoduje synchronizację animacji ze wszystkimi graczami w zasięgu widzenia (opcjonalne). 2 działa tak samo jak 1, tyle że animację będą widzieć TYLKO gracze w zasięgu widzenia, a gracz, któremu została włączona, NIE BĘDZIE jej widział (przydatne m.in. przy animacjach NPC). |
## Zwracane wartości
Ta funkcja zawsze zwraca 1, nawet jeśli podany gracz nie istnieje lub którykolwiek z parametrów jest nieprawidłowy (np. nieprawidłowa biblioteka).
## Przykłady
```c
ApplyAnimation(playerid, "PED", "WALK_DRUNK", 4.1, 1, 1, 1, 1, 1, 1);
```
## Uwagi
:::tip
Opcjonalny parametr `forcesync`, domyślnie ustawiony na 0, w większości przypadków nie jest potrzebny, ponieważ gracze sami synchronizują animacje. Ten parametr może zmusić wszystkich graczy, którzy mogą zobaczyć `playerid` do włączenia animacji niezależnie od tego, czy konkretny gracz wykonuje tę animację. Jest to przydatne w sytuacji, kiedy gracze nie mogą sami zsynchronizować animacji. Na przykład, gdy są AFK.
:::
:::warning
Nieprawidłowa biblioteka animacji zcrashuje klient gracza.
:::
## Powiązane funkcje
- [ClearAnimations](ClearAnimations.md): Wyłącza dowolną wykonywaną przez gracza animację.
- [SetPlayerSpecialAction](SetPlayerSpecialAction.md): Ustawia graczowi specjalną akcję.
| openmultiplayer/web/docs/translations/pl/scripting/functions/ApplyAnimation.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/pl/scripting/functions/ApplyAnimation.md",
"repo_id": "openmultiplayer",
"token_count": 3355
} | 403 |
---
title: Common Issues
---
## Conteúdos
## Cliente
### Eu tenho o erro "San Andreas cannot be found"
San Andreas Multi-player **NÃO** é um programa "stand-alone" (que funciona sozinho). Ele adiciona a funcionalidade de multi-jogador ao San Andreas e portanto você precisa do GTA San Andreas no seu computador, também precisa ser **EU/US v1.0**, outras versões como 2.0, Steam ou Direct2Drive não irão funcionar. [clique aqui para baixar um patch para desatualizar seu GTA: SA para a versão 1.0](http://grandtheftauto.filefront.com/file/GTA_SA_Downgrader_Patch;74661)
### Não consigo ver nenhum servidor no aplicativo do SA-MP
Primeiro, garanta que está seguindo os procedimetnos prescritos no [Quick-start guide](https://team.sa-mp.com/wiki/Getting_Started). Se você seguiu como descrito, e ainda não pode ver nenhum servidor, você precisa permitir que o SA:MP tenha acesso através do seu firewall. Infelizmente, devido ao grande número de firewalls disponíveis, não podemos oferecer suporte para esta ocasião, sugerimos procurar no site dos desenvolvedores ou pesquisar no Google. Também tenha certeza de estar usando a última versão do SA:MP!
### O modo single-player abre ao invés do multiplayer
:::warning
Você, provavelmente, não deverá ver as opções do singleplayer (novo jogo, carregar jogo, etc), SA-MP deve carregar por sí mesmo e não apresentar estas opções, caso ocorra saiba que o modo singleplayer carregou e não o multiplayer.
:::
O modo singleplayer pode carregar por dois motivos, caso tenha instalado o SA:MP no diretório errado, ou você tem a versão errada do San Andreas. Caso tenha a versão errada é fácil de consertar, clique [aqui](http://grandtheftauto.filefront.com/file/GTA_SA_Downgrader_Patch;74661) para baixar o patch de desatualização.
Algumas vezes o menu do singleplayer irá carregar, mas o SA:MP em fato terá carregado corretamente. Para consertar isso você precisa selecionar um item no menu e precionar ESC até que esteja fora, então o SA:MP irá proceder e carregar.
### Eu tenho "Unacceptable NickName" ao conectar no servdior
Garanta que você não está usando nenhum caractere não permitido no jogo (use 0-9, a-z, \[\], (), \$, @, ., \_ e = apenas) e que seu nome não seja maior que 20 caracteres. Isso também pode ser causado quando há um jogador no servidor com o mesmo nome que o seu. Um servidor Windows executando o SA-MP com um tempo maior que 50 dias também pode causar este bug.
### Tela trava no "Connecting to ip:port..."
O servidor pode estar offline, ou se você não pode conectar a nenhum servidor desative seu firewall e veja se funciona. Caso funciona você precisa configurar seu firewall corretamente. Também pode ser que você tenha uma versão antiga do SA-MP, baixa a última versão: [Página de download do SA-MP](http://sa-mp.com/download.php).
### Eu tenha um GTA modificado: San Andreas e SA:MP não irão carregar
Caso ambos não executem retire seus mods.
### Ao carregar o GTA com SA:MP não irá iniciar
Delete o arquivo gta_sa.set da paste onde está seu userfiles e tenha certeza que você não tem nenhum mod/cheat.
### O jogo crasha quando um veículo explode
Se você usa 2 monitores então há 3 maneiras de resolver isso:
1. Desligue o 2º motior ao jogar sa-mp. (Talvez não muito útil caso queira utilizar.)
2. Defina seus efeitos visuais para "Low" baixo. (Esc > Options > Display Setup > Advanced)
3. Renomeie a paste do seu Gta Sanandreas (ex: "GTA San Andreas2") (Isso funciona frequentemente, porém pode ser que volte a crashar, entãi será necessário trocar o nome para outro novamente.)
### Meu mouse não funciona após sair do menu de pausa
Você deve desativar a opção multicre do [sa-mp.cfg](../../../client/ClientCommands#file-sa-mpcfg "Sa-mp.cfg") (coloque em 0)
### O arquivo dinput8.dll está faltando
Isso possivelmente surge quando o DirectX não está propriamente instalado, tente instala-lo novamente, não esqueça de reiniciar seu computador. Se o problema persistir, apenas vá até C:\\Windows\\System32 então copie e cole o arquivo para a pasta raiz do seu GTA San Andreas, isso deve resolver o problema.
### Não consigo ver a nametag de outros jogadores!
Esteja ciente que alguns servidores podem desativar as nametags. Por outro lado, este problema ocorre frequentemente com computadores com processadores gráficos integrados da Intel. Infelizmente, a causa do problema não aparente solução no presente momento. Uma forma de consertar, talvez seria instalando uma placa de vídeo dedicada em seu computador, caso seja possível e seu computador permitir, laptops (notebooks) não podem ser melhorados (geralmente).
| openmultiplayer/web/docs/translations/pt-BR/client/CommonClientIssues.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/pt-BR/client/CommonClientIssues.md",
"repo_id": "openmultiplayer",
"token_count": 1686
} | 404 |
---
title: OnNPCConnect
description: Essa callback é executada quando um NPC conecta com sucesso no servidor.
tags: []
---
## Descrição
Essa callback é executada quando um NPC conecta com sucesso no servidor.
| Nome | Descrição |
| ------------ | -------------------------------------------------- |
| myplayerid | O ID de jogador que o NPC recebeu. |
## Exemplos
```c
public OnNPCConnect(myplayerid)
{
printf("O NPC conectou com sucesso no servidor com o ID %i!", myplayerid);
}
```
## Callbacks Relacionadas
- [OnNPCDisconnect](../callbacks/OnNPCDisconnect): Executada quando o NPC desconecta do servidor.
- [OnPlayerConnect](../callbacks/OnPlayerConnect): Executada quando o jogador conecta no servidor.
- [OnPlayerDisconnect](../callbacks/OnPlayerDisconnect): Executada quando o jogador desconecta do servidor.
| openmultiplayer/web/docs/translations/pt-BR/scripting/callbacks/OnNPCConnect.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/pt-BR/scripting/callbacks/OnNPCConnect.md",
"repo_id": "openmultiplayer",
"token_count": 344
} | 405 |
---
title: OnPlayerEditAttachedObject
description: Esta callback é chamada quando um jogador termina o modo de edição de objetos anexados.
tags: ["player"]
---
## Descrição
Esta callback é chamada quando um jogador termina o modo de edição de objetos anexados.
| Name | Descrição |
|------------------------|------------------------------------------------------------------|
| playerid | O ID do jogador que terminou a edição |
| EDIT_RESPONSE:response | 0 se foi cancelado (ESC), ou 1 se o botão de salvar foi clicado. |
| index | The index of the attached object (0-9) |
| modelid | O modelo do objeto que foi anexado |
| boneid | O ID da parte em que o modelo foi anexado |
| Float:fOffsetX | O desclocamento de X para o objeto editado. |
| Float:fOffsetY | O desclocamento de Y para o objeto editado. |
| Float:fOffsetZ | O desclocamento de Z para o objeto editado. |
| Float:fRotX | A rotação de X para o objeto editado. |
| Float:fRotY | A rotação de Y para o objeto editado. |
| Float:fRotZ | A rotação de Z para o objeto editado. |
| Float:fScaleX | A escala de X para o objeto editado. |
| Float:fScaleY | A escala de Y para o objeto editado. |
| Float:fScaleZ | A escala de Z para o objeto editado. |
## Retorno
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
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];
// Os dados devem ser armazenados na array acima.
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, "Anexo de objeto salvo.");
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, "Anexo de objeto não salvo.");
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;
}
```
## Notas
:::warning
Edições devem ser discartadas se a resposta for '0' (cancelado). Isso deve ser feito armazenando os valores em uma arrat ANTES de usar EditAttachedObject.
:::
## Funções Relacionadas
- [EditAttachedObject](../functions/EditAttachedObject): Edita um objeto anexado.
- [SetPlayerAttachedObject](../functions/SetPlayerAttachedObject): Anexa um objeto a um jogador.
| openmultiplayer/web/docs/translations/pt-BR/scripting/callbacks/OnPlayerEditAttachedObject.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/pt-BR/scripting/callbacks/OnPlayerEditAttachedObject.md",
"repo_id": "openmultiplayer",
"token_count": 1917
} | 406 |
---
title: OnPlayerRequestClass
description: Chamado quando um jogador muda de classe na seleção de classe (e quando a seleção de classe aparece pela primeira vez).
tags: ["player"]
---
## Descrição
Chamado quando um jogador muda de classe na seleção de classe (e quando a seleção de classe aparece pela primeira vez).
| Nome | Descrição |
| -------- | --------------------------------------------------------------------------- |
| playerid | O ID do jogador que mudou de classe |
| classid | O ID da classe atual que está sendo vista (retornardo pelo AddPlayerClass). |
## Retorno
Sempre é chamada primeiro em Filterscripts.
## Exemplos
```c
public OnPlayerRequestClass(playerid,classid)
{
if (classid == 3 && !IsPlayerAdmin(playerid))
{
SendClientMessage(playerid, COLOR_RED, "Esta skin é apenas para ADMINS!");
return 0;
}
return 1;
}
```
## Notas
:::tip
Esta callback também é chamada quando um jogador pressiona F4.
:::
## Funções Relacionadas
- [AddPlayerClass](../functions/AddPlayerClass): Adiciona uma classe.
| openmultiplayer/web/docs/translations/pt-BR/scripting/callbacks/OnPlayerRequestClass.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/pt-BR/scripting/callbacks/OnPlayerRequestClass.md",
"repo_id": "openmultiplayer",
"token_count": 496
} | 407 |
---
title: OnVehicleDamageStatusUpdate
description: Essa callback é executada quando elementos do veíclo como portas, rodas, painéis, ou luzes mudam seu status de dano.
tags: ["vehicle"]
---
:::tip
Funções úteis para trabalhar com danos em veículos podem ser encontradas [aqui](../resources/damagestatus).
:::
## Descrição
Essa callback é executada quando elementos do veíclo como portas, rodas, painéis, ou luzes mudam seu status de dano.
| Nome | Descrição |
| --------- | ------------------------------------------------------------------------------------------------------ |
| vehicleid | ID do veículo que teve seu status de dano modificado. |
| playerid | ID do jogador que foi sincronizado com o dano no veículo (aquele que danificou ou reparou o veículo). |
## Retornos
1 - Irá previnir que outros filterscripts recebam essa callback.
0 - Indica que essa callback pode ser passada para o próximo filterscript.
Sempre executada primeiro nos filterscripts.
## Exemplos
```c
public OnVehicleDamageStatusUpdate(vehicleid, playerid)
{
// Pega o status de dano nos componentes.
new panels, doors, lights, tires;
GetVehicleDamageStatus(vehicleid, panels, doors, lights, tires);
// Define a roda como 0, o que significa que a mesma não está estourada.
tires = 0;
// Faz o update no dano do veículo informando que a roda não está estourada.
UpdateVehicleDamageStatus(vehicleid, panels, doors, lights, tires);
return 1;
}
```
## Notas
:::tip
Essa função não incluí parâmetros do dano(vida) do veículo.
:::
## Funções Relacionadas
- [GetVehicleDamageStatus](../functions/GetVehicleDamageStatus): Pega o status de dano do veículo por parte selecionada.
- [UpdateVehicleDamageStatus](../functions/UpdateVehicleDamageStatus): Faz o update no status de dano do veículo.
| openmultiplayer/web/docs/translations/pt-BR/scripting/callbacks/OnVehicleDamageStatusUpdate.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/pt-BR/scripting/callbacks/OnVehicleDamageStatusUpdate.md",
"repo_id": "openmultiplayer",
"token_count": 780
} | 408 |
---
title: AddStaticVehicle
description: Adiciona um veículo 'fixo' (modelos são pré-carregados para os jogadores) ao gamemode.
tags: ["vehicle"]
---
## Descrição
Adiciona um veículo 'fixo' (modelos são pré-carregados para os jogadores) ao gamemode.
| Name | Descrição |
| ---------------------------------------- | ------------------------------------------ |
| modelid | O modelo ID para o veículo. |
| Float:spawn_X | A coordenada-X para o veículo. |
| Float:spawn_Y | A coordenada-Y para o veículo. |
| Float:spawn_Z | A coordenada-Z para o veículo. |
| Float:z_angle | Direção do veículo - Ângulo. |
| [color1](../resources/vehiclecolorid.md) | O ID da cor primária. -1 para aleatório. |
| [color2](../resources/vehiclecolorid.md) | O ID da cor secundária. -1 para aleatório. |
## Retorno
O ID do veículo criado (entre 1 e MAX_VEHICLES).
INVALID_VEHICLE_ID (65535) caso o veículo não tenha sido criado (limite de veículos alcançado ou modelo inválido).
## Exemplos
```c
public OnGameModeInit()
{
// Adiciona um Hydra ao jogo
AddStaticVehicle(520, 2109.1763, 1503.0453, 32.2887, 82.2873, 0, 1);
return 1;
}
```
## Funções Relacionadas
- [AddStaticVehicleEx](AddStaticVehicleEx.md): Adiciona um veículo fixo com tempo de respawn específico.
- [CreateVehicle](CreateVehicle.md): Cria um veículo.
- [DestroyVehicle](DestroyVehicle.md): Destrói um veículo.
| openmultiplayer/web/docs/translations/pt-BR/scripting/functions/AddStaticVehicle.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/pt-BR/scripting/functions/AddStaticVehicle.md",
"repo_id": "openmultiplayer",
"token_count": 827
} | 409 |
---
title: DeleteSVar
description: Exclui uma variável do servidor definida anteriormente.
tags: []
---
## Descrição
Exclui uma variável do servidor definida anteriormente.
| Nome | Descrição |
| ------- | ---------------------------------------------- |
| varname | O nome da variável do servidor a ser excluída. |
## Retorno
1: A função foi executada com sucesso.
0: A função falhou ao ser executada. Não existe variável definida com o nome fornecido.
## Exemplos
```c
SetSVarInt("SomeVarName", 69);
// Depois, quando a varíavel não for necessária...
DeleteSVar("SomeVarName");
```
## Notas
:::tip
Quando a variável é excluída, tentativas de recuperar o valor irão retornar 0 (para integers/floats e NULL para strings).
:::
## Funções Relacionadas
- [SetSVarInt](SetSVarInt.md): Define um integer para uma variável do servidor.
- [GetSVarInt](GetSVarInt.md): Obtém o servidor do jogador como um integer. Get a player server as an integer.
- [SetSVarString](SetSVarString.md): Define uma string para uma variável do servidor.
- [GetSVarString](GetSVarString.md): Obtém a string definida anteriormente de uma variável do servidor.
- [SetSVarFloat](SetSVarFloat.md): Define um float para uma variável do servidor.
- [GetSVarFloat](GetSVarFloat.md): Obtém o float definido anteriormente de uma variável do servidor.
| openmultiplayer/web/docs/translations/pt-BR/scripting/functions/DeleteSVar.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/pt-BR/scripting/functions/DeleteSVar.md",
"repo_id": "openmultiplayer",
"token_count": 528
} | 410 |
---
title: GetMaxPlayers
description: Retorna o número máximo de jogadores que podem entrar no servidor, conforme definido pela variável 'maxplayer' no servidor.
tags: ["player"]
---
## Descrição
Retorna o número máximo de jogadores que podem entrar no servidor, conforme definido pela variável 'maxplayer' no server.cfg.
## Exemplos
```c
new str[128];
format(str, sizeof(str), "Existem %i slots neste servidor!", GetMaxPlayers());
SendClientMessage(playerid, 0xFFFFFFFF, str);
```
## Notas
:::warning
Esta função não pode ser usada no lugar de MAX_PLAYERS. Não pode ser usado durante a compilação (por exemplo, para tamanhos de arrays). MAX_PLAYERS deve ser sempre redefinido ao valor que a variável 'maxplayer' será ou superior. Veja MAX_PLAYERS para mais informações.
:::
## Funções Relacionadas
- [GetPlayerPoolSize](GetPlayerPoolSize): Obtém o playerid mais alto conectado ao servidor.
- [IsPlayerConnected](IsPlayerConnected): Verifica se um jogador está conectado ao servidor.
| openmultiplayer/web/docs/translations/pt-BR/scripting/functions/GetMaxPlayers.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/pt-BR/scripting/functions/GetMaxPlayers.md",
"repo_id": "openmultiplayer",
"token_count": 364
} | 411 |
---
title: SetActorPos
description: Define a posição de um ator.
tags: []
---
Esta função foi implementada no SA-MP 0.3.7 e não funcionará em versões anteriores.
## Descrição
Define a posição de um ator.
| Nome | Descrição |
| ------- | ------------------------------------------------------------- |
| actorid | O ID do ator a definir a posição. Retornado pelo CreateActor. |
| X | A coordenada X na qual posicionar o ator. |
| Y | A coordenada Y na qual posicionar o ator. |
| Z | A coordenada Z na qual posicionar o ator. |
## Retorno
1: A função foi executada com sucesso.
0: A função falhou ao ser executada. O ator especificado não existe.
## Exemplos
```c
new gMyActor;
public OnGameModeInit()
{
gMyActor = CreateActor(...);
return 1;
}
// Outro local
SetActorPos(gMyActor, 1.0, 2.0, 3.0);
```
## Notas
:::tip
Ao criar um ator com CreateActor, você específica a sua posição. Você não precisa usar esta função, a menos que queira alterar a posição depois.
:::
## Funções Relacionadas
- [GetActorPos](GetActorPos.md): Obtém a posição de um ator.
- [CreateActor](CreateActor.md): Cria um ator (NPC fixo).
| openmultiplayer/web/docs/translations/pt-BR/scripting/functions/SetActorPos.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/pt-BR/scripting/functions/SetActorPos.md",
"repo_id": "openmultiplayer",
"token_count": 587
} | 412 |
---
title: "Estruturas de Controle"
---
## Condicionais
### if
O uso de "if" (se) verifica se algo é verdadeiro e caso seja, realiza alguma coisa.
```c
new
a = 5;
if (a == 5)
{
print("a é 5");
}
```
O código entre os parênteses após o "if" é chamado de condição, há inúmeras formas diferentes que você pode usar e testar este condicional (veja os operadores).
No exemplo acima, ambos "a" e "5" são símbolos, funções também podem ser símbolos:
```c
if (AlgumaFunção() == 5)
{
print("AlgumaFunção() é 5");
}
```
Isso retornará o valor de AlgumaFunção (veja abaixo) e irá comparar com "5".
Você também podem combinar verificações, para checar múltiplas coisas:
```c
new
a = 5,
b = 3;
if (a == 5 && b != 3)
{
print("Não será impresso no log");
}
```
Esse exemplo verifica se "a" é igual a "5" E se "b" não é igual a "3", porém, "b" é igual a "3", então a verificação falha.
```c
new
a = 5,
b = 3;
if (a == 5 || b != 3)
{
print("Será impresso no log");
}
```
Esse exemplo verifica se "a" é igual a "5" OU se "b" não é igual a "3", "b" é igual a "3" então a segunda parte falha, entretanto "a" é "5", então essa parte é verdadeira, nós estamos usando || (OU) então apenas uma das partes precisa ser verdadeira (se ambas as partes são verdadeiras, a condição continua sendo verdadeira, isso é levemente diferente do significado linguístico de "ou", significando apenas um, ou outro), então a condição é verdadeira.
Do mesmo modo, também é possível encadear duas comparações sem a necessidade, explicitamente falando, de usar AND de duas comparações diferentes.
```c
new
idx = 3;
if (0 < idx < 5)
{
print("idx é maior que 0 e menor que 5!");
}
```
### Operadores
Os símbolos a seguir são os que você pode utilizar em comparações, ao lado suas explicações. Alguns já foram utilizados em exemplos. Atente-se pois utilizamos "Esquerda" para indicar o valor que está ao lado esquerdo do operador, e "Direita" para indicar o valor que está ao lado direito do operador.
| Operador | Significado | Uso |
| ------------ | ------------------------------------------------------------------------- | ------------------------------------------------------------------------ |
| == | Esquerda é igual a Direita | if (Esquerda == Direita) |
| != | Esquerda não é igual a Direita | if (Esquerda != Direita) |
| > | Esquerda é maior que a Direita | if (Esquerda > Direita) |
| >= | Esquerda é maior que ou igual a Direita | if (Esquerda >= Direita) |
| < | Esquerda é menor que a Direita | if (Esquerda < Direita) |
| <= | Esquerda é menor ou igual a Direita | if (Esquerda <= Direita) |
| && | e | if (Esquerda && Direita) |
| || | ou | if (Esquerda || Direita) |
| ! | não | if (!Variável) |
| | nem | if (!(Esquerda || Direita)) |
| | e não | if (!(Esquerda && Direita)) |
| | exclusivamente ou (xor, eor) - apenas um ou outro é verdadeiro, ambos não | if (!(Esquerda && Direita) && (Esquerda ||Direita)) |
| | não exclusivamente ou (nxor, neor) - ambos ou nenhum são verdadeiros | if ((Esquerda && Direita) || !(Esquerda || Direita)) |
### Parênteses
Outro aspecto principal sobre condições de "if" é os parênteses, esses controlam a ordem de como tudo é feito em:
```c
new
a = 3,
b = 3,
c = 1;
if (a == 5 && b == 3 || c == 1)
{
print("Isso será chamado?");
}
```
Há duas maneiras de olhar para a condição acima:
```c
if ((a == 5 && b == 3) || c == 1)
```
E:
```c
if (a == 5 && (b == 3 || c == 1))
```
A primeira versão irá verificar se "a" é igual a "5" e se "b" é igual a "3", se isso for falso (ou seja, um ou ambos não são seus respectivos valores) irá verificar se "c" é igual a "1". (a == 5 && b == 3) é falso como você pôde ver acima, então você "substitui" esse grupo por FALSE:
```c
if (FALSE || c == 1)
```
Sabemos que FALSE não pode ser verdadeiro (assim sendo por definição), todavia "c" é igual a "1", então esta parte é verdadeira e como estamos utilizando "OR" toda condição torna-se verdadeira.
A segunda versão verifica se "a" é igual a "5", caso seja o código verificará se "b" é igual a "3" ou se "c" é igual a "1". O jogo irá fazer a parte 'a == 5' primeiro, mas para deixar claro iremos fazer de trás para frente. (b == 3 || c == 1) é verdadeiro pois ambas as metades são verdadeiras, apesar de que apenas uma delas precisa ser, então indo para nossa condição temos:
```c
if (a == 5 && TRUE)
```
(a == 5) é falso, pois "a" é igual a 3, então teremos:
```c
if (FALSE && TRUE)
```
Claramente FALSE é falso, consequentemente a condição não pode ser verdadeira, então a verificação irá falhar.
Estes pequenos exemplos mostram como o uso de parênteses pode mudar a forma como a verificação funciona, sem parênteses o compilador será o primeiro das duas versões demonstradas mas isso não é sempre garantido, então deve sempre usar parênteses, até mesmo para esclarecer o que está acontecendo para outras pessoas.
- (b != 3) no exemplo de "OR" não falha realmente sendo que nunca é chamado, o compilador orgraniza o código usando um método chamado "short-circuiting" (curto-circuito), como a primeira parte já é verdadeira, não há necessidade de verificar a segunda parte, sendo que isso não afetará no resultado, mas se fizesse, a verificação iria falhar.
### else
"else" (senão) basicamente faz alguma coisa, caso um "if" falhe:
```c
new
a = 5;
if (a == 3) // Falso
{
print("Não será chamado");
}
else
{
print("Como a verificação falhou, será chamado.");
}
```
### else if
Um "else if" (senão se) é uma verificação que ocorre caso a primeira falhe para checar algo:
```c
new
a = 5;
if (a == 1)
{
print("Será chamado caso a seja 1");
}
else if (a == 5)
{
print("Será chamado caso a seja 5");
}
else
{
print("Todos os outros números");
}
```
Você pode ter quantos desses quiser (você apenas pode ter um "if" e um "else" em um grupo de verificação):
```c
new
a = 4;
if (a == 1)
{
// Falso
}
else if (a == 2)
{
// Falso
}
else if (a == 3)
{
// Falso
}
else if (a == 4)
{
// Verdadeiro
}
else
{
// Falso
}
```
Os "else if" irão verificar o valor como era quando a sequência começou, então você não pode fazer:
```c
new
a = 5;
if (a == 5)
{
// Será chamado
a = 4;
}
else if (a == 4)
{
// Não será chamado, pois a primeira verificação não falhou, mesmo "a" sendo "4" agora
}
```
Para contornar isso, você apenas faria um "else" caso um "if".
### ?:
'?' e ':' juntos são chamados de um operador triádico, eles basicamente agem como um "if" dentro de outra declaração:
```c
new
a,
b = 3;
if (b == 3)
{
a = 5;
}
else
{
a = 7;
}
```
Esse foi um exemplos simples para atribuir a uma variável um valor baseado em outra variável, porém pode ser simplificado:
```c
new
a,
b = 3;
a = (b == 3) ? (5) : (7);
```
A parte antes do '?' é a condição, é exatamente o mesmo que uma condição normal. A parte entre o '?' e o ':' é o valor que irá retornar se a condição for verdadeira, a outro parte é o valor que irá retornar se a condição for falsa.
```c
new
a,
b = 3;
if (b == 1)
{
a = 2;
}
else if (b == 2)
{
a = 3;
}
else if (b == 3)
{
a = 4;
}
else
{
a = 5;
}
```
Pode ser escrito como:
```c
new
a,
b = 3;
a = (b == 1) ? (2) : ((b == 2) ? (3) : ((b == 3) ? (4) : (5)));
```
Isso é próximo com fazer:
```c
new
a,
b = 3;
if (b == 1)
{
a = 2;
}
else
{
if (b == 2)
{
a = 3;
}
else
{
if (b == 3)
{
a = 4;
}
else
{
a = 5;
}
}
}
```
Mas eles são equivalentes (neste exemplo tanto faz)
## Loops
### While
"while" (enquanto) loops fazem algo enquanto uma condição específica for verdadeira. A condição é exatamente no mesmo formato do que uma condição em uma declaração de "if", ela é apenas verificada repetidamente e o código é feito todo vez que for verdadeiro quando verificado:
```c
new
a = 9;
while (a < 10)
{
// Código no loop
a++;
}
// Código após o loop
```
O código irá verificar se "a" é menor que "10". Caso seja, o código dentro das chaves (a++;) será executado, portanto incrementando "a". Quando as chaves são alcaçadas o código pula de volta para a verificação e faz a mesmo coisa novamente, dessa vez a verificação irá falhar, pois "a" é igual a "10" e a execução irá pular para depois do loop. Se "a" fosse igual a "8" o código seria executado duas vezes, assim por diante.
### for()
Um "for" (para) loop é essencialmente um "while" comprimido. Um "for" contém três seções: "Inicialização, Condição e Finalização". Para escrever o exemplo de "while" acima como um loop "for":
```c
for (new a = 9; a < 10; a++)
{
// Código no loop
}
// Código após o loop
```
Este é um simples código para realizar um loop através de todos os players:
```c
for(new i,a = GetMaxPlayers(); i < a; i++)
{
if(IsPlayerConnected(i))
{
//Faça algo
}
}
```
Ambas as condições podem ser omitidas simplesmente não colocando código nelas:
```c
new
a = 9;
for ( ; a < 10; )
{
// Código no loop
a++;
}
// Código após o loop
```
Esse exemplo torna fácil demonstrar como que um "for" encaixa-se com um "while". Há duas simples diferenças entre os dois "for" loops dados. O primeiro é que o segundo exemplo declara "a" fora do loop "for", isso significa que também pode ser usado fora do loop, no primeiro exemplo o escopo de "a" (seção do código para qual a variável existe) está apenas dentro do loop. A segunda diferença é que o "a++" no segundo exemplo é na verdade feito após o "a++" do primeiro exemplo, 99% dos casos isso não faz diferença alguma, isso importa apenas quando você estiver usando "continue" (veja abaixo), "continue" irá chamar o "a++" no primeiro exemplo, mas irá pular no segundo exemplo.
### do-while
Um "do-while" (faça enquanto) loop é um loop onde a condição vem após o código dentre do loop, ao invés de antes. Isso significa que o código dentro sempre será executado ao menos uma vez, pois a verificação ocorre após o código dentro do loop.
```c
new
a = 10;
do
{
// Código no loop
a++;
}
while (a < 10); // Note o ponto e vírgula
// Código após o loop
```
Se esse fosse um "while" básico "a" não seria incrementado, pois (a < 10) é falso, mas aqui é incrementado antes da verificação. Caso fosse "9" o loop seria executado apenas uma vez, "8" duas vezses, assim em diante.
### if-goto
Esse é essencialmente o que os loops acima fazem, o seu uso não é geralmente aconselhado, entretanto é interessante ver como exatamente o loop funciona:
```c
new
a = 9;
loop_start:
if (a < 10)
{
// Código no loop
a++;
goto loop_start;
}
// Código após o loop
```
### OBOE
OBOE significa "Off By One Error" (Desligado por um erro). Esse é um erro muito comum onde o loop é executado muitas vezes ou poucas vezes, por exemplo:
```c
new
a = 0,
b[10];
while (a <= sizeof (b))
{
b[a] = 0;
}
```
Este exemplo simples demonstra um dos mais comuns OBOE's, de primeiro relance as possoes podem pensar que isso irá realizar um loop através de todo conteúdo de "b" e coloca-los como "0", entretanto, este loop irá rodar 11 vezes e tentará acessar "b[10], que não existe (pois seria o 11º slot em "b" começando em 0), entretando pode causar todos os tipos de problemas. Esse é conhecido como um erro "Out Of Bounds" (Fora dos Limites).
Você deve ser muito cuidadose com OBOEs quando estiver usando um "do-while" loop, pois eles SEMPRE rodam pelo menos uma vez.
## Switch
### switch
Um "switch" (troca) é basicamente uma forma estruturada de if/else (assim como "for" é uma forma estruturada de "while"). A forma mais fácil de explicar é com um exemplo:
```c
new
a = 5;
switch (a)
{
case 1:
{
// Não será chamado
}
case 2:
{
// Não será chamado
}
case 5:
{
// Será chamado
}
default:
{
// Não será chamado
}
}
```
Isso é, funcionalmente falando, equivalente a:
```c
new
a = 5;
if (a == 1)
{
// Não será chamado
}
else if (a == 2)
{
// Não será chamado
}
else if (a == 5)
{
// Será chamado
}
else
{
// Não será chamado
}
```
Entretanto, é levemente mais claro de ver o que está acontecendo.
Um ponto importante para notar aqui, é as diferentes formas em que um "if" e um "switch" são processados.
```c
switch (AlgumaFunção())
{
case 1: {}
case 2: {}
case 3: {}
}
```
Isso irá chamar AlgumaFunção() UMA VEZ e irá comparar seu resultado 3 vezes.
```c
if (AlgumaFunção() == 1) {}
else if (AlgumaFunção() == 2) {}
else if (AlgumaFunção() == 3) {}
```
Isso irá chamar AlgumaFunção() 3 vezes, que é muito ineficiente, um "switch" é como fazer:
```c
new
result = AlgumaFunção();
if (result == 1) {}
else if (result == 2) {}
else if (result == 3) {}
```
Para aqueles que conhecem C, o "switch" do PAWN é levemente diferente, as condições individuais NÃO SÃO "fall-through" e são limitadas por chaves, então não há necessidade de colocar um "break".
### case
Um "case" (caso) (as partes individuais do "switch") pode conter outras opções além de um único número. Você pode comparar um valor a uma lista de números (substituindo "fall-through" em C) ou até mesmo um alcance de determinados valores.
```c
case 1, 2, 3, 4:
```
Esse caso irá ativar se o símbolo sendo testado for "1","2","3" ou "4", é o mesmo que fazer:
```c
if (bla == 1 || bla == 2 || bla == 3 || bla == 4)
```
mas para ser mais conciso. Números em listas não necessitam ser consecutivos, de fato se eles forem é melhor fazer:
```c
case 1 .. 4:
```
Esse caso irá fazer exatamente o mesmo que o acima, porém checando em um determinado alcance da lista, é o mesmo que fazer:
```c
if (bla >= 1 && bla <= 4)
```
```c
new
a = 4;
switch (a)
{
case 1 .. 3:
{
}
case 5, 8, 11:
{
}
case 4:
{
}
default:
{
}
}
```
### default
Um "default" (padrão) é equivalente a um "else", ele realiza algo caso todos os outros falharem.
## Declarações de linhas únicas
### goto
goto is essentially a jump, it goes to a label without question (i.e. there's no condition to need to be true). You can see an example above in the if-goto loop.
Um "goto" (vá até) é essencialmente um pulo, ele vai até determinada "label" sem a necessidade de uma condição. Você pode ver em um exemplo acima um if-goto loop.
```c
goto my_label;
// Esta seção será pulada
my_label: // "Labels" terminam com dois pontos em sua própria linha
// Esta seção será processada como normal
```
O uso de "gotos" é severamente desaconselhado devido aos seus efeitos no seguimento (flow) do programa.
### break
Um "break" (quebra) para e coloca o fim em um loop prematuramente (antes de seu fim padrão):
```c
for (new a = 0; a < 10; a++)
{
if (a == 5) break;
}
```
Esse loop irá executar 6 vezes, até que atinja o break, colocando fim ao loop antes mesmo de acabar.
### continue
Um "continue" (continue) pula parte do loop em uma determinada iteração:
```c
for (new a = 0; a < 3; a++)
{
if (a == 1) continue;
printf("a = %d", a);
}
```
Isso irá resultar em um 'output' de:
```c
a = 0 a = 2
```
O "continue" basicamente pula uma parte fechada de chaves dentro do loop, como dito acima, você precisa ser cuidadoso ao utilizar "continue" em determinados loops:
```c
new
a = 0;
while (a < 3)
{
if (a == 1) continue;
printf("a = %d", a);
a++;
}
```
Esse é muito similar ao outro exemplo, entretanto desta vez o "continue" irá pular a linha do "a++", então o loop ficará preso e repetirá infinitamente, pois sempre será "1".
### return
Um "return" (retorno) irá parar uma função e voltar ao ponto em que a mesma foi chamada:
```c
main()
{
print("1");
MinhaFunção(1);
print("3");
}
MinhaFunção(num)
{
if (num == 1)
{
return;
}
print("2");
}
```
Esse código irá gerar um resultado de:
1 3
Pois a linha de "print("2");" nunca será alcançada.
Você também pode usar um "return" para retornar um valor:
```c
main()
{
print("1");
if (MinhaFunção(1) == 27)
{
print("3");
}
}
MinhaFunção(num)
{
if (num == 1)
{
return 27;
}
print("2");
return 0;
}
```
Esse código irá gerar o mesmo resultado que o visto acima, entretanto, note que um "return" adicional foi adicionado ao fim da função. O fim de uma função tem um "return" implícito nela, porém este retorno não tem valor, você não pode retornar um valor e não retornar um valor na mesma função, então precisamos explicitamente retornar um valor.
O símbolo que você retorna pode ser um número, uma variável ou até mesmo outra função, no caso de outra função ser chamada, irá retornar um valor (ela PRECISA retornar um valor se você usa-la como um valor de retorno) e esse valor será retornado para a primeira função.
Você também pode guardar o valor de um "return" para usar depois:
```c
main()
{
print("1");
new
ret = MinhaFunção(1);
if (ret == 27)
{
print("3");
}
}
MinhaFunção(num)
{
if (num == 1)
{
return 27;
}
print("2");
return 0;
}
```
| openmultiplayer/web/docs/translations/pt-BR/scripting/language/ControlStructures.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/pt-BR/scripting/language/ControlStructures.md",
"repo_id": "openmultiplayer",
"token_count": 9068
} | 413 |
---
title: "Console Remoto (RCON)"
---
O Console Remoto é um prompt de comando onde você pode usar comandos RCON sem precisar estar no jogo e no seu servidor. Desde 0.3b, o Console Remoto foi removido do Navegador de Servidores. A partir de agora você terá que utilizar outra forma de acessar o RCON Remoto conforme explicado abaixo.
1. Abra um editor de texto.
2. Escreva a seguinte linha: rcon.exe IP PORT RCON-PASS (Substitua IP/PORT/PASS pelas informações do seu servidor)
3. Salve o arquivo como rcon.bat
4. Coloque o arquivo no diretório do seu GTA, onde o rcon.exe está localizado.
5. Execute rcon.bat
6. Digite o comando que você deseja.

Nota: Não há necessidade de digitar /rcon antes do comando no console, os comandos não funcionarão se você fizer isso. Por exemplo, se você desejar resetar o servidor, basta digitar gmx e pressionar Enter. Isso é tudo o que você precisa fazer. Aproveite
| openmultiplayer/web/docs/translations/pt-BR/server/RemoteConsole.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/pt-BR/server/RemoteConsole.md",
"repo_id": "openmultiplayer",
"token_count": 369
} | 414 |
---
title: OnObjectMoved
description: Acest callback este apelat atunci când un obiect este mutat după MoveObject (când se oprește din mișcare).
tags: []
---
## Descriere
Acest callback este apelat atunci când un obiect este mutat după MoveObject (când se oprește din mișcare).
| Nume | Descriere |
| -------- | ----------------------------------- |
| objectid | ID-ul obiectului care a fost mutat |
## Returnări
Este întotdeauna numit primul în filterscript-uri.
## Exemple
```c
public OnObjectMoved(objectid)
{
printf("Obiectul %d s-a terminat de mutat.", objectid);
return 1;
}
```
## Note
:::tip
SetObjectPos nu funcționează atunci când este utilizat în acest callback. Pentru a o repara, recreați obiectul.
:::
## Funcții similare
- [MoveObject](../functions/MoveObject): Mișcă un obiect.
- [MovePlayerObject](../functions/MovePlayerObject): Mutați un obiect de jucător.
- [IsObjectMoving](../functions/IsObjectMoving): Verificați dacă obiectul se mișcă.
- [StopObject](../functions/StopObject): Opriți mișcarea unui obiect.
- [OnPlayerObjectMoved](OnPlayerObjectMoved): Apelat atunci când un obiect de jucător se oprește în mișcare. | openmultiplayer/web/docs/translations/ro/scripting/callbacks/OnObjectMoved.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/ro/scripting/callbacks/OnObjectMoved.md",
"repo_id": "openmultiplayer",
"token_count": 499
} | 415 |
---
title: OnPlayerFinishedDownloading
description: Acest callback este apelat atunci când un jucător termină descărcarea modelelor personalizate.
tags: ["player"]
---
<VersionWarn name='callback' version='SA-MP 0.3.DL R1' />
## Descriere
Acest callback este apelat atunci când un jucător termină descărcarea modelelor personalizate. Pentru mai multe informații despre cum să adăugați modele personalizate la serverul dvs., consultați firul de lansare și acest tutorial.
| Nume | Descriere |
| ------------ | ---------------------------------------------------------------------------------------- |
| playerid | ID-ul jucătorului care a terminat descărcarea modelelor personalizate. |
| virtualworld | ID-ul lumii virtuale pentru care jucătorul a terminat de descărcat modele personalizate. |
## Returnări
Acest callback nu se ocupă de returnări.
## Exemple
```c
public OnPlayerFinishedDownloading(playerid, virtualworld)
{
SendClientMessage(playerid, 0xffffffff, "Descărcări finalizate.");
return 1;
}
```
## Note
:::tip
Acest callback este apelat de fiecare dată când un jucător schimbă lumi virtuale, chiar dacă nu există modele personalizate prezente în acea lume.
:::
## Related Functions | openmultiplayer/web/docs/translations/ro/scripting/callbacks/OnPlayerFinishedDownloading.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/ro/scripting/callbacks/OnPlayerFinishedDownloading.md",
"repo_id": "openmultiplayer",
"token_count": 540
} | 416 |
---
title: OnPlayerStreamIn
description: Acest callback este apelat atunci când un jucător este transmis în flux de către clientul altui jucător.
tags: ["player"]
---
## Descriere
Acest callback este apelat atunci când un jucător este transmis în flux de către clientul altui jucător.
| Nume | Descriere |
| ----------- | ------------------------------------------------------- |
| playerid | ID-ul jucătorului care a fost transmis în flux. |
| forplayerid | ID-ul jucătorului care a transmis în flux celălalt jucător. |
## Returnări
Este întotdeauna numit primul în filterscript-uri.
## Exemple
```c
public OnPlayerStreamIn(playerid, forplayerid)
{
new string[40];
format(string, sizeof(string), "Jucătorul %d este acum transmis în flux pentru tine.", playerid);
SendClientMessage(forplayerid, 0xFFFFFFFF, string);
return 1;
}
```
## Note
<TipNPCCallbacks />
## Funcții similare | openmultiplayer/web/docs/translations/ro/scripting/callbacks/OnPlayerStreamIn.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/ro/scripting/callbacks/OnPlayerStreamIn.md",
"repo_id": "openmultiplayer",
"token_count": 410
} | 417 |
---
title: OnVehicleSirenStateChange
description: Acest callback este apelat atunci când sirena unui vehicul este declansata.
tags: ["vehicle"]
---
<VersionWarn name='callback' version='SA-MP 0.3.7' />
## Descriere
Acest callback este apelat atunci când sirena unui vehicul este declansata.
| Nume | Descriere |
| --------- | --------------------------------------------------------- |
| playerid | ID-ul jucătorului care a activat sirena (șofer). |
| vehicleid | ID-ul vehiculului pentru care a fost activată sirena. |
| newstate | 0 dacă sirena a fost oprită, 1 dacă sirena a fost pornită. |
## Returnări
1 - Va împiedica modul de joc să primească acest apel invers.
0 - Indică faptul că acest apel invers va fi trecut în modul de joc.
Este întotdeauna numit primul în filterscript-uri.
## Exemple
```c
public OnVehicleSirenStateChange(playerid, vehicleid, newstate)
{
if (newstate)
{
GameTextForPlayer(playerid, "~W~Sirenă ~G~pornita", 1000, 3);
}
else
{
GameTextForPlayer(playerid, "~W~Sirenă ~r~oprita", 1000, 3);
}
return 1;
}
```
## Note
:::tip
Acest callback este apelat numai atunci când sirena unui vehicul este activată sau dezactivată, NU atunci când este utilizată sirena alternativă (claxon de menținere).
:::
## Funcții similare
- [GetVehicleParamsSirenState](../functions/GetVehicleParamsSirenState): verificați dacă sirena unui vehicul este activată sau oprită. | openmultiplayer/web/docs/translations/ro/scripting/callbacks/OnVehicleSirenStateChange.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/ro/scripting/callbacks/OnVehicleSirenStateChange.md",
"repo_id": "openmultiplayer",
"token_count": 669
} | 418 |
---
title: acos
description: .
tags: []
---
<LowercaseNote />
## Descriere
Obțineți valoarea inversată a unui cosinus arc în radiani.
| Nume | Descriere |
| ------------ | ------------------------------ |
| Float: value | intrarea în cosinusul arcului. |
## Se intoarce
Cosinusul arcului principal al lui x, în intervalul [0, pi] radiani. Un radian este echivalent cu 180 / PI grade.
## Exemple
```c
//The arc cosine of 0.500000 is 60.000000 degrees.
public OnGameModeInit()
{
new Float:param, Float:result;
param = 0.5;
result = acos(param);
printf("The arc cosine of %f is %f degrees.", param, result);
return 1;
}
```
## Functii relatate
- [floatsin](floatsin.md): Obțineți sinusul dintr-un unghi specific.
- [floatcos](floatcos.md): Obțineți cosinusul dintr-un unghi specific.
- [floattan](floattan.md): Obțineți tangenta dintr-un unghi specific.
| openmultiplayer/web/docs/translations/ro/scripting/functions/acos.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/ro/scripting/functions/acos.md",
"repo_id": "openmultiplayer",
"token_count": 383
} | 419 |
---
title: Lista de culori
description: Culorile sunt pretutindeni în SA-MP - vehicule, nume de jucători și clipuri, extrase de text, gametext, chat, texte 3D și dialoguri (ca încorporare a culorilor)! Mai jos puteți găsi informații despre aceste lucruri diferite.
sidebar_label: Lista de culori
---
## Chat text and player color
Culorile din SA-MP sunt în general reprezentate în notație hexazecimală (deși pot fi folosite și numere întregi). Un text de chat sau culoarea unui jucător arată astfel: 0xRRGGBBAA.
_RR_ este partea roșie a culorii, _GG_ verde și _BB_ albastru. _AA_ este valoarea alfa. Dacă se folosește FF acolo, culoarea se va afișa fără transparență și dacă se folosește 00, va fi invizibilă.
Pentru codul Hex pentru aceste culori, accesați [Hex colors](../resources/hex-colors.md) page.
### Valori alfa (transparență)
Următoarele imagini afișează efectul valorilor de transparență utilizate cu o cară albă sub marcajul playerului și lăsate la pictograma dischetă de salvare. Inclinații de 0x11 (zecimală 17) sunt utilizate pentru demonstrare, dar, desigur, puteți utiliza orice valoare. 
### Făcând matematică
Deoarece culorile sunt doar numere, este posibil să se calculeze cu ele, deși este posibil să nu aibă întotdeauna sens. De exemplu, este posibil să reglați vizibilitatea marcatorului radar al jucătorului (a se vedea mai sus) păstrând în același timp culoarea actuală, indiferent de ceea ce este.
```c
SetPlayerMarkerVisibility(playerid, alpha = 0xFF)
{
new oldcolor, newcolor;
alpha = clamp(alpha, 0x00, 0xFF); // if an out-of-range value is supplied we'll fix it here first
oldcolor = GetPlayerColor(playerid); // get their color - Note: SetPlayerColor must have been used beforehand
newcolor = (oldcolor & ~0xFF) | alpha; // first we strip of all alpha data (& ~0xFF) and then we replace it with our desired value (| alpha)
return SetPlayerColor(playerid, newcolor); // returns 1 if it succeeded, 0 otherwise
}
```
### Convert string to value with pawn
Deoarece culorile sunt doar numere, trebuie să le convertiți uneori dintr-un șir de intrare "RRGGBBAA" în numărul său. Acest lucru se poate face folosind sscanf sau următoarea funcție:
```c
stock HexToInt(string[])
{
if (!string[0])
{
return 0;
}
new
cur = 1,
res = 0;
for (new i = strlen(string); i > 0; i--)
{
res += cur * (string[i - 1] - ((string[i - 1] < 58) ? (48) : (55)));
cur = cur * 16;
}
return res;
}
```
Foloseste HexToInt("RRGGBBAA") și veți obține un număr utilizabil ca rezultat pentru [SetPlayerColor](../functions/SetPlayerColor.md).
### Incorporarea culorii
Este posibil să utilizați culori în text în [mesajele clientului](../functions/SendClientMessage.md"), [dialogs](../functions/ShowPlayerDialog.md), [3D text labels](../functions/Create3DTextLabel.md), [object material texts](../functions/SetObjectMaterialText.md) si [vehicle numberplates](../functions/SetVehicleNumberPlate.md").
Este foarte asemănător cu [culorile de la gametext](../resources/gametextstyles.md), dar permite utilizarea oricărei culori.
:::caution
Acest tip de încorporare a culorilor nu funcționează în desenele text. Vezi si [GameTextStyle](../resources/gametextstyles.md).
:::
#### Exemplu
```c
{FFFFFF}Hello this is {00FF00}green {FFFFFF}and this is {FF0000}red
```
Salut, acesta este verde și acesta este roșu

#### Alt exemplu

Codul pentru linia de chat de mai sus arată astfel:
```c
SendClientMessage(playerid, COLOR_WHITE, "Welcome to {00FF00}M{FFFFFF}a{FF0000}r{FFFFFF}c{00FF00}o{FFFFFF}'{FF0000}s {FFFFFF}B{00FF00}i{FFFFFF}s{FF0000}t{FFFFFF}r{00FF00}o{FFFFFF}!");
```
Puteți defini culorile de utilizat astfel:
```c
#define COLOR_RED_EMBED "{FF0000}"
SendClientMessage(playerid, -1, "This is white and "COLOR_RED_EMBED"this is red.");
```
Sau
```c
#define COLOR_RED_EMBED "FF0000"
SendClientMessage(playerid, -1, "This is white and {"COLOR_RED_EMBED"}this is red.");
```
Al doilea exemplu ar fi mai bun, deoarece este mai clar că se folosește încorporarea.
#### Folosind GetPlayerColor
Pentru a utiliza culoarea unui jucător ca culoare încorporată, trebuie mai întâi să eliminați valoarea alfa. Pentru a face acest lucru, efectuați o schimbare logică la dreapta.
```c
new msg[128];
format(msg, sizeof(msg), "{ffffff}This is white and {%06x}this is the player's color!", GetPlayerColor(playerid) >>> 8);
SendClientMessage(playerid, 0xffffffff, msg);
```
%x este substituent pentru valori hexazecimale, 6 asigură că șirul de ieșire va avea întotdeauna șase caractere și 0 îl va bloca cu zerouri dacă nu este. Rețineți că [GetPlayerColor](../resources/GetPlayerColor.md) funcționează corect numai dacă [SetPlayerColor](../resources/SetPlayerColor.md) a fost folosit în prealabil.
Culorile folosite la încorporarea culorilor nu sunt asemănătoare culorilor hexagonale normale în Pion. Nu există nici un prefix '0x' și nici o valoare alfa (ultimele 2 cifre).
### Color Pickers
- [SA-MP Colorpicker v1.1.0](http://www.gtavision.com/index.php?section=downloads&site=download&id=1974)
- [December.com](http://www.december.com/html/spec/color.html)
- [RGB Picker](http://psyclops.com/tools/rgb)
- [Adobe Kuler](https://kuler.adobe.com/create/color-wheel/)
- [Color Scheme Designer](http://colorschemedesigner.com/)
## GameText
Pentru culorile GameText puteți utiliza etichete speciale pentru a seta textul următor la o anumită culoare.
```c
~r~ red
~g~ green
~b~ blue
~w~ white
~y~ yellow
~p~ purple
~l~ black
~h~ lighter color
```
Etichetele de culoare ale textului jocului pot fi folosite pentru a forma cu ușurință diferite culori. Culorile de mai jos nu sunt exact aceeași culoare cu etichetele de mai sus.
```c
~y~ yellow
~r~~h~ light red
~r~~h~~h~ red pink
~r~~h~~h~~h~ dark pink
~r~~h~~h~~h~~h~ light red pink
~r~~h~~h~~h~~h~~h~ pink
~g~~h~ light green
~g~~h~~h~ more light green
~g~~h~~h~~h~ sea green
~g~~h~~h~~h~~h~ offwhite
~b~~h~ blue
~b~~h~~h~ purplish blue
~b~~h~~h~~h~ light blue
~y~~h~~h~ offwhite
~p~~h~ medium pink
```
### Exemplu
```c
~w~Hello this is ~b~blue ~w~and this is ~r~red
```
[
Acum aceste culori sunt destul de întunecate. Le puteți face mai luminoase folosind ** ~ h ~ ** după codul de culoare:
```c
~w~Hello this is ~b~~h~blue ~w~and this is ~r~~h~red
```
[
| openmultiplayer/web/docs/translations/ro/scripting/resources/colorslist.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/ro/scripting/resources/colorslist.md",
"repo_id": "openmultiplayer",
"token_count": 2979
} | 420 |
---
title: AddMenuItem
description: Добавляет элемент в меню.
tags: ["menu"]
---
## Описание
Добавляет элемент в меню.
| Параметр| Описание |
| ------- | -------------------------------- |
| menuid | Id меню |
| column | Столбец ( 0 - 1 ) |
| title[] | Текст |
## Возвращаемые данные
Индекс строки в которую добавлен данный элемент.
## Пример
```c
new Menu:gExampleMenu;
public OnGameModeInit()
{
gExampleMenu = CreateMenu("Your Menu", 2, 200.0, 100.0, 150.0, 150.0);
AddMenuItem(gExampleMenu, 0, "item 1");
AddMenuItem(gExampleMenu, 0, "item 2");
return 1;
}
```
## Примечания
:::tip
Вызывает крэш при указании неверного menuid. Можно иметь 12 элементов меню (13ый идёт наверх в название правого столбца ( название имеет другой цвет ), 14ый элемент и выше не будет показан вообще). Можно добавить только 2 столбца ( 0 и 1 ). Можно добавить 8 цветовых кодов для 1 элемента (~r~, ~g~ и др.). Максимальная длинна текста элемента 31 символ.
:::
## Связанные функции
- [CreateMenu](CreateMenu.md): Создание меню.
- [SetMenuColumnHeader](SetMenuColumnHeader.md): Устанавливает загаловок столбца.
- [DestroyMenu](DestroyMenu.md): Удаляет меню.
- [OnPlayerSelectedMenuRow](../callbacks/OnPlayerSelectedMenuRow.md): Вызывается, когда игрок выбрал строку в меню.
- [OnPlayerExitedMenu](../callbacks/OnPlayerExitedMenu.md): Вызывается, когда игрок закрыл меню.
| openmultiplayer/web/docs/translations/ru/scripting/functions/AddMenuItem.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/ru/scripting/functions/AddMenuItem.md",
"repo_id": "openmultiplayer",
"token_count": 1083
} | 421 |
---
title: Система переменных для каждого игрока
description: Система переменных для каждого игрока (в сокращении PVar) - это новый способ создания переменных для каждого игрока индивидуально в глобальном пространстве, т.е. к одной переменной можно получить доступ и из игрового мода (gamemode), и из подключаемого сценария (filterscript).
---
Система **переменных для каждого игрока** (в сокращении **PVar**) - это новый способ создания переменных для каждого игрока индивидуально в глобальном пространстве, т.е. к одной переменной можно получить доступ и из игрового мода (gamemode), и из подключаемого сценария (filterscript).
Они работают точно так же, как [SVar](servervariablesystem), но привязаны к конкретному ID игрока.
## Преимущества
Система была представлена в серверном обновлении SA-MP 0.3a R5 а предоставляет некоторые преимущества перед массивами размера MAX_PLAYERS для работы с игроками.
- PVar'ы могут быть созданы и считаны во всех запущенных сценариях сервера (игровые режимы, скрипты, инклуды и т.д.), что позволяет легче организовать модульную архитектуру в вашем коде.
- PVar'ы автоматически удаляются, когда игрок покидает сервер (после OnPlayerDisconenct), что значит, что вам не требуется вручную сбрасывать данные для игрока.
- Нет нужды использовать enum и другие структуры для хранения данных.
- Сохраняет память, не выделяя память под ненужные элементы массива игроков, которые, вероятно, даже не будут использованы.
- PVar легко вывести или записать куда-то с помощью перебора. Это делает отладку и хранение данных намного проще.
- Если попытаться получить доступ к ещё не созданной переменной игрока, но всё ещё вернёт значение по умолчанию - 0.
- В PVar можно хранить очень большие строки при помощи динамически выделяемой памяти.
- Можно устанавливать, получать и создавать PVar прямо во время игры.
## Недостатки
- PVar в несколько раз медленнее, чем обычные переменные. Как правило, предпочтительнее пожертвовать памятью, нежели скоростью, но не наоборот.
## Функции
- [SetPVarInt](../scripting/functions/SetPVarInt): установить целочисленное значение переменной игрока.
- [GetPVarInt](../scripting/functions/GetPVarInt): получить значение переменной игрока, как целое число.
- [SetPVarString](../scripting/functions/SetPVarString): установить строчное значение переменной игрока.
- [GetPVarString](../scripting/functions/GetPVarString): получить значение переменной игрока, как строку.
- [SetPVarFloat](../scripting/functions/SetPVarFloat): установить переменной игрока значение с плавающей точкой.
- [GetPVarFloat](../scripting/functions/GetPVarFloat): получить значение переменной игрока, как число с плавающей точкой.
- [DeletePVar](../scripting/functions/GetPVarFloat): удалить переменную игрока.
```c
#define PLAYER_VARTYPE_NONE (0)
#define PLAYER_VARTYPE_INT (1)
#define PLAYER_VARTYPE_STRING (2)
#define PLAYER_VARTYPE_FLOAT (3)
```
| openmultiplayer/web/docs/translations/ru/tutorials/perplayervariablesystem.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/ru/tutorials/perplayervariablesystem.md",
"repo_id": "openmultiplayer",
"token_count": 2608
} | 422 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.