text stringlengths 1 2.83M | id stringlengths 16 152 | metadata dict | __index_level_0__ int64 0 949 |
|---|---|---|---|
package pawndex
import (
"fmt"
"net/http"
"github.com/go-chi/chi"
"github.com/openmultiplayer/web/internal/web"
)
func (s *service) get(w http.ResponseWriter, r *http.Request) {
user := chi.URLParam(r, "user")
repo := chi.URLParam(r, "repo")
p, exists, err := s.store.Get(fmt.Sprintf("%s/%s", user, repo))
if err != nil {
web.StatusInternalServerError(w, err)
return
}
if !exists {
web.StatusNotFound(w, nil)
return
}
web.Write(w, p) //nolint:errcheck
}
| openmultiplayer/web/app/transports/api/pawndex/h_get.go/0 | {
"file_path": "openmultiplayer/web/app/transports/api/pawndex/h_get.go",
"repo_id": "openmultiplayer",
"token_count": 211
} | 282 |
package users
import (
"crypto/md5"
"encoding/hex"
"errors"
"fmt"
"io"
"net/http"
"github.com/go-chi/chi"
"github.com/openmultiplayer/web/internal/web"
)
func (s *service) image(w http.ResponseWriter, r *http.Request) {
id := chi.URLParam(r, "id")
user, err := s.repo.GetUser(r.Context(), id, false)
if err != nil {
web.StatusInternalServerError(w, err)
return
}
if user == nil {
web.StatusNotFound(w, errors.New("not found"))
return
}
hash := md5.Sum([]byte(user.Email))
shash := hex.EncodeToString(hash[:])
url := fmt.Sprintf("https://www.gravatar.com/avatar/%s?d=retro", shash)
resp, err := http.Get(url)
if err != nil {
web.StatusInternalServerError(w, err)
return
}
w.Header().Set("Content-Type", "image/png")
io.Copy(w, resp.Body)
}
| openmultiplayer/web/app/transports/api/users/h_image.go/0 | {
"file_path": "openmultiplayer/web/app/transports/api/users/h_image.go",
"repo_id": "openmultiplayer",
"token_count": 334
} | 283 |
---
title: OnActorStreamIn
description: This callback is called when an actor is streamed in by a player's client.
tags: ["actor"]
---
<VersionWarn name='callback' version='SA-MP 0.3.7' />
## Description
This callback is called when an actor is streamed in by a player's client.
| Name | Description |
| ----------- | ------------------------------------------------------------- |
| actorid | The ID of the actor that has been streamed in for the player. |
| forplayerid | The ID of the player that streamed the actor in. |
## Returns
It is always called first in filterscripts.
## Examples
```c
public OnActorStreamIn(actorid, forplayerid)
{
new string[48];
format(string, sizeof(string), "Actor %d is now streamed in for you.", actorid);
SendClientMessage(forplayerid, 0xFFFFFFFF, string);
return 1;
}
```
## Notes
<TipNPCCallbacks />
## Related Callbacks
The following callbacks might be useful, as they're related to this callback in one way or another.
- [OnActorStreamOut](OnActorStreamOut): This callback is called when an actor is streamed out by a player's client.
| openmultiplayer/web/docs/scripting/callbacks/OnActorStreamIn.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/callbacks/OnActorStreamIn.md",
"repo_id": "openmultiplayer",
"token_count": 388
} | 284 |
---
title: OnNPCModeInit.
description: This callback is called when a NPC script is loaded.
tags: ["npc"]
---
## Description
This callback is called when a NPC script is loaded.
## Examples
```c
public OnNPCModeInit()
{
print("NPC script loaded.");
return 1;
}
```
## Related Callbacks
The following callbacks might be useful, as they're related to this callback in one way or another.
- [OnNPCModeExit](OnNPCModeExit): This callback is called when a NPC script unloaded.
| openmultiplayer/web/docs/scripting/callbacks/OnNPCModeInit.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/callbacks/OnNPCModeInit.md",
"repo_id": "openmultiplayer",
"token_count": 150
} | 285 |
---
title: OnPlayerEditObject
description: This callback is called when a player finishes editing an object (BeginObjectEditing/BeginPlayerObjectEditing).
tags: ["player", "object"]
---
## Description
This callback is called when a player finishes editing an object ([BeginObjectEditing](../functions/BeginObjectEditing)/[BeginPlayerObjectEditing](../functions/BeginPlayerObjectEditing)).
| Name | Description |
|------------------------|-----------------------------------------------------------------|
| playerid | The ID of the player that edited an object |
| playerobject | 0 if it is a global object or 1 if it is a playerobject. |
| objectid | The ID of the edited object |
| EDIT_RESPONSE:response | The [type of response](../resources/objecteditionresponsetypes) |
| Float:fX | The X offset for the object that was edited |
| Float:fY | The Y offset for the object that was edited |
| Float:fZ | The Z offset for the object that was edited |
| Float:fRotX | The X rotation for the object that was edited |
| Float:fRotY | The Y rotation for the object that was edited |
| Float:fRotZ | The Z rotation for the object that was edited |
## Returns
1 - Will prevent other scripts from receiving this callback.
0 - Indicates that this callback will be passed to the next script.
It is always called first in filterscripts.
## Examples
```c
public OnPlayerEditObject(playerid, playerobject, objectid, EDIT_RESPONSE:response, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ)
{
new
Float: oldX,
Float: oldY,
Float: oldZ,
Float: oldRotX,
Float: oldRotY,
Float: oldRotZ;
GetObjectPos(objectid, oldX, oldY, oldZ);
GetObjectRot(objectid, oldRotX, oldRotY, oldRotZ);
if (!playerobject) // If this is a global object, sync the position for other players
{
if (!IsValidObject(objectid))
{
return 1;
}
SetObjectPos(objectid, fX, fY, fZ);
SetObjectRot(objectid, fRotX, fRotY, fRotZ);
}
switch (response)
{
case EDIT_RESPONSE_FINAL:
{
// The player clicked on the save icon
// Do anything here to save the updated object position (and rotation)
}
case EDIT_RESPONSE_CANCEL:
{
//The player cancelled, so put the object back to it's old position
if (!playerobject) //Object is not a playerobject
{
SetObjectPos(objectid, oldX, oldY, oldZ);
SetObjectRot(objectid, oldRotX, oldRotY, oldRotZ);
}
else
{
SetPlayerObjectPos(playerid, objectid, oldX, oldY, oldZ);
SetPlayerObjectRot(playerid, objectid, oldRotX, oldRotY, oldRotZ);
}
}
}
return 1;
}
```
## Notes
:::warning
When using 'EDIT_RESPONSE_UPDATE' be aware that this callback will not be called when releasing an edit in progress resulting in the last update of 'EDIT_RESPONSE_UPDATE' being out of sync of the objects current position.
:::
## Related Functions
The following functions might be useful, as they're related to this callback in one way or another.
- [BeginPlayerObjectEditing](../functions/BeginPlayerObjectEditing): Edit a player-object.
- [BeginObjectEditing](../functions/BeginObjectEditing): Edit an object.
- [CreateObject](../functions/CreateObject): Create an object.
- [DestroyObject](../functions/DestroyObject): Destroy an object.
- [MoveObject](../functions/MoveObject): Move an object.
## Related Resources
- [Object Edition Response Types](../resources/objecteditionresponsetypes)
| openmultiplayer/web/docs/scripting/callbacks/OnPlayerEditObject.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/callbacks/OnPlayerEditObject.md",
"repo_id": "openmultiplayer",
"token_count": 1659
} | 286 |
---
title: OnPlayerLeaveRaceCheckpoint
description: This callback is called when a player leaves the race checkpoint.
tags: ["player", "checkpoint", "racecheckpoint"]
---
## Description
This callback is called when a player leaves the race checkpoint.
| Name | Description |
| -------- | --------------------------------------------------- |
| playerid | The ID of the player that left the race checkpoint. |
## Returns
It is always called first in filterscripts.
## Examples
```c
public OnPlayerLeaveRaceCheckpoint(playerid)
{
printf("Player %d left a race checkpoint!", playerid);
return 1;
}
```
## Notes
<TipNPCCallbacks />
## Related Callbacks
The following callbacks might be useful, as they're related to this callback in one way or another.
- [OnPlayerEnterCheckpoint](OnPlayerEnterCheckpoint): This callback is called when a player enters a checkpoint.
- [OnPlayerLeaveCheckpoint](OnPlayerLeaveCheckpoint): This callback is called when a player leaves a checkpoint.
- [OnPlayerEnterRaceCheckpoint](OnPlayerEnterRaceCheckpoint): This callback is called when a player enters a race checkpoint.
## Related Functions
The following functions might be useful, as they're related to this callback in one way or another.
- [SetPlayerCheckpoint](../functions/SetPlayerCheckpoint): Create a checkpoint for a player.
- [DisablePlayerCheckpoint](../functions/DisablePlayerCheckpoint): Disable the player's current checkpoint.
- [IsPlayerInCheckpoint](../functions/IsPlayerInCheckpoint): Check if a player is in a checkpoint.
- [SetPlayerRaceCheckpoint](../functions/SetPlayerRaceCheckpoint): Create a race checkpoint for a player.
- [DisablePlayerRaceCheckpoint](../functions/DisablePlayerRaceCheckpoint): Disable the player's current race checkpoint.
- [IsPlayerInRaceCheckpoint](../functions/IsPlayerInRaceCheckpoint): Check if a player is in a race checkpoint.
| openmultiplayer/web/docs/scripting/callbacks/OnPlayerLeaveRaceCheckpoint.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/callbacks/OnPlayerLeaveRaceCheckpoint.md",
"repo_id": "openmultiplayer",
"token_count": 521
} | 287 |
---
title: OnPlayerText
description: This callback is called when a player sends a chat message.
tags: ["player"]
---
## Description
This callback is called when a player sends a chat message.
| Name | Description |
| -------- | ---------------------------------------- |
| playerid | The ID of the player who typed the text. |
| text[] | The text the player typed. |
## Returns
It is always called first in filterscripts so returning 0 there blocks other scripts from seeing it.
## Examples
```c
public OnPlayerText(playerid, text[])
{
new string[144];
format(string, sizeof (string), "(%d) %s", playerid, text);
SendPlayerMessageToAll(playerid, string);
return 0; // ignore the default text and send the custom one
}
```
## Notes
<TipNPCCallbacks />
## Related Callbacks
The following callbacks might be useful, as they're related to this callback in one way or another.
- [OnPlayerCommandText](OnPlayerCommandText): Called when a player types a command.
## Related Functions
The following functions might be useful, as they're related to this callback in one way or another.
- [SendPlayerMessageToPlayer](../functions/SendPlayerMessageToPlayer): Force a player to send text for one player.
- [SendPlayerMessageToAll](../functions/SendPlayerMessageToAll): Force a player to send text for all players.
- [ToggleChatTextReplacement](../functions/ToggleChatTextReplacement): Toggles the chat input filter.
| openmultiplayer/web/docs/scripting/callbacks/OnPlayerText.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/callbacks/OnPlayerText.md",
"repo_id": "openmultiplayer",
"token_count": 439
} | 288 |
---
title: OnVehicleStreamIn
description: This callback is called when a vehicle is streamed to a player's client.
tags: ["vehicle"]
---
## Description
This callback is called when a vehicle is streamed to a player's client.
| Name | Description |
| ----------- | ------------------------------------------------------ |
| vehicleid | The ID of the vehicle that streamed in for the player. |
| forplayerid | The ID of the player who the vehicle streamed in for. |
## Returns
It is always called first in filterscripts.
## Examples
```c
public OnVehicleStreamIn(vehicleid, forplayerid)
{
new string[32];
format(string, sizeof(string), "You can now see vehicle %d.", vehicleid);
SendClientMessage(forplayerid, 0xFFFFFFFF, string);
return 1;
}
```
## Notes
<TipNPCCallbacks />
## Related Callbacks
- [OnVehicleStreamOut](OnVehicleStreamOut): This callback is called when a vehicle streams out for a player.
- [OnPlayerStreamIn](OnPlayerStreamIn): This callback is called when a player streams in for another player.
- [OnPlayerStreamOut](OnPlayerStreamOut): This callback is called when a player streams out for another player.
| openmultiplayer/web/docs/scripting/callbacks/OnVehicleStreamIn.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/callbacks/OnVehicleStreamIn.md",
"repo_id": "openmultiplayer",
"token_count": 373
} | 289 |
---
title: AllowPlayerTeleport
description: Enable/Disable the teleporting ability for a player by right-clicking on the map.
tags: ["player"]
---
:::warning
This function, as of 0.3d, is deprecated. Check [OnPlayerClickMap](../callbacks/OnPlayerClickMap).
:::
## Description
Enable/Disable the teleporting ability for a player by right-clicking on the map
| Name | Description |
| ---------- | ---------------------------------------- |
| playerid | The ID of the player to allow teleport. |
| bool:allow | 'false' to disallow and 'true' to allow. |
## Returns
This function does not return any specific values.
## Examples
```c
public OnPlayerConnect(playerid)
{
// Allows the Player to teleport by right-clicking on the map
// since this is in OnPlayerConnect, this will be done for EACH player
AllowPlayerTeleport(playerid, true);
return 1;
}
```
## Notes
:::warning
This function will work only if [AllowAdminTeleport](AllowAdminTeleport) is enabled, and you have to be an admin.
:::
## Related Functions
- [IsPlayerTeleportAllowed](IsPlayerTeleportAllowed): Can this player teleport by right-clicking on the map?
- [AllowAdminTeleport](AllowAdminTeleport): Toggle waypoint teleporting for RCON admins.
| openmultiplayer/web/docs/scripting/functions/AllowPlayerTeleport.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/AllowPlayerTeleport.md",
"repo_id": "openmultiplayer",
"token_count": 393
} | 290 |
---
title: AttachPlayerObjectToVehicle
description: Attach a player object to a vehicle.
tags: ["player", "object", "playerobject", "vehicle"]
---
## Description
Attach a player object to a vehicle.
| Name | Description |
| --------------- | ------------------------------------------------ |
| playerid | The ID of the player the object was created for. |
| objectid | The ID of the object to attach to the vehicle. |
| parentid | The ID of the vehicle to attach the object to. |
| Float:offsetX | The X position offset for attachment. |
| Float:offsetY | The Y position offset for attachment. |
| Float:offsetZ | The Z position offset for attachment. |
| Float:rotationX | The X rotation offset for attachment. |
| Float:rotationY | The Y rotation offset for attachment. |
| Float:rotationZ | The Z rotation offset for attachment. |
## Returns
This function does not return any specific values.
## Examples
```c
public OnPlayerStateChange(playerid, PLAYER_STATE:newstate, PLAYER_STATE:oldstate)
{
if (newstate == PLAYER_STATE_DRIVER) // If player enters vehicle
{
// Attach massive cow.
new cowObject = CreatePlayerObject(playerid, 16442, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
new vehicleid = GetPlayerVehicleID(playerid);
AttachPlayerObjectToVehicle(playerid, cowObject, vehicleid, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0);
}
return 1;
}
```
## Notes
:::tip
You need to create the object before attempting to attach it to a vehicle.
:::
## Related Functions
- [CreatePlayerObject](CreatePlayerObject): Create an object for only one player.
- [DestroyPlayerObject](DestroyPlayerObject): Destroy a player object.
- [IsValidPlayerObject](IsValidPlayerObject): Checks if a certain player object is vaild.
- [MovePlayerObject](MovePlayerObject): Move a player object.
- [StopPlayerObject](StopPlayerObject): Stop a player object from moving.
- [SetPlayerObjectRot](SetPlayerObjectRot): Set the rotation of a player object.
- [GetPlayerObjectPos](GetPlayerObjectPos): Locate a player object.
- [SetPlayerObjectPos](SetPlayerObjectPos): Set the position of a player object.
- [GetPlayerObjectRot](GetPlayerObjectRot): Check the rotation of a player object.
- [AttachPlayerObjectToPlayer](AttachPlayerObjectToPlayer): Attach a player object to a player
- [CreateObject](CreateObject): Create an object.
- [DestroyObject](DestroyObject): Destroy an object.
- [IsValidObject](IsValidObject): Checks if a certain object is vaild.
- [MoveObject](MoveObject): Move a object.
- [StopObject](StopObject): Stop an object from moving.
- [SetObjectPos](SetObjectPos): Set the position of an object.
- [SetObjectRot](SetObjectRot): Set the rotation of an object.
- [GetObjectPos](GetObjectPos): Locate an object.
- [GetObjectRot](GetObjectRot): Check the rotation of an object.
- [AttachObjectToPlayer](AttachObjectToPlayer): Attach an object to a player.
| openmultiplayer/web/docs/scripting/functions/AttachPlayerObjectToVehicle.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/AttachPlayerObjectToVehicle.md",
"repo_id": "openmultiplayer",
"token_count": 985
} | 291 |
---
title: ClearActorAnimations
description: Clear any animations applied to an actor.
tags: ["actor"]
---
<VersionWarn version='SA-MP 0.3.7' />
## Description
Clear any animations applied to an actor.
| Name | Description |
| ------- | ----------------------------------------------------------------------------------------- |
| actorid | The ID of the actor (returned by [CreateActor](CreateActor)) to clear the animations for. |
## Returns
**true** - The function executed successfully.
**false** - The function failed to execute. The actor specified does not exist.
## Examples
```c
new gMyActor;
public OnGameModeInit()
{
gMyActor = CreateActor(179, 316.1, -134.0, 999.6, 90.0); // Actor as salesperson in Ammunation
ApplyActorAnimation(gMyActor, "DEALER", "shop_pay", 4.1, false, false, false, false, 0); // Pay anim
return 1;
}
// Somewhere else
ClearActorAnimations(gMyActor);
```
## Related Functions
- [ApplyActorAnimation](ApplyActorAnimation): Apply an animation to an actor.
| openmultiplayer/web/docs/scripting/functions/ClearActorAnimations.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/ClearActorAnimations.md",
"repo_id": "openmultiplayer",
"token_count": 372
} | 292 |
---
title: CreatePlayerPickup
description: Creates a pickup which will be visible to only one player.
tags: ["player", "pickup", "playerpickup"]
---
<VersionWarn version='omp v1.1.0.2612' />
## Description
Creates a pickup which will be visible to only one player.
| Name | Description |
|----------------------------------|-----------------------------------------------------------------------------------|
| playerid | The ID of the player to create the pickup for. |
| [model](../resources/pickupids) | The model of the pickup. |
| [type](../resources/pickuptypes) | The pickup type. Determines how the pickup responds when picked up. |
| Float:x | The X coordinate to create the pickup at. |
| Float:y | The Y coordinate to create the pickup at. |
| Float:z | The Z coordinate to create the pickup at. |
| virtualWorld | The virtual world ID of the pickup. Use -1 to make the pickup show in all worlds. |
## Returns
The ID of the created player-pickup, **-1** on failure (pickup max limit).
## Examples
```c
new PlayerPickupArmour[MAX_PLAYERS]; // Create a variable to store the player-pickup ID in
public OnPlayerConnect(playerid)
{
PlayerPickupArmour[playerid] = CreatePlayerPickup(playerid, 1242, 2, 2010.0979, 1222.0642, 10.8206, -1);
// Create an armour pickup and store the ID in 'PlayerPickupArmour[playerid]'
return 1;
}
```
## Notes
:::tip
- The only type of pickup that can be picked up from inside a vehicle is 14 (except for special pickups such as bribes).
- Pickups are shown to, and can be picked up by all players.
- It is possible that if DestroyPlayerPickup() is used when a pickup is picked up, more than one player can pick up the pickup, due to lag. This can be circumvented through the use of variables.
- Certain pickup types come with 'automatic responses', for example using an M4 model in the pickup will automatically give the player the weapon and some ammo.
- For fully scripted pickups, type 1 should be used.
:::
:::warning
Known Bug(s):
- Pickups that have a X or Y lower than -4096.0 or bigger than 4096.0 won't show up and won't trigger OnPlayerPickUpPlayerPickup either.
:::
## 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.
- [SetPlayerPickupType](SetPlayerPickupType): Sets the type 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.
## Related Callbacks
The following callbacks might be useful, as they're related to this function.
- [OnPlayerPickUpPlayerPickup](../callbacks/OnPlayerPickUpPlayerPickup): Called when a player picks up a player-pickup.
- [OnPlayerPickupStreamIn](../callbacks/OnPlayerPickupStreamIn): Called when a player-pickup enters the visual range of the player.
- [OnPlayerPickupStreamOut](../callbacks/OnPlayerPickupStreamOut): Called when a player-pickup leaves the visual range of the player.
## Related Resources
- [Pickup IDs](../resources/pickupids)
- [Pickup Types](../resources/pickuptypes)
| openmultiplayer/web/docs/scripting/functions/CreatePlayerPickup.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/CreatePlayerPickup.md",
"repo_id": "openmultiplayer",
"token_count": 1527
} | 293 |
---
title: DisableMenu
description: Disable a menu.
tags: ["menu"]
---
## Description
Disable a menu.
| Name | Description |
| ----------- | ------------------------------ |
| Menu:menuid | The ID of the menu to disable. |
## Returns
This function does not return any specific values.
## Examples
```c
new WeaponMenu;
public OnGameModeInit()
{
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");
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp(cmdtext, "/disableguns", true))
{
DisableMenu(WeaponMenu); //Disable the weapon menu
return 1;
}
return 0;
}
```
## Notes
:::tip
Crashes when passed an invalid menu ID.
:::
## Related Functions
- [CreateMenu](CreateMenu): Create a menu.
- [DestroyMenu](DestroyMenu): Destroy a menu.
- [AddMenuItem](AddMenuItem): Add an item to a menu.
- [IsMenuDisabled](IsMenuDisabled): Check if a menu is disabled.
| openmultiplayer/web/docs/scripting/functions/DisableMenu.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/DisableMenu.md",
"repo_id": "openmultiplayer",
"token_count": 419
} | 294 |
---
title: EnableZoneNames
description: This function allows to turn on zone / area names such as the "Vinewood" or "Doherty" text at the bottom-right of the screen as they enter the area.
tags: []
---
## Description
This function allows to turn on zone / area names such as the "Vinewood" or "Doherty" text at the bottom-right of the screen as they enter the area. This is a gamemode option and should be set in the callback OnGameModeInit.
| Name | Description |
| ----------- | ---------------------------------------------------------------------------------------------------- |
| bool:enable | A toggle option for whether or not you'd like zone names on or off. 'false' is off and 'true' is on. |
## Returns
This function does not return any specific values.
## Examples
```c
public OnGameModeInit()
{
EnableZoneNames(true);
return 1;
}
```
## Notes
:::warning
This function was removed in SA-MP 0.3. This was due to crashes it caused.
:::
:::tip
You can also enable or disable zone names via [config.json](../../server/config.json)
```json
"use_zone_names": true,
```
:::
| openmultiplayer/web/docs/scripting/functions/EnableZoneNames.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/EnableZoneNames.md",
"repo_id": "openmultiplayer",
"token_count": 408
} | 295 |
---
title: GangZoneHideForPlayer
description: Hides a gangzone for a player.
tags: ["player", "gangzone"]
---
## Description
Hides a gangzone for a player.
| Name | Description |
| -------- | ---------------------------------------------- |
| playerid | The ID of the player to hide the gangzone for. |
| zoneid | The ID of the zone to hide. |
## Returns
This function does not return any specific values.
## Examples
```c
new gGangZoneId;
public OnGameModeInit()
{
gGangZoneId = GangZoneCreate(1248.011, 2072.804, 1439.348, 2204.319);
return 1;
}
public OnPlayerSpawn(playerid)
{
GangZoneShowForPlayer(playerid, gGangZoneId, 0xFF0000FF);
return 1;
}
public OnPlayerDeath(playerid, killerid, WEAPON:reason)
{
GangZoneHideForPlayer(playerid, gGangZoneId);
return 1;
}
```
## Related Functions
- [GangZoneCreate](GangZoneCreate): Create a gangzone.
- [GangZoneDestroy](GangZoneDestroy): Destroy a gangzone.
- [GangZoneShowForPlayer](GangZoneShowForPlayer): Show a gangzone for a player.
- [GangZoneShowForAll](GangZoneShowForAll): Show a gangzone for all players.
- [GangZoneHideForAll](GangZoneHideForAll): Hide a gangzone for all players.
- [GangZoneFlashForPlayer](GangZoneFlashForPlayer): Make a gangzone flash for a player.
- [GangZoneFlashForAll](GangZoneFlashForAll): Make a gangzone flash for all players.
- [GangZoneStopFlashForPlayer](GangZoneStopFlashForPlayer): Stop a gangzone flashing for a player.
- [GangZoneStopFlashForAll](GangZoneStopFlashForAll): Stop a gangzone flashing for all players.
| openmultiplayer/web/docs/scripting/functions/GangZoneHideForPlayer.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/GangZoneHideForPlayer.md",
"repo_id": "openmultiplayer",
"token_count": 563
} | 296 |
---
title: GetActorPoolSize
description: Gets the highest actorid created on the server.
tags: ["actor"]
---
<VersionWarn version='SA-MP 0.3.7' />
## Description
Gets the highest actorid created on the server. Note that in SA:MP this function is broken and will return `0` even when there are no actors. fixes.inc and open.mp correct this to return `-1`, but also deprecate the function in favour of `MAX_ACTORS` or `foreach`.
## Examples
```c
SetAllActorsHealth(Float:health)
{
for(new i = 0, j = GetActorPoolSize(); i <= j; i++)
{
if (IsValidActor(i))
{
SetActorHealth(i, health);
}
}
}
```
## Related Functions
- [CreateActor](CreateActor): Create an actor (static NPC).
- [IsValidActor](isValidActor): Check if actor id is valid.
- [SetActorHealth](SetActorHealth): Set the health of an actor.
| openmultiplayer/web/docs/scripting/functions/GetActorPoolSize.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/GetActorPoolSize.md",
"repo_id": "openmultiplayer",
"token_count": 299
} | 297 |
---
title: GetMaxPlayers
description: Returns the maximum number of players that can join the server, as set by the server variable 'maxplayers' in server.
tags: ["player"]
---
## Description
Returns the maximum number of players that can join the server, as set by the server variable 'max_players' in config.json.
## Examples
```c
new string[128];
format(string, sizeof(string), "There are %i slots on this server!", GetMaxPlayers());
SendClientMessage(playerid, 0xFFFFFFFF, string);
```
## Notes
:::warning
- This function can not be used in place of MAX_PLAYERS.
- It can not be used at compile time (e.g. for array sizes).
- `MAX_PLAYERS` should always be re-defined to what the 'max_players' var will be, or higher.
:::
## Related Functions
- [GetPlayerPoolSize](GetPlayerPoolSize): Gets the highest playerid connected to the server.
- [IsPlayerConnected](IsPlayerConnected): Check if a player is connected to the server.
| openmultiplayer/web/docs/scripting/functions/GetMaxPlayers.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/GetMaxPlayers.md",
"repo_id": "openmultiplayer",
"token_count": 264
} | 298 |
---
title: GetObjectModel
description: Get the model ID of an object (CreateObject).
tags: ["object"]
---
<VersionWarn version='SA-MP 0.3.7' />
## Description
Get the model ID of an object ([CreateObject](CreateObject)).
| Name | Description |
| -------- | ---------------------------------------- |
| objectid | The ID of the object to get the model of |
## Returns
The model ID of the object.
**-1** if object does not exist.
## Examples
```c
public OnGameModeInit()
{
new objectid = CreateObject(19609, 666.57239, 1750.79749, 4.95627, 0.00000, 0.00000, -156.00000);
new modelid = GetObjectModel(objectid);
printf("Object model: %d", modelid); // Output: "Object model: 19609"
return 1;
}
```
## Related Functions
- [GetPlayerObjectModel](GetPlayerObjectModel): Get the model ID of a player-object.
| openmultiplayer/web/docs/scripting/functions/GetObjectModel.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/GetObjectModel.md",
"repo_id": "openmultiplayer",
"token_count": 305
} | 299 |
---
title: GetPlayerArmour
description: This function stores the armour of a player into a variable.
tags: ["player"]
---
## Description
This function stores the armour of a player into a variable.
| Name | Description |
| ------------- | --------------------------------------------------------- |
| playerid | The ID of the player that you want to get the armour of. |
| &Float:armour | The float to to store the armour in, passed by reference. |
## Returns
**1** - success
**0** - failure (i.e. player not connected).
The player's armour is stored in the specified variable.
## Examples
```c
public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp(cmdtext, "/myarmour", true))
{
new string[40];
new Float:armour;
GetPlayerArmour(playerid, armour);
format(string, sizeof(string), "SERVER: Your armour is %.2f percent", armour);
SendClientMessage(playerid, 0xFFFFFFAA, string);
return 1;
}
return 0;
}
```
## Notes
:::warning
Even though the armour can be set to near infinite values on the server side, the individual clients will only report values up to 255. Anything higher will wrap around; 256 becomes 0, 257 becomes 1, etc. Armour is obtained rounded to integers: set 50.15, but get 50.0
:::
## Related Functions
- [SetPlayerArmour](SetPlayerArmour): Set the armour of a player.
- [GetPlayerHealth](GetPlayerHealth): Find out how much health a player has.
- [GetVehicleHealth](GetVehicleHealth): Check the health of a vehicle.
| openmultiplayer/web/docs/scripting/functions/GetPlayerArmour.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/GetPlayerArmour.md",
"repo_id": "openmultiplayer",
"token_count": 501
} | 300 |
---
title: GetPlayerColor
description: Gets the color of the player's name and radar marker.
tags: ["player"]
---
## Description
Gets the color of the player's name and radar marker. Only works after SetPlayerColor.
| Name | Description |
| -------- | ----------------------------------------- |
| playerid | The ID of the player to get the color of. |
## Returns
The player's color. 0 if no color set or player not connected.
## Examples
```c
SendClientMessage(playerid, GetPlayerColor(playerid), "This message is in your color :)");
new output[144];
format(output, sizeof(output), "You can also use the player's color for {%06x}color embedding!", GetPlayerColor(playerid) >>> 8);
SendClientMessage(playerid, -1, output);
// will output the message in white, with ''color embedding'' in the player's color
```
## Notes
:::warning
GetPlayerColor will return nothing (0) unless SetPlayerColor has been used first. Click [HERE](../../tutorials/colorfix) for a fix.
:::
## Related Functions
- [SetPlayerColor](SetPlayerColor): Set a player's color.
- [ChangeVehicleColor](ChangeVehicleColor): Set the color of a vehicle.
| openmultiplayer/web/docs/scripting/functions/GetPlayerColor.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/GetPlayerColor.md",
"repo_id": "openmultiplayer",
"token_count": 353
} | 301 |
---
title: GetPlayerLandingGearState
description: Gets the landing gear state of the current player's vehicle.
tags: ["player", "vehicle"]
---
<VersionWarn version='omp v1.1.0.2612' />
## Description
Gets the [landing gear state](../resources/landinggearstate) of the current player's vehicle.
## Parameters
| Name | Description |
|----------|-----------------------|
| playerid | The ID of the player. |
## Examples
```c
new LANDING_GEAR_STATE:state = GetPlayerLandingGearState(playerid);
```
## Related Functions
- [GetVehicleLandingGearState](GetVehicleLandingGearState): Gets the current vehicle landing gear state from the latest driver.
## Related Resources
- [Vehicle Landing Gear States](../resources/landinggearstate)
| openmultiplayer/web/docs/scripting/functions/GetPlayerLandingGearState.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/GetPlayerLandingGearState.md",
"repo_id": "openmultiplayer",
"token_count": 227
} | 302 |
---
title: GetPlayerObjectMovingTargetPos
description: Get the move target position of a player-object.
tags: ["player", "object", "playerobject"]
---
<VersionWarn version='omp v1.1.0.2612' />
## Description
Get the move target position of a player-object.
| Name | Description |
|----------------|---------------------------------------------------------------------------------|
| playerid | The ID of the player. |
| objectid | The ID of the player-object to get the move target position of. |
| &Float:targetX | A float variable in which to store the targetX coordinate, passed by reference. |
| &Float:targetY | A float variable in which to store the targetY coordinate, passed by reference. |
| &Float:targetZ | A float variable in which to store the targetZ coordinate, passed by reference. |
## Returns
`true` - The function was executed successfully.
`false` - The function failed to execute. The object specified does not exist.
## Examples
```c
new playerobjectid = CreatePlayerObject(playerid, 985, 1003.39154, -643.33423, 122.35060, 0.00000, 1.00000, 24.00000);
MovePlayerObject(playerid, playerobjectid, 1003.3915, -643.3342, 114.5122, 0.8);
new
Float:targetX,
Float:targetY,
Float:targetZ;
GetPlayerObjectMovingTargetPos(playerid, playerobjectid, targetX, targetY, targetZ);
// targetX = 1003.3915
// targetY = -643.3342
// targetZ = 114.5122
```
## Related Functions
- [GetPlayerObjectMovingTargetRot](GetPlayerObjectMovingTargetRot): Get the move target rotation of a player-object.
- [GetObjectMovingTargetPos](GetObjectMovingTargetPos): Get the move target position of an object.
| openmultiplayer/web/docs/scripting/functions/GetPlayerObjectMovingTargetPos.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/GetPlayerObjectMovingTargetPos.md",
"repo_id": "openmultiplayer",
"token_count": 634
} | 303 |
---
title: GetPlayerSirenState
description: Gets the siren state of the player's vehicle.
tags: ["player", "vehicle"]
---
<VersionWarn version='omp v1.1.0.2612' />
## Description
Gets the siren state of the player's vehicle.
## Parameters
| Name | Description |
|----------|-----------------------|
| playerid | The ID of the player. |
## Return Values
Returns the vehicle siren state.
## Examples
```c
public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp(cmdtext, "/siren", true))
{
if (!IsPlayerInAnyVehicle(playerid))
{
return 1;
}
new bool:sirenState = GetPlayerSirenState(playerid);
SendClientMessage(playerid, 0xFFFF00FF, "Vehicle siren state: %s", sirenState ? "On" : "Off");
return 1;
}
return 0;
}
```
## Related Functions
- [SetVehicleParamsSirenState](SetVehicleParamsSirenState): Turn the siren for a vehicle on or off.
- [ToggleVehicleSirenEnabled](ToggleVehicleSirenEnabled): Turn the siren for a vehicle on or off.
- [IsVehicleSirenEnabled](IsVehicleSirenEnabled): Checks if a vehicle siren is on or off.
- [GetVehicleSirenState](GetVehicleSirenState): Gets the siren state of the vehicle.
| openmultiplayer/web/docs/scripting/functions/GetPlayerSirenState.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/GetPlayerSirenState.md",
"repo_id": "openmultiplayer",
"token_count": 449
} | 304 |
---
title: GetPlayerVehicleID
description: This function gets the ID of the vehicle the player is currently in.
tags: ["player", "vehicle"]
---
## Description
This function gets the ID of the vehicle the player is currently in.
**Note:** NOT the model id of the vehicle. See [GetVehicleModel](GetVehicleModel) for that.
| Name | Description |
| -------- | ------------------------------------------------------------------ |
| playerid | The ID of the player in the vehicle that you want to get the ID of |
## Returns
ID of the vehicle or **0** if not in a vehicle
## Examples
```c
// Add 10x Nitro if the player is in a car. Might be called on a command.
new vehicleId = GetPlayerVehicleID(playerid);
if (vehicleId != 0)
{
AddVehicleComponent(vehicleId, 1010);
}
```
## Related Functions
- [IsPlayerInVehicle](IsPlayerInVehicle): Check if a player is in a certain vehicle.
- [IsPlayerInAnyVehicle](IsPlayerInAnyVehicle): Check if a player is in any vehicle.
- [GetPlayerVehicleSeat](GetPlayerVehicleSeat): Check what seat a player is in.
- [GetVehicleModel](GetVehicleModel): Get the model id of a vehicle.
| openmultiplayer/web/docs/scripting/functions/GetPlayerVehicleID.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/GetPlayerVehicleID.md",
"repo_id": "openmultiplayer",
"token_count": 382
} | 305 |
---
title: GetSVarInt
description: Gets an integer server variable's value.
tags: ["server variable", "svar"]
---
<VersionWarn version='SA-MP 0.3.7 R2' />
## Description
Gets an integer server variable's value.
| Name | Description |
| ------------ | ---------------------------------------------------------------------------------------------- |
| const svar[] | The name of the server variable (case-insensitive).<br />Assigned in [SetSVarInt](SetSVarInt). |
## Returns
The integer value of the specified server variable.
It will still return 0 if the variable is not set.
## Examples
```c
// set "Version"
SetSVarInt("Version", 37);
// will print version that server has
printf("Version: %d", GetSVarInt("Version"));
```
## Related Functions
- [SetSVarInt](SetSVarInt): Set an integer for a server variable.
- [SetSVarString](SetSVarString): Set a string for a server variable.
- [GetSVarString](GetSVarString): Get the previously set string from a server variable.
- [SetSVarFloat](SetSVarFloat): Set a float for a server variable.
- [GetSVarFloat](GetSVarFloat): Get the previously set float from a server variable.
- [DeleteSVar](DeleteSVar): Delete a server variable.
| openmultiplayer/web/docs/scripting/functions/GetSVarInt.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/GetSVarInt.md",
"repo_id": "openmultiplayer",
"token_count": 425
} | 306 |
---
title: GetVehicleComponentInSlot
description: Retrieves the installed component ID (modshop mod(ification)) on a vehicle in a specific slot.
tags: ["vehicle"]
---
## Description
Retrieves the installed component ID (modshop mod(ification)) on a vehicle in a specific slot.
| Name | Description |
| --------------- | -------------------------------------------------------------------------- |
| vehicleid | The ID of the vehicle to check for the component. |
| CARMODTYPE:slot | The [component slot](../resources/Componentslots) to check for components. |
## Returns
The ID of the component installed in the specified slot.
Returns **0** if no component in specified vehicle's specified slot, or if vehicle doesn't exist.
## Examples
```c
public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp("/myspoiler", cmdtext, true))
{
if (!IsPlayerInAnyVehicle(playerid))
{
return 1;
}
new
component = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), CARMODTYPE_SPOILER);
if (component == 1049)
{
SendClientMessage(playerid, -1, "You have an Alien spoiler installed in your Elegy!");
}
return 1;
}
return 0;
}
```
## Notes
:::warning
Known Bug(s):
- Doesn't work for CARMODTYPE_STEREO.
- Both front bull bars and front bumper components are saved in the CARMODTYPE_FRONT_BUMPER slot. If a vehicle has both of them installed, this function will only return the one which was installed last.
- Both rear bull bars and rear bumper components are saved in the CARMODTYPE_REAR_BUMPER slot. If a vehicle has both of them installed, this function will only return the one which was installed last.
- Both left side skirt and right side skirt are saved in the CARMODTYPE_SIDESKIRT slot. If a vehicle has both of them installed, this function will only return the one which was installed last.
:::
## Related Functions
- [AddVehicleComponent](AddVehicleComponent): Add a component to a vehicle.
- [GetVehicleComponentType](GetVehicleComponentType): Check the type of component via the ID.
## Related Callbacks
- [OnVehicleMod](../callbacks/OnVehicleMod): Called when a vehicle is modded.
- [OnEnterExitModShop](../callbacks/OnEnterExitModShop): Called when a vehicle enters or exits a mod shop.
## Related Resources
- [Vehicle Component Slots](../resources/Componentslots)
| openmultiplayer/web/docs/scripting/functions/GetVehicleComponentInSlot.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/GetVehicleComponentInSlot.md",
"repo_id": "openmultiplayer",
"token_count": 831
} | 307 |
---
title: GetVehicleOccupiedTick
description: Get the occupied tick of a vehicle.
tags: ["vehicle"]
---
<VersionWarn version='omp v1.1.0.2612' />
## Description
Get the occupied tick of a vehicle.
## Parameters
| Name | Description |
|-----------|------------------------|
| vehicleid | The ID of the vehicle. |
## Return Values
Returns occupied tick in milliseconds.
## Examples
```c
public OnGameModeInit()
{
new vehicleid = CreateVehicle(560, 2096.1917, -1328.5150, 25.1059, 0.0000, 1, 8, 60);
new occupiedTick = GetVehicleOccupiedTick(vehicleid);
printf("Vehicle ID %d occupied tick: %d ms", vehicleid, occupiedTick);
return 1;
}
```
## Related Functions
- [SetVehicleOccupiedTick](SetVehicleOccupiedTick): Set the occupied tick of a vehicle.
| openmultiplayer/web/docs/scripting/functions/GetVehicleOccupiedTick.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/GetVehicleOccupiedTick.md",
"repo_id": "openmultiplayer",
"token_count": 275
} | 308 |
---
title: GetVehicleTrainSpeed
description: Gets the speed of the train.
tags: ["vehicle"]
---
<VersionWarn version='omp v1.1.0.2612' />
## Description
Gets the speed of the train.
## Parameters
| Name | Description |
|-----------|------------------------|
| vehicleid | The ID of the vehicle. |
## Examples
```c
new vehicleid = GetPlayerVehicleID(playerid);
new Float:speed = GetVehicleTrainSpeed(vehicleid);
```
## Related Functions
- [GetPlayerTrainSpeed](GetPlayerTrainSpeed): Gets the speed of the player's train.
| openmultiplayer/web/docs/scripting/functions/GetVehicleTrainSpeed.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/GetVehicleTrainSpeed.md",
"repo_id": "openmultiplayer",
"token_count": 179
} | 309 |
---
title: HideGameTextForAll
description: Stop showing a gametext style for all players.
tags: ["player", "gametext"]
---
<VersionWarn version='omp v1.1.0.2612' />
## Description
Stop showing a gametext style for all players.
| Name | Description |
| -------------- | ----------------------------------------------------------------- |
| style | The [style](../resources/gametextstyles) of text to hide. |
## Returns
This function does not return any specific value.
## Examples
```c
public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp(cmdtext, "/hidegametext3", true))
{
if (!IsPlayerAdmin(playerid))
{
return 1;
}
HideGameTextForAll(3);
return 1;
}
return 0;
}
```
## Related Functions
- [HideGameTextForPlayer](HideGameTextForPlayer): Stop showing a gametext style to a player.
- [GameTextForPlayer](GameTextForPlayer): Display gametext to a player.
- [GameTextForAll](GameTextForAll): Display gametext to all players.
- [TextDrawHideForAll](TextDrawHideForAll): Hide a textdraw for all players.
| openmultiplayer/web/docs/scripting/functions/HideGameTextForAll.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/HideGameTextForAll.md",
"repo_id": "openmultiplayer",
"token_count": 449
} | 310 |
---
title: IsMenuDisabled
description: Checks if a menu is disabled.
tags: ["menu"]
---
<VersionWarn version='omp v1.1.0.2612' />
## Description
Checks if a menu is disabled.
| Name | Description |
| ----------- | ---------------------------- |
| Menu:menuid | The ID of the menu to check. |
## Returns
Returns **true** if the menu is disabled, otherwise **false**.
## Related Functions
- [IsValidMenu](IsValidMenu): Checks if a menu ID is valid.
- [IsMenuRowDisabled](IsMenuRowDisabled): Checks if a menu row is disabled.
| openmultiplayer/web/docs/scripting/functions/IsMenuDisabled.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/IsMenuDisabled.md",
"repo_id": "openmultiplayer",
"token_count": 185
} | 311 |
---
title: IsPlayerGangZoneVisible
description: Check if the player gangzone is visible.
tags: ["player", "gangzone", "playergangzone"]
---
<VersionWarn version='omp v1.1.0.2612' />
## Description
Check if the player gangzone is visible.
| Name | Description |
| ----------- | ---------------------------------------------------------------- |
| playerid | The ID of the player to whom player gangzone is bound. |
| zoneid | The ID of the player gangzone. |
## Returns
**true** - The player gangzone is visible.
**false** - The player gangzone is not visible.
## Examples
```c
new gGangZoneID[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
// Create the gangzone
gGangZoneID[playerid] = CreatePlayerGangZone(playerid, 2236.1475, 2424.7266, 2319.1636, 2502.4348);
// Show the gangzone to player
PlayerGangZoneShow(playerid, gGangZoneID[playerid], 0xFF0000FF);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp(cmdtext, "/zone", true))
{
if (IsPlayerGangZoneVisible(playerid, gGangZoneID[playerid]))
{
SendClientMessage(playerid, 0x00FF00FF, "Gangzone is visible.");
}
else
{
SendClientMessage(playerid, 0xFF0000FF, "Gangzone is not visible.");
}
return 1;
}
return 0;
}
```
## Related Functions
- [CreatePlayerGangZone](CreatePlayerGangZone): Create player gangzone.
- [PlayerGangZoneDestroy](PlayerGangZoneDestroy): Destroy player gangzone.
- [PlayerGangZoneShow](PlayerGangZoneShow): Show player gangzone.
- [PlayerGangZoneHide](PlayerGangZoneHide): Hide player gangzone.
- [PlayerGangZoneFlash](PlayerGangZoneFlash): Start player gangzone flash.
- [PlayerGangZoneStopFlash](PlayerGangZoneStopFlash): Stop player gangzone flash.
- [PlayerGangZoneGetFlashColour](PlayerGangZoneGetFlashColour): Get the flashing colour of a player gangzone.
- [PlayerGangZoneGetColour](PlayerGangZoneGetColour): Get the colour of a player gangzone.
- [PlayerGangZoneGetPos](PlayerGangZoneGetPos): Get the position of a gangzone, represented by minX, minY, maxX, maxY coordinates.
- [IsValidPlayerGangZone](IsValidPlayerGangZone): Check if the player gangzone valid.
- [IsPlayerInPlayerGangZone](IsPlayerInPlayerGangZone): Check if the player in player gangzone.
- [IsPlayerGangZoneFlashing](IsPlayerGangZoneFlashing): Check if the player gangzone is flashing.
- [UsePlayerGangZoneCheck](UsePlayerGangZoneCheck): Enables the callback when a player enters/leaves this zone. | openmultiplayer/web/docs/scripting/functions/IsPlayerGangZoneVisible.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/IsPlayerGangZoneVisible.md",
"repo_id": "openmultiplayer",
"token_count": 956
} | 312 |
---
title: IsPlayerStreamedIn
description: Checks if a player is streamed in another player's client.
tags: ["player"]
---
## Description
Checks if a player is streamed in another player's client.
| Name | Description |
| ----------- | ------------------------------------------------------------- |
| playerid | The ID of the player to check is streamed in. |
| forplayerid | The ID of the player to check if playerid is streamed in for. |
## Returns
**true** - The player is streamed in.
**false** - The player is not streamed in.
## Examples
```c
if (IsPlayerStreamedIn(playerid, 0))
{
SendClientMessage(playerid, -1, "ID 0 can see you.");
}
```
## Notes
:::tip
**SA-MP server:** Players stream out if they are more than 200.0 meters away (see [server.cfg](../../server/server.cfg) - **stream_distance**)
**open.mp server:** Players stream out if they are more than 200.0 meters away (see [config.json](../../server/config.json) - **network.stream_radius**)
:::
:::warning
Players aren't streamed in on their own client, so if playerid is the same as forplayerid it will return false!
:::
## Related Functions
- [IsActorStreamedIn](IsActorStreamedIn): Checks if an actor is streamed in for a player.
- [IsVehicleStreamedIn](IsVehicleStreamedIn): Checks if a vehicle is streamed in for a player.
## Related Callbacks
- [OnPlayerStreamIn](../callbacks/OnPlayerStreamIn): Called when a player streams in for another player.
- [OnPlayerStreamOut](../callbacks/OnPlayerStreamOut): Called when a player streams out for another player.
- [OnVehicleStreamIn](../callbacks/OnVehicleStreamIn): Called when a vehicle streams in for a player.
- [OnVehicleStreamOut](../callbacks/OnVehicleStreamOut): Called when a vehicle streams out for a player.
| openmultiplayer/web/docs/scripting/functions/IsPlayerStreamedIn.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/IsPlayerStreamedIn.md",
"repo_id": "openmultiplayer",
"token_count": 575
} | 313 |
---
title: KillTimer
description: Kills (stops) a running timer.
tags: ["timer"]
---
## Description
Kills (stops) a running timer.
| Name | Description |
| ------- | ----------------------------------------------------------------- |
| timerid | The ID of the timer to kill (returned by SetTimer or SetTimerEx). |
## Returns
This function always returns 0.
## Examples
```c
new gConnectTimer[MAX_PLAYERS] = {0, ...};
public OnPlayerConnect(playerid)
{
print("Starting timer...");
gConnectTimer[playerid] = SetTimerEx("WelcomeTimer", 5000, true, "i", playerid);
return 1;
}
public OnPlayerDisconnect(playerid)
{
KillTimer(gConnectTimer[playerid]);
gConnectTimer[playerid] = 0;
return 1;
}
forward WelcomeTimer(playerid);
public WelcomeTimer(playerid)
{
SendClientMessage(playerid, -1, "Welcome!");
}
```
## Related Functions
- [SetTimer](SetTimer): Set a timer.
- [SetTimerEx](SetTimerEx): Set a timer with parameters.
- [IsValidTimer](IsValidTimer): Checks if a timer is valid.
- [IsRepeatingTimer](IsRepeatingTimer): Checks if a timer is set to repeat.
- [GetTimerInterval](GetTimerInterval): Gets the interval of a timer.
- [GetTimerRemaining](GetTimerRemaining): Gets the remaining interval of a timer.
- [CountRunningTimers](CountRunningTimers): Get the running timers.
| openmultiplayer/web/docs/scripting/functions/KillTimer.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/KillTimer.md",
"repo_id": "openmultiplayer",
"token_count": 463
} | 314 |
---
title: PauseRecordingPlayback
description: This will pause playing back the recording.
tags: []
---
## Description
This will pause playing back the recording.
## Related Functions
- [ResumeRecordingPlayback](../functions/ResumeRecordingPlayback): Resumes the recording if its paused.
| openmultiplayer/web/docs/scripting/functions/PauseRecordingPlayback.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/PauseRecordingPlayback.md",
"repo_id": "openmultiplayer",
"token_count": 77
} | 315 |
---
title: PlayerTextDrawBackgroundColor
description: Adjust the background color of a player-textdraw.
tags: ["player", "textdraw", "playertextdraw"]
---
## Description
Adjust the background color of a player-textdraw.
| Name | Description |
| ----------------- | ------------------------------------------------------------------------- |
| playerid | The ID of the player whose player-textdraw to set the background color of |
| PlayerText:textid | The ID of the player-textdraw to set the background color of |
| backgroundColour | The color that the textdraw should be set to. |
## Returns
This function does not return any specific values.
## Examples
```c
new PlayerText:gMyTextdraw[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
gMyTextdraw[playerid] = CreatePlayerTextDraw(playerid, 320.0, 240.0, "Welcome to my OPEN.MP server");
PlayerTextDrawUseBox(playerid, gMyTextdraw[playerid], true);
PlayerTextDrawBackgroundColor(playerid, gMyTextdraw[playerid], 0xFFFFFFFF); // Set the background colour of gMyTextdraw to white
return 1;
}
```
## Notes
:::tip
- If [PlayerTextDrawSetOutline](PlayerTextDrawSetOutline) is used with size > 0, the outline colour will match the colour used in PlayerTextDrawBackgroundColour.
- Changing the value of colour seems to alter the colour used in PlayerTextDrawColour.
:::
## Related Functions
- [CreatePlayerTextDraw](CreatePlayerTextDraw): Create a player-textdraw.
- [PlayerTextDrawDestroy](PlayerTextDrawDestroy): Destroy a player-textdraw.
- [PlayerTextDrawColor](PlayerTextDrawColor): Set the color of the text in a player-textdraw.
- [PlayerTextDrawBoxColor](PlayerTextDrawBoxColor): Set the color of a player-textdraw's box.
- [PlayerTextDrawAlignment](PlayerTextDrawAlignment): Set the alignment of a player-textdraw.
- [PlayerTextDrawFont](PlayerTextDrawFont): Set the font of a player-textdraw.
- [PlayerTextDrawLetterSize](PlayerTextDrawLetterSize): Set the letter size of the text in a player-textdraw.
- [PlayerTextDrawTextSize](PlayerTextDrawTextSize): Set the size of a player-textdraw box (or clickable area for PlayerTextDrawSetSelectable).
- [PlayerTextDrawSetOutline](PlayerTextDrawSetOutline): Toggle the outline on a player-textdraw.
- [PlayerTextDrawSetShadow](PlayerTextDrawSetShadow): Set the shadow on a player-textdraw.
- [PlayerTextDrawSetProportional](PlayerTextDrawSetProportional): Scale the text spacing in a player-textdraw to a proportional ratio.
- [PlayerTextDrawUseBox](PlayerTextDrawUseBox): Toggle the box on a player-textdraw.
- [PlayerTextDrawSetString](PlayerTextDrawSetString): Set the text of a player-textdraw.
- [PlayerTextDrawShow](PlayerTextDrawShow): Show a player-textdraw.
- [PlayerTextDrawHide](PlayerTextDrawHide): Hide a player-textdraw.
| openmultiplayer/web/docs/scripting/functions/PlayerTextDrawBackgroundColor.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/PlayerTextDrawBackgroundColor.md",
"repo_id": "openmultiplayer",
"token_count": 889
} | 316 |
---
title: PlayerTextDrawGetLetterSize
description: Gets the width and height of the letters.
tags: ["player", "textdraw", "playertextdraw"]
---
<VersionWarn version='omp v1.1.0.2612' />
## Description
Gets the width and height of the letters.
| Name | Description |
| ----------------- | ----------------------------------------------------------------- |
| playerid | The ID of the player. |
| PlayerText:textid | The ID of the player-textdraw to get letter size of. |
| &Float:width | A float variable into which to store width, passed by reference. |
| &Float:height | A float variable into which to store height, passed by reference. |
## Returns
This function does not return any specific values.
## Examples
```c
new PlayerText:welcomeText[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
welcomeText[playerid] = CreatePlayerTextDraw(playerid, 320.0, 240.0, "Welcome to my OPEN.MP server");
PlayerTextDrawLetterSize(playerid, welcomeText[playerid], 3.2, 5.1);
PlayerTextDrawShow(playerid, welcomeText[playerid]);
new Float:width, Float:height;
PlayerTextDrawGetLetterSize(playerid, welcomeText[playerid], width, height);
// width = 3.2
// height = 5.1
return 1;
}
```
## Related Functions
- [PlayerTextDrawCreate](PlayerTextDrawCreate): Create a player-textdraw.
- [PlayerTextDrawDestroy](PlayerTextDrawDestroy): Destroy a player-textdraw.
- [PlayerTextDrawLetterSize](PlayerTextDrawLetterSize): Set the letter size of the text in a player-textdraw.
- [PlayerTextDrawColor](PlayerTextDrawColor): Set the color of the text in a player-textdraw.
- [PlayerTextDrawBoxColor](PlayerTextDrawBoxColor): Set the color of a player-textdraw's box.
- [PlayerTextDrawBackgroundColor](PlayerTextDrawBackgroundColor): Set the background color of a player-textdraw.
- [PlayerTextDrawAlignment](PlayerTextDrawAlignment): Set the alignment of a player-textdraw.
- [PlayerTextDrawFont](PlayerTextDrawFont): Set the font of a player-textdraw.
- [PlayerTextDrawTextSize](PlayerTextDrawTextSize): Set the size of a player-textdraw box (or clickable area for PlayerTextDrawSetSelectable).
- [PlayerTextDrawSetOutline](PlayerTextDrawSetOutline): Toggle the outline on a player-textdraw.
- [PlayerTextDrawSetShadow](PlayerTextDrawSetShadow): Set the shadow on a player-textdraw.
- [PlayerTextDrawSetProportional](PlayerTextDrawSetProportional): Scale the text spacing in a player-textdraw to a proportional ratio.
- [PlayerTextDrawUseBox](PlayerTextDrawUseBox): Toggle the box on a player-textdraw.
- [PlayerTextDrawSetString](PlayerTextDrawSetString): Set the text of a player-textdraw.
- [PlayerTextDrawShow](PlayerTextDrawShow): Show a player-textdraw.
- [PlayerTextDrawHide](PlayerTextDrawHide): Hide a player-textdraw.
- [IsPlayerTextDrawVisible](IsPlayerTextDrawVisible): Checks if a player-textdraw is shown for the player.
- [IsValidPlayerTextDraw](IsValidPlayerTextDraw): Checks if a player-textdraw is valid.
| openmultiplayer/web/docs/scripting/functions/PlayerTextDrawGetLetterSize.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/PlayerTextDrawGetLetterSize.md",
"repo_id": "openmultiplayer",
"token_count": 982
} | 317 |
---
title: RemovePlayerFromVehicle
description: Removes/ejects a player from their vehicle.
tags: ["player", "vehicle"]
---
## Description
Removes/ejects a player from their vehicle.
| Name | Description |
| ---------- | ------------------------------------------------------- |
| playerid | The ID of the player to remove from their vehicle. |
| bool:force | Force remove from vehicle instantly. (default: `false`) |
## Returns
**true** - The function was executed successfully.
**false** - The function failed to execute. This means the player is not connected.
## Examples
```c
// Example - Players can only drive vehicles if they have 10 score.
public OnPlayerStateChange(playerid, PLAYER_STATE:newstate, PLAYER_STATE:oldstate)
{
if (newstate == PLAYER_STATE_DRIVER && GetPlayerScore(playerid) < 10) // PlAYER_STATE_DRIVER = 2
{
RemovePlayerFromVehicle(playerid);
}
return 1;
}
```
## Notes
:::tip
- The exiting animation is not synced for other players.
- This function will not work when used in [OnPlayerEnterVehicle](../callbacks/OnPlayerEnterVehicle), because the player isn't in the vehicle when the callback is called. Use [OnPlayerStateChange](../callbacks/OnPlayerStateChange) instead (see the example above).
- If the player is in an RC vehicle, they will not be removed. (Use `.force = true` parameter or [ClearAnimations](ClearAnimations) function)
:::
## Related Functions
- [PutPlayerInVehicle](PutPlayerInVehicle): Put a player in a vehicle.
| openmultiplayer/web/docs/scripting/functions/RemovePlayerFromVehicle.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/RemovePlayerFromVehicle.md",
"repo_id": "openmultiplayer",
"token_count": 487
} | 318 |
---
title: SendClientMessageToAllf
description: Displays a formatted message in chat to all players.
tags: []
---
<VersionWarn version='open.mp beta build 6' />
:::warning
This function was deprecated.
[SendClientMessageToAll](SendClientMessageToAll) function now is built-in with format!
:::
## Description
Displays a formatted message in chat to all players. This is a multi-player equivalent of SendClientMessage.
| Name | Description |
| --------------- | ------------------------------------------------- |
| color | The color of the message (0xRRGGBBAA Hex format). |
| const message[] | The message to show (max 144 characters). |
| {Float,_}:... | Indefinite number of arguments of any tag |
## Returns
This function always returns true (1).
## Examples
```c
#define HELLO_WORLD "Hello World"
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(cmdtext, "/helloworld", true) == 0)
{
// Send a message to everyone.
SendClientMessageToAllf(-1, "%s!", HELLO_WORLD);
return 1;
}
return 0;
}
```
| openmultiplayer/web/docs/scripting/functions/SendClientMessageToAllf.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/SendClientMessageToAllf.md",
"repo_id": "openmultiplayer",
"token_count": 413
} | 319 |
---
title: SetActorVirtualWorld
description: Set the virtual world of an actor.
tags: ["actor"]
---
<VersionWarn version='SA-MP 0.3.7' />
## Description
Set the virtual world of an actor. Only players in the same world will see the actor.
| Name | Description |
| ------------ | -------------------------------------------------------------------------- |
| actorid | The ID of the actor (returned by CreateActor) to set the virtual world of. |
| virtualWorld | The virtual world to put the actor ID. |
## Returns
**true** - The function was executed successfully.
**false** - The function failed to execute. The actor specified does not exist.
## Examples
```c
new gMyActor;
public OnGameModeInit()
{
// Create the actor
gMyActor = CreateActor(69, 0.0, 0.0, 3.0, 0.0);
// Set their virtual world
SetActorVirtualWorld(gMyActor, 69);
return 1;
}
```
## Related Functions
- [GetActorVirtualWorld](GetActorVirtualWorld): Get the virtual world of an actor.
- [CreateActor](CreateActor): Create an actor (static NPC).
| openmultiplayer/web/docs/scripting/functions/SetActorVirtualWorld.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/SetActorVirtualWorld.md",
"repo_id": "openmultiplayer",
"token_count": 414
} | 320 |
---
title: SetObjectRot
description: Set the rotation of an object on the three axes (X, Y and Z).
tags: ["object"]
---
## Description
Set the rotation of an object on the three axes (X, Y and Z).
| Name | Description |
| --------------- | -------------------------------------------- |
| objectid | The ID of the object to set the rotation of. |
| Float:rotationX | The X rotation. |
| Float:rotationY | The Y rotation. |
| Float:rotationZ | The Z rotation. |
## Returns
This function always returns 1, even if the object doesn't exist.
## Examples
```c
public OnGameModeInit()
{
new objectid = CreateObject(2587, 2001.195679, 1547.113892, 14.283400, 0.0, 0.0, 96.0);
SetObjectRot(objectid, 0.0, 0.0, 180.0);
return 1;
}
```
## Related Functions
- [CreateObject](CreateObject): Create an object.
- [DestroyObject](DestroyObject): Destroy an object.
- [IsValidObject](IsValidObject): Checks if a certain object is vaild.
- [MoveObject](MoveObject): Move an object.
- [StopObject](StopObject): Stop an object from moving.
- [SetObjectPos](SetObjectPos): Set the position of an object.
- [GetObjectPos](GetObjectPos): Locate an object.
- [GetObjectRot](GetObjectRot): Check the rotation of an object.
- [AttachObjectToPlayer](AttachObjectToPlayer): Attach an object to a player.
- [CreatePlayerObject](CreatePlayerObject): Create an object for only one player.
- [DestroyPlayerObject](DestroyPlayerObject): Destroy a player object.
- [IsValidPlayerObject](IsValidPlayerObject): Checks if a certain player object is vaild.
- [MovePlayerObject](MovePlayerObject): Move a player object.
- [StopPlayerObject](StopPlayerObject): Stop a player object from moving.
- [SetPlayerObjectPos](SetPlayerObjectPos): Set the position of a player object.
- [SetPlayerObjectRot](SetPlayerObjectRot): Set the rotation of a player object.
- [GetPlayerObjectPos](GetPlayerObjectPos): Locate a player object.
- [GetPlayerObjectRot](GetPlayerObjectRot): Check the rotation of a player object.
- [AttachPlayerObjectToPlayer](AttachPlayerObjectToPlayer): Attach a player object to a player.
| openmultiplayer/web/docs/scripting/functions/SetObjectRot.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/SetObjectRot.md",
"repo_id": "openmultiplayer",
"token_count": 736
} | 321 |
---
title: SetPlayerAttachedObject
description: Attach an object to a specific bone on a player.
tags: ["player", "object", "attachment"]
---
## Description
Attach an object to a specific bone on a player.
| Name | Description |
| --------------- | ------------------------------------------------------------------------------------ |
| playerid | The ID of the player to attach the object to. |
| index | The index (slot 0-9) to assign the object to. |
| modelid | The model to attach. |
| bone | The [bone](../resources/boneid) to attach the object to. |
| Float:offsetX | (optional) X axis offset for the object position. |
| Float:offsetY | (optional) Y axis offset for the object position. |
| Float:offsetZ | (optional) Z axis offset for the object position. |
| Float:rotationX | (optional) X axis rotation of the object. |
| Float:rotationY | (optional) Y axis rotation of the object. |
| Float:rotationZ | (optional) Z axis rotation of the object. |
| Float:scaleX | (optional) X axis scale of the object. |
| Float:scaleY | (optional) Y axis scale of the object. |
| Float:scaleZ | (optional) Z axis scale of the object. |
| materialColour1 | (optional) The first object color to set, as an integer or hex in ARGB color format. |
| materialColour2 | (optional) The second object color to set, as an integer or hex in ARGB color format |
## Returns
**1** on success, **0** on failure.
## Examples
```c
public OnPlayerSpawn(playerid)
{
SetPlayerAttachedObject(playerid, 3, 1609, 2); // Attach a turtle to the playerid's head, in slot 3
// Example of using colors on an object being attached to the player:
SetPlayerAttachedObject(playerid, 3, 19487, 2, 0.101, -0.0, 0.0, 5.50, 84.60, 83.7, 1.0, 1.0, 1.0, 0xFF00FF00);
// Attach a white hat to the head of the player and paint it green
return 1;
}
```
## Notes
:::tip
This function is separate from the CreateObject / CreatePlayerObject pools.
:::
:::warning
Atleast 10 objects can be attached to a single player (index 0-9)
:::
## Related Functions
- [RemovePlayerAttachedObject](RemovePlayerAttachedObject): Remove an attached object from a player
- [IsPlayerAttachedObjectSlotUsed](IsPlayerAttachedObjectSlotUsed): Check whether an object is attached to a player in a specified index
- [GetPlayerAttachedObject](GetPlayerAttachedObject): Gets the player attachment object data by index.
- [EditAttachedObject](EditAttachedObject): Edit an attached object.
## Related Resources
- [Bone IDs](../resources/boneid)
| openmultiplayer/web/docs/scripting/functions/SetPlayerAttachedObject.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/SetPlayerAttachedObject.md",
"repo_id": "openmultiplayer",
"token_count": 1407
} | 322 |
---
title: SetPlayerSkillLevel
description: Set the skill level of a certain weapon type for a player.
tags: ["player"]
---
## Description
Set the skill level of a certain weapon type for a player.
| Name | Description |
| ----------------- | ---------------------------------------------------------------------------------------------------- |
| playerid | The ID of the player to set the weapon skill of. |
| WEAPONSKILL:skill | The [weapon](../resources/weaponskills) to set the skill of. |
| level | The skill level to set for that weapon, ranging from 0 to 999. A level out of range will max it out. |
## Returns
This function does not return any specific values.
## Examples
```c
public OnPlayerSpawn(playerid)
{
// Make the player use single-handed sawn-off shotguns.
SetPlayerSkillLevel(playerid, WEAPONSKILL_SAWNOFF_SHOTGUN, 1);
return 1;
}
```
## Notes
:::warning
The skill parameter is NOT the weapon ID, it is the skill type. Click [here](../resources/weaponskills) for a list of skill types.
:::
## Related Functions
- [GetPlayerSkillLevel](GetPlayerSkillLevel): Get the player skill level of a certain weapon type.
- [SetPlayerArmedWeapon](SetPlayerArmedWeapon): Set a player's armed weapon.
- [GivePlayerWeapon](GivePlayerWeapon): Give a player a weapon.
## Related Information
- [Weapon Skills](../resources/weaponskills#skill-levels): List of weapon skills that are used to set player's skill level.
| openmultiplayer/web/docs/scripting/functions/SetPlayerSkillLevel.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/SetPlayerSkillLevel.md",
"repo_id": "openmultiplayer",
"token_count": 608
} | 323 |
---
title: SetTeamCount
description: This function is used to change the amount of teams used in the gamemode.
tags: []
---
## Description
This function is used to change the amount of teams used in the gamemode. It has no obvious way of being used, but can help to indicate the number of teams used for better (more effective) internal handling. This function should only be used in the OnGameModeInit callback. Important: You can pass 2 billion here if you like, this function has no effect at all.
| Name | Description |
| ----- | ----------------------------------- |
| count | Number of teams the gamemode knows. |
## Returns
This function does not return any specific values.
## Examples
```c
public OnGameModeInit( )
{
// We use 18 teams in this use Team-Deathmatch mode, define it;
SetTeamCount(18);
return 1;
}
```
## Related Functions
- [GetPlayerTeam](GetPlayerTeam): Check what team a player is on.
- [SetPlayerTeam](SetPlayerTeam): Set a player's team.
| openmultiplayer/web/docs/scripting/functions/SetTeamCount.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/SetTeamCount.md",
"repo_id": "openmultiplayer",
"token_count": 291
} | 324 |
---
title: SpawnPlayer
description: (Re)Spawns a player.
tags: ["player"]
---
## Description
(Re)Spawns a player.
| Name | Description |
| -------- | ------------------------------ |
| playerid | The ID of the player to spawn. |
## Returns
**true** - The function executed successfully.
**false** - The function failed to execute. This means the player is not connected.
## Examples
```c
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(cmdtext, "/spawn", true) == 0)
{
SpawnPlayer(playerid);
return 1;
}
return 0;
}
```
## Notes
:::warning
Known Bug(s):
- Kills the player if they are in a vehicle and then they spawn with a bottle in their hand. (Fixed in open.mp)
:::
## Related Functions
- [IsPlayerSpawned](IsPlayerSpawned): Checks if a player is spawned.
- [SetSpawnInfo](SetSpawnInfo): Set the spawn setting for a player.
- [AddPlayerClass](AddPlayerClass): Add a class.
## Related Callbacks
- [OnPlayerSpawn](../callbacks/OnPlayerSpawn): Called when a player spawns.
| openmultiplayer/web/docs/scripting/functions/SpawnPlayer.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/SpawnPlayer.md",
"repo_id": "openmultiplayer",
"token_count": 356
} | 325 |
---
title: TextDrawCreate
description: Creates a textdraw.
tags: ["textdraw"]
---
## Description
Creates a textdraw. Textdraws are, as the name implies, text (mainly - there can be boxes, sprites and model previews (skins/vehicles/weapons/objects too) that is drawn on a player's screens. See this page for extensive information about textdraws.
| Name | Description |
|------------------|----------------------------------------------------------|
| Float:x | The X (left/right) coordinate to create the textdraw at. |
| Float:y | The Y (up/down) coordinate to create the textdraw at. |
| const format[] | The text that will appear in the textdraw. |
| OPEN_MP_TAGS:... | Indefinite number of arguments of any tag. |
## Returns
The ID of the created textdraw.
Textdraw IDs start at **0**.
## Examples
```c
// This variable is used to store the id of the textdraw
// so that we can use it throught the script
new Text:gMyTextdraw;
public OnGameModeInit()
{
// This line is used to create the textdraw.
// Note: This creates a textdraw without any formatting.
gMyTextdraw = TextDrawCreate(240.0, 580.0, "Welcome to my OPEN.MP server");
return 1;
}
public OnPlayerConnect(playerid)
{
//This is used to show the player the textdraw when they connect.
TextDrawShowForPlayer(playerid, gMyTextdraw);
return 1;
}
```
## Notes
:::tip
- The `x, y` coordinate is the top left coordinate for the text draw area based on a 640x480 "canvas" (irrespective of screen resolution).
- If you plan on using [TextDrawAlignment](TextDrawAlignment) with alignment 3 (`TEXT_DRAW_ALIGN_RIGHT`), the `x, y` coordinate is the top right coordinate for the text draw.
- This function merely CREATES the textdraw, you must use [TextDrawShowForPlayer](TextDrawShowForPlayer) or [TextDrawShowForAll](TextDrawShowForAll) to show it.
- It is recommended to use WHOLE numbers instead of decimal positions when creating textdraws to ensure resolution friendly design.
:::
:::warning
Keyboard key mapping codes (such as ~k~~VEHICLE_ENTER_EXIT~) don't work beyond 255th character.
:::
## Related Functions
- [TextDrawDestroy](TextDrawDestroy): Destroy 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.
- [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.
- [IsTextDrawVisibleForPlayer](IsTextDrawVisibleForPlayer): Checks if a textdraw is shown for the player.
- [IsValidTextDraw](IsValidTextDraw): Checks if a textdraw is valid.
- [TextDrawGetAlignment](TextDrawGetAlignment): Gets the text alignment of a textdraw.
- [TextDrawGetBackgroundColour](TextDrawGetBackgroundColour): Gets the background colour of a textdraw.
- [TextDrawGetBoxColour](TextDrawGetBoxColour): Gets the box colour of a textdraw.
- [TextDrawGetColour](TextDrawGetColour): Gets the text colour of a textdraw.
- [TextDrawGetFont](TextDrawGetFont): Gets the text font of a textdraw.
- [TextDrawGetLetterSize](TextDrawGetLetterSize): Gets the width and height of the letters.
- [TextDrawGetOutline](TextDrawGetOutline): Gets the thickness of a textdraw's text's outline.
- [TextDrawGetPos](TextDrawGetPos): Gets the position of a textdraw.
- [TextDrawGetPreviewModel](TextDrawGetPreviewModel): Gets the preview model of a 3D preview textdraw.
- [TextDrawGetPreviewRot](TextDrawGetPreviewRot): Gets the rotation and zoom of a 3D model preview textdraw.
- [TextDrawGetPreviewVehCol](TextDrawGetPreviewVehCol): Gets the preview vehicle colors of a 3D preview textdraw.
- [TextDrawGetPreviewVehicleColours](TextDrawGetPreviewVehicleColours): Gets the preview vehicle colours of a 3D preview textdraw.
- [TextDrawGetShadow](TextDrawGetShadow): Gets the size of a textdraw's text's shadow.
- [TextDrawGetString](TextDrawGetString): Gets the text of a textdraw.
- [TextDrawGetTextSize](TextDrawGetTextSize): Gets the X axis and Y axis of the textdraw.
- [TextDrawIsBox](TextDrawIsBox): Checks if a textdraw is box.
- [TextDrawIsProportional](TextDrawIsProportional): Checks if a textdraw is proportional.
- [TextDrawIsSelectable](TextDrawIsSelectable): Checks if a textdraw is selectable.
- [TextDrawSetPos](TextDrawSetPos): Sets the position of a textdraw.
- [TextDrawSetStringForPlayer](TextDrawSetStringForPlayer): Changes the text on a textdraw for a specific player.
## Related Resources
- [TextDraw Sprites](../resources/textdrawsprites)
| openmultiplayer/web/docs/scripting/functions/TextDrawCreate.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/TextDrawCreate.md",
"repo_id": "openmultiplayer",
"token_count": 1693
} | 326 |
---
title: TextDrawGetPreviewVehCol
description: Gets the preview vehicle colors of a 3D preview textdraw.
tags: ["textdraw"]
---
<VersionWarn version='omp v1.1.0.2612' />
## Description
Gets the preview vehicle colors of a 3D preview textdraw.
| Name | Description |
| ----------- | ---------------------------------------------------------------- |
| Text:textid | The ID of the textdraw to get the vehicle colors of. |
| &colour1 | A variable into which to store the colour1, passed by reference. |
| &colour2 | A variable into which to store the colour2, passed by reference. |
## Examples
```c
new Text:gMyTextdraw;
public OnGameModeInit()
{
gMyTextdraw = TextDrawCreate(320.0, 240.0, "_");
TextDrawFont(gMyTextdraw, TEXT_DRAW_FONT_MODEL_PREVIEW);
TextDrawUseBox(gMyTextdraw, true);
TextDrawBoxColor(gMyTextdraw, 0x000000FF);
TextDrawTextSize(gMyTextdraw, 40.0, 40.0);
TextDrawSetPreviewModel(gMyTextdraw, 411);
TextDrawSetPreviewVehCol(gMyTextdraw, 6, 8);
new colour1, colour2;
TextDrawGetPreviewVehCol(gMyTextdraw, colour1, colour2);
// colour1 = 6
// colour2 = 8
return 1;
}
```
## Related Functions
- [TextDrawSetPreviewModel](TextDrawSetPreviewModel): Set the 3D preview model of a textdraw.
- [TextDrawSetPreviewRot](TextDrawSetPreviewRot): Set rotation of a 3D textdraw preview.
- [TextDrawFont](TextDrawFont): Set the font of a textdraw.
## Related Callbacks
- [OnPlayerClickTextDraw](../callbacks/OnPlayerClickTextDraw): Called when a player clicks on a textdraw.
| openmultiplayer/web/docs/scripting/functions/TextDrawGetPreviewVehCol.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/TextDrawGetPreviewVehCol.md",
"repo_id": "openmultiplayer",
"token_count": 578
} | 327 |
---
title: TogglePlayerWidescreen
description: Toggle player's widescreen.
tags: ["player"]
---
<VersionWarn version='omp v1.1.0.2612' />
## Description
Toggle player's widescreen.
| Name | Description |
|-----------|--------------------------------------------------|
| playerid | The ID of the player to toggle the widescreen. |
| bool:wide | **true** for turn on and **false** for turn off. |
## Returns
**true** - The function was executed successfully.
**false** - The function failed to execute. This means the player specified does not exist.
## Examples
```c
public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp(cmdtext, "/widescreen", true))
{
TogglePlayerWidescreen(playerid, true);
SendClientMessage(playerid, -1, "SERVER: You turned on the widescreen!");
return 1;
}
return 0;
}
```
<hr />
**Widescreen on:**

**Widescreen off:**

## Related Functions
- [IsPlayerWidescreenToggled](IsPlayerWidescreenToggled): Checks if a player widescreen is on or off.
| openmultiplayer/web/docs/scripting/functions/TogglePlayerWidescreen.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/TogglePlayerWidescreen.md",
"repo_id": "openmultiplayer",
"token_count": 445
} | 328 |
---
title: argvalue
description: Get the number of arguments passed to the script (those after --).
tags: ["arguments", "args"]
---
## Description
Get the number of arguments passed to the script (those after **--**).
| Name | Description |
| --------------------- | ----------------------------------------------------------------- |
| skip = 0 | The number of arguments (with potentially the same name) to skip. |
| const argument[] = "" | The name of the argument, including `-`s and `/`s. |
| &value = cellmin | The output destination. |
## Returns
**true** - the argument was found with value, **false** - it wasn't.
## Notes
Separate parameters also count for the index here.
For example with `--load test --run` the argument `--run` is index `2`.
## Related Functions
- [argcount](argcount): Get the number of arguments passed to the script (those after --).
- [argindex](argindex): Get the name of the argument at the given index after --.
- [argstr](argstr): Get the string value of an argument by name.
| openmultiplayer/web/docs/scripting/functions/argvalue.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/argvalue.md",
"repo_id": "openmultiplayer",
"token_count": 413
} | 329 |
---
title: fcreatedir
description: Create a directory.
tags: ["file management"]
---
<VersionWarn version='omp v1.1.0.2612' />
<LowercaseNote />
## Description
Create a directory.
| Name | Description |
| --------------- | ---------------------------------------------------------------------- |
| const dirname[] | The name of the directory to create, optionally including a full path. |
## Returns
**true** on success, **false** on failure.
## Examples
```c
if (fcreatedir("logs"))
{
// Success
printf("The directory \"logs\" created successfully.");
}
else
{
// Error
print("Failed to create the directory \"logs\"");
}
```
## Notes
:::tip
To delete the directory again, use [fremove](fremove). The directory must be empty before it can be removed.
:::
## 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.
- [fputchar](fputchar): Put a character in a file.
- [fgetchar](fgetchar): Get a character from a file.
- [fblockwrite](fblockwrite): Write blocks of data into a file.
- [fblockread](fblockread): Read blocks of data from a file.
- [fseek](fseek): Jump to a specific character in a file.
- [flength](flength): Get the file length.
- [fexist](fexist): Check, if a file exists.
- [fmatch](fmatch): Check, if patterns with a file name matches.
- [ftell](ftell): Get the current position in the file.
- [fflush](fflush): Flush a file to disk (ensure all writes are complete).
- [fstat](fstat): Return the size and the timestamp of a file.
- [frename](frename): Rename a file.
- [fcopy](fcopy): Copy a file.
- [filecrc](filecrc): Return the 32-bit CRC value of a file.
- [diskfree](diskfree): Returns the free disk space.
- [fattrib](fattrib): Set the file attributes.
| openmultiplayer/web/docs/scripting/functions/fcreatedir.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/fcreatedir.md",
"repo_id": "openmultiplayer",
"token_count": 661
} | 330 |
---
title: floatround
description: Round a floating point number to an integer value.
tags: ["math", "floating-point"]
---
<LowercaseNote />
## Description
Round a floating point number to an integer value.
| Name | Description |
|--------------------------|-------------------------------------------------------------------------------------------------|
| Float:value | The value to round. |
| floatround_method:method | The [floatround mode](../resources/floatroundmodes) to use.<br />By default: `floatround_round` |
## Returns
The rounded value as an integer.
## Examples
```c
new value = floatround(3.3, floatround_ceil);
printf("3.3 rounded to %d", value); // 3.3 rounded to 4
```
<br />
```c
new value = floatround(50.996229);
printf("50.996229 rounded to %d", value); // 50.996229 rounded to 51
```
<br />
```c
new value = floatround(270.0034);
printf("270.0034 rounded to %d", value); // 270.0034 rounded to 270
```
## Related Functions
- [float](float): Convert an integer to a float.
- [floatstr](floatstr): Convert an string to a float.
## Related Resources
- [Floatround Modes](../resources/floatroundmodes)
| openmultiplayer/web/docs/scripting/functions/floatround.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/floatround.md",
"repo_id": "openmultiplayer",
"token_count": 528
} | 331 |
---
title: numpubvars
description: Counts how many public variables there are in the script.
tags: ["core", "pubvar", "public variable"]
---
<LowercaseNote />
## Description
Counts how many public variables there are in the script.
## Returns
The number of public variables declared.
## Related Functions
- [getpubvar](getpubvar): Gets a specific public variable from the current script.
- [setpubvar](setpubvar): Sets a specific public variable in the current script.
- [existpubvar](existpubvar): Checks if a specific public variable exists in the current script.
| openmultiplayer/web/docs/scripting/functions/numpubvars.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/numpubvars.md",
"repo_id": "openmultiplayer",
"token_count": 150
} | 332 |
---
title: strins
description: Insert a string into another string.
tags: ["string"]
---
<LowercaseNote />
## Description
Insert a string into another string.
| Name | Description |
| --------------------------- | ------------------------------------------ |
| string[] | The string you want to insert substr in. |
| const substr[] | The string you want to insert into string. |
| pos | The position to start inserting. |
| maxlength = sizeof (string) | The maximum size to insert. |
## Returns
This function does not return any specific values.
## Examples
```c
// Add an [AFK] tag to the start of players' names
new playerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);
if (strlen(playerName) <= 18)
{
strins(playerName, "[AFK]", 0);
}
SetPlayerName(playerid, playerName);
// WARNING: Players with names that are 20+ characters long can not have an [AFK] tag, as that would make their name 25 characters long and the limit is 24.
```
## 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.
- [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.
- [strcat](strcat): Concatenate two strings into a destination reference.
| openmultiplayer/web/docs/scripting/functions/strins.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/functions/strins.md",
"repo_id": "openmultiplayer",
"token_count": 556
} | 333 |
---
title: "Keywords: Statements"
---
## `assert`
Aborts execution with a runtime error if the expression evaluates to logically false. Seems to work only in the main() block. The assert statement should be used to indicate a logical(programmer's) error, never a run-time(user's) error.
```c
main()
{
assert (MAX_PLAYERS == GetMaxPlayers()); // ascertain that the definition of MAX_PLAYERS is equal to the actual number of server slots in use
}
```
## `break`
Breaks out of a loop instantly, only leaves the top level loop, not all current loops.
```c
for (new i = 0; i < 10; i++)
{
printf("%d", i);
if (i == 5)
{
break;
}
}
```
Will produce:
```c
0
1
2
3
4
5
```
While:
```c
for (new i = 0; i < 10; i++)
{
if (i == 5)
{
break;
}
printf("%d", i);
}
```
Will produce:
```c
0
1
2
3
4
```
As the loop is instantly exited neither loop gets to 10 and the second one ends before the number 5 is printed.
## `case`
Handles a specific result in a switch statement. The result can be either a single number, a selection of numbers or a range of numbers:
```c
new
switchVar = 10;
switch (switchVar)
{
case 1:
{
printf("switchVar is 1");
}
case 4:
{
printf("switchVar is 4");
}
case 2, 3, 5:
{
printf("switchVar is either 2, 3 or 5");
}
case 7 .. 11:
{
printf("switchVar is somewhere between 7 and 11 inclusive (7, 8, 9, 10 or 11)");
}
default:
{
printf("switchVar is not 1, 2, 3, 4, 5, 7, 8, 9, 10 or 11");
}
}
```
## `continue`
Similar to break but just goes on to the next loop itteration. It is important to note that the point to which it jumps varies depending on which loop type you use.
```c
for (new i = 0; i < 10; i++)
{
if (i == 5)
{
continue;
}
printf("%d", i);
}
```
Will produce:
```c
0
1
2
3
4
6
7
8
9
```
A continue after the print will basically do nothing. In a for loop continue jumps to the third statement in the for statement (in this example the "i++;" bit), this is different to how it behaves in a while loop:
```c
new
i = 0;
while (i < 10)
{
if (i == 5)
{
continue;
}
printf("%d", i);
i++;
}
```
This will produce an infinate loop as continue will jump to AFTER the "i++;" and go back to the "while (i < 10)" part. At this time, "i" will still be 5 as "i++;" was never called, and so continue will be called again and "i" will be stuck at 5 forever.
## `default`
default handles switch statement results which aren't handled explicitly by case statements. See the case example for an example.
## `do`
do is a type of loop which can be used with while to produce a loop which will always be run at least once. Note the semi-colon after the while () in the following example:
```c
new
i = 10;
do
{
printf("%d", i);
i++;
}
while (i < 10);
```
"i" is clearly not less that 10 but this loop will produce:
```c
10
```
anyway. The similar while loop:
```c
new
i = 10;
while (i < 10)
{
printf("%d", i);
i++;
}
```
} Will not give any output as the condition instantly fails.
These are also useful for avoiding double checks:
```c
new
checkVar = 10;
if (checkVar == 10)
{
new
i = 0;
while (checkVar == 10)
{
checkVar = someFunction(i);
i++;
}
}
```
This isn't obviously a major issue but you are checking checkVar twice in quick succession at the start of the loop, which is quite pointless, however the if is required as you need to do code if the condition is true but outside the loop (this is a fairly common situation). This can be improved by doing:
```c
new
checkVar = 10;
if (checkVar == 10)
{
new
i = 0;
do
{
checkVar = someFunction(i);
i++;
}
while (checkVar == 10);
}
```
In this instance the result will be exactly the same but crucially with one less pointless check.
## `else`
else is called when an if statement fails (assuming it is present):
```c
new
checkVar = 5;
if (checkVar == 10)
{
printf("This will never be called");
}
else
{
printf("The if statement failed so this will be displayed");
}
```
else can also be combined with if:
```c
new
checkVar = 2;
if (checkVar == 1)
{
printf("This will not be called"):
}
else if (checkVar == 2)
{
printf("The first if failed so the second was checked and is true");
}
else
{
printf("This will not be called as one of the ifs was true");
}
```
## `exit`
This exits the current program instantly.
```c
main()
{
exit;
return 0;
}
```
## `for`
A for loop is a type of loop involving three stages, initialisation, comparison and update. These are each separated by a semicolon (Wink and can each be excluded by just setting a blank space. The most basic for loop is:
```c
for ( ; ; ) {}
```
This has no initialisation, no comparison and no update and as a result will go forever (the comparison, being absent, defaults to true).
One of the more common loops is:
```c
for (new i = 0; i < MAX_PLAYERS; i++)
{
printf("%d", i);
}
```
The initialisation in this loop is:
```c
new i = 0;
```
The semicolon marks the end of the initialisation. This declares a new variable, called i, which can only be used with this loop. Next comparison is done. This compares i to MAX_PLAYERS (default 500 - see #define) and if it is less continues. Then the contents of the loop is run. Initially this will print "0". Finally the update is done "i++", this increases the value of i. Now a complete itteration is done, the loop loops, as its name implies, and goes back to the comparison stage (initialisation is only done once per call).
The result of this loop is all the numbers from 0 to 499 inclusive being printed out. The equivalent while loop (ignoring the effects of continue) would be:
```c
new
i = 0;
while (i < MAX_PLAYERS)
{
printf("%d", i);
i++;
}
```
The three stages can be made a lot more complex if required using commas for the first and last sections and standard comparisons for the middle section:
```c
for (new i = 0, j = 200; i < MAX_PLAYERS && j > 10; i++, j -= 2)
{
printf("%d %d", i, j);
}
```
This will create two new variables and set them to 0 and 200, then loop while one is less than 200 and the other is greater than 10, increasing one each time and decreasing the other by two each time.
As stated before the scope of variables is limited to the loop usually:
```c
for (new i = 0; i < MAX_PLAYERS; i++)
{
printf("%d", i);
}
printf("%d", i);
```
That will produce an error as "i" doesn't exist after the loop ends. However:
```c
new
i = 0;
for ( ; i < MAX_PLAYERS; i++)
{
printf("%d", i);
}
printf("%d", i);
```
Is fine as "i" is not declared in the loop. You could also initialise "i" in the loop but not declare it there:
```c
new
i;
for (i = 0; i < MAX_PLAYERS; i++)
{
printf("%d", i);
}
printf("%d", i);
```
## `goto`
goto and labels are generally discouraged in the coding community as what they do can usually be done better by restructuring your code properly. However basically a goto is a jump:
```c
goto my_label;
printf("This will never be printed");
my_label:
printf("This will be printed");
```
The compiler however doesn't handle goto very well so that will not be optimised at all and things like:
```c
{
new
i = 5;
if (i == 5)
{
goto my_label;
}
else
{
my_label:
return 0;
}
}
```
Will give a warning about inconsistent return types as it things the true branch doesn't return anything when it actually does, just in a very roundabout way. Also:
```c
MyFunction()
{
new
i = 5;
if (i == 5)
{
goto my_label;
}
return 0;
my_label:
return 1;
}
```
Will give an unreachable code warning despite the fact it actually is reachable.
The basic syntax is:
```c
label:
goto label;
```
The label should be on a line on it's own and ends in a colon, NOT a semicolon. Labels follow the same naming restrictions as variables and functions etc.
## `if`
If is one of the most important operators. It determines wether something should be done or not and acts accordingly, it, along with goto, is the basis of almost all other control structures:
```c
for (new i = 0; i < 10; i++)
{
}
```
Is equivalent to:
```c
new
i = 0;
for_loop:
if (i < 10)
{
i++;
goto for_loop;
}
```
The conditions if can take are way too many for this post however some are listed below:
Operator Explanation Example Result when a=1, b=0 Result when a=1, b=1 Result when a=0, b=1 Result when a=0, b=0 == Checks if one thing is equal to another if (a == b) false true false true != Checks if one thing is not the same as another if (a != b) true false true false < Checks if one thing is less than another if (a < b) false false true false > Checks if one thing is greater than another if (a > b) true false false false <= Checks if one thing is less than or equal to another if (a <= b) false true true true >= Checks if one thing is greater than or equal to another if (a >= b) true true false true && Checks if two things are true (not 0) if (a && b) false true false false || Checks if at least one of two things are true (not 0) if (a || b) true true true false ! Checks if something is false if (!(a == b)) true false true false
Obviously with these you can build up complex conditionals:
```c
if (a == b && (c != d || f < g))
```
That will be true if a is the same as b and either f is less than g or c is not the same as d (or both).
## `return`
This breaks out a function and can return data to the calling function:
```c
MyFunction()
{
new
someVar = OtherFunction();
}
OtherFunction()
{
return 5;
}
```
someVar will now be 5.
```c
MyFunction()
{
if (SomeFunction())
{
printf("Returned 1");
}
}
SomeFunction()
{
return random(2);
}
```
That will either return 1 or 0 to the calling function's if statement. 1 is true and 0 if false so the text will only be printed if 1 is returned. However:
```c
MyFunction()
{
if (SomeFunction())
{
printf("Returned something between 1 and 10");
}
}
SomeFunction()
{
return random(11);
}
```
That will return 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 or 10. Anything which is not 0 is true so the text will display if anything between 1 and 10 is returned.
You can also use return with strings:
```c
MyFunction()
{
printf("%s", SomeFunction());
}
SomeFunction()
{
new
str[10] = "Hello";
return str;
}
```
Will print "Hello" (without the quotes).
You also don't have to return anything:
```c
MyFunction()
{
SomeFunction();
}
SomeFunction()
{
return;
}
```
However if you do this you must make sure the function's return is never used:
```c
MyFunction()
{
if (SomeFunction())
{
printf("Problem");
}
}
SomeFunction()
{
return;
}
```
Here SomeFunction is not returning anything however MyFunction is checking if the value returned from SomeFunction is true or not - it's neither as it just doesn't exist, so you will get a compiler error. No return is the default, so:
```c
SomeFunction()
{
return;
}
```
And:
```c
SomeFunction()
{
}
```
Are the same.
Finally, you can't mix return values:
```c
MyFunction()
{
SomeFunction();
}
SomeFunction()
{
if (random(2))
{
return 1;
}
else
{
return;
}
}
```
This will give an error because it doesn't know what to do.
```c
SomeFunction()
{
if (random(2))
{
return 1;
}
}
```
Is also not allowed as the default return is nothing.
## `sleep`
sleep is a psudo-function which makes execution pause for a given number of milliseconds:
```c
printf("Time 0s");
sleep(1000);
printf("Time 1s");
```
This only works in main(), not callbacks however as it's run in the PAWN thread.
## `state`
state is part of the PAWN state machine and autonoma system, see [this thread](https://forum.sa-mp.com/showthread.php?t=86850) for more information.
## `switch`
switch is basically a structured if/else if/else system:
```c
switch (someVar)
{
case 1:
{
printf("one");
}
case 2:
{
printf("two");
}
case 3:
{
printf("three");
}
default:
{
printf("other");
}
}
```
Is just a slightly more efficient (and much cleaner) way of doing:
```c
if (someVar == 1)
{
printf("one");
}
else if (someVar == 2)
{
printf("two");
}
else if (someVar == 3)
{
printf("three");
}
else
{
printf("other");
}
```
## `while`
while is a loop type similar to for and do..while. The basic operation is an if statement done which if true does some code and jumps back to the if. If it's false it goes to after the loop code - there is no else. Going back to the goto example:
```c
new
i = 0;
for_loop:
if (i < 10)
{
i++;
goto for_loop;
}
```
This can also be written as:
```c
new
i = 0;
while (i < 10)
{
i++;
}
```
See do and for more information.
| openmultiplayer/web/docs/scripting/language/Statements.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/language/Statements.md",
"repo_id": "openmultiplayer",
"token_count": 4681
} | 334 |
# Assorted tips
---
### • Working with characters and strings
Strings can be in packed or in unpacked format. In the packed format, each
cell will typically hold four characters (in common implementations, a cell is
32-bit and a character is 8 bit). In this configuration, the first character
in a “pack” of four is the highest byte of a cell and the fourth character is in the
lowest byte of each cell.
A string must be stored in an array. For an unpacked string, the array must
be large enough to hold all characters in the string plus a terminating zero
cell. That is, in the example below, the variable ustring is defined as having five
cells, which is just enough to contain the string with which it is initialized:
Listing: unpacked string
```c
new ustring[5] = "test"
```
In a packed string, each cell contains several characters and the string
ends with a zero character. The char operator helps with declaring the array size
to contain the required number of characters . The example below will allocate
enough cells to hold five packed characters. In a typical implementation, there
will be two cells in the array.
Listing: packed string
```c
new pstring[5 char] = !"test"
```
In other words, the char operators divides its left operand by the number of
bytes that fit in a cell and rounds upwards. Again, in a typical implementation,
this means dividing by four and rounding upwards.
You can design routines that work on strings in both packed and unpacked for-
mats. To find out whether a string is packed or unpacked, look at the first
cell of a string. If its value is either negative or higher than the maximum possible
value of an unpacked character, the string is a packed string. Otherwise it
is an unpacked string.
The code snippet below returns true if the input string is packed and false otherwise:
Listing: ispacked function
```c
bool: ispacked(string[])
return !(0 <= string[0] <= ucharmax)
```
An unpacked string ends with a full zero cell. The end of a packed string is
marked with only a zero character. Since there may be up to four characters
in a 32-bit cell, this zero character may occur at any of the four positions in
the “pack”. The { } operator extracts a character from a cell in an
array. Basically, one uses the cell index operator (“[ ]”) for unpacked strings and
the character index operator (“{ }”) to work on packed strings.
For example, a routine that returns the length in characters of any
string (packed or unpacked) is:
Listing: my strlen function
```c
my_strlen(string[])
{
new len = 0
if (ispacked(string))
while (string{len} != EOS) /* get character from pack */
++len
else
while (string[len] != EOS) /* get cell */
++len
return len
}
```
If you make functions to work exclusively on either packed or unpacked strings,
it is a good idea to add an assertion to enforce this condition:
Listing: strupper function
```c
strupper(string[])
{
assert ispacked(string)
for (new i=0; string{i} != EOS; ++i)
string{i} = toupper(string{i})
}
```
Although, in preceding paragraphs we have assumed that a cell is 32
bits wide and a character is 8 bits, this should not be relied upon. The
size of a cell is implementation defined; the maximum and minimum values are
in the predefined constants cellmax and cellmin. There are similar predefined
constants for characters. One may safely assume, however, that both the size
of a character in bytes and the size of a cell in bytes are powers of two.
The char operator allows you to determine how many packed characters fit in
a cell. For example:
```c
#if 4 char == 1
/* code that assumes 4 packed characters per cell */
#elseif 4 char == 2
/* code that assumes 2 packed characters per cell */
#elseif 4 char == 4
/* code that assumes 1 packed character per cell */
#else
#assert 0 /* unsupported cell/character size */
#endif
```
### • Internationalization
Programming examples in this manual have used the English language for
all output (prompts, messages, . . . ), and a Latin character set. This
is not necessarily so; one can, for example, modify the first “hello world” program on page 5 to:
Listing: “hello world” in Greek
```c
main()
printf "
˙ ˙\n"
```
PAWN has basic support for non-Latin alphabets, but it only accepts non-Latin
characters in strings and character constants. The PAWN language
requires that all keywords and symbols (names of functions, variables, tags and other
elements) be encoded in the ascii character set.
For languages whose required character set is relatively small, a common solu-
tion is to use an 8-bit extended ascii character set (the ascii character set is
7-bit, holding 128 characters). The upper 128 codes of the extended set con-
tain glyphs specific for the language. For Western European languages, a well
known character set is “Latin-1”, which is standardized as ISO 8859-1 —the
same set also goes by the name “codepage 1252”, at least for Microsoft Win-
dows.∗ Codepages have been defined for many languages; for example, ISO
8859-2 (“Latin-2”) has glyphs used in Central and Eastern Europe, and ISO
8859-7 contains the Greek alphabet in the upper half of the extended ascii set.
Unfortunately, codepage selection can by confusing, as vendors of operating
systems typically created their own codepages irrespective of what
already existed. As a result, for most character sets there exist multiple incompatible codepages
---
###### ∗ Codepage 1252 is not exactly the same as Latin-1; Microsoft extended the standardized set to include glyphs at code positions that Latin-1 marks as “reserved”.
---
For example, codepage 1253 for Microsoft Windows also encodes
the Greek alphabet, but it is incompatible with ISO 8859-7. When writing
texts in Greek, it now becomes important to check what encoding is
used, because many Microsoft Windows applications support both.
When the character set for a language exceeds 256 glyphs, a codepage does
not suffice. Traditionally, the codepage technique was extended by reserving
special “shift” codes in the base character set that switch to a new set of
glyphs. The next character then indicates the specific glyph. In effect, the glyph is
now identified by a 2-byte index. On the other hand, some characters (especially
the 7-bit ascii set) can still be indicated by a single byte. The
“Shift-JIS” standard, for the Japanese character set, is an example for the variable length encoding.
Codepages become problematic when interchanging documents or data with
people in regions that use a different codepage, or when using different
languages in the same document. Codepages that use “shift” characters compli-
cate the matter further, because text processing must now take into account
that a character may take either one or two bytes. Scanning through a string
from right to left may even become impossible, as a byte may either indicate a
glyph from the base set (“unshifted”) or it may be a glyph from a shifted set
-in the latter case the preceding byte indicates the shift set, but the meaning
of the preceding character depends on the character before that.
The ISO/IEC 10646 “Universal Character Set” (UCS) standard has the ambi-
tious goal to eventually include all characters used in all the written
languages in the world, using a 31-bit character set. This solves both of the problems
related to codepages and “shifted” character sets. However, the ISO/IEC body
could not produce a standard in time, and therefore a consortium of mainly
American software manufacturers started working in parallel on a simplified
16-bit character set called “Unicode”. The rationale behind Unicode was that
it would encode abstract characters, not glyphs, and that therefore 65,536 would
be sufficient.† In practice, though, Unicode does encode glyphs and not long
after it appeared, it became apparent that 65,536 code points would not be
enough. To counter this, later Unicode versions were extended with multiple
“planes” and special codes that select a plane. The combination of a
plane selector and the code pointer inside that plane is called a “surrogate pair”.
---
###### † If Unicode encodes characters, an “Unicode font” is a contradictio in terminis —because a font encodes glyphs.
---
The first 65,536 code points are in the “Basic Multilingual Plane” (BMP) and
characters in this set do not need a plane selector.
Essentially, the introduction of surrogate pairs in the Unicode
standard is equivalent to the shift codes of earlier character sets —and it carries some of
the problems that Unicode was intended to solve. The UCS-4 encoding by
ISO/IEC 10646 does not have/need surrogate pairs.
Support for Unicode/UCS-4 in (host) applications and operating systems has
emerged in two different ways: either the internal representation of characters
is multi-byte (typically 16-bit, or 2-byte), or the application stores strings
internally in UTF-8 format, and these strings are converted to the proper glyphs
only when displaying or printing them. Recent versions of Microsoft Windows
use Unicode internally; The Plan-9 operating system pioneered the UTF-8 en-
coding approach, which is now widely used in Unix/Linux. The
advantage of UTF-8 encoding as an internal representation is that it is physically an 8-
bit encoding, and therefore compatible with nearly all existing databases, file
formats and libraries. This circumvents the need for double entry-points for
functions that take string parameters —as is the case in Microsoft Windows,
where many functions exist in an “A”nsi and a “W”ide version. A disadvantage of UTF-8
is that it is a variable length encoding, and many in-memory
string operations are therefore clumsy (and inefficient). That said, with the
appearance of surrogate pairs, Unicode has now also become a variable length
encoding.
The PAWN language requires that its keywords and symbols names are in ascii,
and it allows non-ascii characters in strings. There are five ways that a host
application could support non-ascii characters in strings and character
literals:
1 Support codepages: in this strategy the entire complexity of choosing the
correct glyphs and fonts is delegated to the host application. The codepage
support is based on codepage mapping files with a file format of the “cross
mapping tables” distributed by the Unicode consortium.
2 Support Unicode or UCS-4 and let the PAWN compiler convert scripts that
were written using a codepage to “wide” characters: for this strategy, you
need to set #pragma codepage or use the equivalent compiler option. The
compiler will only correctly translate characters in unpacked strings.
3 Support Unicode or UCS-4 and let the PAWN compiler convert scripts encoded
in UTF-8 to “wide” characters: when the source file for the PAWN
compiler is in UTF-8 encoding, the compiler expands characters to Unicode/UCS-4 in unpacked strings.
4 Support UTF-8 encoding internally (in the host application) and write the
source file in UTF-8 too: all strings should now be packed strings to avoid
the compiler to convert them.
For most internationalization strategies, as you can see, the host application
needs to support Unicode or UCS-4. As a side note, the PAWN compiler does not
generate Unicode surrogate pairs. If characters outside the BMP are needed
and the host application (or operating system) does not support the full UCS-4
encoding, the host application must split the 32-bit character cell provided
by the PAWN compiler into a surrogate pair.
The PAWN compiler accepts a source file as an UTF-8 encoded text file —see
page 168. When the source file is in UTF-8 encoding, “wide” characters in
an unpacked string are stored as multi-byte Unicode/UCS-4 characters; wide
characters in a packed string remain in UTF-8 encoding. To write
source files in UTF-8 encoding, you need, of course, a (programmer’s) editor
that supports UTF-8. Codepage translation does not apply for files that
are in UTF-8 encoding.
For an occasional Unicode character in a literal string, an alternative is that
you use an escape sequence. As Unicode character tables
are usually documented with hexadecimal glyph indices, the xhhh; sequence is probably the
more convenient specification of a random Unicode character. For example,
the escape sequence “\x2209” stands for the “6∈” character.
There is a lot more to internationalization than just basic support for extended
character sets, such as formatting date & time fields, reading order
(left-to-right or right-to-left) and locale-driven translation of system messages. The
PAWN toolkit delegates these issues to the host application.
### • Working with tags
The tag name system was invented to add a “usage checking” mechanism to PAWN.
A tag denotes a “purpose” of a value or variable, and the PAWN compiler
issues a diagnostic message when the tag of an expression does not match the
required tag for the context of the expression.
Many modern computer languages offer variable types, where a type specifies
the memory layout and the purpose of the variable. The programming language
then checks the type equivalence; the pascal language is very strict at checking
type equality, whereas the C programming language is more forgiving. The
PAWN language does not have types: all variables have the size and the layout
of a cell, although bit representations in the cell may depend on the purpose
of the variable. In summary:
- a type specifies the memory layout and the range of variables and function results
- a tagname labels the purpose of variables, constants and function results
Tags in PAWN are mostly optional. A program that was “fortified” with tag
names on the variable and constant declarations will function identically when
all tag names are removed. One exception is formed by user-defined operators:
the PAWN compiler uses the tags of the operands to choose between any user-
defined operators and the standard operator.
The snippet below declares three variables and does three assignments, two of
which give a “tag mismatch” diagnostic message:
Listing: comparing apples to oranges
```c
new apple:elstar /* variable "elstar" with tag "apple" */
new orange:valencia /* variable "valencia" with tag "orange" */
new x /* untagged variable "x" */
elstar = valencia /* tag mismatch */
elstar = x /* tag mismatch */
x = valencia /* ok */
```
The first assignment causes a “tag mismatch” diagnostic as it assigns an “or-
ange” tagged variable to a variable with an “apple” tag. The second assignment
puts the untagged value of x into a tagged variable, which causes again a di-
agnostic. When the untagged variable is on the left hand of the assignment
operator, as in the third assignment, there is no warning or error message. As
variable x is untagged, it can accept a value of any weak tag.
The same mechanism applies to passing variables or expressions to functions
as function operands —see page 78 for an example. In short, when a function
expects a particular tag name on an argument, you must pass an expression/
variable with a matching tag to that function; but if the function expects an
untagged argument, you may pass in arguments with any weak tag.
On occasion, it is necessary to temporarily change the tag of an expression.
For example, with the declarations of the previous code snippet, if you would
wish to compare apples with oranges (recent research indicates that comparing
apples to oranges is not as absurd than popular belief holds), you could use:
```c
if (apple:valencia < elstar)
valencia = orange:elstar
```
The test expression of the if statement (between parentheses) compares the
variable valencia to the variable elstar. To avoid a “tag mismatch” diagnos-
tic, it puts a tag override apple: on valencia —after that, the expressions
on the left and the right hands of the > operator have the same tag
name: “apple:”. The second line, the assignment of elstar to valencia, overrides
the tag name of elstar or orange: before the assignment. In an assignment,
you cannot override the tag name of the destination; i.e., the left hand of
the = operator. It is an error to write “apple:valencia = elstar”. In the as-
signment, valencia is an “lvalue” and you cannot override the tag name of an
lvalue.
As shown earlier, when the left hand of an assignment holds an
untagged variable, the expression on the right hand may have any weak tag name. When
used as an lvalue, an untagged variable is compatible with all weak tag names.
Or rather, a weak tag is silently dropped when it is assigned to an untagged
variable or when it is passed to a function that expects an untagged argument.
When a tag name indicates the bit pattern of a cell, silently dropping a weak
tag can hide errors. For example, the snippet below has an error that is not
immediately obvious:
Listing: bad way of using tags
```c
#pragma rational float
new limit = -5.0
new value = -1.0
if (value < limit)
printf("Value %f below limit %f\n", value, limit)
else
printf("Value above limit\n")
```
Through the “#pragma rational”, all rational numbers receive the “float”
tag name and these numbers are encoded in the 4-byte IEEE 754 format. The
snippet declares two variables, limit and value, both of which are untagged
(this is the error). Although the literal values -5.0 and -1.0 are implicitly
tagged with float:, this weak tag is silently dropped when the values
get assigned to the untagged symbols limit and value. Now, the if statement
compares value to limit as integers, using the built-in standard < operator
(a user-defined operator would be more appropriate to compare two IEEE 754
encoded values). When run, this code snippet tells us that “Value -1.000000
below limit -5.000000” —which is incorrect, of course.
To avoid such subtle errors to go undetected, one should use strong tags. A
strong tag is merely a tag name that starts with an upper case letter, such
as Float: instead of float:. A strong tag is never automatically “dropped”,
but it may still be explicitly overridden. Below is a modified code snippet
with the proposed adaptations:
Listing: strong tags are safer
```c
#pragma rational Float
new Float:limit = -5.0
new Float:value = -1.0
if (value < limit)
printf("Value %f below limit %f\n", _:value, _:limit)
else
printf("Value above limit\n")
```
Forgetting the Float: tag name in the declaration of the variables
limit or value immediately gives a “tag mismatch” diagnostic, because the literal
values -5.0 and -1.0 now have a strong tag name.
printf is a general purpose function that can print strings and values in
various formats. To be general purpose, printf accepts arguments with any weak tag
name, be it apple:’s, orange:’s, or something else. The printf
function does this by accepting untagged arguments —weak tags are dropped when an
untagged argument is expected. Strong tags, however, are never dropped, and
in the above snippet (which uses the original definition of printf), I
needed to put an empty tag override, “\_:”, before the variables value and limit in
the first printf call.
There is an alternative to untagging expressions with strong tag names in gen-
eral purpose functions: adjust the definition of the function to accept both
all weak tags and a selective set of strong tag names. The PAWN language supports
multiple tag names for every function arguments. The original definition of printf (from the file console.inc) is:
```c
native printf(const format[], ...);
```
By adding both a Float: tag and an empty tag in front of the ellipsis (“...”),
printf will accept arguments with the Float: tag name, arguments without
a tag name and arguments that have a weak tag name. To specify plural tag
names, enclose all tag names without their final colon between braces with a
comma separating the tag names (see the example below). It is necessary to
add the empty tag specification to the list of tag names, because printf would
otherwise only accept arguments with a Float: tag name. Below is the new
definition of the function printf:
```c
native printf(const format[], {Float, \_}: ...);
```
Plural tags allow you to write a single function that accepts cells with a pre-
cisely specified subset of tags (strong and/or weak). While a function argument
may accept being passed actual arguments with diverse tags, a variable can
only have a single tag —and a formal function argument is a local variable in
the body of the function. In the presence of plural tags, the formal function
argument takes on the tag that is listed first.
On occasion, you may want to check which tag an actual function argument
had, when the argument accepts plural tags. Checking the tag of the formal
argument (in the body of the function) is of no avail, because it will always
have the first tag in the tag list in the declaration of the function argument.
You can check the tag of the actual argument by adding an extra argument
to the function, and set its default value to be the “tagof” of the argument
in question. Similar to the sizeof operator, the tagof operator has a special
meaning when it is applied in a default value of
a function argument: the expression is evaluated at the point of the function call,
instead of at the function definition.
This means that the “default value” of the function argument is
the actual tag of the parameter passed to the function.
Inside the body of the function, you can compare the tag to known tags by,
again, using the tagof operator.
### • Concatenating lines
PAWN is a free format language, but the parser directives must be on a single line.
Strings may not run over several lines either. When this is inconvenient,
you can use a backslash character (“\”) at the end of a line to “glue” that
line with the next line.
For example:
```c
#define max_path max_drivename + max_directorystring + \
max_filename + max_extension
```
You also use the concatenation character to cut long literal strings over
multiple lines. Note that the “\” eats up all trailing white space that comes after it
and leading white space on the next line. The example below prints “Hello
world” with one space between the two words (because there is a space between
”Hello” and the backslash):
```c
print("Hello \
world")
```
### • A program that generates its own source code
An odd, slightly academic, criterion to quantify the “expressiveness” of a pro-
gramming language is size of the smallest program that, upon execution, re-
generates its own source code. The rationale behind this criterion
is that the shorter the self-generating program, the more flexible and expressive the
language must be. Programs of this kind have been created for many program-
ming languages —sometimes surprisingly small, as for languages that have a
built-in reflective capabilities.
Self-generating programs are called “quines”, in honour of the
philosopher Willard Van Orman Quine who wrote self-creating phrases in natural language.
The work of Van Orman Quine became well known through the books “G¨odel,
Escher, Bach” and “Metamagical Themas” by Douglas Hofstadter.
The PAWN quine is in the example below; it is modelled after the famous “C”
quine (of which many variations exist). At 77 characters, it is amongst the
smallest versions for the class of imperative programming languages, and the
size can be reduced to 73 characters by removing four “space” characters that
were left in for readability.
Listing: quine.p
```c
new s[]="new s[]=%c%s%c; main() printf s,34,s,34"; main() printf s,34,s,34
```
---
`See the separate application note for proposed native functions that operate on both packed and unpacked strings`
`EOS: predefined constant to mark the End Of String; it has the value ’\0’`
`Predefined constants: 102`
`Packed & unpacked strings: 99`
`Escape sequence: 99`
`Tag names: 68`
`User-defined operators: 86`
`More tag name rules: 68`
`lvalue (definition of ~): 104`
`Directives: 77`
`Directives: 117`
---
[Go Back to Contents](00-Contents.md)
| openmultiplayer/web/docs/scripting/language/reference/12-Assorted-tips.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/language/reference/12-Assorted-tips.md",
"repo_id": "openmultiplayer",
"token_count": 6446
} | 335 |
---
title: Crime List
description: Crime List used by PlayCrimeReportForPlayer function.
sidebar_label: Crime List
---
:::info
Here you can find all of the crime IDs used by [PlayCrimeReportForPlayer](../functions/PlayCrimeReportForPlayer) function.
:::
| Crime ID | Ten-code | Description |
| -------- | -------- | -------------------------------------------------------- |
| 3 | 10-71 | Advise nature of fire (size, type, contents of building) |
| 4 | 10-37 | Emergency road repairs needed |
| 5 | 10-81 | Breatherlizer Report |
| 6 | 10-24 | Assignment Completed |
| 7 | 10-21 | Call () by phone |
| 8 | 10-21 | Call () by phone |
| 9 | 10-21 | Call () by phone |
| 10 | 10-17 | Meet Complainant |
| 11 | 10-81 | Breatherlizer Report |
| 12 | 10-91 | Pick up prisoner/subject |
| 13 | 10-28 | Vehicle registration information |
| 14 | 10-81 | Breathalyzer |
| 15 | 10-28 | Vehicle registration information |
| 16 | 10-91 | Pick up prisoner/subject |
| 17 | 10-34 | Riot |
| 18 | 10-37 | (Investigate) suspicious vehicle |
| 19 | 10-81 | Breathalyzer |
| 21 | 10-7 | Out of service |
| 22 | 10-7 | Out of service |
| openmultiplayer/web/docs/scripting/resources/crimelist.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/resources/crimelist.md",
"repo_id": "openmultiplayer",
"token_count": 1225
} | 336 |
---
description: This page has most of the available interiors in SAMP.
sidebar_label: Interiors
---
## How to get the Interior ID
---
If you are inside an interior type
```c
/interior
```
and you'll see the ID of the interior universe. Now you can safely use [SetPlayerInterior](../functions/SetPlayerInterior) and [LinkVehicleToInterior](../functions/LinkVehicleToInterior) before using [SetPlayerPos](../functions/SetPlayerPos).
## Interiors List
---
## 24/7's
| Interior | Interior ID | X | Y | Z | Picture |
| -------- | ----------- | -------- | --------- | --------- | -------------------------------------- |
| 24/7 1 | 17 | -25.7220 | -187.8216 | 1003.5469 |  |
| 24/7 2 | 10 | 6.0856 | -28.8966 | 1003.5494 |  |
| 24/7 3 | 18 | -30.9875 | -89.6806 | 1003.5469 |  |
| 24/7 4 | 16 | -26.1856 | -140.9164 | 1003.5469 |  |
| 24/7 5 | 4 | -27.844 | -26.6737 | 1003.5573 |  |
| 24/7 6 | 6 | -26.8339 | -55.5846 | 1003.5469 |  |
## Modding shops
| Interior | Interior ID | X | Y | Z | Picture |
| ----------------- | ----------- | -------- | --------- | --------- | ------------------------------------- |
| Loco Low Co. | 2 | 611.3536 | -77.5574 | 997.9995 |  |
| Wheel Arch Angels | 3 | 612.2191 | -123.9028 | 997.9922 |  |
| TransFender | 1 | 621.4528 | -23.7289 | 1000.9219 |  |
## Casinos
| Interior | Interior ID | X | Y | Z | Picture |
| ---------------------- | ----------- | --------- | --------- | --------- | -------------------------------------- |
| Four Dragons | 10 | 2016.1156 | 1017.1541 | 996.875 |  |
| Casino (Redsands West) | 12 | 1000.6797 | 1133.35 | -7.8462 |  |
| Caligula's Casino | 1 | 2233.9363 | 1711.8038 | 1011.6312 |  |
| Caligula's Roof | 1 | 2268.5156 | 1647.7682 | 1084.2344 |  |
## Clothing Shops
| Interior | Interior ID | X | Y | Z | Picture |
| ------------ | ----------- | -------- | --------- | --------- | ------------------------------------- |
| Victim | 5 | 225.0306 | -9.1838 | 1002.218 |  |
| Sub Urban | 1 | 204.1174 | -46.8047 | 1001.8047 |  |
| Zip | 18 | 161.4048 | -94.2416 | 1001.8047 |  |
| Didier Sachs | 14 | 204.1658 | -165.7678 | 1000.5234 |  |
| Binco | 15 | 207.5219 | -109.7448 | 1005.1328 |  |
| Pro-Laps | 3 | 206.4627 | -137.7076 | 1003.0938 |  |
## Restaurants, bars
| Interior | Interior ID | X | Y | Z | Picture |
| -------------------- | ----------- | --------- | --------- | --------- | -------------------------------------- |
| Pizza Stack | 5 | 372.5565 | -131.3607 | 1001.4922 |  |
| Rusty Brown's Donuts | 17 | 378.026 | -190.5155 | 1000.6328 |  |
| Burger Shot | 10 | 366.0248 | -73.3478 | 1001.5078 |  |
| Cluckin' Bell | 9 | 366.0002 | -9.4338 | 1001.8516 |  |
| Bar | 11 | 501.9578 | -70.5648 | 998.7578 |  |
| Lil' Probe Inn | 18 | -227.5703 | 1401.5544 | 27.7656 |  |
## Barber, tattoo, sex shops
| Interior | Interior ID | X | Y | Z | Picture |
| ------------- | ----------- | --------- | -------- | --------- | -------------------------------------- |
| Barber shop 1 | 12 | 411.9707 | -51.9217 | 1001.8984 |  |
| Barber shop 2 | 2 | 414.2987 | -18.8044 | 1001.8047 |  |
| Barber shop 3 | 3 | 418.4666 | -80.4595 | 1001.8047 |  |
| Tattoo sarlor | 3 | -201.2236 | -43.2465 | 1002.2734 |  |
| Sex shop | 3 | -100.2674 | -22.9376 | 1000.7188 |  |
## Burglary houses
| Interior | Interior ID | X | Y | Z | Picture |
| ----------------- | ----------- | ------------- | --------- | --------- | -------------------------------------- |
| Burglary house 1 | 3 | 234.6087 | 1187.8195 | 1080.2578 |  |
| Burglary house 2 | 2 | 225.5707 | 1240.0643 | 1082.1406 |  |
| Burglary house 3 | 1 | 224.288 | 1289.1907 | 1082.1406 |  |
| Burglary house 4 | 5 | 239.2819 | 1114.1991 | 1080.9922 |  |
| Burglary house 5 | 15 | 295.1391 | 1473.3719 | 1080.2578 |  |
| Burglary house 6 | 2 | 446.626 | 1397.738 | 1084.3047 |  |
| Burglary house 7 | 5 | 227.7559 | 1114.3844 | 1080.9922 |  |
| Burglary house 8 | 4 | 261.1165 | 1287.2197 | 1080.2578 |  |
| Burglary house 9 | 10 | 24.3769 | 1341.1829 | 1084.375 |  |
| Burglary house 10 | 4 | 221.6766 | 1142.4962 | 1082.6094 |  |
| Burglary house 11 | 4 | -262.1759 | 1456.6158 | 1084.3672 |  |
| Burglary house 12 | 5 | 22.861 | 1404.9165 | 1084.4297 |  |
| Burglary house 13 | 5 | 140.3679 | 1367.8837 | 1083.8621 |  |
| Burglary house 14 | 6 | 234.2826 | 1065.229 | 1084.2101 |  |
| Burglary house 15 | 6 | -68.5145 | 1353.8485 | 1080.2109 |  |
| Burglary house 16 | 15 | -285.2511 | 1471.197 | 1084.375 |  |
| Burglary house 17 | 8 | -42.5267 | 1408.23 | 1084.4297 |  |
| Burglary house 18 | 9 | 84.9244 | 1324.2983 | 1083.8594 |  |
| Burglary house 19 | 9 | 260.7421 | 1238.2261 | 1084.2578 |  |
## Ammunations
| Interior | Interior ID | X | Y | Z | Picture |
| ------------- | ----------- | -------- | --------- | --------- | -------------------------------------- |
| Ammu-nation 1 | 7 | 315.244 | -140.8858 | 999.6016 |  |
| Ammu-nation 2 | 1 | 285.8361 | -39.0166 | 1001.5156 |  |
| Ammu-nation 3 | 4 | 291.7626 | -80.1306 | 1001.5156 |  |
| Ammu-nation 4 | 6 | 297.144 | -109.8702 | 1001.5156 |  |
| Ammu-nation 5 | 6 | 316.5025 | -167.6272 | 999.5938 |  |
## Safe houses
| Interior | Interior ID | X | Y | Z | Picture |
| ------------------------- | ----------- | --------- | ---------- | --------- | -------------------------------------- |
| The Johnson house | 3 | 2496.0549 | -1695.1749 | 1014.7422 |  |
| Angel Pine trailer | 2 | 1.1853 | -3.2387 | 999.4284 |  |
| Abandoned AC tower | 10 | 419.8936 | 2537.1155 | 10.0000 |  |
| Wardrobe/Changing room | 14 | 256.9047 | -41.6537 | 1002.0234 |  |
| The Camel's Toe safehouse | 1 | 2216.1282 | -1076.3052 | 1050.4844 |  |
| Verdant Bluffs safehouse | 8 | 2365.1089 | -1133.0795 | 1050.875 |  |
| Willowfield safehouse | 11 | 2282.9766 | -1140.2861 | 1050.8984 |  |
| Safehouse 1 | 5 | 2233.6919 | -1112.8107 | 1050.8828 |  |
| Safehouse 3 | 9 | 2319.1272 | -1023.9562 | 1050.2109 |  |
| Safehouse 4 | 10 | 2261.0977 | -1137.8833 | 1050.6328 |  |
| Unused safe house | 12 | 2323.7063 | -1147.6509 | 1050.7101 |  |
## Girlfriend related
| Interior | Interior ID | X | Y | Z | Picture |
| ----------------- | ----------- | -------- | -------- | --------- | ------------------------------------- |
| Denise's house | 1 | 245.2307 | 304.7632 | 999.1484 |  |
| Helena's barn | 3 | 290.623 | 309.0622 | 999.1484 |  |
| Barbara's "house" | 5 | 322.5014 | 303.6906 | 999.1484 |  |
| Katie's house | 2 | 269.6405 | 305.9512 | 999.1484 |  |
| Michelle's house | 4 | 306.1966 | 307.819 | 1003.3047 |  |
## Departments
| Interior | Interior ID | X | Y | Z | Picture |
| ------------------------------ | ----------- | -------- | -------- | --------- | -------------------------------------- |
| Planning Department | 3 | 386.5259 | 173.6381 | 1008.3828 |  |
| Los Santos Police Department | 6 | 246.6695 | 65.8039 | 1003.6406 |  |
| Las Venturas Police Department | 3 | 288.4723 | 170.0647 | 1007.1794 |  |
| San Fierro Police Department | 10 | 246.0688 | 108.9703 | 1003.2188 |  |
## Stadiums
| Interior | Interior ID | X | Y | Z | Picture |
| ------------------ | ----------- | ---------- | --------- | --------- | -------------------------------------- |
| Oval Stadium | 1 | -1402.6613 | 106.3897 | 1032.2734 |  |
| Vice Stadium | 16 | -1401.067 | 1265.3706 | 1039.8672 |  |
| Blood Bowl Stadium | 15 | -1417.8927 | 932.4482 | 1041.5313 |  |
## Schools
| Interior | Interior ID | X | Y | Z | Picture |
| -------------- | ----------- | ---------- | --------- | --------- | -------------------------------------- |
| Bike school | 3 | 1494.8589 | 1306.48 | 1093.2953 |  |
| Driving school | 3 | -2031.1196 | -115.8287 | 1035.1719 |  |
## GYMs
| Interior | Interior ID | X | Y | Z | Picture |
| ------------------ | ----------- | -------- | -------- | --------- | -------------------------------------- |
| Ganton Gym | 5 | 770.8033 | -0.7033 | 1000.7267 |  |
| Cobra Gym | 3 | 773.8887 | -47.7698 | 1000.5859 |  |
| Below The Belt Gym | 1 | 773.7318 | -74.6957 | 1000.6542 |  |
## Clubs, Brothels
| Interior | Interior ID | X | Y | Z | Picture |
| -------------------------- | ----------- | --------- | --------- | --------- | -------------------------------------- |
| Brothel 1 | 3 | 974.0177 | -9.5937 | 1001.1484 |  |
| Brothel 2 | 3 | 961.9308 | -51.9071 | 1001.1172 |  |
| The Big Spread Ranch | 3 | 1212.1489 | -28.5388 | 1000.9531 |  |
| The Pig Pen | 2 | 1204.668 | -13.5429 | 1000.9219 |  |
| Club | 17 | 493.1443 | -24.2607 | 1000.6797 |  |
| Fanny Batter's Whore House | 6 | 748.4623 | 1438.2378 | 1102.9531 |  |
## Warehouses
| Interior | Interior ID | X | Y | Z | Picture |
| ----------- | ----------- | --------- | ------- | --------- | ------------------------------------ |
| Warehouse 1 | 18 | 1290.4106 | 1.9512 | 1001.0201 |  |
| Warehouse 2 | 1 | 1412.1472 | -2.2836 | 1000.9241 |  |
## Cutscene, Missions
| Interior | Interior ID | X | Y | Z | Picture |
| ------------------------------ | ----------- | ---------- | ---------- | --------- | -------------------------------------- |
| Inside Track Betting | 3 | 830.6016 | 5.9404 | 1004.1797 |  |
| Blastin' Fools Records | 3 | 1037.8276 | 0.397 | 1001.2845 |  |
| B Dup's Apartment | 3 | 1527.0468 | -12.0236 | 1002.0971 |  |
| B Dup's Crack Palace | 2 | 1523.5098 | -47.8211 | 1002.2699 |  |
| OG Loc's House | 3 | 512.9291 | -11.6929 | 1001.5653 |  |
| Ryder's house | 2 | 2447.8704 | -1704.4509 | 1013.5078 |  |
| Sweet's House | 1 | 2527.0176 | -1679.2076 | 1015.4986 |  |
| Wu-Zi Mu's | 1 | -2158.6731 | 642.09 | 1052.375 |  |
| Los Santos Airport | 14 | -1864.9434 | 55.7325 | 1055.5276 |  |
| Four Dragons' Janitor's Office | 10 | 1893.0731 | 1017.8958 | 31.8828 |  |
| Jefferson Motel | 15 | 2217.281 | -1150.5349 | 1025.7969 |  |
| Kickstart Stadium | 14 | -1420.4277 | 1616.9221 | 1052.5313 |  |
| Liberty City | 1 | -741.8495 | 493.0036 | 1371.9766 |  |
| Francis International Airport | 14 | -1813.213 | -58.012 | 1058.9641 |  |
| The Pleasure Domes | 3 | -2638.8232 | 1407.3395 | 906.4609 |  |
| RC Battlefield | 10 | -1129.8909 | 1057.5424 | 1346.4141 |  |
| San Fierro Garage | 1 | -2041.2334 | 178.3969 | 28.8465 |  |
| The Welcome Pump | 1 | 681.6216 | -451.8933 | -25.6172 |  |
| 8-Track Stadium | 7 | -1403.0116 | -250.4526 | 1043.5341 |  |
| Dirtbike Stadium | 4 | -1421.5618 | -663.8262 | 1059.5569 |  |
| Crack Den | 5 | 322.1117 | 1119.3270 | 1083.8830 |  |
| Big Smoke's Crack Palace | 2 | 2536.5322 | -1294.8425 | 1044.125 |  |
| Zero's RC Shop | 6 | -2240.1028 | 136.973 | 1035.4141 |  |
| Sherman Dam | 17 | -944.2402 | 1886.1536 | 5.0051 |  |
| Rosenberg's Office | 2 | 2182.2017 | 1628.5848 | 1043.8723 |  |
| Secret Valley Diner | 6 | 442.1295 | -52.4782 | 999.7167 |  |
| World of Coq | 1 | 445.6003 | -6.9823 | 1000.7344 |  |
| Jays Diner | 5 | 454.9853 | -107.2548 | 999.4376 |  |
| Madd Dogg's Mansion | 5 | 1267.8407 | -776.9587 | 1091.9063 |  |
| Colonel Furhberger's | 8 | 2807.3604 | -1171.7048 | 1025.5703 |  |
| Burning Desire Building | 5 | 2350.1597 | -1181.0658 | 1027.9766 |  |
| Atrium | 18 | 1727.2853 | -1642.9451 | 20.2254 |  |
| Sindacco Abatoir | 1 | 963.0586 | 2159.7563 | 1011.0303 |  |
| Jet Interior | 1 | 1.5491 | 23.3183 | 1199.5938 |  |
| Andromada | 9 | 315.4544 | 976.5972 | 1960.8511 |  |
| Palomino Bank | 0 | 2306.3826 | -15.2365 | 26.7496 |  |
| Dillimore Gas Station | 0 | 663.0588 | -573.6274 | 16.3359 |  |
## Non-categorized
| Interior | Interior ID | X | Y | Z | Picture |
| --------------------- | ----------- | --------- | ---------- | --------- | -------------------------------------- |
| Random House | 2 | 2236.6997 | -1078.9478 | 1049.0234 |  |
| Budget Inn Motel Room | 12 | 446.3247 | 509.9662 | 1001.4195 |  |
| openmultiplayer/web/docs/scripting/resources/interiorids.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/resources/interiorids.md",
"repo_id": "openmultiplayer",
"token_count": 9951
} | 337 |
---
title: "Svar Types"
---
:::info
Types of server variables (also called svar types) used by [GetSVarType](../functions/GetSVarType) function.
See also: [Server variable system](../../tutorials/servervariablesystem)
:::
| ID | Definition |
| -- | --------------------- |
| 0 | SERVER_VARTYPE_NONE |
| 1 | SERVER_VARTYPE_INT |
| 2 | SERVER_VARTYPE_STRING |
| 3 | SERVER_VARTYPE_FLOAT |
| openmultiplayer/web/docs/scripting/resources/svartypes.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/resources/svartypes.md",
"repo_id": "openmultiplayer",
"token_count": 169
} | 338 |
---
title: Weapon Slots
description: Weapon Slots used by GetWeaponSlot and GetPlayerWeaponData.
---
:::info
Weapon Slots used by [GetWeaponSlot](../functions/GetWeaponSlot) and [GetPlayerWeaponData](../functions/GetPlayerWeaponData).
:::
| Definition | Value |
|---------------------------|-------|
| WEAPON_SLOT_UNKNOWN | -1 |
| WEAPON_SLOT_UNARMED | 0 |
| WEAPON_SLOT_MELEE | 1 |
| WEAPON_SLOT_PISTOL | 2 |
| WEAPON_SLOT_SHOTGUN | 3 |
| WEAPON_SLOT_MACHINE_GUN | 4 |
| WEAPON_SLOT_ASSAULT_RIFLE | 5 |
| WEAPON_SLOT_LONG_RIFLE | 6 |
| WEAPON_SLOT_ARTILLERY | 7 |
| WEAPON_SLOT_EXPLOSIVES | 8 |
| WEAPON_SLOT_EQUIPMENT | 9 |
| WEAPON_SLOT_GIFT | 10 |
| WEAPON_SLOT_GADGET | 11 |
| WEAPON_SLOT_DETONATOR | 12 |
| openmultiplayer/web/docs/scripting/resources/weaponslots.md/0 | {
"file_path": "openmultiplayer/web/docs/scripting/resources/weaponslots.md",
"repo_id": "openmultiplayer",
"token_count": 445
} | 339 |
---
title: OnVehicleSirenStateChange
description: يتم إستدعاء هذا الكال باك عند تفعيل صفارة الإنذار للسيارة
tags: ["vehicle"]
---
<VersionWarn name='callback' version='SA-MP 0.3.7' />
<div dir="rtl" style={{ textAlign: "right" }}>
## Description
يتم إستدعاء هذا الكال باك عند تفعيل صفارة الإنذار للسيارة
| Name | Description |
| --------- | --------------------------------------------------------- |
| playerid | إيدي اللاعب الذي فعّل صفارة الإنذار (السائق) |
| vehicleid |إيدي السيارة التي تم تفعيل صفارة الإنذار فيها |
| newstate | 1 تم إطفاء الصفارة 0 | إذا تم تشغيل الصفارة |
## Returns
1 - سيمنع ال(الغيم مود¹) من تلقي هذا الكالباك
0 - يشير إلى أنه سيتم تمرير هذا الكال باك إلى ال(الغيم مود¹) القادم
¹الغيم مود = gamemode
يتم إستدعائه أولا في الفيلترسكريبتات
## أمثلة
</div>
```c
public OnVehicleSirenStateChange(playerid, vehicleid, newstate)
{
if (newstate)
{
GameTextForPlayer(playerid, "~W~Siren ~G~on", 1000, 3);
}
else
{
GameTextForPlayer(playerid, "~W~Siren ~r~off", 1000, 3);
}
return 1;
}
```
<div dir="rtl" style={{ textAlign: "right" }}>
## Notes
:::tip
يتم إستدعاء هذا الكالباك فقط عندما يتم تشغيل او إطفاء صفارة الإنظار
:::
## وظائف ذات صلة
قد تكون الوظائف التالية مفيدة، حيث أنها ذات صلة بهذا الاستدعاء بطريقة أو بأخرى
- [GetVehicleParamsSirenState](../functions/GetVehicleParamsSirenState): التحقق إذ كانت صفارة الإنذار الخاصة بالسيارة مشغلة أو لا
</div>
| openmultiplayer/web/docs/translations/ar/scripting/callbacks/OnVehicleSirenStateChange.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/ar/scripting/callbacks/OnVehicleSirenStateChange.md",
"repo_id": "openmultiplayer",
"token_count": 1073
} | 340 |
---
title: OnEnterExitModShop
description: Ovaj callback se poziva kada igrač uđe ili izađe iz mod shopa.
tags: []
---
## Deskripcija
Ovaj callback se poziva kada igrač uđe ili izađe iz mod shopa.
| Ime | Deskripcija |
| ---------- | -------------------------------------------------------- |
| playerid | ID igrača koji je ušao ili izašao iz modshop-a |
| enterexit | 1 ako je igrač ušao 0 ako je izašao iz modshop-a |
| interiorid | ID interijera modshopa u koji igrač ulazi (0 ako izlazi) |
## Returns
Uvijek je pozvana prva u filterskripti.
## Primjeri
```c
public OnEnterExitModShop(playerid, enterexit, interiorid)
{
if (enterexit == 0) // Ako je enterexit 0, to znači da izlaze iz modshop-a
{
SendClientMessage(playerid, COLOR_WHITE, "Sjajno vozilo! Naplaceno ti je $100.");
GivePlayerMoney(playerid, -100);
}
return 1;
}
```
## Zabilješke
:::warning
Poznati Bug(ovi): Igrači se sudaraju kad uđu u isti modshop
:::
## Srodne Funkcije
- [AddVehicleComponent](../functions/AddVehicleComponent.md): Dodaj komponentu na vozilo.
| openmultiplayer/web/docs/translations/bs/scripting/callbacks/OnEnterExitModShop.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/callbacks/OnEnterExitModShop.md",
"repo_id": "openmultiplayer",
"token_count": 526
} | 341 |
---
title: OnPlayerDeath
description: Ovaj callback je pozvan kada igrač umre, bilo to samoubistvo ili ubistvo od strane drugog igrača.
tags: ["player"]
---
## Deskripcija
Ovaj callback je pozvan kada igrač umre, bilo to samoubistvo ili ubistvo od strane drugog igrača.
| Ime | Deskripcija |
|---------------|------------------------------------------------------------------------------------------------------|
| playerid | ID igrača koji je umro. |
| killerid | ID igrača koji je ubio igrača koji je umro, ili INVALID_PLAYER_ID ako ga nema (igrač sam sebe ubio). |
| WEAPON:reason | ID razloga zbog kojeg je igrač umro. |
## Returns
0 - Spriječiti će da druge filterskripte primaju ovaj callback.
1 - Označava da će ovaj callback biti proslijeđen do sljedeće filterskripte.
Uvijek je pozvana prva u filterskripti.
## Primjeri
```c
new PlayerDeaths[MAX_PLAYERS];
new PlayerKills[MAX_PLAYERS];
public OnPlayerDeath(playerid, killerid, WEAPON:reason)
{
SendDeathMessage(killerid, playerid, reason); // Prikazuje ubistvo u listi ubistava
// Provjerava da li je killerid validan prije nego što uradi nešto sa njim
if (killerid != INVALID_PLAYER_ID)
{
PlayerKills[killerid] ++;
}
// Izvan provjere upravljamo stvarima za playerid (uvijek je validan)
PlayerDeaths[playerid] ++;
return 1;
}
```
## Zabilješke
:::tip
Razlog će return-ovati 37 (flame thrower/bacač plamena) ako je igrač umro od bilo kojeg izvora vatre (npr. molotov, 18). Razlog će return-ovati 51 ako je igrač umro od bilo koje vrste eksplozije (npr. RPG, granata). Ne moraš provjeravati da li je killerid validan prije nego što ga koristite u `SendDeathMessage`. INVALID_PLAYER_ID je validan killerid ID parametar u toj funkciji. playerid je jedini koji može pozvati ovaj callback. (dobro za znati za sprječavanje lažne smrti 'anti fake death').
:::
:::warning
MORAŠ provjeriti da li je 'killerid' validan (ako nije: INVALID_PLAYER_ID) prije nego ga koristiš u array-u (ili prosto svuda) ili će uzrokovati da OnPlayerDeath izazove skriptu da crasha (ne cijelu skriptu). Ovo ja zbog toga što je INVALID_PLAYER_ID definiran kao 65535, i ako array ima samo 'MAX_PLAYERS' elemente, npr. 500, ti pokušavaš pristupiti indexu koji je iznad 499, što je izvan granica.
:::
## Srodne Funkcije
- [SendDeathMessage](../functions/SendDeathMessage): Dodaj smrt na listu smrti.
- [SetPlayerHealth](../functions/SetPlayerHealth): Postavi health(zdravlje) igraču.
| openmultiplayer/web/docs/translations/bs/scripting/callbacks/OnPlayerDeath.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/callbacks/OnPlayerDeath.md",
"repo_id": "openmultiplayer",
"token_count": 1231
} | 342 |
---
title: OnPlayerObjectMoved
description: Ovaj callback je pozvana kada player object biva premješten nakon MovePlayerObject funkcije (kada se prestane kretati).
tags: ["player"]
---
## Deskripcija
Ovaj callback je pozvana kada player object biva premješten nakon MovePlayerObject funkcije (kada se prestane kretati).
| Ime | Deskripcija |
| -------- | -------------------------------------- |
| playerid | playerid ta koji je objekat dodijeljen |
| objectid | ID player objecta koji je pomjeren |
## Returns
Uvijek je pozvana prva u filterskripti.
## Primjeri
```c
public OnPlayerObjectMoved(playerid, objectid)
{
printf("Player object moved: objectid: %d playerid: %d", objectid, playerid);
return 1;
}
```
## Zabilješke
:::tip
Ovaj callback pozvat će i NPC.
:::
## Related Functions
- [MovePlayerObject](../functions/MovePlayerObject.md): Pomjeri player object.
- [IsPlayerObjectMoving](../functions/IsPlayerObjectMoving.md): Provjeri da li se player object kreće.
- [StopPlayerObject](../functions/StopPlayerObject.md): Zaustavi player object od kretanja.
- [CreatePlayerObject](../functions/CreatePlayerObject.md): Kreiraj objekat za samo jednog igrača.
- [DestroyPlayerObject](../functions/DestroyPlayerObject.md): Uništi player objekat.
| openmultiplayer/web/docs/translations/bs/scripting/callbacks/OnPlayerObjectMoved.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/callbacks/OnPlayerObjectMoved.md",
"repo_id": "openmultiplayer",
"token_count": 464
} | 343 |
---
title: OnRconLoginAttempt
description: Ovaj callback je potvan kada neko pokuša da se uloguje/da pristupi RCONu in-game; uspješno ili ne.
tags: []
---
## Deskripcija
Ovaj callback je potvan kada neko pokuša da se uloguje/da pristupi RCONu in-game; uspješno ili ne.
| Ime | Deskripcija |
| ---------- | ---------------------------------------------------- |
| ip[] | IP igrača koji se pokušao ulogovati/pristupi u RCON. |
| password[] | Lozinka kojim je pokušao pristupiti. |
| success | 0 ako je lozinka netačna 1 je tačna. |
## Returns
Uvijek je pozvan prvo u filterskriptama.
## Primjeri
```c
public OnRconLoginAttempt(ip[], password[], success)
{
if (!success) //Ako je lozinka netačna
{
printf("NESUPJESNA KONEKCIJA NA RCON, IP %s KORISTIO LOZINKU %s",ip, password);
new pip[16];
for(new i = GetPlayerPoolSize(); i != -1; --i) //Petlja kroz sve igrače
{
GetPlayerIp(i, pip, sizeof(pip));
if (!strcmp(ip, pip, true)) //Ako je IP igrača isti kao i IP koji nije uspio pristupiti RCONu
{
SendClientMessage(i, 0xFFFFFFFF, "Pogresna lozinka. Cao!"); //Posalji poruku
Kick(i); //Sada je kickovan.
}
}
}
return 1;
}
```
## Zabilješke
:::tip
Ovaj callback je pozvan samo kada se /rcon login iskoristi unutar igra. Ovaj callback je pozvan samo kada igral nije još ulogovan (nije još pristupio) u RCON. Kada se igrač prijavi/uloguje u RCON, OnRconCommand se poziva umjesto toga.
:::
## Srodne Funkcije
- [IsPlayerAdmin](../functions/IsPlayerAdmin.md): Provjerava da li je igrač pristupio/ulogovan u RCON.
- [SendRconCommand](../functions/SendRconCommand.md): Šalje RCON komandu preko skripte.
| openmultiplayer/web/docs/translations/bs/scripting/callbacks/OnRconLoginAttempt.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/callbacks/OnRconLoginAttempt.md",
"repo_id": "openmultiplayer",
"token_count": 878
} | 344 |
---
title: AddPlayerClassEx
description: Ova funkcija je u potpunosti ista kao i AddPlayerClass funkcija, sa akcentom na 'Tim' parametar.
tags: ["player"]
---
## Deskripcija
Ova funkcija je u potpunosti ista kao i AddPlayerClass funkcija, sa akcentom na 'Tim' parametar.
| Ime | Deskripcija |
| ------------- | ---------------------------------------------------------- |
| teamid | Tim u koji hoćete da se igrač spawnuje/stvori. |
| modelid | Skin sa kojim će se igrač spawnovati/stvoriti. |
| Float:spawn_x | X kordinata spawnpointa ove klase. |
| Float:spawn_y | Y kordinata spawnpointa ove klase. |
| Float:spawn_z | Z kordinata spawnpointa ove klase. |
| Float:z_angle | Smjer u koji će igrač gledati nakon spawnovanja/stvaranja. |
| weapon1 | Prvo spawn-oružje za igrača. |
| weapon1_ammo | Količina municije za primarno spawn oružje. |
| weapon2 | Drugo spawn-oružje za igrača. |
| weapon2_ammo | Količina municije za sekundarno spawn oružje. |
| weapon3 | Treće spawn-oružje za igrača. |
| weapon3_ammo | Količina municije za treće spawn oružje. |
## Returns
ID klase koja je upravo dodana.
319 ako je limit klasa (320) dostignut. Najveći mogući ID klase je 319.
## Primjeri
```c
public OnGameModeInit()
{
// Igrači se mogu spawnovati/stvoriti i sa CJ skinom
// CJ Skin (ID 0) u timu 1.
// The Truth skin (ID 1) u timu 2.
AddPlayerClassEx(1, 0, 1958.33, 1343.12, 15.36, 269.15, 26, 36, 28, 150, 0, 0); // CJ
AddPlayerClassEx(2, 1, 1958.33, 1343.12, 15.36, 269.15, 26, 36, 28, 150, 0, 0); // The Truth
return 1;
}
```
## Zabilješke
:::tip
Najveći mogući ID klase je 319 (Počinje od 0, znači maksimalno 320 klasa). Kada je limit dostignut, sve naredne dodane klase će zamijeniti ID 319.
:::
## Srodne Funkcije
- [AddPlayerClass](AddPlayerClass.md): Dodaj klasu.
- [SetSpawnInfo](SetSpawnInfo.md): Postavi postavke za spawnovanje/stvaranje igrača.
- [SetPlayerTeam](SetPlayerTeam.md): Postavi igraču tim.
- [SetPlayerSkin](SetPlayerSkin.md): Postavi igračev skin/izgled.
| openmultiplayer/web/docs/translations/bs/scripting/functions/AddPlayerClassEx.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/AddPlayerClassEx.md",
"repo_id": "openmultiplayer",
"token_count": 1169
} | 345 |
---
title: AttachObjectToObject
description: Možete koristiti ovu funkciju da prikvačite objekat za drugi objekat.
tags: []
---
## Deskripcija
Možete koristiti ovu funkciju da prikvačite objekat za drugi objekat. Objekti će pratiti glavni objekat.
| Ime | Deskripcija |
| ------------- | ------------------------------------------------------------------------------ |
| objectid | Objekat kojeg želite prikvačiti za neki drugi. |
| attachtoid | Objekat za kojeg želite zakačiti prvi objekat. |
| Float:OffsetX | Razdaljina između glavnog objekta i objekta za prikvačiti u X smjeru. |
| Float:OffsetY | Razdaljina između glavnog objekta i objekta za prikvačiti u Y smjeru. |
| Float:OffsetZ | Razdaljina između glavnog objekta i objekta za prikvačiti u Z smjeru. |
| Float:RotX | X rotacija između glavnog objekta i objekta za prikvačiti. |
| Float:RotY | Y rotacija između glavnog objekta i objekta za prikvačiti. |
| Float:RotZ | Z rotacija između glavnog objekta i objekta za prikvačiti. |
| SyncRotation | Ako je stavljeno na 0, rotacija objectid-a se neće mijenjati sa attachtoid-em. |
## Returns
1: Funkcija uspješno izvršena.
0: Funkcija nije uspjela da se izvrši. Ovo znali da prvi objekat (objectid) ne postoji. Ne postoje interne provjere da se potvrdi da li drugi objekat (attachtoid) postoji.
## Primjeri
```c
new gObjectId = CreateObject(...);
new gAttachToId = CreateObject(...);
AttachObjectToObject(gObjectId, gAttachToId, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1);
```
## Zabilješke
:::tip
Oba objekta treba stvoriti prije pokušaja da ih prikačite. Ne postoji verzija ove funkcije player-objekta (AttachPlayerObjectToObject), što znači da je streameri neće podržati.
:::
## Srodne Funkcije
- [AttachObjectToPlayer](AttachObjectToPlayer): Prikvači objekat za igrača.
- [AttachObjectToVehicle](AttachObjectToVehicle): Prikvači objekat za vozilo.
- [AttachPlayerObjectToPlayer](AttachPlayerObjectToPlayer): Prikvači player-objekat za igrača.
- [CreateObject](CreateObject): Kreiraj objekat.
- [DestroyObject](DestroyObject): Uništi objekat.
- [IsValidObject](IsValidObject): Provjerava da li je određeni objekat validan.
- [MoveObject](MoveObject): Pomjeri objekat.
- [StopObject](StopObject): Zaustavi objekat od kretanja.
- [SetObjectPos](SetObjectPos): Postavi poziciju objekta.
- [SetObjectRot](SetObjectRot): Postavi rotaciju objekta.
- [GetObjectPos](GetObjectPos): Lociraj objekat.
- [GetObjectRot](GetObjectRot): Provjeri rotaciju objekta.
- [CreatePlayerObject](CreatePlayerObject): Kreiraj objekat samo za jednog igrača.
- [DestroyPlayerObject](DestroyPlayerObject): Uništi player-objekat.
- [IsValidPlayerObject](IsValidPlayerObject): Provjerava da li je određeni player-objekat validan.
- [MovePlayerObject](MovePlayerObject): Pomjeri player objekat.
- [StopPlayerObject](StopPlayerObject): Zaustavi player-objekat od kretanja.
- [SetPlayerObjectPos](SetPlayerObjectPos): Postavi poziciju player-objekta.
- [SetPlayerObjectRot](SetPlayerObjectRot): Postavi rotaciju player-objekta.
- [GetPlayerObjectPos](GetPlayerObjectPos): Lociraj player objekat.
- [GetPlayerObjectRot](GetPlayerObjectRot): Provjeri rotaciju player-objekta.
| openmultiplayer/web/docs/translations/bs/scripting/functions/AttachObjectToObject.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/AttachObjectToObject.md",
"repo_id": "openmultiplayer",
"token_count": 1464
} | 346 |
---
title: ClearAnimations
description: Čisti sve animacije koje su date igraču (ovo također zaustavlja trenutne zadatke koji se vrše poput jetpackinga, padobraniranja, ulaženaj u vozila, voženja (ukloni igrača iz vozila), plivanja itd.)
tags: []
---
## Deskripcija
Čisti sve animacije koje su date igraču (ovo također zaustavlja trenutne zadatke koji se vrše poput jetpackinga, padobraniranja, ulaženaj u vozila, voženja (ukloni igrača iz vozila), plivanja itd.)
| Ime | Deskripcija |
| --------- | ------------------------------------------------------------------------------------------------------- |
| playerid | ID igrača za očistiti animacije |
| forcesync | Postavi na 1 da natjeraš igrača da sinhronizuje animaciju sa ostalima u streaming radijusu (neobavezno) |
## Returns
Ova funkcija uvijek returna/vraća 1, bilo da odabrani igrač nije konektovan.
## Primjeri
```c
public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp(cmdtext, "/animclear", true))
{
ClearAnimations(playerid);
return 1;
}
return 0;
}
```
## Zabilješke
:::tip
ClearAnimations ne radi ništa kada animacija završi ako u ApplyAnimation dodamo 1 za parametar zamrzavanja.
:::
:::tip
Za razliku od nekih drugih načina uklanjanja igrača iz vozila, ovo će također resetirati brzinu vozila na nulu, trenutno zaustavljajući automobil. Igrač će se pojaviti na vrhu vozila s istim mjestom na kojem je bio u svome sjedištu.
:::
## Srodne Funkcije
- [ApplyAnimation](ApplyAnimation): Primijeni animaciju za igrača.
| openmultiplayer/web/docs/translations/bs/scripting/functions/ClearAnimations.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/ClearAnimations.md",
"repo_id": "openmultiplayer",
"token_count": 820
} | 347 |
---
title: DeleteSVar
description: Briše prethodno postavljenu server varijablu.
tags: []
---
## Deskripcija
Briše prethodno postavljenu server varijablu.
| Ime | Deskripcija |
| ------- | ------------------------------------------ |
| varname | Ime server varijable koju brišemo |
## Returns
1: Funkcija uspješno izvršena.
0: Funkcija neuspješno izvršena. There is no variable set with the given name.
## Primjeri
```c
SetSVarInt("SomeVarName", 69);
// Kasnije, kada varijabla više nije potrebna
DeleteSVar("SomeVarName");
```
## Zabilješke
:::tip
Jednom kada se varijabla izbriše, pokušavajući vratiti vrijednost vratiti će 0 (za integere i floatove i NULL za stringove).
:::
## Srodne Funkcije
- [SetSVarInt](SetSVarInt): Postavite cijeli broj za varijablu servera.
- [GetSVarInt](GetSVarInt): Dobijte poslužitelj igrača kao cijeli broj.
- [SetSVarString](SetSVarString): Postavite string za server varijablu.
- [GetSVarString](GetSVarString): Dobij prethodno postavljeni string iz server varijable.
- [SetSVarFloat](SetSVarFloat): Postavi float za server varijablu.
- [GetSVarFloat](GetSVarFloat): Dobij prethodno postavljeni float iz server varijable.
| openmultiplayer/web/docs/translations/bs/scripting/functions/DeleteSVar.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/DeleteSVar.md",
"repo_id": "openmultiplayer",
"token_count": 516
} | 348 |
---
title: EditObject
description: Omogućuje igraču da uređuje objekt (položaj i rotaciju) pomoću miša na GUI (grafičko korisničko sučelje / Graphical User Interface).
tags: []
---
## Deskripcija
Omogućuje igraču da uređuje objekt (položaj i rotaciju) pomoću miša na GUI (grafičko korisničko sučelje / Graphical User Interface).
| Ime | Deskripcija |
| -------- | ------------------------------------------------ |
| playerid | ID igrača koji bi trebao uređivati objekt. |
| objectid | ID objekta koji će biti uređen od strane igrača. |
## Returns
1: Funkcija uspješno izvršena. Uspjeh se izvještava i kada se navede nepostojeći objekt, ali ništa se neće dogoditi.
0: Funkcija neuspješno izvršena. Igrač nije konektovan.
## Primjeri
```c
new object;
public OnGameModeInit()
{
object = CreateObject(1337, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp(cmdtext, "/oedit", true))
{
EditObject(playerid, object);
SendClientMessage(playerid, 0xFFFFFFFF, "SERVER: Sada možete uređivati objekte!");
return 1;
}
return 0;
}
```
## Zabilješke
:::tip
Kameru možete pomicati tijekom uređivanja pritiskom i držanjem razmaknice (ili W u vozilu) i pomicanjem miša.
:::
## Srodne Funkcije
- [CreateObject](CreateObject): Kreiraj objekat.
- [DestroyObject](DestroyObject): Uništi objekat.
- [MoveObject](MoveObject): Pomjeri objekat.
- [EditPlayerObject](EditPlayerObject): Uredi objekat.
- [EditAttachedObject](EditAttachedObject): Uredi prikvačeni objekat.
- [SelectObject](SelectObject): odaberi objekat.
- [CancelEdit](CancelEdit): Prekini uređivanje objekta.
| openmultiplayer/web/docs/translations/bs/scripting/functions/EditObject.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/EditObject.md",
"repo_id": "openmultiplayer",
"token_count": 771
} | 349 |
---
title: GangZoneFlashForAll
description: GangZoneFlashForAll treperi gangzonu za sve igrače.
tags: ["gangzone"]
---
## Deskripcija
GangZoneFlashForAll treperi gangzonu za sve igrače.
| Ime | Deskripcija |
| ---------- | -------------------------------------------------------------------------------------------------------- |
| zone | Zona za treperiti. |
| flashcolor | Boja za bljeskanje gangzone, kao cijeli broj ili hex u RGBA formatu boja. Podržana alfa transparentnost. |
## Returns
Ova funkcija ne returna (vraća) nikakve posebne vrijednosti.
## Primjeri
```c
new gGangZoneId;
public OnGameModeInit()
{
gGangZoneId = GangZoneCreate(1248.011, 2072.804, 1439.348, 2204.319);
return 1;
}
public OnPlayerDeath(playerid, killerid, WEAPON:reason)
{
GangZoneFlashForAll(gGangZoneId, COLOR_RED);
return 1;
}
```
## Srodne Funkcije
- [GangZoneCreate](GangZoneCreate): Kreiraj gangzonu.
- [GangZoneDestroy](GangZoneDestroy): Uništi gang zonu.
- [GangZoneShowForPlayer](GangZoneShowForPlayer): Prikaži gang zonu za igrača.
- [GangZoneShowForAll](GangZoneShowForAll): Prikaži gang zonu za sve igrače.
- [GangZoneHideForPlayer](GangZoneHideForPlayer): Sakrij gangzonu za igrača.
- [GangZoneHideForAll](GangZoneHideForAll): Sakrij gangzonu za sve igrače.
- [GangZoneFlashForPlayer](GangZoneFlashForPlayer): Kreiraj bljeskalicu gang zone za igrača.
- [GangZoneStopFlashForPlayer](GangZoneStopFlashForPlayer): Zaustavi gang zonu da bljeska za igrača.
- [GangZoneStopFlashForAll](GangZoneStopFlashForAll): Zaustavi gang zonu da bljeska za sve igrače.
| openmultiplayer/web/docs/translations/bs/scripting/functions/GangZoneFlashForAll.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/GangZoneFlashForAll.md",
"repo_id": "openmultiplayer",
"token_count": 800
} | 350 |
---
title: GetConsoleVarAsString
description: Dobij string vrijednost varijable iz konzole.
tags: []
---
## Deskripcija
Dobij string vrijednost varijable iz konzole.
| Ime | Deskripcija |
| --------------- | --------------------------------------------------------------- |
| const varname[] | Ime string varijable za dobijanje vrijednosti. |
| buffer[] | Array u koji se pohranjuje vrijednost, proslijeđena referencom. |
| len | Dužina stringa koju treba pohraniti. |
## Returns
Dužina returnanog stringa. 0 ako navedena console varijabla nije string ili ne postoji.
## Primjeri
```c
public OnGameModeInit()
{
new hostname[64];
GetConsoleVarAsString("hostname", hostname, sizeof(hostname));
printf("Hostname: %s", hostname);
}
```
## Zabilješke
:::tip
Kada su filterskripte ili plugini specificirani kao varname, ova funkcija returna samo ime prve specificirane filterskripte ili plugina.
:::
:::tip
Upišite 'varlist' u konzolu servera da biste prikazali listu dostupnih console varijabli i njihove tipove.
:::
:::warning
Korištenje ove funkcije s bilo čim drugim osim stringom (integerom, booleanom ili floatom) će uzrokovati pad vašeg servera. Korištenje s nepostojećom console varijablom također će uzrokovati pad vašeg servera.
:::
## Srodne Funkcije
- [GetConsoleVarAsInt](GetConsoleVarAsInt): Dobij cjelobrojnu (integer) vrijednost varijable iz konzole.
- [GetConsoleVarAsBool](GetConsoleVarAsBool): Dobij bool(ean) vrijednost varijable iz konzole.
| openmultiplayer/web/docs/translations/bs/scripting/functions/GetConsoleVarAsString.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/GetConsoleVarAsString.md",
"repo_id": "openmultiplayer",
"token_count": 700
} | 351 |
---
title: GetPlayerSpecialAction
description: Dohvaća trenutnu specijalnu akciju igrača.
tags: ["player"]
---
## Deskripcija
Dohvaća trenutnu specijalnu akciju igrača.
| Ime | Deskripcija |
| -------- | -------------------------------------- |
| playerid | ID igrača za dobiti specijalnu akciju. |
## Returns
Specijalnu akciju igrača (pogledaj: [Specijalne Akcije](../resources/specialactions)).
## Primjeri
```c
public OnPlayerUpdate(playerid)
{
// Banuje igrača ako ima jetpack
if (GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USEJETPACK)
{
Ban(playerid);
}
return 1;
}
```
## Srodne Funkcije
- [SetPlayerSpecialAction](SetPlayerSpecialAction): Postavi igraču specijalnu akciju.
- [GetPlayerState](GetPlayerState): Dobij trenutno stanje igrača.
| openmultiplayer/web/docs/translations/bs/scripting/functions/GetPlayerSpecialAction.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/GetPlayerSpecialAction.md",
"repo_id": "openmultiplayer",
"token_count": 351
} | 352 |
---
title: GetPlayerWeaponState
description: Provjeri stanje igračevog oružja.
tags: ["player"]
---
## Deskripcija
Provjeri stanje igračevog oružja.
| Ime | Deskripcija |
| -------- | ----------------------------------- |
| playerid | ID igrača za primiti stanje oružja. |
## Returns
Stanje igračevog oružja. 0 ako navedeni igrač ne postoji.
## Primjeri
```c
public OnPlayerSpawn(playerid)
{
SetPVarInt(playerid, "WepState", GetPlayerWeaponState(playerid));
return 1;
}
```
## Srodne Funkcije
- [GivePlayerWeapon](GivePlayerWeapon): Daj igraču oružje.
| openmultiplayer/web/docs/translations/bs/scripting/functions/GetPlayerWeaponState.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/GetPlayerWeaponState.md",
"repo_id": "openmultiplayer",
"token_count": 258
} | 353 |
---
title: GetVehicleHealth
description: Dobij healthe vozila.
tags: ["vehicle"]
---
## Deskripcija
Dobij healthe vozila.
| Ime | Deskripcija |
| ------------- | -------------------------------------------------------------------- |
| vehicleid | ID vozila za dobiti healthe. |
| &Float:health | Float varijabla za pohraniti healthe vozila, proslijeđeno referencom |
## Returns
1 - uspješno
0 - greška (nevažeći ID vozila).
Healthi vozila su pohranjeni u varijablama, ne u return vrijednosti.
## Primjeri
```c
if (strcmp(cmdtext, "/repair", true) == 0)
{
new
Float: vehicleHealth,
playerVehicleId = GetPlayerVehicleID(playerid);
GetVehicleHealth(playerVehicleId, vehicleHealth);
if (vehicleHealth > 500)
{
return SendClientMessage(playerid, COLOR_RED, "Vozilo ne treba popravak!");
}
SetVehicleHealth(playerVehicleId, 1000);
SendClientMessage(playerid, COLOR_GREEN, "Vozilo popravljeno!");
}
```
## Zabilješke
:::tip
Potpuno health stanje vozila je 1000, međutim moguće su veće vrijednosti i povećavaju health stanje vozila. Za više informacija o health vrijednostima pogledajte [ovdje](../resources/vehiclehealth).
:::
:::tip
Vozilo se zapali kad mu je health ispod 250. Eksplodirat će nekoliko sekundi kasnije.
:::
## Srodne Funkcije
- [SetVehicleHealth](SetVehicleHealth): Postavi helte vozila.
- [GetPlayerHealth](GetPlayerHealth): Doznaj koliko healtha ima igrač.
- [GetPlayerArmour](GetPlayerArmour): Otkrijte koliko armora ima igrač.
| openmultiplayer/web/docs/translations/bs/scripting/functions/GetVehicleHealth.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/GetVehicleHealth.md",
"repo_id": "openmultiplayer",
"token_count": 715
} | 354 |
---
title: GivePlayerWeapon
description: Dajte igraču oružje sa određenom količinom streljiva.
tags: ["player"]
---
## Deskripcija
Dajte igraču oružje sa određenom količinom streljiva.
| Ime | Deskripcija |
| -------- | ---------------------------------- |
| playerid | ID igrača za dati oružje. |
| weaponid | ID oružja za dati igraču. |
| ammo | Količina streljiva za dati igraču. |
## Returns
1: Funkcija uspješno izvršena.
0: Funkcija neuspješno izvršena. Ovo znači da igrač nije konektovan.
## Primjeri
```c
GivePlayerWeapon(playerid, 26, 64); // Dajte igraču sačmaricu sa 64 streljiva
```
## Srodne Funkcije
- [SetPlayerArmedWeapon](SetPlayerArmedWeapon): Postavite igračevo "armed" oružje.
- [GetPlayerWeapon](GetPlayerWeapon): Provjeri koje oružje igrač trenutno drži.
| openmultiplayer/web/docs/translations/bs/scripting/functions/GivePlayerWeapon.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/GivePlayerWeapon.md",
"repo_id": "openmultiplayer",
"token_count": 397
} | 355 |
---
title: IsPlayerInRangeOfPoint
description: Provjerava ako je igrač u dometu/blizini određene tačke.
tags: ["player"]
---
## Deskripcija
Provjerava ako je igrač u blizinu određene tačke. Ova izvorna funkcija je brža od implementacije PAWN-a koristeći formulu udaljenosti.
| Ime | Deskripcija |
| ----------- | ------------------------------------------------------------------- |
| playerid | ID igrača. |
| Float:range | Najdalja udaljenost koju igrač može biti od točke da bude u dometu. |
| Float:x | X kordinata točke do koje treba provjeriti domet. |
| Float:y | Y kordinata točke do koje treba provjeriti domet. |
| Float:z | Z kordinata točke do koje treba provjeriti domet. |
## Returns
true - Igrač je u dometu/blizini točke.
false - Igrač nije u dometu/blizini točke.
## Primjeri
```c
if (!strcmp("/stadium", cmdtext))
{
if (IsPlayerInRangeOfPoint(playerid, 7.0, 2695.6880, -1704.6300, 11.8438))
{
SendClientMessage(playerid,0xFFFFFFFF,"Ti si u blizini ulaza u stadion!");
}
return 1;
}
```
## Srodne Funkcije
- [GetPlayerDistanceFromPoint](GetPlayerDistanceFromPoint): Dobij razmak između igrača i tačke.
- [GetVehicleDistanceFromPoint](GetVehicleDistanceFromPoint): Dobij razmak između vozila i tačke.
- [GetPlayerPos](GetPlayerPos): Dobij poziciju igrača.
| openmultiplayer/web/docs/translations/bs/scripting/functions/IsPlayerInRangeOfPoint.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/IsPlayerInRangeOfPoint.md",
"repo_id": "openmultiplayer",
"token_count": 729
} | 356 |
---
title: LimitPlayerMarkerRadius
description: Postavite radijus markera/oznake igrača.
tags: ["player"]
---
## Deskripcija
Postavite radijus markera igrača.
| Ime | Deskripcija |
| ------------------- | -------------------------------------------------- |
| Float:marker_radius | Radijus na kojem će se markeri/oznake prikazivati. |
## Returns
Ova funkcija ne returna (vraća) nikakve posebne vrijednosti.
## Primjeri
```c
public OnGameModeInit()
{
LimitPlayerMarkerRadius(100.0);
}
```
## Srodne Funkcije
- [ShowPlayerMarkers](ShowPlayerMarkers): Odlučite hoće li server prikazivati oznake na radaru.
- [SetPlayerMarkerForPlayer](SetPlayerMarkerForPlayer): Postavite marker/oznaku igrača.
- [LimitGlobalChatRadius](LimitGlobalChatRadius): Ograničite udaljenost između igrača potrebnih da biste vidjeli njihov chat.
| openmultiplayer/web/docs/translations/bs/scripting/functions/LimitPlayerMarkerRadius.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/LimitPlayerMarkerRadius.md",
"repo_id": "openmultiplayer",
"token_count": 371
} | 357 |
---
title: PlayerPlaySound
description: Reprodukuje navedeni zvuk igraču.
tags: ["player"]
---
## Deskripcija
Reprodukuje navedeni zvuk igraču.
Pogledajte library koji sadrži sve zvukove, [ovo](https://github.com/WoutProvost/samp-sound-array).
| Ime | Deskripcija |
| -------- | ---------------------------------------------------------- |
| playerid | ID igrača kojem će se reprodukovati zvuk. |
| soundid | Zvuk za reprodukovati. |
| Float:x | X kordinata za reprodukovanje zvuka. (0.0 za bez pozicije) |
| Float:y | Y kordinata za reprodukovanje zvuka. (0.0 za bez pozicije) |
| Float:z | Z kordinata za reprodukovanje zvuka. (0.0 za bez pozicije) |
## Returns
1: Funkcija uspješno izvršena.
0: Funkcija neuspješno izvršena. Ovo znači da igrač nije konektovan.
## Primjeri
```c
// zvuk udaranja igrača (odgovara za naredbe kao što je /slap). Zvuk će biti tih, jer je izvor zapravo 10 metara iznad igrača.
PlayerPlaySound(playerid, 1130, 0.0, 0.0, 10.0);
```
## Zabilješke
:::tip
Koristite kordinate samo ako želite da se zvuk reproducira na određenoj poziciji. Postavite kordinatama sve na 0,0 da samo reproducira zvuk.
:::
## Srodne Funkcije
- [PlayCrimeReportForPlayer](PlayCrimeReportForPlayer): Pusti krivičnu prijavu za igrača.
- [PlayAudioStreamForPlayer](PlayAudioStreamForPlayer): Reprodukuje audio tok za igrača.
- [StopAudioStreamForPlayer](StopAudioStreamForPlayer): Zaustavlja trenutni audio stream za igrača.
| openmultiplayer/web/docs/translations/bs/scripting/functions/PlayerPlaySound.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/PlayerPlaySound.md",
"repo_id": "openmultiplayer",
"token_count": 717
} | 358 |
---
title: PlayerTextDrawSetSelectable
description: Omogućuje/onemogućuje da li player-textdraw može biti selektovan ili ne.
tags: ["player", "textdraw", "playertextdraw"]
---
## Deskripcija
Omogućuje/onemogućuje da li player-textdraw može biti selektovan ili ne.
| Ime | Deskripcija |
|-----------------|---------------------------------------------------------------------------------------------------------|
| playerid | ID igrača čiji player-textdraw se (ne)može selektovati. |
| PlayerText:text | ID player-textdrawa za postaviti selektabilnost. |
| bool:set | Postavi da je player-textdraw selektabilan (true) ili ne (false). Po zadanim postavkama ovo je (false). |
## Returns
Ova funkcija ne returna (vraća) nikakve posebne vrijednosti.
## Primjeri
```c
public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp(cmdtext, "/select_ptd", true))
{
for (new i = 0; i < MAX_PLAYER_TEXT_DRAWS; i++)
{
PlayerTextDrawSetSelectable(playerid, PlayerText:i, true);
}
SendClientMessage(playerid, 0xFFFFFFAA, "SERVER: Svi player-textdraws se sada mogu selektovati!");
return 1;
}
return 0;
}
```
## Zabilješke
:::tip
Upotrijebite [PlayerTextDrawTextSize](PlayerTextDrawTextSize) da definirate područje na koje je moguće kliknuti.
:::
:::warning
PlayerTextDrawSetSelectable MORA SE koristiti PRIJE nego što se textdraw prikaže igraču.
:::
## Srodne Funkcije
- [SelectTextDraw](SelectTextDraw): Omogućava miš kako bi igrač mogao da selektuje textdraw.
- [CancelSelectTextDraw](CancelSelectTextDraw): Prekida selekciju textdrawa sa mišem.
## Srodne Callbacks
- [OnPlayerClickPlayerTextDraw](../callbacks/OnPlayerClickPlayerTextDraw): Pozvano kada igrač klikne na player-textdraw.
| openmultiplayer/web/docs/translations/bs/scripting/functions/PlayerTextDrawSetSelectable.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/PlayerTextDrawSetSelectable.md",
"repo_id": "openmultiplayer",
"token_count": 916
} | 359 |
---
title: SHA256_PassHash
description: Hashira lozinku pomoću algoritma heširanja SHA-256.
tags: []
---
:::warning
Ova funkcija je dodana u SA-MP 0.3.7 R1 i ne radi u nižim verzijama!
:::
## Deskripcija
Hashira lozinku pomoću algoritma heširanja SHA-256. Uključuje salt. Izlaz je uvijek 256 bita, ili ekvivalent od 64 Pawn ćelija.
| Ime | Deskripcija |
| ------------ | ---------------------------------------------- |
| password[] | Lozinka za heširati. |
| salt[] | Salt za koristiti u heširanju. |
| ret_hash[] | Vraćeni heš u velikom heksadecimalnom sažetku. |
| ret_hash_len | Vraćeni heš u maksimalnoj dužini. |
## Returns
Heš je pohranjen u određenom nizu.
## Primjeri
```c
public OnGameModeInit()
{
new MyHash[64 + 1]; // + 1 za račun potrebnog nultog terminatora
SHA256_PassHash("test", "78sdjs86d2h", MyHash, sizeof MyHash);
printf("Returned hash: %s", MyHash); // Vratio hash: CD16A1C8BF5792B48142FF6B67C9CB5B1BDC7260D8D11AFBA6BCDE0933A3C0AF
return 1;
}
```
## Zabilješke
:::tip
Vraćeni hash nema nula popunjavanja (npr. mogući prefiks 00ABCD123...).
:::
:::tip
Salt je dodan na kraj lozinke, što znači da lozinka 'foo' i salt 'bar' čine 'foobar'. Salt bi treba biti nasumičan, jedinstven za svakog igrača i najmanje dug kao hashirana lozinka. Treba ga pohraniti uz stvarni heš na računu igrača.
:::
:::warning
Ova funkcija nije binarno sigurna. Korištenje binarnih vrijednosti na lozinci i soli može dati neočekivani rezultat.
:::
## Srodne Funkcije
| openmultiplayer/web/docs/translations/bs/scripting/functions/SHA256_PassHash.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/SHA256_PassHash.md",
"repo_id": "openmultiplayer",
"token_count": 783
} | 360 |
---
title: SetDeathDropAmount
description: .
tags: []
---
## Deskripcija
.
| Ime | Deskripcija |
| ------ | ----------- |
| amount | |
## Returns
Ova funkcija ne returna (vraća) nikakve posebne vrijednosti.
## Primjeri
```c
public OnGameModeInit()
{
SetDeathDropAmount(5000);
// VIŠE KODA
return 1;
}
```
## Zabilješke
:::warning
Ova funkcija ne radi u trenutnoj verziji SA:MP-a!
:::
## Srodne Funkcije
- [CreatePickup](CreatePickup): Kreiraj pickup.
- [GivePlayerMoney](GivePlayerMoney): Dajte igraču novac.
- [OnPlayerDeath](../callbacks/OnPlayerDeath): Pozvano kada igrač umre.
| openmultiplayer/web/docs/translations/bs/scripting/functions/SetDeathDropAmount.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/SetDeathDropAmount.md",
"repo_id": "openmultiplayer",
"token_count": 273
} | 361 |
---
title: SetPlayerArmedWeapon
description: Postavlja koje oružje (koje igrač posjeduje) igrač trenutno drži.
tags: ["player"]
---
## Deskripcija
Postavlja koje oružje (koje igrač posjeduje) igrač trenutno drži.
| Ime | Deskripcija |
| -------- | ------------------------------------------------ |
| playerid | ID igrača za naoružati sa oružjem. |
| weaponid | ID oružja s kojim bi igrač trebao biti naoružan. |
## Returns
1: Funkcija uspješno izvršena. Uspješno je vraćeno i kada se funkcija neuspješno izvrši (igrač ne posjeduje navedeno oružje ili je proslijeđen nevažeći ID oružja).
0: Funkcija neuspješno izvršena. Igrač nije konektovan.
## Primjeri
```c
public OnPlayerUpdate(playerid)
{
SetPlayerArmedWeapon(playerid,0); // onemogućuje oružja
return 1;
}
// SMG driveby by [03]Garsino
public OnPlayerStateChange(playerid, PLAYER_STATE:newstate, PLAYER_STATE:oldstate)
{
if (newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
{
new
weapon,
ammo;
GetPlayerWeaponData(playerid, 4, weapon, ammo); // Uzmi igračev SMG u slot 4
SetPlayerArmedWeapon(playerid, weapon); // Postavi da igrač drive-by-ea uz SMG
}
return 1;
}
```
## Zabilješke
:::tip
Ova funkcija naoružava igrača oružjem koje već ima; ne daje im novo oružje. Pogledajte GivePlayerWeapon.
:::
## Srodne Funkcije
- [GivePlayerWeapon](GivePlayerWeapon): Daj igraču oružje.
- [GetPlayerWeapon](GetPlayerWeapon): Provjeri koje oružje igrač trenutno drži.
| openmultiplayer/web/docs/translations/bs/scripting/functions/SetPlayerArmedWeapon.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/SetPlayerArmedWeapon.md",
"repo_id": "openmultiplayer",
"token_count": 743
} | 362 |
---
title: SetPlayerName
description: Postavlja ime igrača.
tags: ["player"]
---
## Deskripcija
Postavlja ime igrača.
| Ime | Deskripcija |
| ------------ | -------------------------------------------------------------------------------------------------------------------------------- |
| playerid | ID igrača za postaviti ime. |
| const name[] | Ime za postaviti. Mora biti dug između 1-24 karaktera i samo sadržavati važeće karaktere (0-9, a-z, A-Z, [], (), \$ @ . \_ i =). |
## Returns
1 Ime je uspješno promijenjeno
0 Igrač već ima to ime
-1 Ime se ne može promijeniti (već je u upitrebi, previše je veliko ili sadrži nevažeće karaktere)
## Primjeri
```c
// Komanda prosto postavlja ime igrača u "Superman" ako je moguće, bez provjera greški ili poruka.
if (strcmp(cmdtext, "/superman", true) == 0)
{
SetPlayerName(playerid, "Superman");
return 1;
}
// Komanda postavlja ime igrača u "Superman" ako je moguće, obavještava igrača ako postoje određene greške
// koristeći "switch" statement
if (strcmp(cmdtext, "/superman", true) == 0)
{
switch (SetPlayerName(playerid, "Superman"))
{
case -1:
{
SendClientMessage(playerid, 0xFF0000FF, "Neuspješno mjenjanje imena, neko se već zove 'Superman'.");
}
case 0:
{
SendClientMessage(playerid, 0xFF0000FF, "Već se zoveš 'Superman'");
}
case 1:
{
SendClientMessage(playerid, 0x00FF00FF, "Sada se zoveš 'Superman'");
}
}
return 1;
}
```
## Zabilješke
:::warning
Promjena imena igrača u isto ime, ali s različitim slučajevima slova (npr. "John" u "JOHN") neće uspjeti. Ako se koristi u OnPlayerConnect, novo ime neće biti prikazano za povezujećeg igrača. Prosljeđivanje null niza kao novog imena srušit će server. Imena igrača mogu imati do 24 znaka kada se koristi ova funkcija, ali kada se pridružuju serveru iz pregledača servera SA-MP, imena igrača ne smiju biti veća od 20 i manja od 3 znaka (server će odbiti ulazak). Ovo omogućava dodavanje 4 znaka kada koristite SetPlayerName.
:::
## Srodne Funkcije
- [GetPlayerName](GetPlayerName): Dobij ime igrača.
| openmultiplayer/web/docs/translations/bs/scripting/functions/SetPlayerName.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/SetPlayerName.md",
"repo_id": "openmultiplayer",
"token_count": 1190
} | 363 |
---
title: SetPlayerTime
description: Postavlja vrijeme igre za igrača.
tags: ["player"]
---
## Deskripcija
Postavlja vrijeme igre za igrača. Ako je sat igrača uključen (TogglePlayerClock) prikazano vrijeme će se automatski ažurirati.
| Ime | Deskripcija |
| -------- | ------------------------------------ |
| playerid | ID igrača za postaviti vrijeme igre. |
| hour | Sat za postaviti (0-23). |
| minute | Minute za postaviti (0-59). |
## Returns
1: Funkcija uspješno izvršena.
0: Funkcija neuspješno izvršena. Navedeni igrač ne postoji.
## Primjeri
```c
SetPlayerTime(playerid, 12, 0); // Podne
SetPlayerTime(playerid, 0, 0); // Ponoć
```
## Zabilješke
:::tip
Korištenje ove funkcije unutar OnPlayerConnect neće raditi.
:::
## Srodne Funkcije
- [SetWorldTime](SetWorldTime): Postavi globalno vrijeme servera.
- [GetPlayerTime](GetPlayerTime): Dobij vrijeme igrača.
- [TogglePlayerClock](TogglePlayerClock): Uključite / isključite sat u gornjem desnom uglu.
| openmultiplayer/web/docs/translations/bs/scripting/functions/SetPlayerTime.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/SetPlayerTime.md",
"repo_id": "openmultiplayer",
"token_count": 458
} | 364 |
---
title: SetVehicleParamsCarDoors
description: Dozvoljava ti da otvoriš i zatvoriš vrata vozila.
tags: ["vehicle"]
---
:::warning
Ova funkcija je dodana u SA-MP 0.3.7 i ne radi u nižim verzijama!
:::
## Deskripcija
Dozvoljava ti da otvoriš i zatvoriš vrata vozila.
| Ime | Deskripcija |
| --------- | ----------------------------------------------------------------------------- |
| vehicleid | ID vozila za postaviti stanje vrata. |
| driver | Stanje vozačevih vrata. 0 za otvoriti, 1 za zatvoriti. |
| passenger | Stanje suvozačevih vrata. 0 za otvoriti, 1 za zatvoriti. |
| backleft | Stanje lijevih pozadi vrata (ako je dostupno). 0 za otvoriti, 1 za zatvoriti. |
| backright | Stanje desnih pozadi vrata (ako je dostupno). 0 za otvoriti, 1 za zatvoriti. |
## Returns
[edit]
## Srodne Funkcije
- [GetVehicleParamsCarDoors](GetVehicleParamsCarDoors): Doznaj trenutno stanje vrata od vozila
- [SetVehicleParamsCarWindows](SetVehicleParamsCarWindows): Otvori i zatvori prozore vozila.
- [GetVehicleParamsCarWindows](GetVehicleParamsCarWindows): Doznaj trenutno stanje prozora vozila.
| openmultiplayer/web/docs/translations/bs/scripting/functions/SetVehicleParamsCarDoors.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/SetVehicleParamsCarDoors.md",
"repo_id": "openmultiplayer",
"token_count": 597
} | 365 |
---
title: ShowPlayerNameTagForPlayer
description: Ova funkcija ti omogućava da omogućite/onemogućite iscrtavanje nametag-ova, healthbar-pva i armora igrača koji se prikazuju iznad njegove glave.
tags: ["player"]
---
## Deskripcija
Ova funkcija ti omogućava da omogućite/onemogućite iscrtavanje nametag-ova, healthbar-pva i armoa igrača koji se prikazuju iznad njegove glave. Za upotrebu slične funkcije poput ove na globalnom nivou, funkcija ShowNameTags.
| Ime | Deskripcija |
| ------------ | ------------------------------------------------- |
| playerid | Igrač koji će vidjeti rezultate ove funkcije. |
| showplayerid | Player čiji će nametag biti skriven ili prikazan. |
| show | 1-prikaži nametag, 0-sakrij nametag. |
## Returns
## Važna Bilješka
ShowNameTags mora biti postavljen na 1 da bi bilo moguće prikazati name tagove sa ShowPlayerNameTagForPlayer, to znači da u slučaju da bude efikasno moraš da izvršiš funkciju: ShowPlayerNameTagForPlayer(forplayerid, playerid, 0) ispred vremena (OnPlayerStreamIn je dobro mjesto).
## Primjeri
```c
//igrač koji je napisao /nameoff neće biti u mogućnosti da vidi nametagove ostalih igrača.
if (strcmp("/nameoff", cmdtext, true) == 0)
{
for (new i = 0; i != MAX_PLAYERS; -- i)
{
ShowPlayerNameTagForPlayer(playerid, i, false);
}
GameTextForPlayer(playerid, "~W~Nametagovi ~R~ugaseni", 5000, 5);
return 1;
}
```
## Zabilješke
:::warning
ShowNameTags mora biti postavljen na 1 da bi bilo moguće prikazati name tagove sa ShowPlayerNameTagForPlayer, to znači da u slučaju da bude efikasno moraš da izvršiš funkciju: ShowPlayerNameTagForPlayer(forplayerid, playerid, 0) ispred vremena (OnPlayerStreamIn je dobro mjesto).
:::
## Srodne Funkcije
- [ShowNameTags](ShowNameTags): Postavi nametagove uključeno ili isključeno.
- [DisableNameTagLOS](DisableNameTagLOS): Onemogućite provjeru oznake imena.
- [SetPlayerMarkerForPlayer](SetPlayerMarkerForPlayer): Postavite marker/oznaku igrača.
| openmultiplayer/web/docs/translations/bs/scripting/functions/ShowPlayerNameTagForPlayer.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/ShowPlayerNameTagForPlayer.md",
"repo_id": "openmultiplayer",
"token_count": 890
} | 366 |
---
title: TextDrawHideForPlayer
description: Sakriva textdraw za određenog igrača.
tags: ["player", "textdraw"]
---
## Deskripcija
Sakriva textdraw za određenog igrača.
| Ime | Deskripcija |
| -------- | --------------------------------------------- |
| playerid | ID igrača za kojeg će textdraw biti sakriven. |
| text | ID textdrawa za sakriti. |
## Returns
Ova funkcija ne returna (vraća) nikakve posebne vrijednosti.
## Primjeri
```c
new Text: gMyTextdraw;
public OnGameModeInit()
{
gMyTextdraw = TextDrawCreate( ... );
return 1;
}
public OnGameModeExit()
{
TextDrawDestroy(gMyTextdraw);
return 1;
}
public OnPlayerSpawn(playerid)
{
TextDrawShowForPlayer(playerid, gMyTextdraw);
return 1;
}
public OnPlayerDeath(playerid, reason)
{
TextDrawHideForPlayer(playerid, gMyTextdraw);
return 1;
}
```
## Srodne Funkcije
- [TextDrawHideForAll](TextDrawHideForAll): Sakrij textdraw za sve igrače.
- [TextDrawShowForPlayer](TextDrawShowForPlayer): Prikaži textdraw za određenog igrača.
- [TextDrawShowForAll](TextDrawShowForAll): Prikaži textdraw za sve igrače.
| openmultiplayer/web/docs/translations/bs/scripting/functions/TextDrawHideForPlayer.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/TextDrawHideForPlayer.md",
"repo_id": "openmultiplayer",
"token_count": 506
} | 367 |
---
title: TogglePlayerControllable
description: Uključuje / isključuje da li igrač može kontrolirati svog lika ili ne.
tags: ["player"]
---
## Deskripcija
Uključuje / isključuje da li igrač može kontrolirati svog lika ili ne.
| Ime | Deskripcija |
| -------- | ------------------------------------------------- |
| playerid | ID igrača za prebacivanje mogućnosti upravljanja. |
| toggle | 0 da ne mogu kontrolisati, 1 da mogu. |
## Returns
1: Funkcija uspješno izvršena.
0: Funkcija neuspješno izvršena. Navedeni igrač ne postoji.
## Primjeri
```c
public OnPlayerCommandText(playerid, cmdtext[])
{
// Zaledi igrača kada napiše /freezeme
if (strcmp(cmdtext, "/freezeme", true) == 0)
{
TogglePlayerControllable(playerid,0);
return 1;
}
// Odledi igrača kada napiše /unfreezeme
if (strcmp(cmdtext, "/unfreezeme", true) == 0)
{
TogglePlayerControllable(playerid,1);
return 1;
}
return 0;
}
```
## Srodne Funkcije
| openmultiplayer/web/docs/translations/bs/scripting/functions/TogglePlayerControllable.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/TogglePlayerControllable.md",
"repo_id": "openmultiplayer",
"token_count": 512
} | 368 |
---
title: db_field_name
description: Vraća ime polja u navedenom indeksu.
keywords:
- sqlite
---
:::warning
Ova funkcija započinje malim slovom.
:::
## Deskripcija
Vraća ime polja u navedenom indeksu.
| Ime | Deskripcija |
| ----------------- | ------------------------------------------------------------------------ |
| DBResult:dbresult | Rezultat za dobivanje podataka; returnovao/vratio [db_query] (db_query). |
| field | Indeks polja za dobivanje imena. |
| result[] | Rezultat. |
| maxlength | Maksimalna dužina polja. |
## Returns
Returns 1 if result set handle is valid, otherwise 0.
## Primjeri
```c
static DB:gDBConnectionHandle;
public OnGameModeInit()
{
// ...
// Kreiramo konekciju za databazu
gDBConnectionHandle = db_open("example.db");
// Ako konekcija za databazu postoji
if (gDBConnectionHandle)
{
// Izaberite prvi unos u tabeli "join_log"
new DBResult:db_result_set = db_query(g_DBConnection, "SELECT * FROM `join_log` LIMIT 1");
// Ako je upravitelj skupa rezultata važeći
if (db_result_set)
{
// Dobijte broj polja iz skupa rezultata
new columns = db_num_fields(db_result_set);
// Dodijelite malo memorije za pohranu imena polja
new field_name[32];
// Prelistajte sve indekse stupaca
for (new column_index; index < column_index; index++)
{
// Pohranite ime indeksiranog imena stupca u "field_name"
db_field_name(db_result_set, index, field_name, sizeof field_name);
// Ispiši "field_name"
printf("Field name at index %d: \"%s\"", index, field_name);
}
// Oslobađa skup rezultata
db_free_result(db_result_set);
}
}
else
{
// Neuspješno kreiranje konekcije do databaze
print("Otvaranje veze s bazom podataka nije uspjelo \"example.db\".");
}
}
public OnGameModeExit()
{
// Zatvori konekciju sa databazom ako je otvorena
if (db_close(gDBConnectionHandle))
{
// Dodatno čišćenje
gDBConnectionHandle = DB:0;
}
// ...
return 1;
}
```
## Zabilješke
:::warning
Upotreba nevaljanog upravitelja databaze koja nije nula srušit će vaš server! Nabavite važeći upravitelj databazom pomoću [db_open] (db_open).
:::
## Srodne Funkcije
- [db_open](db_open): Otvori konekciju do SQLite databaze.
- [db_close](b_close): Zatvori konekciju do SQLite databaze.
- [db_query](db_query): Upitajte SQLite bazu podataka.
- [db_free_result](db_free_result): Oslobodite memoriju rezultata iz db_query.
- [db_num_rows](db_num_rows): Dobijte broj redaka u rezultatu.
- [db_next_row](db_next_row): Pređi na sljedeći red.
- [db_num_fields](db_num_fields): Dobij broj polja u rezultatu.
- [db_get_field](db_get_field): Preuzmite sadržaj polja iz db_query.
- [db_get_field_assoc](db_get_field_assoc): Dobij sadržaj polja kao string s navedenim imenom polja.
- [db_get_field_int](db_get_field_int): Dobijte sadržaj polja kao cijeli broj iz db_query.
- [db_get_field_assoc_int](db_get_field_assoc_int): Dobijte sadržaj polja kao cijeli broj s navedenim imenom iz trenutnog reda rezultata.
- [db_get_field_float](db_get_field_float): Dobijte sadržaj polja kao float broj s navedenim imenom iz trenutnog reda rezultata.
- [db_get_field_assoc_float](db_get_field_assoc_float): Dobij sadržaj polja kao float broj s navedenim imenom polja.
- [db_get_mem_handle](db_get_mem_handle): Dobij memorijski upravitelj za vezu SQLite databaze koja je otvorena s `db_open`.
- [db_get_result_mem_handle](db_get_result_mem_handle): Dobiva memorijski upravitelj za vezu SQLite databaze koja je dodijeljena sa s `db_query`.
- [db_debug_openfiles](db_debug_openfiles): Dobiva broj otvorenih konekcija/veza databaza u svrhu otklanjanja pogrešaka.
- [db_debug_openresults](db_debug_openresults): Dobiva broj rezultata otvorene databaze.
| openmultiplayer/web/docs/translations/bs/scripting/functions/db_field_name.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/db_field_name.md",
"repo_id": "openmultiplayer",
"token_count": 2057
} | 369 |
---
title: existproperty
description: Provjeri da li imovina postoji.
tags: []
---
:::warning
Ova funkcija započinje malim slovom.
:::
## Deskripcija
Provjeri da li imovina postoji.
| Ime | Deskripcija |
| ------ | ---------------------------------------------------------------------------- |
| id | Virtualna mašina za upotrebu. Trebali biste ovo držati kao nulu. |
| name[] | Ime imovine, trebali biste ovo ostaviti prazno (""). |
| value | Jedinstveni ID imovine. Upotrijebite hash-funkciju za izračunavanje iz niza. |
## Returns
Tačno (true) ako imovina postoji, uostalom netačno (false).
## Primjeri
```c
if ( existproperty(0, "", 123984334) )
{
//imovina postoji, radi nešto
}
```
## Zabilješke
:::tip
Preporučljivo je da koristite PVars/SVars ili GVar plugin umjesto ovih native-a zbog njihove brzine (spori su).
:::
## Srodne Funkcije
- [setproperty](setproperty): Postavi imovinu.
- [getproperty](getproperty): Dobij vrijednost imovine.
- [deleteproperty](deleteproperty): Obriši imovinu.
| openmultiplayer/web/docs/translations/bs/scripting/functions/existproperty.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/existproperty.md",
"repo_id": "openmultiplayer",
"token_count": 519
} | 370 |
---
title: floatpower
description: Daje zadanu vrijednost u potenciju eksponenta.
tags: []
---
:::warning
Ova funkcija započinje malim slovom.
:::
## Deskripcija
Daje zadanu vrijednost u potenciju eksponenta.
| Ime | Deskripcija |
| -------- | --------------------------------------------------------------------------- |
| value | Vrijednost koju treba povisiti u stepen kao broj s pomičnom zarezom. |
| exponent | Eksponent je također broj s pomičnom zarezom. Može biti nula ili negativna. |
## Returns
Rezultat 'vrijednosti' u potenciji 'eksponenta'.
## Primjeri
```c
printf("2 do snage 8 je% f", floatpower(2.0, 8.0));
// Result: 256.0
```
## Srodne Funkcije
- [floatsqroot](floatsqroot): Izračunajte kvadratni korijen float vrijednosti.
- [floatlog](floatlog): Nabavite logaritam plutajuće vrijednosti.
| openmultiplayer/web/docs/translations/bs/scripting/functions/floatpower.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/floatpower.md",
"repo_id": "openmultiplayer",
"token_count": 423
} | 371 |
---
title: fwrite
description: Napišite tekst u datoteku.
tags: []
---
:::warning
Ova funkcija započinje malim slovom.
:::
## Deskripcija
Napišite tekst u datoteku.
| Ime | Deskripcija |
| ------ | ----------------------------------------------------- |
| handle | Upravitelj datoteke za upotrebu, otvorila je fopen () |
| string | String za upisati u fajl. |
## Returns
Duljina zapisanog niza kao cijeli broj.
## Primjeri
```c
// Otvorite "file.txt" u "write only" načinu (samo pisanje)
new File:handle = fopen("file.txt", io_write);
// Provjeri da li je fajl/datoteka otvoren/a
if (handle)
{
// Uspješno
// Upiši "I just wrote here!" u ovaj fajl
fwrite(handle, "I just wrote here!");
// Zatvori fajl/datoteku
fclose(handle);
}
else
{
// Error
print("Nesupješno otvaranje file \"file.txt\".");
}
// Otvorite "file.txt" u "read and write" načinu (čitanje i pisanje)
new File:handle = fopen("file.txt"),
// Inicijalizirajte "buf"
buf[128];
// Provjeri da li je fajl/datoteka otvoren/a
if (handle)
{
// Uspješno
// Čitajte cijelu datoteku
while(fread(handle, buf)) print(buf);
// Postavite pokazivač datoteke na prvi bajt
fseek(handle, _, seek_begin);
// Upiši "I just wrote here!" u ovaj fajl
fwrite(handle, "I just wrote here!");
// Zatvori fajl/datoteku
fclose(handle);
}
else
{
// Error
print("The file \"file.txt\" does not exists, or can't be opened.");
}
// Otvorite "file.txt" u "append only" načinu (samo dodavanje)
new File:handle = fopen("file.txt", io_append);
// Provjeri da li je fajl/datoteka otvoren/a
if (handle)
{
// Uspješno
// Dodati "This is a text.\r\n"
fwrite(handle, "This is a test.\r\n");
// Zatvori fajl/datoteku
fclose(handle);
}
else
{
// Error
print("Nesupješno otvaranje file \"file.txt\".");
}
```
## Zabilješke
:::tip
Ova funkcija zapisuje u datoteku u UTF-8, koja ne podržava neke simbole lokaliziranog jezika.
:::
:::warning
Korištenje nevaljanog upravitelja srušit će vaš server! Nabavite važeći upravitelj pomoću fopen ili ftemp.
:::
## Srodne Funkcije
- [fopen](fopen): Otvori fajl/datoteku.
- [fclose](fclose): Zatvori fajl/datoteku.
- [ftemp](ftemp): Stvorite privremeni tok fajlova/datoteka.
- [fremove](fremove): Uklonite fajl/datoteku.
- [fwrite](fwrite): Piši u fajl/datoteku.
- [fread](fread): Čitaj fajl/datoteku.
- [fputchar](fputchar): Stavite znak u fajl/datoteku.
- [fgetchar](fgetchar): Dobijte znak iz fajla/datoteke.
- [fblockwrite](fblockwrite): Zapišite blokove podataka u fajl/datoteku.
- [fblockread](fblockread): Očitavanje blokova podataka iz fajla/datoteke.
- [fseek](fseek): Skoči na određeni znak u fajlu/datoteci.
- [flength](flength): Nabavite dužinu fajla/datoteke.
- [fexist](fexist): Provjeri da li datoteka postoji.
- [fmatch](fmatch): Provjeri podudaraju li se uzorci s nazivom datoteke.
| openmultiplayer/web/docs/translations/bs/scripting/functions/fwrite.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/fwrite.md",
"repo_id": "openmultiplayer",
"token_count": 1387
} | 372 |
---
title: random
description: Dobij (pseudo-)slučajni broj.
tags: []
---
:::warning
Ova funkcija započinje malim slovom.
:::
## Deskripcija
Dobij (pseudo-)slučajni broj.
| Ime | Deskripcija |
| --- | ---------------------------------------------------------------------------- |
| max | Raspon vrijednosti (od 0 do ove vrijednosti minus 1) koja može biti vraćena. |
## Returns
Slučajan broj u rasponu od 0 do max-1.
## Primjeri
```c
new value = random(5);
// 'value' može biti 0, 1, 2, 3 ili 4, 5 mogućih vrijednosti.
new Float:RandomSpawn[][4] =
{
// Pozicije, (X, Y, Z and Facing Angle)
{-2796.9854, 1224.8180, 20.5429, 192.0335},
{-2454.2170, 503.8759, 30.0790, 267.2932},
{-2669.7322, -6.0874, 6.1328, 89.8853}
};
public OnPlayerSpawn(playerid)
{
new rand = random(sizeof(RandomSpawn));
// SetPlayerPos na slučajne podatke o spawnu
SetPlayerPos(playerid, RandomSpawn[rand][0], RandomSpawn[rand][1],RandomSpawn[rand][2]);
// SetPlayerFacingAngle na slučajne podatke o smjeru gledanja
SetPlayerFacingAngle(playerid, RandomSpawn[rand][3]);
return 1;
}
```
## Zabilješke
:::tip
Korištenje vrijednosti manje od 1 daje čudne vrijednosti.
:::
## Srodne Funkcije
| openmultiplayer/web/docs/translations/bs/scripting/functions/random.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/random.md",
"repo_id": "openmultiplayer",
"token_count": 605
} | 373 |
---
title: tolower
description: Ova funkcija mijenja jedan znak u malo slovo.
tags: []
---
:::warning
Ova funkcija započinje malim slovom.
:::
## Deskripcija
Ova funkcija mijenja jedan znak u malo slovo.
| Ime | Deskripcija |
| --- | ----------------------------------- |
| c | Znak za promijeniti u veliko slovo. |
## Returns
Vrijednost ASCII znaka, ali malim slovima.
## Primjeri
```c
public OnPlayerText(playerid, text[])
{
text[0] = tolower(text[0]);
//Ovo postavlja prvi karakter u malo slovo
return 1;
}
```
## Srodne Funkcije
- [toupper](toupper): Ova funkcija mijenja jedan znak u veliko slovo.
| openmultiplayer/web/docs/translations/bs/scripting/functions/tolower.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/tolower.md",
"repo_id": "openmultiplayer",
"token_count": 298
} | 374 |
---
title: Vrste Spectate-ovanja
description: Vrste Spectate-ovanja korištene za GetPlayerSpectateType.
tags: []
sidebar_label: Vrste Spectate-ovanja
---
:::info
Vrste Spectate-ovanja korištene za [GetPlayerSpectateType](../functions/GetPlayerSpectateType).
:::
| Tip | Vrijednost |
| ------- | ---------- |
| Nijedan | 0 |
| Vozilo | 1 |
| Igrač | 2 |
| openmultiplayer/web/docs/translations/bs/scripting/resources/spectatetypes.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/bs/scripting/resources/spectatetypes.md",
"repo_id": "openmultiplayer",
"token_count": 178
} | 375 |
---
title: AddStaticVehicle
description: Fügt ein 'static' vehicle (models werden für den Spieler vorgeladen) zum Gamemode hinzu.
tags: ["vehicle"]
---
## Beschreibung
Fügt ein 'static' vehicle (models werden für den Spieler vorgeladen) zum Gamemode hinzu.
| Name | Beschreibung |
| ---------------------------------------- | -------------------------------------- |
| modelid | Die Model ID des Fahrzeugs. |
| Float:spawn_X | Die X-Koordinate des Fahrzeugs. |
| Float:spawn_Y | Die Y-Koordinate des Fahrzeugs. |
| Float:spawn_Z | Die Z-Koordinate des Fahrzeugs. |
| Float:z_angle | Direction of vehicle - angle. |
| [color1](../resources/vehiclecolorid) | Die ID der Primärfarbe. -1 für zufällige Farbe. |
| [color2](../resources/vehiclecolorid) | Die ID der Sekundärfarbe. -1 für zufällige Farbe. |
## Rückgabe(return value)
Die vehicleID des erstellten Fahrzeug (zwischen 1 und MAX_VEHICLES).
INVALID_VEHICLE_ID (65535) wenn das Fahrzeug nicht erstellt werden konnte (Fahrzeug-Limit ist erreicht oder fehlerhafte model ID).
## Beispiele
```c
public OnGameModeInit()
{
// Fügt einen Sultan zum Spiel hinzu
AddStaticVehicle(560, 2109.1763, 1503.0453, 32.2887, 82.2873, 0, 1);
return 1;
}
```
## Ähnliche Funktionen
- [AddStaticVehicleEx](AddStaticVehicleEx): Erstelle ein static Fahrzeug mit bestimmter Respawnzeit.
- [CreateVehicle](CreateVehicle): Erstelle ein Fahrzeug.
- [DestroyVehicle](DestroyVehicle): Lösche ein Fahrzeug.
| openmultiplayer/web/docs/translations/de/scripting/functions/AddStaticVehicle.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/de/scripting/functions/AddStaticVehicle.md",
"repo_id": "openmultiplayer",
"token_count": 794
} | 376 |
---
título: OnFilterScriptInit
descripción: Este callback se llama cuando un filterscript es inicializado (cargado).
tags: []
---
## Descripción
Este callback se llama cuando un filterscript es inicializado (cargado). Solo se llama adentro del filterscript que está siendo iniciado.
## Ejemplos
```c
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print("El filterscript fue cargado");
print("--------------------------------------\n");
return 1;
}
```
## Funciones Relacionadas
| openmultiplayer/web/docs/translations/es/scripting/callbacks/OnFilterScriptInit.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/es/scripting/callbacks/OnFilterScriptInit.md",
"repo_id": "openmultiplayer",
"token_count": 173
} | 377 |
---
título: OnPlayerEnterCheckpoint
descripción: Este callback se llama cuando un jugador entra al checkpoint establecido para ese jugador.
tags: ["player", "checkpoint"]
---
## Descripción
Este callback se llama cuando un jugador entra al checkpoint establecido para ese jugador.
| Nombre | Descripción |
| -------- | -------------------------------------- |
| playerid | ID del jugador que entró al checkpoint.|
## Devoluciones
Siempre se llama primero en filterscripts.
## Ejemplos
```c
//En este ejemplo, un checkpoint se crea al jugador cuando spawnea,
//el cual crea un vehículo y desactiva el checkpoint.
public OnPlayerSpawn(playerid)
{
SetPlayerCheckpoint(playerid, 1982.6150, -220.6680, -0.2432, 3.0);
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
CreateVehicle(520, 1982.6150, -221.0145, -0.2432, 82.2873, -1, -1, 60000);
DisablePlayerCheckpoint(playerid);
return 1;
}
```
## Notas
<TipNPCCallbacksES />
## Funciones Relacionadas
- [SetPlayerCheckpoint](../functions/SetPlayerCheckpoint): Crea un checkpoint a un jugador.
- [DisablePlayerCheckpoint](../functions/DisablePlayerCheckpoint): Desactiva el checkpoint actual de un jugador.
- [IsPlayerInCheckpoint](../functions/IsPlayerInCheckpoint): Comprueba si un jugador está en un checkpoint.
- [SetPlayerRaceCheckpoint](../functions/SetPlayerRaceCheckpoint): Crea un checkpoint de carrera a un jugador.
- [DisablePlayerRaceCheckpoint](../functions/DisablePlayerRaceCheckpoint): Desactiva el checkpoint de carrera actual del jugador.
- [IsPlayerInRaceCheckpoint](../functions/IsPlayerInRaceCheckpoint): Comprueba si el jugador está en un checkpoint de carrera.
| openmultiplayer/web/docs/translations/es/scripting/callbacks/OnPlayerEnterCheckpoint.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/es/scripting/callbacks/OnPlayerEnterCheckpoint.md",
"repo_id": "openmultiplayer",
"token_count": 576
} | 378 |
---
título: OnPlayerRequestSpawn
descripción: Se llama cuando un jugador intenta spawnear vía selección de clase ya sea presionando SHIFT o clickeando el botón 'Spawn'.
tags: ["player"]
---
## Descripción
Se llama cuando un jugador intenta spawnear vía selección de clase ya sea presionando SHIFT o clickeando el botón 'Spawn'.
| Nombre | Descripción |
| -------- | --------------------------------------------- |
| playerid | El ID del jugador que solicitó spawnear. |
## 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 OnPlayerRequestSpawn(playerid)
{
if (!IsPlayerAdmin(playerid))
{
SendClientMessage(playerid, -1, "No podés spawnear.");
return 0;
}
return 1;
}
```
## Notas
<TipNPCCallbacksES />
:::tip
Para prevenir a los jugadores de spawnear con ciertas clases, la última clase vista debe ser guardada en una variable en OnPlayerRequestClass.
:::
## Funciones Relacionadas
| openmultiplayer/web/docs/translations/es/scripting/callbacks/OnPlayerRequestSpawn.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/es/scripting/callbacks/OnPlayerRequestSpawn.md",
"repo_id": "openmultiplayer",
"token_count": 432
} | 379 |
---
título: OnVehicleDamageStatusUpdate
descripción: Este callback se llama cuando un elemento de vehículo como las puertas, llantas, paneles, o luces cambiar su estado de daño.
tags: ["vehicle"]
---
:::tip
Para algunas funciones útiles para trabajar con valores de daños del vehículo, vea [aquí](../resources/damagestatus).
:::
## Descripción
Este callback se llama cuando un elemento de vehículo como las puertas, llantas, paneles, o luces cambiar su estado de daño.
| Nombre | Descripción |
| --------- | ------------------------------------------------------------------------------------------------------ |
| vehicleid | El ID del vehículo que cambió su estado de daño. |
| playerid | El ID del jugador que sincronizó el cambio en el estado de daño (quién hizo reparar o dañar el auto). |
## 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 OnVehicleDamageStatusUpdate(vehicleid, playerid)
{
// Obtiene el estado de daño de todos los componentes del vehículo
new panels, doors, lights, tires;
GetVehicleDamageStatus(vehicleid, panels, doors, lights, tires);
// Establece las ruedas a 0, lo que significa que ninguna está pinchada
tires = 0;
// Actualiza el daño del vehículo sin las ruedas pinchadas
UpdateVehicleDamageStatus(vehicleid, panels, doors, lights, tires);
return 1;
}
```
## Notas
:::tip
Esto no incluye cambios en la salud del vehículo.
:::
## Funciones Relacionadas
- [GetVehicleDamageStatus](../functions/GetVehicleDamageStatus): Obtiene el estado de daño de cada parte individualmente.
- [UpdateVehicleDamageStatus](../functions/UpdateVehicleDamageStatus): Actualiza el daño del vehículo.
| openmultiplayer/web/docs/translations/es/scripting/callbacks/OnVehicleDamageStatusUpdate.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/es/scripting/callbacks/OnVehicleDamageStatusUpdate.md",
"repo_id": "openmultiplayer",
"token_count": 777
} | 380 |
---
title: OnNPCDisconnect
description: Ang callback na ito ay tinatawag kapag ang NPC ay nadiskonekta sa server.
tags: ["npc"]
---
## Description
Ang callback na ito ay tinatawag kapag ang NPC ay nadiskonekta sa server.
| Name | Description |
| ------------ | ------------------------------------------------------- |
| reason[] | Ang dahilan kung bakit nadiskonekta ang bot sa server |
## Examples
```c
public OnNPCDisconnect(reason[])
{
printf("Disconnected from the server. %s", reason);
}
```
## Related Callbacks
Maaaring maging kapaki-pakinabang ang mga sumusunod na callback, dahil nauugnay ang mga ito sa callback na ito sa isang paraan o iba pa.
- [OnNPCConnect](OnNPCConnect): Tinatawag ang callback na ito kapag matagumpay na nakakonekta ang NPC sa server.
- [OnPlayerDisconnect](OnPlayerDisconnect): Ang callback na ito ay tinatawag kapag ang isang manlalaro ay umalis sa server.
- [OnPlayerConnect](OnPlayerConnect): Tinatawag ang callback na ito kapag kumonekta ang isang player sa server. | openmultiplayer/web/docs/translations/fil/scripting/callbacks/OnNPCDisconnect.md/0 | {
"file_path": "openmultiplayer/web/docs/translations/fil/scripting/callbacks/OnNPCDisconnect.md",
"repo_id": "openmultiplayer",
"token_count": 396
} | 381 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.