text
stringlengths
1
2.83M
id
stringlengths
16
152
metadata
dict
__index_level_0__
int64
0
949
--- title: OnPlayerRequestSpawn description: This callback is called when a player attempts to spawn via class selection either by pressing SHIFT or clicking the 'Spawn' button. tags: ["player", "class"] --- ## Description This callback is called when a player attempts to spawn via class selection either by pressing SHIFT or clicking the 'Spawn' button. | Name | Description | | -------- | --------------------------------------------- | | playerid | The ID of the player that requested to spawn. | ## Returns It is always called first in filterscripts so returning 0 there also blocks other scripts from seeing it. ## Examples ```c public OnPlayerRequestSpawn(playerid) { if (!IsPlayerAdmin(playerid)) { SendClientMessage(playerid, -1, "You may not spawn."); return 0; } return 1; } ``` ## Notes <TipNPCCallbacks /> :::tip To prevent players from spawning with certain classes, the last viewed class must be saved in a variable in OnPlayerRequestClass. ::: ## Related Callbacks The following callbacks might be useful, as they're related to this callback in one way or another. - [OnPlayerSpawn](OnPlayerSpawn): This callback is called when a player spawns. - [OnPlayerRequestClass](OnPlayerRequestClass): This callback is called when a player changes class at class selection.
openmultiplayer/web/docs/scripting/callbacks/OnPlayerRequestSpawn.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/callbacks/OnPlayerRequestSpawn.md", "repo_id": "openmultiplayer", "token_count": 396 }
283
--- title: OnUnoccupiedVehicleUpdate description: This callback is called when a player's client updates/syncs the position of a vehicle they're not driving. tags: ["vehicle"] --- ## Description This callback is called when a player's client updates/syncs the position of a vehicle they're not driving. This can happen outside of the vehicle or when the player is a passenger of a vehicle that has no driver. | Name | Description | | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | | vehicleid | The ID of the vehicle that's position was updated. | | playerid | The ID of the player that sent a vehicle position sync update. | | passenger_seat | The ID of the seat if the player is a passenger. 0=not in vehicle, 1=front passenger, 2=backleft 3=backright 4+ is for coach/bus etc. with many passenger seats. | | Float:new_x | The new X coordinate of the vehicle. | | Float:new_y | The new Y coordinate of the vehicle. | | Float:new_z | The new Z coordinate of the vehicle. | | Float:vel_x | The new X velocity of the vehicle. | | Float:vel_y | The new Y velocity of the vehicle. | | Float:vel_z | The new Z velocity of the vehicle. | ## Returns It is always called first in filterscripts so returning 0 there also blocks other scripts from seeing it. ## Examples ```c public OnUnoccupiedVehicleUpdate(vehicleid, playerid, passenger_seat, Float:new_x, Float:new_y, Float:new_z, Float:vel_x, Float:vel_y, Float:vel_z) { // Check if it moved far if (GetVehicleDistanceFromPoint(vehicleid, new_x, new_y, new_z) > 50.0) { // Reject the update return 0; } return 1; } ``` ## Notes :::warning - This callback is called very frequently per second per unoccupied vehicle. You should refrain from implementing intensive calculations or intensive file writing/reading operations in this callback. - [GetVehiclePos](../functions/GetVehiclePos) will return the old coordinates of the vehicle before this update. ::: ## Related Callbacks The following callbacks might be useful, as they're related to this callback in one way or another. - [OnTrailerUpdate](OnTrailerUpdate): Called when a trailer's position is synced by a client.
openmultiplayer/web/docs/scripting/callbacks/OnUnoccupiedVehicleUpdate.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/callbacks/OnUnoccupiedVehicleUpdate.md", "repo_id": "openmultiplayer", "token_count": 1767 }
284
--- title: Attach3DTextLabelToVehicle description: Attaches a 3D Text Label to a specific vehicle. tags: ["vehicle", "3dtextlabel"] --- ## Description Attaches a 3D Text Label to a specific vehicle. | Name | Description | | ------------- | ------------------------------------------------------------------------------- | | Text3D:textid | The 3D Text Label you want to attach. | | parentid | The vehicle you want to attach the 3D Text Label to. | | Float:offsetX | The Offset-X coordinate of the player vehicle (the vehicle is `0.0, 0.0, 0.0`). | | Float:offsetY | The Offset-Y coordinate of the player vehicle (the vehicle is `0.0, 0.0, 0.0`). | | Float:offsetZ | The Offset-Z coordinate of the player vehicle (the vehicle is `0.0, 0.0, 0.0`). | ## Returns This function does not return any specific values. ## Examples ```c new Text3D:gVehicle3dText[MAX_VEHICLES], // Creating the TextLabel for later use gVehicleId; public OnGameModeInit() { gVehicleId = CreateVehicle(510, 0.0, 0.0, 15.0, 5, 0, 120); // Creating the Vehicle. gVehicle3dText[gVehicleId] = Create3DTextLabel("Example Text", 0xFF0000AA, 0.0, 0.0, 0.0, 50.0, 0, 1); Attach3DTextLabelToVehicle(gVehicle3dText[gVehicleId], gVehicleId, 0.0, 0.0, 2.0); // Attaching Text Label To Vehicle. return 1; } public OnGameModeExit() { Delete3DTextLabel(gVehicle3dText[gVehicleId]); return 1; } ``` ## Related Functions - [Create3DTextLabel](Create3DTextLabel): Create a 3D text label. - [Delete3DTextLabel](Delete3DTextLabel): Delete a 3D text label. - [Get3DTextLabelAttachedData](Get3DTextLabelAttachedData): Gets the 3D text label attached data. - [Attach3DTextLabelToPlayer](Attach3DTextLabelToPlayer): Attach a 3D text label to a player. - [Update3DTextLabelText](Update3DTextLabelText): Change the text of a 3D text label. - [CreatePlayer3DTextLabel](CreatePlayer3DTextLabel): Create A 3D text label for one player. - [DeletePlayer3DTextLabel](DeletePlayer3DTextLabel): Delete a player's 3D text label. - [UpdatePlayer3DTextLabelText](UpdatePlayer3DTextLabelText): Change the text of a player's 3D text label.
openmultiplayer/web/docs/scripting/functions/Attach3DTextLabelToVehicle.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/functions/Attach3DTextLabelToVehicle.md", "repo_id": "openmultiplayer", "token_count": 865 }
285
--- title: CallLocalFunction description: Calls a public function from the script in which it is used. tags: ["core"] --- ## Description Calls a public function from the script in which it is used. | Name | Description | | -------------------- | ------------------------------------------- | | const functionName[] | Public function's name. | | const specifiers[] | Tag/format of each variable | | OPEN_MP_TAGS:... | 'Indefinite' number of arguments of any tag | ## Returns If the function exists, returns the same as the called function. If the function does not exist, returns 0. ## Format Specifiers | **Placeholder** | **Meaning** | | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `a` | Passes an array (the next placeholder should be d or i for the array size, so the function will be aware of it).<br/><br/>**NOTE**: It accepts only one dimension, so a trick like sizeof (array) + sizeof (array) \* sizeof (array[]) for the array size would be needed to pass a 2D array. | | `c` | Passes a single character. | | `d`,`i` | Passes an integer (whole) number. | | `x` | Passes a number in hexadecimal notation. | | `f` | Passes a floating point number. | | `s` | Passes a string. | ## Examples ```c forward publicFunc(number, Float:flt, const string[]); public publicFunc(number, Float:flt, const string[]) { printf("Received integer %i, float %f, string %s", number, flt, string); return 1; } CallLocalFunction("publicFunc", "ifs", 420, 68.999999999, "Hello world"); ``` ## Notes :::warning CallLocalFunction crashes the server if it's passing an empty string. (Fixed in open.mp) ::: ## Related Functions - [CallRemoteFunction](CallRemoteFunction): Call a function in any loaded script.
openmultiplayer/web/docs/scripting/functions/CallLocalFunction.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/functions/CallLocalFunction.md", "repo_id": "openmultiplayer", "token_count": 2221 }
286
--- title: CreateExplosion description: Create an explosion at the specified coordinates. tags: [] --- ## Description Create an explosion at the specified coordinates. | Name | Description | | ------------ | -------------------------------------------------------- | | Float:x | The X coordinate of the explosion. | | Float:y | The Y coordinate of the explosion. | | Float:z | The Z coordinate of the explosion. | | type | The [type](../resources/explosionlist) of the explosion. | | Float:radius | The radius of the explosion. | ## Returns This function always returns 1, even when the explosion type and/or radius values are invalid. ## Examples ```c public OnPlayerEnterCheckpoint(playerid) { // Get the player's position new Float:x, Float:y, Float:z; GetPlayerPos(playerid, x, y, z); // Create an explosion at the player's position CreateExplosion(x, y, z, 12, 10.0); return 1; } ``` ## Notes :::tip There is a limit as to how many explosions can be seen at once by a player. This is roughly 10. ::: ## Related Functions - [CreateExplosionForPlayer](CreateExplosionForPlayer): Create an explosion which is visible for only a single player. ## See Also - [Explosion Types](../resources/explosionlist): A list of all the explosion types.
openmultiplayer/web/docs/scripting/functions/CreateExplosion.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/functions/CreateExplosion.md", "repo_id": "openmultiplayer", "token_count": 534 }
287
--- title: DestroyMenu description: Destroys the specified menu. tags: ["menu"] --- ## Description Destroys the specified menu. | Name | Description | | ----------- | ---------------------- | | Menu:menuid | The menu ID to destroy | ## Returns **true** if the destroying was successful, otherwise **false** ## Examples ```c new Menu:exampleMenu; exampleMenu = CreateMenu("Your Menu", 2, 200.0, 100.0, 150.0, 150.0); // Later ... DestroyMenu(exampleMenu); ``` ## Related Functions - [CreateMenu](CreateMenu): Create a menu. - [SetMenuColumnHeader](SetMenuColumnHeader): Set the header for one of the columns in a menu. - [AddMenuItem](AddMenuItem): Add an item to a menu. ## Related Callbacks - [OnPlayerSelectedMenuRow](../callbacks/OnPlayerSelectedMenuRow): Called when a player selected a row in a menu. - [OnPlayerExitedMenu](../callbacks/OnPlayerExitedMenu): Called when a player exits a menu.
openmultiplayer/web/docs/scripting/functions/DestroyMenu.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/functions/DestroyMenu.md", "repo_id": "openmultiplayer", "token_count": 290 }
288
--- title: EditPlayerClass description: Edit a class data. tags: ["class"] --- <VersionWarn version='omp v1.1.0.2612' /> ## Description Edit a class data. | Name | Description | |----------------|------------------------------------------------------------------| | classid | The class id to edit. | | team | The team you want the player to spawn in. | | skin | The [skin](../resources/skins) which the player will spawn with. | | Float:spawnX | The X coordinate of the spawnpoint of this class. | | Float:spawnY | The Y coordinate of the spawnpoint of this class. | | Float:spawnZ | The Z coordinate of the spawnpoint of this class. | | Float:angle | The direction in which the player will face after spawning. | | WEAPON:weapon1 | The first spawn-weapon for the player. | | ammo1 | The amount of ammunition for the first spawn weapon. | | WEAPON:weapon2 | The second spawn-weapon for the player. | | ammo2 | The amount of ammunition for the second spawn weapon. | | WEAPON:weapon3 | The third spawn-weapon for the player. | | ammo3 | The amount of ammunition for the third spawn weapon. | ## Examples ```c // Edit class id 10 EditPlayerClass(10, TEAM_NONE, 299, -253.8291, 2602.9312, 62.8527, -90.0000, WEAPON_KNIFE, 1, WEAPON_MP5, 100, WEAPON_COLT45, 20); ``` ## Related Functions - [AddPlayerClass](AddPlayerClass): Adds a class. - [AddPlayerClassEx](AddPlayerClassEx): Add a class with a default team. - [GetAvailableClasses](GetAvailableClasses): Get the number of classes defined. ## Related Resources - [Skin IDs](../resources/skins) - [Weapon IDs](../resources/weaponids)
openmultiplayer/web/docs/scripting/functions/EditPlayerClass.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/functions/EditPlayerClass.md", "repo_id": "openmultiplayer", "token_count": 826 }
289
--- title: GangZoneCreate description: Create a gangzone (colored radar area). tags: ["gangzone"] --- ## Description Create a gangzone (colored radar area). | Name | Description | | ---------- | ---------------------------------------------------- | | Float:minX | The X coordinate for the west side of the gangzone. | | Float:minY | The Y coordinate for the south side of the gangzone. | | Float:maxX | The X coordinate for the east side of the gangzone. | | Float:maxY | The Y coordinate for the north side of the gangzone. | ## Returns The ID of the created zone, returns **-1** if not created ## Examples ```c new gangZone; public OnGameModeInit() { gangZone = GangZoneCreate(1248.011, 2072.804, 1439.348, 2204.319); return 1; } ``` ``` MaxY v -------------* < MaxX | | | gangzone | | center | | | MinX > *------------- ^ MinY ``` ## Notes :::warning - There is a limit of 1024 gangzones. - Putting the parameters in the wrong order results in glitchy behavior. ::: :::tip This function merely CREATES the gangzone, you must use [GangZoneShowForPlayer](GangZoneShowForPlayer) or [GangZoneShowForAll](GangZoneShowForAll) to show it. ::: ## Related Functions - [GangZoneDestroy](GangZoneDestroy): Destroy a gangzone. - [GangZoneShowForPlayer](GangZoneShowForPlayer): Show a gangzone for a player. - [GangZoneShowForAll](GangZoneShowForAll): Show a gangzone for all players. - [GangZoneHideForPlayer](GangZoneHideForPlayer): Hide a gangzone for a player. - [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. ## GangZone Editors - [Prineside DevTools GangZone Editor](https://dev.prineside.com/en/gtasa_gangzone_editor/)
openmultiplayer/web/docs/scripting/functions/GangZoneCreate.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/functions/GangZoneCreate.md", "repo_id": "openmultiplayer", "token_count": 859 }
290
--- title: Get3DTextLabelDrawDistance description: Gets the 3D text label draw distance. tags: ["3dtextlabel"] --- <VersionWarn version='omp v1.1.0.2612' /> ## Description Gets the 3D text label draw distance. | Name | Description | | ------------- | -------------------------------------------------------- | | Text3D:textid | The ID of the 3D text label to get the draw distance of. | ## Returns Returns the draw distance of the 3D text label as float. ## Examples ```c new Text3D:gMyLabel; new Float:drawDistance; gMyLabel = Create3DTextLabel("Hello World!", 0x008080FF, 30.0, 40.0, 50.0, 10.0, 0, false); drawDistance = Get3DTextLabelDrawDistance(gMyLabel); // drawDistance = 10.0 ``` ## Related Functions - [Set3DTextLabelDrawDistance](Set3DTextLabelDrawDistance): Sets the 3D text label draw distance. - [GetPlayer3DTextLabelDrawDistance](GetPlayer3DTextLabelDrawDistance): Gets the player 3D text label draw distance.
openmultiplayer/web/docs/scripting/functions/Get3DTextLabelDrawDistance.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/functions/Get3DTextLabelDrawDistance.md", "repo_id": "openmultiplayer", "token_count": 345 }
291
--- title: GetConsoleVarAsBool description: Get the boolean value of a console variable. tags: [] --- ## Description Get the boolean value of a console variable. | Name | Description | | ------------ | ----------------------------------------------------- | | const cvar[] | The name of the boolean variable to get the value of. | ## Returns The value of the specified console variable. 0 if the specified console variable is not a boolean or doesn't exist. ## Examples ```c public OnGameModeInit() { new queryEnabled = GetConsoleVarAsBool("enable_query"); if (!queryEnabled) { print("WARNING: Querying is disabled. The server will appear offline in the server browser."); } return 1; } ``` ## Notes :::tip Type 'varlist' in the server console to display a list of available console variables and their types. ::: ## Related Functions - [GetConsoleVarAsString](GetConsoleVarAsString): Retreive a server variable as a string. - [GetConsoleVarAsInt](GetConsoleVarAsInt): Retreive a server variable as an integer.
openmultiplayer/web/docs/scripting/functions/GetConsoleVarAsBool.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/functions/GetConsoleVarAsBool.md", "repo_id": "openmultiplayer", "token_count": 348 }
292
--- title: GetMyFacingAngle description: Get the current facing angle of the NPC. tags: [] --- ## Description Get the current facing angle of the NPC. | Name | Description | | -------------------- | ---------------------------------------------------------------- | | &Float:Angle | A float to save the angle in, passed by reference. | ## Returns The facing angle is stored in the specified variable. ## Examples ```c public OnPlayerText(playerid, text[]) { new Float:Angle; GetMyFacingAngle(Angle); printf("I am currently facing %f!", Angle); ``` ## Related Functions - [SetMyFacingAngle](../functions/SetMyFacingAngle): Set the NPC's facing angle.
openmultiplayer/web/docs/scripting/functions/GetMyFacingAngle.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/functions/GetMyFacingAngle.md", "repo_id": "openmultiplayer", "token_count": 276 }
293
--- title: GetPVarFloat description: Gets a player variable as a float. tags: ["player variable", "pvar"] --- ## Description Gets a player variable as a float. | Name | Description | | ------------ | ----------------------------------------------------------- | | playerid | The ID of the player whose player variable you want to get. | | const pvar[] | The name of the player variable. | ## Returns The float from the specified player variable ## Examples ```c LoadPlayerPos(playerid) { new Float:x, Float:y, Float:z; x = GetPVarFloat(playerid, "Xpos"); y = GetPVarFloat(playerid, "Ypos"); z = GetPVarFloat(playerid, "Zpos"); SetPlayerPos(playerid, x, y, z); return 1; } ``` ## Notes :::tip Variables aren't reset until after [OnPlayerDisconnect](../callbacks/OnPlayerDisconnect) is called, so the values are still accessible in OnPlayerDisconnect. ::: ## Related Functions - [SetPVarInt](SetPVarInt): Set an integer for a player variable. - [GetPVarInt](GetPVarInt): Get the previously set integer from a player variable. - [SetPVarString](SetPVarString): Set a string for a player variable. - [GetPVarString](GetPVarString): Get the previously set string from a player variable. - [SetPVarFloat](SetPVarFloat): Set a float for a player variable. - [DeletePVar](DeletePVar): Delete a player variable.
openmultiplayer/web/docs/scripting/functions/GetPVarFloat.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/functions/GetPVarFloat.md", "repo_id": "openmultiplayer", "token_count": 500 }
294
--- title: GetPlayer3DTextLabelLOS description: Gets the player's 3D text label line-of-sight. tags: ["player", "3dtextlabel"] --- <VersionWarn version='omp v1.1.0.2612' /> ## Description Gets the player's 3D text label line-of-sight. | Name | Description | | ------------------- | ----------------------------------------------------------------- | | playerid | The ID of the player. | | PlayerText3D:textid | The ID of the player's 3D text label to get the line-of-sight of. | ## Returns Returns the line-of-sight of the player's 3D text label as boolean (false/true). ## Examples ```c new PlayerText3D:playerTextId; new Float:X, Float:Y, Float:Z; new bool:testLOS; GetPlayerPos(playerid, X, Y, Z); playerTextId = CreatePlayer3DTextLabel(playerid, "Hello\nI'm at your position", 0x008080FF, X, Y, Z, 40.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, true); testLOS = GetPlayer3DTextLabelLOS(playerid, playerTextId); // testLOS = true ``` ## Related Functions - [SetPlayer3DTextLabelLOS](SetPlayer3DTextLabelLOS): Sets the player's 3D text label line-of-sight. - [Get3DTextLabelLOS](Get3DTextLabelLOS): Gets the 3D text label line-of-sight.
openmultiplayer/web/docs/scripting/functions/GetPlayer3DTextLabelLOS.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/functions/GetPlayer3DTextLabelLOS.md", "repo_id": "openmultiplayer", "token_count": 510 }
295
--- title: GetPlayerCameraTargetObject description: Allows you to retrieve the ID of the object the player is looking at. tags: ["player", "camera"] --- <VersionWarn version='SA-MP 0.3.7' /> ## Description Allows you to retrieve the ID of the object the player is looking at. | Name | Description | | -------- | ----------------------------- | | playerid | The ID of the player to check | ## Returns The ID of the object playerid is looking at. If INVALID_OBJECT_ID (65535) is returned, playerid isn't looking at any object. ## Examples ```c new globalObjectID; public OnGameModeInit() { globalObjectID = CreateObject(1337, 0.0, 0.0, 3.0, 0.0, 0.0, 0.0); return 1; } public OnPlayerCommandText(playerid, cmdtext[]) { if (!strcmp(cmdtext, "/check", true)) { new objectid = GetPlayerCameraTargetObject(playerid); if (objectid == globalObjectID) { SendClientMessage(playerid, -1, "You're looking at your object."); } else if (objectid == INVALID_OBJECT_ID) // INVALID_OBJECT_ID = 65535 { SendClientMessage(playerid, -1, "You're not looking at any object."); } return 1; } return 0; } ``` ## Notes :::warning This function is disabled by default to save bandwidth. Use [EnablePlayerCameraTarget](EnablePlayerCameraTarget) to enable it for each player. ::: ## Related Functions - [GetPlayerCameraTargetVehicle](GetplayerCameraTargetVehicle): Get the ID of the vehicle a player is looking at. - [GetPlayerCameraTargetPlayer](GetplayerCameraTargetPlayer): Get the ID of the player a player is looking at. - [GetPlayerCameraFrontVector](GetPlayerCameraFrontVector): Get the player's camera front vector
openmultiplayer/web/docs/scripting/functions/GetPlayerCameraTargetObject.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/functions/GetPlayerCameraTargetObject.md", "repo_id": "openmultiplayer", "token_count": 608 }
296
--- title: GetPlayerFightingStyle description: Get the fighting style the player currently using. tags: ["player"] --- ## Description Get the fighting style the player currently using. | Name | Description | | -------- | -------------------------------------------------- | | playerid | The ID of the player to get the fighting style of. | ## Returns The ID of the [fighting style](../resources/fightingstyles) of the player. ## Examples ```c public OnPlayerCommandText(playerid, cmdtext[]) { if (!strcmp(cmdtext, "/fightstyle", true)) { new string[64]; new FIGHT_STYLE:style = GetPlayerFightingStyle(playerid); new styleName[11]; switch (style) { case FIGHT_STYLE_NORMAL: { styleName = "normal"; } case FIGHT_STYLE_BOXING: { styleName = "boxing"; } case FIGHT_STYLE_KUNGFU: { styleName = "kungfu"; } case FIGHT_STYLE_KNEEHEAD: { styleName = "kneehead"; } case FIGHT_STYLE_GRABKICK: { styleName = "grabkick"; } case FIGHT_STYLE_ELBOW: { styleName = "elbow"; } } format(string, sizeof(string), "You are using %s fighting style!", styleName); SendClientMessage(playerid, 0xFFFFFFAA, string); return 1; } return 0; } ``` ## Related Functions - [SetPlayerFightingStyle](SetPlayerFightingStyle): Set a player's fighting style. ## Related Resources - [Fighting Styles](../resources/fightingstyles)
openmultiplayer/web/docs/scripting/functions/GetPlayerFightingStyle.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/functions/GetPlayerFightingStyle.md", "repo_id": "openmultiplayer", "token_count": 839 }
297
--- title: GetPlayerNetworkStats description: Gets a player's network stats and saves them into a string. tags: ["player", "network monitoring"] --- ## Description Gets a player's network stats and saves them into a string. | Name | Description | | ---------------------- | ------------------------------------------------------------- | | playerid | The ID of the player you want to get the networkstats of. | | output[] | The string to store the networkstats in, passed by reference. | | size = sizeof (output) | The length of the string that should be stored. | ## Returns This function always returns 1. ## Examples ```c public OnPlayerCommandText(playerid, cmdtext[]) { if (!strcmp(cmdtext, "/mynetstats")) { new stats[400+1]; GetPlayerNetworkStats(playerid, stats, sizeof(stats)); ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "My Network Stats", stats, "Okay", ""); } return 1; } ``` ## Notes :::tip This function may not return accurate data when used under [OnPlayerDisconnect](OnPlayerDisconnect) if the player has quit normally. It usually returns accurate data if the player has been kicked or has timed out. ::: ## Related Functions - [GetNetworkStats](GetNetworkStats): Gets the servers networkstats and saves it into a string. - [NetStats_GetConnectedTime](NetStats_GetConnectedTime): Get the time that a player has been connected for. - [NetStats_MessagesReceived](NetStats_MessagesReceived): Get the number of network messages the server has received from the player. - [NetStats_BytesReceived](NetStats_BytesReceived): Get the amount of information (in bytes) that the server has received from the player. - [NetStats_MessagesSent](NetStats_MessagesSent): Get the number of network messages the server has sent to the player. - [NetStats_BytesSent](NetStats_BytesSent): Get the amount of information (in bytes) that the server has sent to the player. - [NetStats_MessagesRecvPerSecond](NetStats_MessagesRecvPerSecond): Get the number of network messages the server has received from the player in the last second. - [NetStats_PacketLossPercent](NetStats_PacketLossPercent): Get a player's packet loss percent. - [NetStats_ConnectionStatus](NetStats_ConnectionStatus): Get a player's connection status. - [NetStats_GetIpPort](NetStats_GetIpPort): Get a player's IP and port.
openmultiplayer/web/docs/scripting/functions/GetPlayerNetworkStats.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/functions/GetPlayerNetworkStats.md", "repo_id": "openmultiplayer", "token_count": 769 }
298
--- title: GetPlayerPickupVirtualWorld description: Gets the virtual world ID of a player-pickup. tags: ["player", "pickup", "playerpickup"] --- <VersionWarn version='omp v1.1.0.2612' /> ## Description Gets the virtual world ID of a player-pickup. | Name | Description | |----------|-------------------------------------------------------------| | playerid | The ID of the player. | | pickupid | The ID of the player-pickup to get the virtual world ID of. | ## Returns Returns the virtual world ID of the player-pickup. ## Examples ```c new PlayerPickup[MAX_PLAYERS]; public OnPlayerConnect(playerid) { PlayerPickup[playerid] = CreatePlayerPickup(playerid, 1239, 1, 2010.0979, 1222.0642, 10.8206, 20); new worldid = GetPlayerPickupVirtualWorld(playerid, PlayerPickup[playerid]); // worldid = 20 return 1; } ``` ## Related Functions - [CreatePlayerPickup](CreatePlayerPickup): Creates a pickup which will be visible to only one player. - [DestroyPlayerPickup](DestroyPlayerPickup): Destroy a player-pickup. - [IsValidPlayerPickup](IsValidPlayerPickup): Checks if a player-pickup is valid. - [IsPlayerPickupStreamedIn](IsPlayerPickupStreamedIn): Checks if a player-pickup is streamed in for the player. - [SetPlayerPickupPos](SetPlayerPickupPos): Sets the position of a player-pickup. - [GetPlayerPickupPos](GetPlayerPickupPos): Gets the coordinates of a player-pickup. - [SetPlayerPickupModel](SetPlayerPickupModel): Sets the model of a player-pickup. - [GetPlayerPickupModel](GetPlayerPickupModel): Gets the model ID of a player-pickup. - [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.
openmultiplayer/web/docs/scripting/functions/GetPlayerPickupVirtualWorld.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/functions/GetPlayerPickupVirtualWorld.md", "repo_id": "openmultiplayer", "token_count": 647 }
299
--- title: GetPlayerSurfingOffsets description: Gets a player's surfing offsets. tags: ["player"] --- <VersionWarn version='omp v1.1.0.2612' /> ## Description Gets a player's surfing offsets. | Name | Description | |----------------|----------------------------------------------------------------------------------| | playerid | The ID of the player. | | &Float:offsetX | A float variable in which to store the offset X coordinate, passed by reference. | | &Float:offsetY | A float variable in which to store the offset Y coordinate, passed by reference. | | &Float:offsetZ | A float variable in which to store the offset Z coordinate, passed by reference. | ## Returns This function does not return any specific value. ## Examples ```c new surfingVehicleId = GetPlayerSurfingVehicleID(playerid); if (surfingVehicleId != INVALID_VEHICLE_ID) { new Float:offsetX, Float:offsetY, Float:offsetZ; GetPlayerSurfingOffsets(playerid, offsetX, offsetY, offsetZ); SendClientMessage(playerid, -1, "offsetX = %.2f offsetY = %.2f offsetZ = %.2f", offsetX, offsetY, offsetZ); } ``` ## Related Functions - [GetPlayerSurfingObjectID](GetPlayerSurfingObjectID): Gets the ID of the object the player is surfing on. - [GetPlayerSurfingVehicleID](GetPlayerSurfingVehicleID): Get the ID of the vehicle that the player is surfing (stuck to the roof of).
openmultiplayer/web/docs/scripting/functions/GetPlayerSurfingOffsets.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/functions/GetPlayerSurfingOffsets.md", "repo_id": "openmultiplayer", "token_count": 569 }
300
--- title: GetPlayerWeaponState description: Check the state of a player's weapon. tags: ["player"] --- ## Description Check the state of a player's weapon. | Name | Description | | -------- | --------------------------------------------------- | | playerid | The ID of the player to obtain the weapon state of. | ## Returns The [state of the player's weapon](../resources/weaponstates). **0** if player specified does not exist. ## Examples ```c public OnPlayerCommandText(playerid, cmdtext[]) { if (!strcmp(cmdtext, "/wstate", true)) { new WEAPONSTATE:state = GetPlayerWeaponState(playerid); static weaponStates[4][64] = { "Current weapon has no ammo remaining", "Current weapon has a single bullet left", "Current weapon has more than one bullet left", "Reloading current weapon" }; new string[144]; format(string, sizeof(string), "Your weapon state: %s", weaponStates[state]); SendClientMessage(playerid, -1, string); return 1; } return 0; } ``` ## Related Functions - [GivePlayerWeapon](GivePlayerWeapon): Give a player a weapon. ## Related Resources - [Weapon States](../resources/weaponstates)
openmultiplayer/web/docs/scripting/functions/GetPlayerWeaponState.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/functions/GetPlayerWeaponState.md", "repo_id": "openmultiplayer", "token_count": 475 }
301
--- title: GetServerVarAsInt description: Get the integer value of a server variable. tags: [] --- :::warning This function, as of 0.3.7 R2, is deprecated. Please see GetConsoleVarAsInt ::: ## Description Get the integer value of a server variable. | Name | Description | | --------------- | ----------------------------------------------------- | | const varname[] | The name of the integer variable to get the value of. | ## Returns The value of the specified server variable. 0 if the specified server variable is not an integer or doesn't exist. ## Examples ```c new serverPort = GetServerVarAsInt("port"); printf("Server Port: %i", serverPort); ``` ## Notes :::tip Type 'varlist' in the server console to display a list of available server variables and their types. ::: ## Related Functions - [GetServerVarAsString](GetServerVarAsString): Retreive a server variable as a string. - [GetServerVarAsBool](GetServerVarAsBool): Retreive a server variable as a boolean.
openmultiplayer/web/docs/scripting/functions/GetServerVarAsInt.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/functions/GetServerVarAsInt.md", "repo_id": "openmultiplayer", "token_count": 326 }
302
--- title: GetVehicleLandingGearState description: Gets the current vehicle landing gear state from the latest driver. tags: ["vehicle"] --- <VersionWarn version='omp v1.1.0.2612' /> ## Description Gets the current vehicle [landing gear state](../resources/landinggearstate) from the latest driver. ## Parameters | Name | Description | |-----------|------------------------| | vehicleid | The ID of the vehicle. | ## Examples ```c new LANDING_GEAR_STATE:state = GetVehicleLandingGearState(vehicleid); ``` ## Related Functions - [GetPlayerLandingGearState](GetPlayerLandingGearState): Gets the landing gear state of the current player's vehicle. ## Related Resources - [Vehicle Landing Gear States](../resources/landinggearstate)
openmultiplayer/web/docs/scripting/functions/GetVehicleLandingGearState.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/functions/GetVehicleLandingGearState.md", "repo_id": "openmultiplayer", "token_count": 226 }
303
--- title: GetVehicleRespawnDelay description: Get the respawn delay of a vehicle. tags: ["vehicle"] --- <VersionWarn version='omp v1.1.0.2612' /> ## Description Get the respawn delay of a vehicle. ## Parameters | Name | Description | |-----------|------------------------| | vehicleid | The ID of the vehicle. | ## Examples ```c public OnGameModeInit() { new vehicleid = CreateVehicle(560, 2096.1917, -1328.5150, 25.1059, 0.0000, 1, 8, 60); new respawnDelay = GetVehicleRespawnDelay(vehicleid); // respawnDelay = 60 return 1; } ``` ## Related Functions - [SetVehicleRespawnDelay](SetVehicleRespawnDelay): Set the respawn delay of a vehicle.
openmultiplayer/web/docs/scripting/functions/GetVehicleRespawnDelay.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/functions/GetVehicleRespawnDelay.md", "repo_id": "openmultiplayer", "token_count": 247 }
304
--- title: GetWorldTime description: Get the current world time. tags: ["worldtime"] --- <VersionWarn version='omp v1.1.0.2612' /> ## Description Get the current world time. ## Examples ```c SetWorldTime(12); printf("Current world time: %d", GetWorldTime()); // The output will be 'Current world time: 12' ``` ## Related Functions - [SetWorldTime](SetWorldTime): Sets the world time (for all players) to a specific hour. - [SetPlayerTime](SetPlayerTime): Set a player's time.
openmultiplayer/web/docs/scripting/functions/GetWorldTime.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/functions/GetWorldTime.md", "repo_id": "openmultiplayer", "token_count": 152 }
305
--- title: InterpolateCameraPos description: Move a player's camera from one position to another, within the set time. tags: ["player", "interpolate"] --- ## Description Move a player's camera from one position to another, within the set time. Useful for scripted cut scenes | Name | Description | | ------------ | -------------------------------------------------------------------------------------------------------------------- | | playerid | The ID of the player the camera should be moved for | | Float:fromX | The X position the camera should start to move from | | Float:fromY | The Y position the camera should start to move from | | Float:fromZ | The Z position the camera should start to move from | | Float:toX | The X position the camera should move to | | Float:toY | The Y position the camera should move to | | Float:toZ | The Z position the camera should move to | | time | Time in milliseconds | | CAM_MOVE:cut | The [jumpcut](../resources/cameracutstyles) to use. Defaults to CAMERA_CUT. Set to CAMERA_MOVE for a smooth movement | ## Returns This function does not return any specific values. ## Examples ```c public OnPlayerCommandText(playerid, cmdtext[]) { if (!strcmp(cmdtext, "/moveme", true)) { TogglePlayerSpectating(playerid, true); InterpolateCameraPos(playerid, 0.0, 0.0, 10.0, 1000.0, 1000.0, 30.0, 10000, CAMERA_MOVE); //Move the player's camera from point A to B in 10000 milliseconds (10 seconds). return 1; } return 0; } ``` ## Notes :::tip - Use [TogglePlayerSpectating](TogglePlayerSpectating) to make objects stream in for the player while the camera is moving and remove the HUD. - The player's camera can be reset to behind the player with [SetCameraBehindPlayer](SetCameraBehindPlayer). ::: ## Related Functions - [InterpolateCameraLookAt](InterpolateCameraLookAt): Move a player's camera view from one location to another. - [SetPlayerCameraPos](SetPlayerCameraPos): Set a player's camera position. - [SetPlayerCameraLookAt](SetPlayerCameraLookAt): Set where a player's camera should face. ## Related Resources - [Camera Cut Styles](../resources/cameracutstyles)
openmultiplayer/web/docs/scripting/functions/InterpolateCameraPos.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/functions/InterpolateCameraPos.md", "repo_id": "openmultiplayer", "token_count": 1338 }
306
--- title: IsPlayerAdmin description: Check if a player is logged in as an RCON admin. tags: ["player", "rcon", "administration"] --- ## Description Check if a player is logged in as an RCON admin. | Name | Description | | -------- | ------------------------------ | | playerid | The ID of the player to check. | ## Returns **true** - Player is an RCON admin. **false** - Player is NOT an RCON admin. ## Examples ```c public OnPlayerSpawn(playerid) { if (IsPlayerAdmin(playerid)) { SendClientMessageToAll(0xDEEE20FF, "An admin spawned."); } return 1; } ``` ## Related Functions - [SetPlayerAdmin](SetPlayerAdmin): Sets the player as an RCON admin. - [SendRconCommand](SendRconCommand): Sends an RCON command via the script. ## Related Callbacks - [OnRconLoginAttempt](../callbacks/OnRconLoginAttempt): Called when an attempt to login to RCON is made.
openmultiplayer/web/docs/scripting/functions/IsPlayerAdmin.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/functions/IsPlayerAdmin.md", "repo_id": "openmultiplayer", "token_count": 310 }
307
--- title: IsPlayerInRangeOfPoint description: Checks if a player is in range of a point. tags: ["player"] --- ## Description Checks if a player is in range of a point. This native function is faster than the PAWN implementation using distance formula. | Name | Description | | ----------- | ---------------------------------------------------------------------- | | playerid | The ID of the player. | | Float:range | The furthest distance the player can be from the point to be in range. | | Float:x | The X coordinate of the point to check the range to. | | Float:y | The Y coordinate of the point to check the range to. | | Float:z | The Z coordinate of the point to check the range to. | ## Returns **true** - The player is in range of the point. **false** - The player is not in range of the point. ## Examples ```c public OnPlayerCommandText(playerid, cmdtext[]) { if (!strcmp(cmdtext, "/stadium", true)) { if (IsPlayerInRangeOfPoint(playerid, 7.0, 2695.6880, -1704.6300, 11.8438)) { SendClientMessage(playerid, 0xFFFFFFFF, "You are near the stadium entrance!"); } return 1; } return 0; } ``` ## Related Functions - [GetPlayerDistanceFromPoint](GetPlayerDistanceFromPoint): Get the distance between a player and a point. - [GetVehicleDistanceFromPoint](GetVehicleDistanceFromPoint): Get the distance between a vehicle and a point. - [GetPlayerPos](GetPlayerPos): Get a player's position.
openmultiplayer/web/docs/scripting/functions/IsPlayerInRangeOfPoint.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/functions/IsPlayerInRangeOfPoint.md", "repo_id": "openmultiplayer", "token_count": 635 }
308
--- title: IsValid3DTextLabel description: Checks if a 3D text label is valid. tags: ["3dtextlabel"] --- <VersionWarn version='omp v1.1.0.2612' /> ## Description Checks if a 3D text label is valid. | Name | Description | | ------------- | ------------------------------------- | | Text3D:textid | The ID of the 3D text label to check. | ## Returns This function returns **true** if the 3D text label is valid, or **false** if it is not. ## Examples ```c new Text3D:gMyLabel; public OnGameModeInit() { gMyLabel = Create3DTextLabel("I'm at the coordinates:\n30.0, 40.0, 50.0", 0x008080FF, 30.0, 40.0, 50.0, 40.0, 0, false); if (IsValid3DTextLabel(gMyLabel)) { // Do something } return 1; } ``` ## Related Functions - [Create3DTextLabel](Create3DTextLabel): Creates a 3D Text Label at a specific location in the world. - [IsValidPlayer3DTextLabel](IsValidPlayer3DTextLabel): Checks if a player's 3D text label is valid.
openmultiplayer/web/docs/scripting/functions/IsValid3DTextLabel.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/functions/IsValid3DTextLabel.md", "repo_id": "openmultiplayer", "token_count": 379 }
309
--- title: IsValidTimer description: Checks if a timer is valid. tags: ["timer"] --- <VersionWarn version='omp v1.1.0.2612' /> ## Description Checks if a timer is valid. ## Parameters | Name | Description | |---------|-------------------------------| | timerid | The ID of the timer to check. | ## Return Values **true**: Timer is valid. **false**: Timer is not valid. ## Examples ```c new g_Timer; public OnGameModeInit() { g_Timer = SetTimer("TimerCallback", 60000, true); return 1; } public OnGameModeExit() { if (IsValidTimer(g_Timer)) { printf("Timer ID %d is valid.", g_Timer); KillTimer(g_Timer); } else { printf("Timer ID %d is not valid.", g_Timer); } return 1; } ``` ## Related Functions - [SetTimer](SetTimer): Set a timer. - [SetTimerEx](SetTimerEx): Set a timer with parameters. - [KillTimer](KillTimer): Stop a timer. - [IsRepeatingTimer](IsRepeatingTimer): Checks if a timer is set to repeat. - [CountRunningTimers](CountRunningTimers): Get the running timers.
openmultiplayer/web/docs/scripting/functions/IsValidTimer.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/functions/IsValidTimer.md", "repo_id": "openmultiplayer", "token_count": 401 }
310
--- title: PlayerGangZoneHide description: Hide player gangzone tags: ["player", "gangzone", "playergangzone"] --- <VersionWarn version='omp v1.1.0.2612' /> ## Description Hide player gangzone. | Name | Description | | ----------- | ---------------------------------------------------------------- | | playerid | The ID of the player to whom player gangzone is bound. | | zoneid | The ID of the player gangzone for hide. | ## Returns **1:** The function executed successfully. Success is reported even if the player gangzone was hide to begin with. **0:** The function failed to execute. The gangzone specified does not exist. ## Examples ```c // This variable is used to store the id of the gangzone // so that we can use it throught the script new gGangZoneID[MAX_PLAYERS] = {INVALID_GANG_ZONE, ...}; public OnPlayerConnect(playerid) { // Create the gangzone gGangZoneID[playerid] = CreatePlayerGangZone(playerid, 2236.1475, 2424.7266, 2319.1636, 2502.4348); } public OnPlayerDeath(playerid, killerid, WEAPON:reason) { if (IsValidPlayerGangZone(playerid, gGangZoneID[playerid])) { PlayerGangZoneHide(playerid, gGangZoneID[playerid]); } } ``` ## Related Functions - [CreatePlayerGangZone](CreatePlayerGangZone): Create player gangzone. - [PlayerGangZoneDestroy](PlayerGangZoneDestroy): Destroy player gangzone. - [PlayerGangZoneShow](PlayerGangZoneShow): Show player gangzone. - [PlayerGangZoneFlash](PlayerGangZoneFlash): Start player gangzone flash. - [PlayerGangZoneStopFlash](PlayerGangZoneStopFlash): Stop player gangzone flash. - [PlayerGangZoneGetColour](PlayerGangZoneGetColour): Get the colour of a player gangzone. - [PlayerGangZoneGetFlashColour](PlayerGangZoneGetFlashColour): Get the flashing 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. - [IsPlayerGangZoneVisible](IsPlayerGangZoneVisible): Check if the player gangzone is visible. - [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/PlayerGangZoneHide.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/functions/PlayerGangZoneHide.md", "repo_id": "openmultiplayer", "token_count": 836 }
311
--- title: PlayerTextDrawGetAlignment description: Gets the text alignment of a player-textdraw. tags: ["player", "textdraw", "playertextdraw"] --- <VersionWarn version='omp v1.1.0.2612' /> ## Description Gets the text alignment of a player-textdraw. | Name | Description | | ----------------- | ------------------------------------------------------ | | playerid | The ID of the player. | | PlayerText:textid | The ID of the player-textdraw to get the alignment of. | ## Returns Returns the player-textdraw text alignment. ## Examples ```c new PlayerText:gMyTextdraw[MAX_PLAYERS]; public OnPlayerConnect(playerid) { gMyTextdraw[playerid] = CreatePlayerTextDraw(playerid, 320.0, 425.0, "This is an example textdraw"); PlayerTextDrawAlignment(playerid, gMyTextdraw[playerid], TEXT_DRAW_ALIGN_CENTER); new TEXT_DRAW_ALIGN:align = PlayerTextDrawGetAlignment(playerid, gMyTextdraw[playerid]); // align = TEXT_DRAW_ALIGN_CENTER return 1; } ``` ## Related Functions - [PlayerTextDrawCreate](PlayerTextDrawCreate): Create a player-textdraw. - [PlayerTextDrawDestroy](PlayerTextDrawDestroy): Destroy a player-textdraw. - [PlayerTextDrawAlignment](PlayerTextDrawAlignment): Set the alignment of 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. - [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. - [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/PlayerTextDrawGetAlignment.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/functions/PlayerTextDrawGetAlignment.md", "repo_id": "openmultiplayer", "token_count": 887 }
312
--- title: PlayerTextDrawGetString description: Gets the text of a player-textdraw. tags: ["player", "textdraw", "playertextdraw"] --- <VersionWarn version='omp v1.1.0.2612' /> ## Description Gets the text of a player-textdraw. | Name | Description | | ---------------------------- | ----------------------------------------------------------- | | playerid | The ID of the player. | | PlayerText:textid | The ID of the player-textdraw to get the text of. | | string[] | An array into which to store the text, passed by reference. | | stringSize = sizeof (string) | The size of the string. | ## 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, "Hello World!"); PlayerTextDrawShow(playerid, welcomeText[playerid]); new string[16]; PlayerTextDrawGetString(playerid, welcomeText[playerid], string, sizeof(string)); // string = "Hello World!" return 1; } ``` ## Related Functions - [PlayerTextDrawCreate](PlayerTextDrawCreate): Create a player-textdraw. - [PlayerTextDrawDestroy](PlayerTextDrawDestroy): Destroy a player-textdraw. - [PlayerTextDrawSetString](PlayerTextDrawSetString): Change the text of 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. - [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. - [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. - [TextDrawGetString](TextDrawGetString): Gets the text of a textdraw.
openmultiplayer/web/docs/scripting/functions/PlayerTextDrawGetString.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/functions/PlayerTextDrawGetString.md", "repo_id": "openmultiplayer", "token_count": 1011 }
313
--- title: PlayerTextDrawSetString description: Change the text of a player-textdraw. tags: ["player", "textdraw", "playertextdraw"] --- ## Description Change the text of a player-textdraw. | Name | Description | | ----------------- | ------------------------------------------------- | | playerid | The ID of the player who's textdraw string to set | | PlayerText:textid | The ID of the textdraw to change | | const format[] | The new string for the TextDraw | | OPEN_MP_TAGS:... | Indefinite number of arguments of any tag. | ## Returns This function does not return any specific values. ## Examples ```c new PlayerText:pVehicleHealthTD[MAX_PLAYERS]; new pVehicleHealthTimer[MAX_PLAYERS]; public OnPlayerStateChange(playerid, PLAYER_STATE:newstate, PLAYER_STATE:oldstate) { if (newstate == PLAYER_STATE_DRIVER) // Entered a vehicle as driver { pVehicleHealthTD[playerid] = CreatePlayerTextDraw(playerid, 320.0, 240.0, " "); PlayerTextDrawShow(playerid, pVehicleHealthTD[playerid]); // Set a timer to update the textdraw every second pVehicleHealthTimer[playerid] = SetTimerEx("UpdateVehicleHealthTextDraw", 1000, true, "i", playerid); } if (oldstate == PLAYER_STATE_DRIVER) { KillTimer(pVehicleHealthTimer[playerid]); PlayerTextDrawDestroy(playerid, pVehicleHealthTD[playerid]); } return 1; } forward UpdateVehicleHealthTextDraw(playerid); public UpdateVehicleHealthTextDraw(playerid) { new string[32], vehicleid = GetPlayerVehicleID(playerid), Float:health; GetVehicleHealth(vehicleid, health); format(string, sizeof(string), "Vehicle Health: %.0f", health); PlayerTextDrawSetString(playerid, pVehicleHealthTD[playerid], string); // <<< Update the text to show the vehicle health // PRO TIP: You don't need `format` in open.mp PlayerTextDrawSetString(playerid, pVehicleHealthTD[playerid], "Vehicle Health: %.0f", health); return 1; } /* NOTE: This example is purely for demonstration purposes, it is not guaranteed to work in-game. It is merely to show the usage of the PlayerTextDrawSetString function. */ ``` ## Notes :::tip You don't have to show the TextDraw again in order to apply the changes. ::: :::warning There are limits to the length of textdraw strings! See [Limits](../resources/limits) for more info. ::: ## Related Functions - [CreatePlayerTextDraw](CreatePlayerTextDraw): Create a player-textdraw. - [PlayerTextDrawDestroy](PlayerTextDrawDestroy): Destroy a player-textdraw. - [PlayerTextDrawGetString](PlayerTextDrawGetString): Gets the text of 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. - [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. - [PlayerTextDrawShow](PlayerTextDrawShow): Show a player-textdraw. - [PlayerTextDrawHide](PlayerTextDrawHide): Hide a player-textdraw.
openmultiplayer/web/docs/scripting/functions/PlayerTextDrawSetString.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/functions/PlayerTextDrawSetString.md", "repo_id": "openmultiplayer", "token_count": 1308 }
314
--- title: ResumeRecordingPlayback description: This will resume the paused recording. tags: [] --- ## Description This will resume the paused recording. ## Related Functions - [PauseRecordingPlayback](../functions/PauseRecordingPlayback): Resumes the recording if its paused.
openmultiplayer/web/docs/scripting/functions/ResumeRecordingPlayback.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/functions/ResumeRecordingPlayback.md", "repo_id": "openmultiplayer", "token_count": 73 }
315
--- title: Set3DTextLabelDrawDistance description: Sets the 3D text label draw distance. tags: ["3dtextlabel"] --- <VersionWarn version='omp v1.1.0.2612' /> ## Description Sets the 3D text label draw distance. | Name | Description | | ------------------ | -------------------------------------------------------------- | | Text3D:textid | The ID of the 3D text label to set the draw distance. | | Float:drawDistance | The distance from where you are able to see the 3D Text Label. | ## Returns This function always returns true. ## Examples ```c new Text3D:gMyLabel; gMyLabel = Create3DTextLabel("Hello World!", 0x008080FF, 30.0, 40.0, 50.0, 10.0, 0, false); Set3DTextLabelDrawDistance(gMyLabel, 20.0); // The draw distance changed from 10.0 to 20.0 ``` ## Related Functions - [Get3DTextLabelDrawDistance](Get3DTextLabelDrawDistance): Gets the 3D text label draw distance. - [SetPlayer3DTextLabelDrawDistance](SetPlayer3DTextLabelDrawDistance): Sets the player 3D text label draw distance.
openmultiplayer/web/docs/scripting/functions/Set3DTextLabelDrawDistance.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/functions/Set3DTextLabelDrawDistance.md", "repo_id": "openmultiplayer", "token_count": 386 }
316
--- title: SetMyPos description: Set position of the NPC tags: ["npc"] --- ## Description Set the position of the NPC. | Name | Description | | -------- | ------------------------------------| | Float:x | The X coordinate to put the NPC at. | | Float:y | The Y coordinate to put the NPC at. | | Float:z | The Z coordinate to put the NPC at. | ## Returns This function does not return any specific values. ## Example ```c SetMyPos(0.0, 0.0, 3.0); ``` ## Related Functions - [GetMyPos](GetMyPos): Get the NPC's current position.
openmultiplayer/web/docs/scripting/functions/SetMyPos.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/functions/SetMyPos.md", "repo_id": "openmultiplayer", "token_count": 203 }
317
--- title: SetPickupPos description: Sets the position of a pickup. tags: ["pickup"] --- <VersionWarn version='omp v1.1.0.2612' /> ## Description Sets the position of a pickup. | Name | Description | |--------------------|------------------------------------------| | pickupid | The ID of the pickup. | | Float:x | The x coordinate to set the pickup at. | | Float:y | The y coordinate to set the pickup at. | | Float:z | The z coordinate to set the pickup at. | | bool:update = true | Update pickup for everyone. (true/false) | ## Returns This function always returns **true**. ## Examples ```c new g_Pickup; public OnGameModeInit() { g_Pickup = CreatePickup(1239, 1, 1686.6160, 1455.4277, 10.7705, -1); SetPickupPos(g_Pickup, 1958.5488, 1344.9137, 15.3613); return 1; } ``` ## Related Functions - [CreatePickup](CreatePickup): Create a pickup. - [AddStaticPickup](AddStaticPickup): Add a static pickup. - [DestroyPickup](DestroyPickup): Destroy a pickup. - [IsValidPickup](IsValidPickup): Checks if a pickup is valid. - [IsPickupStreamedIn](IsPickupStreamedIn): Checks if a pickup is streamed in for a specific player. - [IsPickupHiddenForPlayer](IsPickupHiddenForPlayer): Checks if a pickup is hidden for a specific player. - [GetPickupPos](GetPickupPos): Gets the coordinates of a pickup. - [SetPickupModel](SetPickupModel): Sets the model of a pickup. - [GetPickupModel](GetPickupModel): Gets the model ID of a pickup. - [SetPickupType](SetPickupType): Sets the type of a pickup. - [GetPickupType](GetPickupType): Gets the type of a pickup. - [SetPickupVirtualWorld](SetPickupVirtualWorld): Sets the virtual world ID of a pickup. - [GetPickupVirtualWorld](GetPickupVirtualWorld): Gets the virtual world ID of a pickup. - [ShowPickupForPlayer](ShowPickupForPlayer): Shows a pickup for a specific player. - [HidePickupForPlayer](HidePickupForPlayer): Hides a pickup for a specific player. - [SetPickupForPlayer](SetPickupForPlayer): Adjusts the pickup model, type, and position for a specific player.
openmultiplayer/web/docs/scripting/functions/SetPickupPos.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/functions/SetPickupPos.md", "repo_id": "openmultiplayer", "token_count": 741 }
318
--- title: SetPlayerFightingStyle description: Set a player's special fighting style. tags: ["player"] --- ## Description Set a player's special fighting style. To use in-game, aim and press the 'secondary attack' key (ENTER by default). | Name | Description | | ----------------- | --------------------------------------------------------------------- | | playerid | The ID of player to set the fighting style of. | | FIGHT_STYLE:style | The fighting [style](../resources/fightingstyles) that should be set. | ## Returns This function does not return any specific values. ## Examples ```c public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp(cmdtext, "/boxing", true) == 0) { SetPlayerFightingStyle(playerid, FIGHT_STYLE_BOXING); SendClientMessage(playerid, 0xFFFFFFAA, "You have changed your fighting style to boxing!"); return 1; } return 0; } ``` ## Notes :::tip This does not affect normal fist attacks - only special/secondary attacks (aim + press 'secondary attack' key). ::: ## Related Functions - [GetPlayerFightingStyle](GetPlayerFightingStyle): Get a player's fighting style. ## Related Resources - [Fighting Styles](../resources/fightingstyles)
openmultiplayer/web/docs/scripting/functions/SetPlayerFightingStyle.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/functions/SetPlayerFightingStyle.md", "repo_id": "openmultiplayer", "token_count": 457 }
319
--- title: SetPlayerPickupPos description: Sets the position of a player-pickup. tags: ["player", "pickup", "playerpickup"] --- <VersionWarn version='omp v1.1.0.2612' /> ## Description Sets the position of a player-pickup. | Name | Description | |--------------------|----------------------------------------| | playerid | The ID of the player. | | pickupid | The ID of the player-pickup. | | Float:x | The x coordinate to set the pickup at. | | Float:y | The y coordinate to set the pickup at. | | Float:z | The z coordinate to set the pickup at. | | bool:update = true | Update pickup for player. (true/false) | ## Returns This function always returns **true**. ## Examples ```c new PlayerPickup[MAX_PLAYERS]; public OnPlayerConnect(playerid) { PlayerPickup[playerid] = CreatePlayerPickup(playerid, 1242, 2, 2010.0979, 1222.0642, 10.8206, -1); SetPlayerPickupPos(playerid, PlayerPickup[playerid], 1958.5488, 1344.9137, 15.3613); return 1; } ``` ## Related Functions - [CreatePlayerPickup](CreatePlayerPickup): Creates a pickup which will be visible to only one player. - [DestroyPlayerPickup](DestroyPlayerPickup): Destroy a player-pickup. - [IsValidPlayerPickup](IsValidPlayerPickup): Checks if a player-pickup is valid. - [IsPlayerPickupStreamedIn](IsPlayerPickupStreamedIn): Checks if a player-pickup is streamed in for the player. - [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.
openmultiplayer/web/docs/scripting/functions/SetPlayerPickupPos.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/functions/SetPlayerPickupPos.md", "repo_id": "openmultiplayer", "token_count": 741 }
320
--- title: SetPlayerWeather description: Set a player's weather. tags: ["player"] --- ## Description Set a player's weather. | Name | Description | | -------- | ---------------------------------------------- | | playerid | The ID of the player whose weather to set. | | weather | The [weather](../resources/weatherid) to set. | ## Returns This function does not return any specific values. ## Examples ```c public OnPlayerCommandText(playerid, cmdtext[]) { if (!strcmp(cmdtext, "/storm", true)) { SetPlayerWeather(playerid, 8); return 1; } return 0; } ``` ## Notes :::tip - If [TogglePlayerClock](TogglePlayerClock) is enabled, weather will slowly change over time, instead of changing instantly. - There are only valid 21 weather IDs in the game (0 - 20), however the game does not have any form of range check. ::: ## Related Functions - [GetPlayerWeather](GetPlayerWeather): Get a player's weather. - [SetWeather](SetWeather): Set the global weather. - [SetGravity](SetGravity): Set the global gravity. ## Related Resources - [Weather IDs](../resources/weatherid)
openmultiplayer/web/docs/scripting/functions/SetPlayerWeather.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/functions/SetPlayerWeather.md", "repo_id": "openmultiplayer", "token_count": 380 }
321
--- title: SetVehicleOccupiedTick description: Set the occupied tick of a vehicle. tags: ["vehicle"] --- <VersionWarn version='omp v1.1.0.2612' /> :::warning This function has not yet been implemented. ::: ## Description Set the occupied tick of a vehicle. ## Parameters | Name | Description | |-----------|------------------------| | vehicleid | The ID of the vehicle. | | ticks | The ticks to set. | ## Return Values **true** - Function executed successfully. **false** - Function failed to execute. ## Examples ```c public OnGameModeInit() { new vehicleid = CreateVehicle(560, 2096.1917, -1328.5150, 25.1059, 0.0000, 1, 8, 60); SetVehicleOccupiedTick(vehicleid, 300); return 1; } ``` ## Related Functions - [GetVehicleOccupiedTick](GetVehicleOccupiedTick): Get the occupied tick of a vehicle.
openmultiplayer/web/docs/scripting/functions/SetVehicleOccupiedTick.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/functions/SetVehicleOccupiedTick.md", "repo_id": "openmultiplayer", "token_count": 298 }
322
--- title: ShowMenuForPlayer description: Shows a previously created menu for a player. tags: ["player", "menu"] --- ## Description Shows a previously created menu for a player. | Name | Description | | ----------- | ---------------------------------------------------- | | Menu:menuid | The ID of the menu to show. Returned by CreateMenu. | | playerid | The ID of the player to whom the menu will be shown. | ## Returns **true** - The function executed successfully. **false** - The function failed to execute. Menu and/or player doesn't exist. ## Examples ```c new Menu:exampleMenu; public OnGameModeInit() { exampleMenu = CreateMenu("Example Menu", 2, 200.0, 100.0, 150.0, 150.0); return 1; } public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp(cmdtext, "/menu", true) == 0) { ShowMenuForPlayer(exampleMenu, playerid); return 1; } return 0; } ``` ## Notes :::tip Crashes the both server and player if an invalid menu ID given. ::: ## Related Functions - [CreateMenu](CreateMenu): Create a menu. - [AddMenuItem](AddMenuItem): Adds an item to a specified menu. - [SetMenuColumnHeader](SetMenuColumnHeader): Set the header for one of the columns in a menu. - [DestroyMenu](DestroyMenu): Destroy a menu. ## Related Callbacks - [OnPlayerSelectedMenuRow](../callbacks/OnPlayerSelectedMenuRow): Called when a player selected a row in a menu. - [OnPlayerExitedMenu](../callbacks/OnPlayerExitedMenu): Called when a player exits a menu.
openmultiplayer/web/docs/scripting/functions/ShowMenuForPlayer.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/functions/ShowMenuForPlayer.md", "repo_id": "openmultiplayer", "token_count": 518 }
323
--- title: StopRecordingPlayerData description: Stops all the recordings that had been started with StartRecordingPlayerData for a specific player. tags: ["player"] --- ## Description Stops all the recordings that had been started with StartRecordingPlayerData for a specific player. | Name | Description | | -------- | ---------------------------------------------- | | playerid | The player you want to stop the recordings of. | ## Returns This function does not return any specific values. ## Examples ```c public OnPlayerCommandText(playerid, cmdtext[]) { if (!strcmp("/stoprecording", cmdtext)) { StopRecordingPlayerData(playerid); SendClientMessage(playerid, 0xFFFFFFFF, "Your recorded file has been saved to the scriptfiles folder!"); return 1; } } ``` ## Related Functions - [StartRecordingPlayerData](StartRecordingPlayerData): Start recording player data.
openmultiplayer/web/docs/scripting/functions/StopRecordingPlayerData.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/functions/StopRecordingPlayerData.md", "repo_id": "openmultiplayer", "token_count": 296 }
324
--- title: TextDrawTextSize description: Change the size of a textdraw (box if TextDrawUseBox is enabled and/or clickable area for use with TextDrawSetSelectable). tags: ["textdraw"] --- ## Description Change the size of a textdraw (box if [TextDrawUseBox](TextDrawUseBox) is enabled and/or clickable area for use with [TextDrawSetSelectable](TextDrawSetSelectable)). | Name | Description | | ------------ | -------------------------------------------------------------------------------------- | | Text:textid | The TextDraw to set the size of. | | Float:width | The size on the X axis (left/right) following the same 640x480 grid as TextDrawCreate. | | Float:height | The size on the Y axis (up/down) following the same 640x480 grid as TextDrawCreate. | ## Returns This function does not return any specific values. ## Examples ```c new Text:gMyTextdraw; public OnGameModeInit() { gMyTextdraw = TextDrawCreate(100.0, 33.0, "Example TextDraw"); TextDrawTextSize(gMyTextdraw, 2.0, 3.6); return 1; } ``` ## Notes :::tip - The x and y have different meanings with different TextDrawAlignment values: 1 (left): they are the right-most corner of the box, absolute coordinates. 2 (center): they need to inverted (switch the two) and the x value is the overall width of the box. 3 (right): the x and y are the coordinates of the left-most corner of the box - Using font type 4 (sprite) and 5 (model preview) converts X and Y of this function from corner coordinates to WIDTH and HEIGHT (offsets). - The TextDraw box starts 10.0 units up and 5.0 to the left as the origin (TextDrawCreate coordinate). - This function defines the clickable area for use with TextDrawSetSelectable, whether a box is shown or not. ::: :::tip - If you want to change the text size of a textdraw that is already shown, you don't have to recreate it. Simply use [TextDrawShowForPlayer](TextDrawShowForPlayer)/[TextDrawShowForAll](TextDrawShowForAll) after modifying the textdraw and the change will be visible. ::: ## Related Functions - [TextDrawCreate](TextDrawCreate): Create a textdraw. - [TextDrawDestroy](TextDrawDestroy): Destroy a textdraw. - [TextDrawGetTextSize](TextDrawGetTextSize): Gets the X axis and Y axis of the 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. - [TextDrawSetOutline](TextDrawSetOutline): Choose whether the text has an outline. - [TextDrawSetShadow](TextDrawSetShadow): Toggle shadows on a textdraw. - [TextDrawSetProportional](TextDrawSetProportional): Scale the text spacing in a textdraw to a proportional ratio. - [TextDrawUseBox](TextDrawUseBox): Toggle if the textdraw has a box or not. - [TextDrawSetString](TextDrawSetString): Set the text in an existing textdraw. - [TextDrawShowForPlayer](TextDrawShowForPlayer): Show a textdraw for a certain player. - [TextDrawHideForPlayer](TextDrawHideForPlayer): Hide a textdraw for a certain player. - [TextDrawShowForAll](TextDrawShowForAll): Show a textdraw for all players. - [TextDrawHideForAll](TextDrawHideForAll): Hide a textdraw for all players.
openmultiplayer/web/docs/scripting/functions/TextDrawTextSize.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/functions/TextDrawTextSize.md", "repo_id": "openmultiplayer", "token_count": 1114 }
325
--- title: UsePlayerPedAnims description: Uses standard player walking animation (animation of the CJ skin) instead of custom animations for every skin (e.g. skating for skater skins). tags: ["player"] --- ## Description Uses standard player walking animation (animation of the CJ skin) instead of custom animations for every skin (e.g. skating for skater skins). ## Examples ```c public OnGameModeInit() { UsePlayerPedAnims(); return 1; } ``` ## Notes :::tip Only works when placed under [OnGameModeInit](../callbacks/OnGameModeInit). Not using this function causes two-handed weapons (not dual-handed - a single weapon that is held by both hands) to be held in only one hand. ::: :::tip You can also enable standard player walking animation via [config.json](../../server/config.json) ```json "use_player_ped_anims": true, ``` ::: ## Related Functions - [ApplyAnimation](ApplyAnimation): Apply an animation to a player. - [ClearAnimations](ClearAnimations): Clear any animations a player is performing.
openmultiplayer/web/docs/scripting/functions/UsePlayerPedAnims.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/functions/UsePlayerPedAnims.md", "repo_id": "openmultiplayer", "token_count": 295 }
326
--- title: db_field_name description: Returns the name of the field at the specified index. keywords: - sqlite --- <LowercaseNote /> ## Description Returns the name of a field at a particular index. | Name | Description | | ----------------- | ------------------------------------------------------------------ | | DBResult:dbresult | The result to get the data from; returned by [db_query](db_query). | | field | The index of the field to get the name of. | | result[] | The result. | | maxlength | The max length of the field. | ## Returns Returns 1 if result set handle is valid, otherwise 0. ## Examples ```c static DB:gDBConnectionHandle; public OnGameModeInit() { // ... // Create a connection to a database gDBConnectionHandle = db_open("example.db"); // If connection to the database exists if (gDBConnectionHandle) { // Select first entry in table "join_log" new DBResult:db_result_set = db_query(g_DBConnection, "SELECT * FROM `join_log` LIMIT 1"); // If result set handle is valid if (db_result_set) { // Get the number of fields from result set new columns = db_num_fields(db_result_set); // Allocate some memory for storing field names new field_name[32]; // Iterate through all column indices for (new column_index; index < column_index; index++) { // Store the name of the i indexed column name into "field_name" db_field_name(db_result_set, index, field_name, sizeof field_name); // Print "field_name" printf("Field name at index %d: \"%s\"", index, field_name); } // Frees the result set db_free_result(db_result_set); } } else { // Failed to create a connection to the database print("Failed to open a connection to database \"example.db\"."); } } public OnGameModeExit() { // Close the connection to the database if connection is open if (db_close(gDBConnectionHandle)) { // Extra cleanup gDBConnectionHandle = DB:0; } // ... return 1; } ``` ## Notes :::warning Using an invalid handle other than zero will crash your server! Get a valid database connection handle by using [db_query](db_query). ::: ## Related Functions - [db_open](db_open): Open a connection to an SQLite database - [db_close](db_close): Close the connection to an SQLite database - [db_query](db_query): Query an SQLite database - [db_free_result](db_free_result): Free result memory from a db_query - [db_num_rows](db_num_rows): Get the number of rows in a result - [db_next_row](db_next_row): Move to the next row - [db_num_fields](db_num_fields): Get the number of fields in a result - [db_get_field](db_get_field): Get content of field with specified ID from current result row - [db_get_field_assoc](db_get_field_assoc): Get content of field with specified name from current result row - [db_get_field_int](db_get_field_int): Get content of field as an integer with specified ID from current result row - [db_get_field_assoc_int](db_get_field_assoc_int): Get content of field as an integer with specified name from current result row - [db_get_field_float](db_get_field_float): Get content of field as a float with specified ID from current result row - [db_get_field_assoc_float](db_get_field_assoc_float): Get content of field as a float with specified name from current result row - [db_get_mem_handle](db_get_mem_handle): Get memory handle for an SQLite database that was opened with db_open. - [db_get_result_mem_handle](db_get_result_mem_handle): Get memory handle for an SQLite query that was executed with db_query. - [db_debug_openfiles](db_debug_openfiles): The function gets the number of open database connections for debugging purposes. - [db_debug_openresults](db_debug_openresults): The function gets the number of open database results.
openmultiplayer/web/docs/scripting/functions/db_field_name.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/functions/db_field_name.md", "repo_id": "openmultiplayer", "token_count": 1605 }
327
--- title: diskfree description: Returns the free disk space. tags: ["file management"] --- <VersionWarn version='omp v1.1.0.2612' /> :::warning This function has not yet been implemented. ::: <LowercaseNote /> ## Description Returns the free disk space. | Name | Description | | ------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | | const volume[] = "" | The name of the volume on systems that support multiple disks or multiple memory cards. On single-volume systems, it is optional. | ## Returns The amount of free space in KiB. ## Examples ```c new freeSpace = diskfree(); printf("freeSpace = %d KiB", freeSpace); ``` ## Notes :::tip The maximum size that can be supported 2048 GiB (2 terabyte). ::: ## 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. - [fattrib](fattrib): Set the file attributes. - [fcreatedir](fcreatedir): Create a directory.
openmultiplayer/web/docs/scripting/functions/diskfree.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/functions/diskfree.md", "repo_id": "openmultiplayer", "token_count": 707 }
328
--- title: floatadd description: Adds two floats together. tags: ["math", "floating-point"] --- <LowercaseNote /> ## Description Adds two floats together. This function is redundant as the standard operator (+) does the same thing. | Name | Description | | ------------- | ------------- | | Float:Number1 | First float. | | Float:Number2 | Second float. | ## Returns The sum of the two given floats. ## Examples ```c public OnGameModeInit() { new Float:Number1 = 2, Float:Number2 = 3; // Declares two floats, Number1 (2) and Number2 (3) new Float:Sum; Sum = floatadd(Number1, Number2); // Saves the Sum(=2+3 = 5) of Number1 and Number2 in the float "Sum" return 1; } ``` ## Related Functions - [Floatsub](Floatsub): Subtracts two floats. - [Floatmul](Floatmul): Multiplies two floats. - [Floatdiv](Floatdiv): Divides a float by another.
openmultiplayer/web/docs/scripting/functions/floatadd.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/functions/floatadd.md", "repo_id": "openmultiplayer", "token_count": 297 }
329
--- title: format description: Formats a string to include variables and other strings inside it. tags: ["string"] --- <LowercaseNote /> ## Description Formats a string to include variables and other strings inside it. | Name | Description | | -------------- | ----------------------------------------- | | output[] | The string to output the result to | | len | The maximum length output can contain | | const format[] | The format string | | {Float,\_}:... | Indefinite number of arguments of any tag | ## Returns This function does not return any specific values. ## Format Specifiers | Specifier | Meaning | | --------- | --------------------------------------------- | | %i | Unsigned Integer | | %d | Signed Integer | | %s | String | | %f | Floating-point number | | %c | ASCII character | | %x | Hexadecimal number | | %b | Binary number | | %% | Literal '%' | | %q | Escape a text for SQLite. (Added in 0.3.7 R2) | The values for the placeholders follow in the exact same order as parameters in the call, i.e. `"I am %i years old"` - the `%i` will be replaced with an integer variable, which is the person's age. You may optionally put a number between the `%` and the letter of the placeholder code. This number indicates the field width; if the size of the parameter to print at the position of the placeholder is smaller than the field width, the field is expanded with spaces. To cut the number of decimal places beeing shown of a float, you can add '.\<max number\>' between the `%` and the `f`, i.e. `%.2f`. ## Examples ```c new result[128]; new number = 42; format(result, sizeof(result), "The number is %i.", number); // The number is 42. new string[] = "simple message"; format(result, sizeof(result), "This is a %s containing the number %i.", string, number); // This is a simple message containing the number 42. ``` <br /> ```c new string[64]; format(string, sizeof(string), "Your score is: %d", GetPlayerScore(playerid)); SendClientMessage(playerid, 0xFF8000FF, string); ``` <br /> ```c new string[32]; new hour, minute, second; gettime(hour, minute, second); format(string, sizeof(string), "The time is %02d:%02d:%02d.", hour, minute, second); // will output something like "The time is 09:45:02." ``` <br /> ```c new string[32]; format(string, sizeof(string), "43%s of my shirts are black.", "%%"); SendClientMessage(playerid, 0xFF8000FF, string); ``` ## Notes :::warning This function doesn't support packed strings. ::: ## Related Functions - [print](print): Print a basic message to the server logs and console. - [printf](printf): Print a formatted message into the server logs and console.
openmultiplayer/web/docs/scripting/functions/format.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/functions/format.md", "repo_id": "openmultiplayer", "token_count": 1209 }
330
--- title: gpci description: Fetch the CI (computer/client identification) of a user, this is linked to their SAMP/GTA on their computer. tags: [] --- <LowercaseNote /> ## Description Fetch the CI of a user, this is linked to their SAMP/GTA on their computer. :::warning A player's CI is NOT UNIQUE, some players may have similar or the same CI, don't ban solely due to a CI match. ::: ## Parameters | Name | Description | | --------------------- | --------------------------------------- | | playerid | The ID of the player to fetch their CI. | | serial[] | String to store the fetched CI in. | | len = sizeof (serial) | Assigned size of the string. | ## Return Values This function will return the string value of a user's CI. ## Example Usage **SA-MP server:** ```c #include <a_samp> #if !defined gpci native gpci(playerid, serial[], len); #endif public OnPlayerConnect(playerid) { new serial[41]; // 40 + \0 gpci(playerid, serial, sizeof(serial)); new string[128]; format(string, sizeof(string), "Your CI Serial: %s", serial); SendClientMessage(playerid, -1, string); return 1; } ``` **open.mp server:** ```c #include <open.mp> public OnPlayerConnect(playerid) { new serial[41]; // 40 + \0 GPCI(playerid, serial, sizeof(serial)); SendClientMessage(playerid, -1, "Your CI Serial: %s", serial); return 1; } ``` ## Notes :::warning In SA-MP server you must add 'native gpci(playerid, serial[], len);' at the top of your script before using any CI functions. ::: ## Related Functions - [GetNetworkStats](GetNetworkStats): Gets the servers networkstats and saves it into a string. - [GetPlayerNetworkStats](GetPlayerNetworkStats): Gets a player networkstats and saves it into a string.
openmultiplayer/web/docs/scripting/functions/gpci.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/functions/gpci.md", "repo_id": "openmultiplayer", "token_count": 654 }
331
--- title: setpubvar description: Sets a specific public variable in the current script. tags: ["core", "pubvar", "public variable"] --- <LowercaseNote /> ## Description Sets a specific public variable in the current script. | Name | Description | | ------------ | ------------------------------------------ | | const name[] | The public variable's name. | | value | The value to store in the public variable. | ## Returns The previous value of the variable. ## Related Functions - [getpubvar](getpubvar): Gets a specific public variable from the current script. - [existpubvar](existpubvar): Checks if a specific public variable exists in the current script. - [numpubvars](numpubvars): Counts how many public variables there are in the script.
openmultiplayer/web/docs/scripting/functions/setpubvar.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/functions/setpubvar.md", "repo_id": "openmultiplayer", "token_count": 254 }
332
--- title: toupper description: This function changes a single character to uppercase. tags: ["string"] --- <LowercaseNote /> ## Description This function changes a single character to uppercase. | Name | Description | | ---- | ------------------------------------- | | c | The character to change to uppercase. | ## Returns The ASCII value of the character provided, but in uppercase. ## Examples ```c public OnPlayerText(playerid, text[]) { text[0] = toupper(text[0]); //This sets the first character to upper case. return 1; } ``` ## Related Functions - [tolower](tolower): This function changes a single character to lowercase.
openmultiplayer/web/docs/scripting/functions/toupper.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/functions/toupper.md", "repo_id": "openmultiplayer", "token_count": 222 }
333
# Functions --- A function declaration specifies the name of the function and, between paren- theses, its formal parameters. A function may also return a value. A function declaration must appear on a global level (i.e. outside any other functions) and is globally accessible. If a semicolon follows the function declaration (rather than a statement), the declaration denotes a forward declaration of the function. The return statement sets the function result. For example, function sum (see below) has as its result the value of both its arguments added together. The return expression is optional for a function, but one cannot use the value of a function that does not return a value. Listing: sum function ```c sum(a, b) return a + b ``` Arguments of a function are (implicitly declared) local variables for that function. The function call determines the values of the arguments. Another example of a complete definition of the function leapyear (which returns true for a leap year and false for a non-leap year): Listing: leapyear function ```c leapyear(y) return y % 4 == 0 && y % 100 != 0 || y % 400 == 0 ``` The logical and arithmetic operators used in the leapyear example are covered on pages 108 and 104 respectively. Usually a function contains local variable declarations and consists of a com- pound statement. In the following example, note the assert statement to guard against negative values for the exponent. Listing: power function (raise to a power) ```c power(x, y) { /* returns x raised to the power of y */ assert y >= 0 new r = 1 for (new i = 0; i < y; i++) r *= x return r } ``` A function may contain multiple return statements —one usually does this to quickly exit a function on a parameter error or when it turns out that the function has nothing to do. If a function returns an array, all return statements must specify an array with the same size and the same dimensions. --- `The preferred way to declare forward functions is at page 82` `“assert” statement: 112` --- • Function arguments (call-by-value versus call-by-reference) The “faculty” function in the next program has one parameter which it uses in a loop to calculate the faculty of that number. What deserves attention is that the function modifies its argument. Listing: faculty.p ```c /* Calculation of the faculty of a value */ main() { print "Enter a value: " new v = getvalue() new f = faculty(v) printf "The faculty of %d is %d\n", v, f } faculty(n) { assert n >= 0 new result = 1 while (n > 0) result *= n-- return result } ``` Whatever (positive) value that “n” had at the entry of the while loop in function faculty, “n” will be zero at the end of the loop. In the case of the faculty function, the parameter is passed “by value”, so the change of “n” is local to the faculty function. In other words, function main passes “v” as input to function faculty, but upon return of faculty, “v” still has the same value as before the function call. Arguments that occupy a single cell can be passed by value or by reference. The default is “pass by value”. To create a function argument that is passed by reference, prefix the argument name with the character &. Example: Listing: swap function ```c swap(&a, &b) { new temp = b b = a a = temp } ``` To pass an array to a function, append a pair of brackets to the argument name. You may optionally indicate the size of the array; doing so improves error checking of the parser. Example: Listing: addvector function ```c addvector(a[], const b[], size) { for (new i = 0; i < size; i++) a[i] += b[i] } ``` Arrays are always passed by reference. As a side note, array b in the above example does not change in the body of the function. The function argument has been declared as const to make this explicit. In addition to improving error checking, it also allows the pawn parser to generate more efficient code. To pass an array of literals to a function, use the same syntax as for array initiallers: a literal string or the series of array indices enclosed in braces (see page 99; the ellipsis for progressive initiallers cannot be used). Literal arrays can only have a single dimension. The following snippet calls addvector to add five to every element of the array “vect”: Listing: addvector usage ```c new vect[3] = { 1, 2, 3 } addvector(vect, {5, 5, 5}, 3) /* vect[] now holds the values 6, 7 and 8 */ ``` The invocation of function printf with the string "Hello world\n" in the first ubiquitous program is another example of passing a literal array to a function. --- `Another example is function JulianToDate at page 13` `Constant variables: 64` `“Hello world” program: 5` --- ### • Calling functions When inserting a function name with its parameters in a statement or expression, the function will get executed in that statement/expression. The statement that refers to the function is the “caller” and the function itself, at that point, is the “callee”: the one being called. The standard syntax for calling a function is to write the function’s name, followed by a list with all explicitly passed parameters between parentheses. If no parameters are passed, or if the function does not have any, the pair of parentheses behind the function name are still present. For example, to try out the power function, the following program calls it thus: Listing: example program for the power function ```c main() { print "Please give the base value and the power to raise it to:" new base = getvalue() new power = getvalue() new result = power(base, power) printf "%d raised to the power %d is %d", base, power, result } ``` A function may optionally return a value. The sum, leapyear and power functions all return a value, but the swap function does not. Even if a function returns a value, the caller may ignore it. For the situation that the caller ignores the function’s return value, there is an alternative syntax to call the function, which is also illustrated by the preceding example program calls the power function. The parentheses around all function arguments are optional if the caller does not use the return value. In the last statement, the example program reads `printf "%d raised to the power %d is %d", base, power, result` rather than `printf("%d raised to the power %d is %d", base, power, result)` which does the same thing. The syntax without parentheses around the parameter list is called the “pro- cedure call” syntax. You can use it only if: - the caller does not assign the function’s result to a variable and does not use it in an expression, or as the “test expression” of an if statement for example; - the first parameter does not start with an opening paranthesis; - the first parameter is on the same line as the function name, unless you use named parameters (see the next section). As you may observe, the procedure call syntax applies to cases where a function call behaves rather as a statement, like in the calls to print and printf in the preceding example. The syntax is aimed at making such statements appear less cryptic and friendlier to read, but not that the use of the syntax is optional. As a side note, all parentheses in the example program presented in this section are required: the return values of the calls to getvalue are stored in two variables, and therefore an empty pair of parentheses must follow the function name. Function getvalue has optional parameters, but none are passed in this example program. --- `Function power: 70` `Functions sum & leapyear: 70` `Function swap: 71` --- ### • Named parameters versus positional parameters In the previous examples, the order of parameters of a function call was im- portant, because each parameter is copied to the function argument with the same sequential position. For example, with the function weekday (which uses Zeller’s congruence algorithm) defined as below, you would call weekday(12,31,1999) to get the week day of the last day of the preceding century. Listing: weekday function ```c weekday(month, day, year) { /* returns the day of the week: 0=Saturday, 1=Sunday, etc. */ if (month <= 2) month += 12, --year new j = year % 100 new e = year / 100 return (day + (month+1)*26/10 + j + j/4 + e/4 - 2*e) % 7 } ``` Date formats vary according to culture and nation. While the format month/ day/year is common in the United States of America, European countries often use the day/month/year format, and technical publications sometimes standardize on the year/month/day format (ISO/IEC 8824). In other words, no order of arguments in the weekday function is “logical” or “conventional”. That being the case, the alternative way to pass parameters to a function is to use “named parameters”, as in the next examples (the three function calls are equivalent): Listing: weekday usage —positional parameters ```c new wkday1 = weekday( .month = 12, .day = 31, .year = 1999) new wkday2 = weekday( .day = 31, .month = 12, .year = 1999) new wkday3 = weekday( .year = 1999, .month = 12, .day = 31) ``` With named parameters, a period (“.”) precedes the name of the function argument. The function argument can be set to any expression that is valid for the argument. The equal sign (“=”) does in the case of a named parameter not indicate an assignment; rather it links the expression that follows the equal sign to one of the function arguments. One may mix positional parameters and named parameters in a function call with the restriction that all positional parameters must precede any named parameters. ### • Default values of function arguments A function argument may have a default value. The default value for a function argument must be a constant. To specify a default value, append the equal sign (“=”) and the value to the argument name. When the function call specifies an argument placeholder instead of a valid ar- gument, the default value applies. The argument placeholder is the underscore character (“\_”). The argument placeholder is only valid for function arguments that have a default value. The rightmost argument placeholders may simply be stripped from the function argument list. For example, if function increment is defined as: Listing: increment function —default values ```c increment(&value, incr=1) value += incr ``` the following function calls are all equivalent: Listing: increment usage ```c increment(a) increment(a, \_) increment(a, 1) ``` Default argument values for passed-by-reference arguments are useful to make the input argument optional. For example, if the function divmod is designed to return both the quotient and the remainder of a division operation through its arguments, default values make these arguments optional: Listing: divmod function —default values for reference parameters ```c divmod(a, b, &quotient=0, &remainder=0) { quotient = a / b remainder = a % b } ``` With the preceding definition of function divmod, the following function calls are now all valid: Listing: divmod usage ```c new p, q divmod(10, 3, p, q) divmod(10, 3, p, \_) divmod(10, 3, \_, q) divmod(10, 3, p) divmod 10, 3, p, q ``` Default arguments for array arguments are often convenient to set a default string or prompt to a function that receives a string argument. For example: Listing: print error function ```c print_error(const message[], const title[] = "Error: ") { print title print message print "\n" } ``` The next example adds the fields of one array to another array, and by default increments the first three elements of the destination array by one: Listing: addvector function, revised ```c addvector(a[], const b[] = {1, 1, 1}, size = 3) { for (new i = 0; i < size; i++) a[i] += b[i] } ``` --- `Public functions do not support default argument values; see page 83` --- ### • sizeof operator & default function arguments A default value of a function argument must be a constant, and its value is determined at the point of the function’s declaration. Using the “sizeof” operator to set the default value of a function argument is a special case: the calculation of the value of the sizeof expression is delayed to the point of the function call and it takes the size of the actual argument rather than that of the formal argument. When the function is used several times in a program, with different arguments, the outcome of the “sizeof” expression is potentially different at every call —which means that the “default value” of the function argument may change. Below is an example program that draws ten random numbers in the range of 0–51 without duplicates. An example for an application for drawing random numbers without duplicates is in card games —those ten numbers could repre- sent the cards for two “hands” in a poker game. The virtues of the algorithm used in this program, invented by Robert W. Floyd, are that it is efficient and unbiased —provided that the pseudo-random number generator is unbiased as well. Listing: randlist.p ```c main() { new HandOfCards[10] FillRandom(HandOfCards, 52) print "A draw of 10 numbers from a range of 0 to 51 \ (inclusive) without duplicates:\n" for (new i = 0; i < sizeof HandOfCards; i++) printf "%d ", HandOfCards[i] } FillRandom(Series[], Range, Number = sizeof Series) { assert Range >= Number /* cannot select 50 values * without duplicates in the * range 0..40, for example */ new Index = 0 for (new Seq = Range - Number; Seq < Range; Seq++) { new Val = random(Seq + 1) new Pos = InSeries(Series, Val, Index) if (Pos >= 0) { Series[Index] = Series[Pos] Series[Pos] = Seq } else Series[Index] = Val Index++ } } InSeries(Series[], Value, Top = sizeof Series) { for (new i = 0; i < Top; i++) if (Series[i] == Value) return i return -1 } ``` Function main declares the array HandOfCards with a size of ten cells and then calls function FillRandom with the purpose that it draws ten positive random numbers below 52. Observe, however, that the only two parameters that main passes into the call to FillRandom are the array HandsOfCards, where the random numbers should be stored, and the upper bound “52”. The number of random numbers to draw (“10”) is passed implicitly to FillRandom. The definition of function FillRandom below main specifies for its third param- eter “Number = sizeof Series”, where “Series” refers to the first parameter of the function. Due to the special case of a “sizeof default value”, the default value of the Number argument is not the size of the formal argument Series, but that of the actual argument at the point of the function call: HandOfCards. Note that inside function FillRandom, asking the “sizeof” the function ar- gument Series would (still) evaluate in zero, because the Series array is declared with unspecified length (see page 109 for the behaviour of sizeof). Using sizeof as a default value for a function argument is a specific case. If the formal parameter Series were declared with an explicit size, as in Series[10], it would be redundant to add a Number argument with the array size of the actual argument, because the parser would then enforce that both formal and actual arguments have the size and dimensions. --- `“sizeof ” operator 109` `“random” is a proposed core function, see page 124` `Array declarations: 64` `Tag names: 68` --- ### • Arguments with tag names A tag optionally precedes a function argument. Using tags improves the compile-time error checking of the script and it serves as “implicit documenta- tion” of the function. For example, a function that computes the square root of an input value in fixed point precision may require that the input parameter is a fixed point value and that the result is fixed point as well. The function below uses the fixed point extension module, and an approximation algorithm known as “bisection” to calculate the square root. Note the use of tag overrides on numeric literals and expression results. Listing: sqroot function —strong tags ```c Fixed: sqroot(Fixed: value) { new Fixed: low = 0.0 new Fixed: high = value while (high - low > Fixed: 1) { new Fixed: mid = (low + high) >> 1 if (fmul(mid, mid) < value) low = mid else high = mid } return low } ``` With the above definition, the pawn parser issues a diagnostic if one calls the sqroot function with a parameter with a tag different from “Fixed:”, or when it tries to store the function result in a variable with a “non-Fixed:” tag. The bisection algorithm is related to binary search, in the sense that it continuously halves the interval in which the result must lie. A “successive substi- tution” algorithm like Newton-Raphson, that takes the slope of the function’s curve into account, achieves precise results more quickly, but at the cost that a stopping criterion is more difficult to state. State of the art algorithms for computing square roots combine bisection and Newton-Raphson algorithms. In the case of an array, the array indices can be tagged as well. For example, a function that creates the intersection of two rectangles may be written as: Listing: intersection function ```c intersection(dest[rectangle], const src1[rectangle], const src2[rectangle]) { if (src1[right] > src2[left] && src1[left] < src2[right] && src1[bottom] > src2[top] && src1[top] < src2[bottom]) { \* there is an intersection, calculate it using the "min" and *"max" functions from the "core" library, see page 124. */ dest[left] = max(src1[left], src2[left]) dest[right] = min(src1[right], src2[right]) dest[top] = max(src1[top], src2[top]) dest[bottom] = min(src1[bottom], src2[bottom]) return true } else { /* "src1" and "src2" do not intersect */ dest = { 0, 0, 0, 0 } return false } } ``` --- `Fixed point arithmetic: 90; see also the application note “Fixed Point Support Library”` `For the “rectangle” tag, see page 68` --- ### • Variable arguments A function that takes a variable number of arguments, uses the “ellipsis” oper- ator (“...”) in the function header to denote the position of the first variable argument. The function can access the arguments with the predefined func- tions numargs, getarg and setarg (see page 124). Function sum returns the summation of all of its parameters. It uses a variable length parameter list. Listing: sum function, revised ```c sum(...) { new result = 0 for (new i = 0; i < numargs(); ++i) result += getarg(i) return result } ``` This function could be used in: Listing: sum function usage ```c new v = sum(1, 2, 3, 4, 5) ``` A tag may precede the ellipsis to enforce that all subsequent parameters have the same tag, but otherwise there is no error checking with a variable argument list and this feature should therefore be used with caution. The functions getarg and setarg assume that the argument is passed “by reference”. When using getarg on normal function parameters (instead of variable arguments) one should be cautious of this, as neither the compiler nor the abstract machine can check this. Actual parameters that are passed as part of a “variable argument list” are always passed by reference. --- `Tag names: 68` --- ### • Coercion rules If the function argument, as per the function definition (or its declaration), is a “value parameter”, the caller can pass as a parameter to the function: - a value, which is passed by value; - a reference, whose dereferenced value is passed; - an (indexed) array element, which is a value. If the function argument is a reference, the caller can pass to the function: - a value, whose address is passed; - a reference, which is passed by value because it has the type that the function expects; - an (indexed) array element, which is a value. If the function argument is an array, the caller can pass to the function: - an array with the same dimensions, whose starting address is passed; - an (indexed) array element, in which case the address of the element is passed. ### • Recursion A faculty example function earlier in this chapter used a simple loop. An example function that calculated a number from the Fibonacci series also used a loop and an extra variable to do the trick. These two functions are the most popular routines to illustrate recursive functions, so by implementing these as iterative procedures, you might be inclined to think that pawn does not support recursion. Well, pawn does support recursion, but the calculation of faculties and of Fi- bonacci numbers happen to be good examples of when not to use recursion. Faculty is easier to understand with a loop than it is with recursion. Solving Fibonacci numbers by recursion indeed simplifies the problem, but at the cost of being extremely inefficient: the recursive Fibonacci calculates the same values over and over again. The program below is an implementation of the famous “Towers of Hanoi” game in a recursive function: Listing: hanoi.p ```c /* The Towers of Hanoi, a game solved through recursion */ main() { print "How many disks: " new disks = getvalue() move 1, 3, 2, disks } move(from, to, spare, numdisks) { if (numdisks > 1) move from, spare, to, numdisks-1 printf "Move disk from pillar %d to pillar %d\n", from, to if (numdisks > 1) move spare, to, from, numdisks-1 } ``` --- `“faculty”: 71` `“fibonacci”: 11` `There exists an intriguing iterative solution to the Towers of Hanoi.` --- ### • Forward declarations For standard functions, the current “reference implementation” of the pawn compiler does not require functions to be declared before their first use.∗ Userdefined operators are special functions, and unlike standard functions theymust be declared before use. In many cases it is convenient to put the implementation of a user-defined operator in an include file, so that the implementation and declaration precedes any call/invocation. Sometimes, it may however be required (or convenient) to declare a user- defined operator first and implement it elsewhere. A particular use of this technique is to implement “forbidden” user-defined operators. To create a forward declaration, precede the function name and its parame- ter list with the keyword forward. For compatibility with early versions of pawn, and for similarity with C/C⁺⁺, an alternative way to forwardly declare a function is by typing the function header and terminating it with a semicolon (which follows the closing parenthesis of the parameter list). The full definition of the function, with a non-empty body, is implemented elsewhere in the source file (except for forbidden user-defined operators). State classifiers are ignored on forward declarations. --- ###### ∗ Other implementations of the Pawn language (if they exist) may use “single pass” parsers, requiring functions to be defined before use. --- `Forbidden userdefined operators: 92` --- ### • State classifiers All functions except native functions may optionally have a state attribute. This consists of a list of state (and automata) names between angle brackets behind the function header. The names are separated by commas. When the state is part of a non-default automaton, the name of the automaton and a colon separator must precede the state; for example, “parser:slash” stands for the state slash of the automaton parser. If a function has states, there must be several “implementations” of the function in the source code. All functions must have the same function header (excluding the state classifier list). As a special syntax, when there are no names between the angle brackets, the function is linked to all states that are not attributed to other implementations of the function. The function that handles “all states not handled elsewhere” is the so-called fall-back function. ### • Public functions, function main A stand-alone program must have the function main. This function is the starting point of the program. The function main may not have arguments. A function library need not to have a main function, but it must have it either a main function, or at least one public function. Function main is the primary entry point into the compiled program; the public functions are alternative entry points to the program. The virtual machine can start execution with one of the public functions. A function library may have a main function to perform one-time initialization at startup. To make a function public, prefix the function name with the keyword public. For example, a text editor may call the public function “onkey” for every key that the user typed in, so that the user can change (or reject) keystrokes. The onkey function below would replace every “~” character (code 126 in the ISO Latin-1 character set) by the “hard space” code in the ANSI character table: Listing: onkey function ```c public onkey(keycode) { if (key==’~’) return 160 /* replace ~ by hard space (code 160 in Latin-1) */ else return key /* leave other keys unaltered */ } ``` --- `Example: 40` --- Functions whose name starts with the “@” symbol are also public. So an alternative way to write the public function onkey function is: Listing: @onkey function ```c @onkey(keycode) return key==’~’ ? 160 : key ``` The “@” character, when used, becomes part of the function name; that is, in the last example, the function is called “@onkey”. The host application decides on the names of the public functions that a script may implement. Arguments of a public function may not have default values. A public func- tion interfaces the host application to the pawn script. Hence, the arguments passed to the public function originate from the host application, and the host application cannot know what “default values” the script writer plugged for function arguments —which is why the pawn parser flags the use of default values for arguments of public functions as an error. The issue of default values in public function arguments only pops up in the case that you wish to call public functions from the script itself. ### • Static functions When the function name is prefixed with the keyword static, the scope of the function is restricted to the file that the function resides in. The static attribute can be combined with the “stock” attribute. ### • Stock functions A “stock” function is a function that the pawn parser must “plug into” the program when it is used, and that it may simply “remove” from the program (without warning) when it is not used. Stock functions allow a compiler or interpreter to optimize the memory footprint and the file size of a (compiled) pawn program: any stock function that is not referred to, is completely skipped —as if it were lacking from the source file. A typical use of stock functions, hence, is in the creation of a set of “library” functions. A collection of general purpose functions, all marked as “stock” may be put in a separate include file, which is then included in any pawn script. Only the library functions that are actually used get “linked” in. To declare a stock function, prefix the function name with the keyword stock. Public functions and native functions cannot be declared “stock”. When a stock function calls other functions, it is usually a good practice to declare those other functions as “stock” too —with the exception of native functions. Similarly, any global variables that are used by a stock function should in most cases also be defined “stock”. The removal of unused (stock) functions can cause a chain reaction in which other functions and global vari- ables are not longer accessed either. Those functions are then removed as well, thereby continuing the chain reaction until only the functions that are used, directly or indirectly, remain. --- `Default values of function arguments: 75` `Public variables can be declared “stock”` `Stock variables: 63` --- ### • Native functions A pawn program can call application-specific functions through a “native function”. The native function must be declared in the pawn program by means of a function prototype. The function name must be preceded by the keyword native. Examples: ```c native getparam(a[], b[], size) native multiply_matrix(a[], b[], size) native openfile(const name[]) ``` The names “getparam”, “multiply_matrix” and “openfile” are the internal names of the native functions; these are the names by which the functions are known in the pawn program. Optionally, you may also set an external name for the native function, which is the name of the function as the “host application” knows it. To do so, affix an equal sign to the function prototype followed by the external name. For example: ```c native getparam(a[], b[], size) = host_getparam native multiply_matrix(a[], b[], size) = mtx_mul ``` When a native function returns an array, the dimensions and size of the ar- ray must be explicitly declared. The array specification occurs between the function name and the parameter list. For example: ```c enum rect { left, top, right, bottom } native intersect[rect](src1[rect], src2[rect]) ``` Unless specified explicitly, the external name is equal to the internal name of a native function. One typical use for explicit external names is to set a symbolic name for a user-defined operator that is implemented as a native function. See the “Implementor’s Guide” for implementing native functions in C/C++(on the “host application” side). Native functions may not have state specifiers. --- `An example of a native user-defined operator is on page 89` --- ### • User-defined operators The only data type of pawn is a “cell”, typically a 32-bit number or bit pattern. Tags: 68 The meaning of a value in a cell depends on the particular application —it need not always be a signed integer value. pawn allows to attach a “meaning” to a cell with its “tag” mechanism. Based on tags, pawn also allows you to redefine operators for cells with a specific purpose. The example below defines a tag “ones” and an operator to add two “ones” values together (the example also implements operators for subtraction and negation). The example was inspired by the checksum algorithm of several protocols in the TCP/IP protocol suite: it simulates one’s complement arithmetic by adding the carry bit of an arithmetic overflow back to the least significant bit of the value. Listing: ones.p ```c forward ones: operator+(ones: a, ones: b) forward ones: operator-(ones: a, ones: b) forward ones: operator-(ones: a) main() { new ones: chksum = ones: 0xffffffff print "Input values in hexadecimal, zero to exit\n" new ones: value do { print ">> " value = ones: getvalue(.base=16) chksum = chksum + value printf "Checksum = %x\n", chksum } while (value) } stock ones: operator+(ones: a, ones: b) { const ones: mask = ones: 0xffff /* word mask */ const ones: shift = ones: 16 /* word shift */ /* add low words and high words separately */ new ones: r1 = (a & mask) + (b & mask) new ones: r2 = (a >>> shift) + (b >>> shift) new ones: carry restart: /* code label (goto target) */ \* add carry of the new low word to the high word, then * strip it from the low word */ carry = (r1 >>> shift) r2 += carry r1 &= mask \* add the carry from the new high word back to the low * word, then strip it from the high word */ carry = (r2 >>> shift) r1 += carry r2 &= mask \* a carry from the high word injected back into the low * word may cause the new low to overflow, so restart in that case */ if (carry) goto restart return (r2 << shift) | r1 } stock ones: operator-(ones: a) return (a == ones: 0xffffffff) ? a : ~a stock ones: operator-(ones: a, ones: b) return a + -b ``` The notable line in the example is the line “chksum = chksum + value” in the loop in function main. Since both the variables chksum and value have the tag ones, the “+” operator refers to the user-defined operator (instead of the default “+” operator). User-defined operators are merely a notational convenience. The same effect is achieved by calling functions explicitly. The definition of an operator is similar to the definition of a function, with the difference that the name of the operator is composed by the keyword “opera- tor” and the character of the operator itself. In the above example, both the unary “-” and the binary “-” operators are redefined. An operator function for a binary operator must have two arguments, one for an unary operator must have one argument. Note that the binary “-” operator adds the two val- ues together after inverting the sign of the second operand. The subtraction operator thereby refers to both the user-defined “negation” (unary “-”) and addition operators. A redefined operator must adhere to the following restrictions: - A user-defined operator must be declared before use (this is in contrast to “normal” functions): either put the implementation of the user-defined operator above the functions that use it, or add a forward declaration near the top of the file. - Only the following operators may be redefined: +, -, \*, /, %, ++, --, ==, !=, <, > , <=, >=, ! and =. That is, the sets of arithmetic and relational operators can be overloaded, but the bitwise operators and the logical operators cannot. The = and ! operators are a special case. - You cannot invent new operators; you cannot define operator “#” for example. - The precedence level and associativity of the operators, as well as their “arity” remain as defined. You cannot make an unary “+” operator, for example. - The return tag of the relational operators and of the “!” operator must be “bool:”. - The return tag of the arithmetic operators is at your choosing, but you cannot redefine an operator that is identical to another operator except for its return tag. For example, you cannot make both `alpha: operator+(alpha: a, alpha: b)` and `beta: operator+(alpha: a, alpha: b)` (The assignment operator is an exception to this rule.) - PAWN already defines operators to work on untagged cells, you cannot redefine the operators with only arguments without tags. - The arguments of the operator function must be non-arrays passed by value. You cannot make an operator work on arrays. In the example given above, both arguments of the binary operators have the same tag. This is not required; you may, for example, define a binary “+” operator that adds an integer value to a “ones:” number. Au fond, the operation of the pawn parser is to look up the tag(s) of the operand(s) that the operator works on and to look up whether a user-defined operator exists for the combination of the operator and the tag(s). However, the parser recognizes special situations and provides the following features: The parser recognizes operators like “+=” as a sequence of “+” and “=” and it will call a user-defined operator “+” if available and/or a user-defined operator “=”. In the example program, the line “chksum = chksum + value” might have been abbreviated to “chksum += value”. The parser recognizes commutative operators (“+”, “\*”, “==”, and “!=”) and it will swap the operands of a commutative operator if that produces a fit with a user-defined operator. For example, there is usually no need to implement both `ones:operator+(ones:a, b)` and `ones:operator+(a, ones:b)` (implementing both functions is valid, and it is useful in case the user-defined operator should not be commutative). - Prefix and postfix operators are handled automatically. You only need to define one user operator for the “++” and “--” operators for a tag. - The parser calls the “!” operator implicitly in case of a test without explicit comparison. For example, in the statement “if (var) ...” when “var” has tag “ones:”, the user-defined operator “!” will be called for var. The “!” operator thus doubles as a “test for zero” operator. (In one’s complement arithmetic, both the “all-ones” and the “all-zeros” bit patterns represent zero.) - The user-defined assignment operator is implicitly called for a function argument that is passed “by value” when the tag names of the formal and the actual arguments match the tag names of the left and right hand sides of the operator. In other words, the pawn parser simulates that “pass by value” happens through assignment. The user-defined operator is not called for function arguments that are passed “by reference”. - If you wish to forbid an operation, you can “forward declare” the operator without ever defining it (see page 82). This will flag an error when the user-defined operator is invoked. For example, to forbid the “%” operator (remainder after division) on floating point values, you can add the line: `forward Float: operator%(Float: a, Float: b)` User-defined operators can optionally be declared “stock” or “native”. In the case of a native operator function, the definition should include an external name. For example (when, on the host’s side, the native function is called float_add): Listing: native operator+ function ```c native Float: operator+(Float: val, Float: val) = float_add ``` The user-defined assignment operator is a special case, because it is an operator that has a side effect. Although the operator has the appearance of a binary operator, its “expression result” is the value at the right hand —the assignment operator would be a “null”-operator if it weren’t for its side-effect. In pawn a user-defined assignment operator is declared as: Listing: operator= function ```c ones: operator=(a) return ones: ( (a >= 0) ? a : ~(-a) ) ``` The user-defined “=” operator looks like a unary operator in this definition, but it is a special case nevertheless. In contrast to the other operators, the tag of the return value for the user-defined operator is important: the pawn parser uses the tags of the argument and the return value to find a matching user-defined operator. The example function above is a typical application for a user-defined assign- ment operator: to automatically coerce/convert an untagged value to a tagged value, and to optionally change the memory representation of the value in the process. Specifically, the statement “new ones:A = -5” causes the user-defined operator to run, and for the constant -5 the operator will return “~(- -5)”, or ~5, or −6.∗ --- `Tags: 68` `Forward declaration: 82` `“Call by value” versus “call by reference”: 71` `Native functions: 85` `Rational literals: 98` `#pragma rational: 121` --- ### • Floating point and fixed point arithmetic pawn only has intrinsic support for integer arithmetic (the -domain: “whole numbers”, both positive and negative). Support for floating point arithmetic or fixed point arithmetic must be implemented through (native) functions. User operators, then, allow a more natural notation of expressions with fixed or floating point numbers. The pawn parser has support for literal values with a fractional part, which it calls “rational numbers”. Support for rational literals must be enabled explic- itly with a #pragma. The #pragma indicates how the rational numbers must be stored —floating point or fixed point. For fixed point rational values, the #pragma also specifies the precision in decimals. Two examples for the #pragma are: ```c #pragma rational Float /* floating point format */ #pragma rational Fixed(3) /* fixed point, with 3 decimals */ ``` --- ###### ∗ Modern CPUs use two’s complement integer arithmetic. For positive values, the bitwise representation of a value is the same in one’s complement and two’s complement, but the representations differ for negative values. For instance, the same bit pattern that means -5 in one’s complement stands for -6 in two’s complement. --- Since a fixed point value must still fit in a cell, the number of decimals has a direct influence of the range of a fixed point value. For a fixed point value with 3 decimals, the range would be −2, 147, 482 . . . + 2, 147, 482. The format for a rational number may only be specified once for the entire pawn program. In an implementation one typically chooses either floating point support or fixed point support. As stated above, for the actual imple- mentation of the floating point or fixed point arithmetic, pawn requires the help of (native) functions and user-defined operators. A good place to put the #pragma for rational number support would be in the include file that also defines the functions and operators. The include file † for fixed point arithmetic contains definitions like: ```c native Fixed: operator\*(Fixed: val1, Fixed: val2) = fmul native Fixed: operator/(Fixed: val1, Fixed: val2) = fdiv ``` The user-defined operators for multiplication and division of two fixed point numbers are aliased directly to the native functions fmul and fdiv. The host application must, then, provide these native functions. Another native user-defined operator is convenient to transform an integer to fixed point automatically, if it is assigned to a variable tagged as “Fixed:”: ```c native Fixed: operator=(oper) = fixed ``` With this definition, you can say “new Fixed: fract = 3” and the value will be transformed to 3.000 when it is stored in variable fract. As explained in the section on user-defined operators, the assignment operator also runs for function arguments that are passed by value. In the expression “new Fixed: root = sqroot(16)” (see the implementation of function sqroot on page 79), the user-defined assignment operator is called on the argument 16. For adding two fixed point values together, the default “+” operator is suffi- cient, and the same goes for subtraction. Adding a normal (integer) number to a fixed point number is different: the normal value must be scaled before adding it. Hence, the include file implements operators for that purpose too: ###### † See the application note “Fixed Point Support Library” for where to obtain the include file. Listing: additive operators, commutative and non-commutative ```c stock Fixed: operator+(Fixed: val1, val2) return val1 + fixed(val2) stock Fixed: operator-(Fixed: val1, val2) return val1 - fixed(val2) stock Fixed: operator-(val1, Fixed: val2) return fixed(val1) - val2 ``` The “+” operator is commutative, so one implementation handles both cases. For the “-” operator, both cases must be implemented separately. Finally, the include file forbids the use of the modulus operator (“%”) on fixed point values: the modulus is only applicable to integer values: Listing: forbidden operators on fixed point values ```c forward Fixed: operator%(Fixed: val1, Fixed: val2) forward Fixed: operator%(Fixed: val1, val2) forward Fixed: operator%(val1, Fixed: val2) ``` Because of the presence of the (forward) declaration of the operator, the pawn parser will attempt to use the user-defined operator rather than the default “%” operator. By not implementing the operator, the parser will subsequently issue an error message. `User-defined operators: 86` --- ### • Call by Value and Call by Reference In Pawn, function arguments can be passed in two ways: by value and by reference. #### Call by value In this method, the value of the variable is passed to the function. A copy of the variable is created and the function operates on the copy, not the original variable. Any changes made to the variable inside the function do not affect the original variable. ```c swap(a, b){ new c = a; a = b; b = c; } main(){ new x = 10, y = 20; printf("The value of x is %d and value of y is %d, before calling 'swap'.", x, y); swap(x, y); printf("The value of x is %d and value of y is %d, after calling 'swap'.", x, y); } ``` Output ``` The value of x is 10 and value of y is 20, before calling 'swap'. The value of x is 10 and value of y is 20, after calling 'swap'. ``` #### Call by reference In this method, the address of the variable is passed to the function. The function operates on the original variable and any changes made to the variable inside the function are reflected in the original variable. ```c swap(&a, &b){ new c = a; a = b; b = c; } main(){ new x = 10, y = 20; printf("The value of x is %d and value of y is %d, before calling 'swap'.", x, y); swap(x, y); printf("The value of x is %d and value of y is %d, after calling 'swap'.", x, y); } ``` Output ``` The value of x is 10 and value of y is 20, before calling 'swap'. The value of x is 20 and value of y is 10, after calling 'swap'. ``` ### • Recursion / Function Recursion Recursion in programming refers to the process of a function calling itself in order to solve a problem. It's a fundamental concept used to solve problems that can be broken down into smaller instances of the same problem. Recursion consists of two main components: base cases and recursive cases. ##### Base Case: Every recursive function should have one or more base cases. A base case is a condition under which the function stops calling itself and returns a result directly. Without base cases, the recursion would continue indefinitely, causing a stack overflow. Read Stack/Heap section to know more about it. ##### Recursive Case: The recursive case is where the function calls itself to solve a smaller instance of the problem. Each recursive call should bring the problem closer to a base case. #### Example ```c stock factorial(n) { // Base case: factorial of 0 is 1 if (n == 0) { return 1; } // Recursive case: n! = n * (n - 1)! else { return n * factorial(n - 1); } } main() { new num = 3; new result = factorial(num); printf("Factorial of %d is %d", num, result); // Output: Factorial of 3 is 6 } ``` #### Demonstrate the Output ``` main() \\ main function from where execution of program starts new num = 3; \\ creates a num variable new result = factorial(num); \\ create a result variable and calls the factorial() with passing value of num, factorial(5) factorial(3) \\ factorial initiate if(3 == 0) \\ checks the condition which is false else{ 3 * factorial(3-1) } \\ 3 * and calls the factorial(2) factorial(2) \\ factorial initiate again if(2 == 0) \\ checks the condition which is false else{ 2 * factorial(2-1) } \\ 3 * 2 * and calls the factorial(1) factorial(1) \\ factorial initiate again if(1 == 0) \\ checks the condition which is false else{ 1 * factorial(1-1) } \\ 3 * 2 * 1 and calls the factorial(0) factorial(0) \\ factorial initiate again if(0 == 0) return 1 \\ checks the conition which is true and return 1 \\ at the final call 3 * 2 * 1 * 1 ``` ### Stack Memory The stack is a region of memory used for storing local variables, function call information, and control flow data. It operates in a Last-In-First-Out (LIFO) manner, which means that the last item pushed onto the stack is the first one to be popped off. #### Example (Stack Overflow) ```c #pragma dynamic 35 // (35 * 4 bytes, a cell size) #pragma dynamic [cells] helps to modify the size of stack, read docs/scripting/language/Directives to know more about #pragma main(){ grow_stack(1); } grow_stacK(n){ // recursive function printf("N: %d", n); grow_stacK(n+1); } ``` #### Output ``` N: 1 N: 2 N: 3 .. . Stack/heap collision (insufficient stack size) ``` ![Stack](https://i.imgur.com/ZaIVUkJ.png) [Go Back to Contents](00-Contents.md)
openmultiplayer/web/docs/scripting/language/reference/04-Functions.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/language/reference/04-Functions.md", "repo_id": "openmultiplayer", "token_count": 13853 }
334
--- title: Callbacks Sequence description: A list of callbacks available in SA-MP/open.mp and its call sequence tags: [] --- Below is a list of callbacks available in SA-MP/open.mp and its call sequence. Tickbox represent called first. | Callback | FilterScript | GameMode | |-------------------------------------------------------------------------|--------------|----------| | [OnActorStreamIn](../callbacks/OnActorStreamIn) | ✅ | | | [OnActorStreamOut](../callbacks/OnActorStreamOut) | ✅ | | | [OnClientCheckResponse](../callbacks/OnClientCheckResponse) | ✅ | | | [OnClientMessage](../callbacks/OnClientMessage) | ✅ | | | [OnDialogResponse](../callbacks/OnDialogResponse) | ✅ | | | [OnEnterExitModShop](../callbacks/OnEnterExitModShop) | ✅ | | | [OnFilterScriptExit](../callbacks/OnFilterScriptExit) | ✅ | | | [OnFilterScriptInit](../callbacks/OnFilterScriptInit) | ✅ | | | [OnGameModeExit](../callbacks/OnGameModeExit) | ✅ | | | [OnGameModeInit](../callbacks/OnGameModeInit) | ✅ | | | [OnIncomingConnection](../callbacks/OnIncomingConnection) | ✅ | | | [OnObjectMoved](../callbacks/OnObjectMoved) | ✅ | | | [OnPlayerClickMap](../callbacks/OnPlayerClickMap) | | ✅ | | [OnPlayerClickPlayer](../callbacks/OnPlayerClickPlayer) | ✅ | | | [OnPlayerClickPlayerTextDraw](../callbacks/OnPlayerClickPlayerTextDraw) | ✅ | | | [OnPlayerClickTextDraw](../callbacks/OnPlayerClickTextDraw) | ✅ | | | [OnPlayerCommandText](../callbacks/OnPlayerCommandText) | ✅ | | | [OnPlayerConnect](../callbacks/OnPlayerConnect) | ✅ | | | [OnPlayerDeath](../callbacks/OnPlayerDeath) | ✅ | | | [OnPlayerDisconnect](../callbacks/OnPlayerDisconnect) | ✅ | | | [OnPlayerEditAttachedObject](../callbacks/OnPlayerEditAttachedObject) | ✅ | | | [OnPlayerEditObject](../callbacks/OnPlayerEditObject) | ✅ | | | [OnPlayerEnterCheckpoint](../callbacks/OnPlayerEnterCheckpoint) | ✅ | | | [OnPlayerEnterRaceCheckpoint](../callbacks/OnPlayerEnterRaceCheckpoint) | ✅ | | | [OnPlayerEnterVehicle](../callbacks/OnPlayerEnterVehicle) | ✅ | | | [OnPlayerExitedMenu](../callbacks/OnPlayerExitedMenu) | | ✅ | | [OnPlayerExitVehicle](../callbacks/OnPlayerExitVehicle) | ✅ | | | [OnPlayerFinishedDownloading](../callbacks/OnPlayerFinishedDownloading) | ✅ | | | [OnPlayerGiveDamage](../callbacks/OnPlayerGiveDamage) | ✅ | | | [OnPlayerGiveDamageActor](../callbacks/OnPlayerGiveDamageActor) | ✅ | | | [OnPlayerInteriorChange](../callbacks/OnPlayerInteriorChange) | | ✅ | | [OnPlayerKeyStateChange](../callbacks/OnPlayerKeyStateChange) | | ✅ | | [OnPlayerLeaveCheckpoint](../callbacks/OnPlayerLeaveCheckpoint) | ✅ | | | [OnPlayerLeaveRaceCheckpoint](../callbacks/OnPlayerLeaveRaceCheckpoint) | ✅ | | | [OnPlayerObjectMoved](../callbacks/OnPlayerObjectMoved) | ✅ | | | [OnPlayerPickUpPickup](../callbacks/OnPlayerPickUpPickup) | | ✅ | | [OnPickupStreamIn](../callbacks/OnPickupStreamIn) | ✅ | | | [OnPickupStreamOut](../callbacks/OnPickupStreamOut) | ✅ | | | [OnPlayerPickUpPlayerPickup](../callbacks/OnPlayerPickUpPlayerPickup) | | ✅ | | [OnPlayerPickupStreamIn](../callbacks/OnPlayerPickupStreamIn) | ✅ | | | [OnPlayerPickupStreamOut](../callbacks/OnPlayerPickupStreamOut) | ✅ | | | [OnPlayerRequestClass](../callbacks/OnPlayerRequestClass) | ✅ | | | [OnPlayerRequestDownload](../callbacks/OnPlayerRequestDownload) | ✅ | | | [OnPlayerRequestSpawn](../callbacks/OnPlayerRequestSpawn) | ✅ | | | [OnPlayerSelectedMenuRow](../callbacks/OnPlayerSelectedMenuRow) | | ✅ | | [OnPlayerSelectObject](../callbacks/OnPlayerSelectObject) | ✅ | | | [OnPlayerSpawn](../callbacks/OnPlayerSpawn) | ✅ | | | [OnPlayerStateChange](../callbacks/OnPlayerStateChange) | ✅ | | | [OnPlayerStreamIn](../callbacks/OnPlayerStreamIn) | ✅ | | | [OnPlayerStreamOut](../callbacks/OnPlayerStreamOut) | ✅ | | | [OnPlayerTakeDamage](../callbacks/OnPlayerTakeDamage) | ✅ | | | [OnPlayerText](../callbacks/OnPlayerText) | ✅ | | | [OnPlayerUpdate](../callbacks/OnPlayerUpdate) | ✅ | | | [OnPlayerWeaponShot](../callbacks/OnPlayerWeaponShot) | ✅ | | | [OnRconCommand](../callbacks/OnRconCommand) | ✅ | | | [OnRconLoginAttempt](../callbacks/OnRconLoginAttempt) | ✅ | | | [OnRecordingPlaybackEnd](../callbacks/OnRecordingPlaybackEnd) | ✅ | | | [OnTrailerUpdate](../callbacks/OnTrailerUpdate) | ✅ | | | [OnUnoccupiedVehicleUpdate](../callbacks/OnUnoccupiedVehicleUpdate) | ✅ | | | [OnVehicleDamageStatusUpdate](../callbacks/OnVehicleDamageStatusUpdate) | ✅ | | | [OnVehicleDeath](../callbacks/OnVehicleDeath) | ✅ | | | [OnVehicleMod](../callbacks/OnVehicleMod) | | ✅ | | [OnVehiclePaintjob](../callbacks/OnVehiclePaintjob) | | ✅ | | [OnVehicleRespray](../callbacks/OnVehicleRespray) | | ✅ | | [OnVehicleSirenStateChange](../callbacks/OnVehicleSirenStateChange) | ✅ | | | [OnVehicleSpawn](../callbacks/OnVehicleSpawn) | ✅ | | | [OnVehicleStreamIn](../callbacks/OnVehicleStreamIn) | ✅ | | | [OnVehicleStreamOut](../callbacks/OnVehicleStreamOut) | ✅ | |
openmultiplayer/web/docs/scripting/resources/callbacks-sequence.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/resources/callbacks-sequence.md", "repo_id": "openmultiplayer", "token_count": 4186 }
335
--- title: File Modes description: The modes to open the file with. --- :::note These file modes are used by [fopen](../functions/fopen). ::: | Mode | Description | | ------------ | ----------------------------------------------------------------------------------------- | | io_read | Reads from the file. | | io_write | Write in the file, or create the file if it does not exist. Erases all existing contents. | | io_readwrite | Reads the file or creates it if it doesn't already exist. | | io_append | Appends (adds) to file, write-only. If the file does not exist, it is created. |
openmultiplayer/web/docs/scripting/resources/file-modes.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/resources/file-modes.md", "repo_id": "openmultiplayer", "token_count": 368 }
336
--- title: Material Text Alignments description: A list of Material Text Alignments. --- :::info There are two kinds of parameters for [SetObjectMaterialText](../functions/SetObjectMaterialText) - material text alignments and material text sizes. Text alignments are listed on this page. ::: | Value | Definition | | ----- | -------------------------------- | | 0 | OBJECT_MATERIAL_TEXT_ALIGN_LEFT | | 1 | OBJECT_MATERIAL_TEXT_ALIGN_CENTER | | 2 | OBJECT_MATERIAL_TEXT_ALIGN_RIGHT |
openmultiplayer/web/docs/scripting/resources/materialtextalignment.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/resources/materialtextalignment.md", "repo_id": "openmultiplayer", "token_count": 183 }
337
--- title: Vehicle Tire Status description: Vehicle tire status definitions. --- :::note These definitions are used by natives such as [GetVehicleDamageStatus](../functions/GetVehicleDamageStatus) and [UpdateVehicleDamageStatus](../functions/UpdateVehicleDamageStatus). ::: | Definition | Value | | ----------------------------------------------------------------------- | ----- | | UNKNOWN_VEHICLE_TYRE_STATUS | -1 | | VEHICLE_TYRE_STATUS_NONE | 0 | | VEHICLE_TYRE_STATUS_FRONT_LEFT_POPPED **/** CARTYRE_FRONT_LEFT_POPPED | 8 | | VEHICLE_TYRE_STATUS_FRONT_RIGHT_POPPED **/** CARTYRE_FRONT_RIGHT_POPPED | 2 | | VEHICLE_TYRE_STATUS_REAR_LEFT_POPPED **/** CARTYRE_REAR_LEFT_POPPED | 4 | | VEHICLE_TYRE_STATUS_REAR_RIGHT_POPPED **/** CARTYRE_REAR_RIGHT_POPPED | 1 | | VEHICLE_TIRE_STATUS_FRONT_LEFT_POPPED **/** CARTIRE_FRONT_LEFT_POPPED | 8 | | VEHICLE_TIRE_STATUS_FRONT_RIGHT_POPPED **/** CARTIRE_FRONT_RIGHT_POPPED | 2 | | VEHICLE_TIRE_STATUS_REAR_LEFT_POPPED **/** CARTIRE_REAR_LEFT_POPPED | 4 | | VEHICLE_TIRE_STATUS_REAR_RIGHT_POPPED **/** CARTIRE_REAR_RIGHT_POPPED | 1 |
openmultiplayer/web/docs/scripting/resources/vehicle-tire-status.md/0
{ "file_path": "openmultiplayer/web/docs/scripting/resources/vehicle-tire-status.md", "repo_id": "openmultiplayer", "token_count": 660 }
338
--- title: open.mp functions description: New functions and callbacks. --- This page contains all the functions and callbacks that were added in open.mp ## Player | Name | |---------------------------------------------------------------------------------------------------------| | [TogglePlayerWidescreen](../scripting/functions/TogglePlayerWidescreen) | | [IsPlayerWidescreenToggled](../scripting/functions/IsPlayerWidescreenToggled) | | [SetPlayerGravity](../scripting/functions/SetPlayerGravity) | | [GetPlayerGravity](../scripting/functions/GetPlayerGravity) | | [ClearPlayerWorldBounds](../scripting/functions/ClearPlayerWorldBounds) | | [GetPlayerRotationQuat](../scripting/functions/GetPlayerRotationQuat) | | [GetPlayerSpectateID](../scripting/functions/GetPlayerSpectateID) | | [GetPlayerSpectateType](../scripting/functions/GetPlayerSpectateType) | | [GetPlayerSurfingOffsets](../scripting/functions/GetPlayerSurfingOffsets) | | [GetPlayerWorldBounds](../scripting/functions/GetPlayerWorldBounds) | | [GetPlayerZAim](../scripting/functions/GetPlayerZAim) | | [IsPlayerSpawned](../scripting/functions/IsPlayerSpawned) | | [GetPlayerHydraReactorAngle](../scripting/functions/GetPlayerHydraReactorAngle) | | [GetPlayerLandingGearState](../scripting/functions/GetPlayerLandingGearState) | | [GetPlayerLastSyncedTrailerID](../scripting/functions/GetPlayerLastSyncedTrailerID) | | [GetPlayerSirenState](../scripting/functions/GetPlayerSirenState) | | [GetPlayerTrainSpeed](../scripting/functions/GetPlayerTrainSpeed) | | [IsPlayerInModShop](../scripting/functions/IsPlayerInModShop) | | [GetPlayerDialogData](../scripting/functions/GetPlayerDialogData) | | [GetPlayerDialogID](../scripting/functions/GetPlayerDialogID) | | [HidePlayerDialog](../scripting/functions/HidePlayerDialog) | | [GetPlayerWeather](../scripting/functions/GetPlayerWeather) | | [GetPlayerSkillLevel](../scripting/functions/GetPlayerSkillLevel) | | [GetPlayerRawIp](../scripting/functions/GetPlayerRawIp) | | [GetPlayerAttachedObject](../scripting/functions/GetPlayerAttachedObject) | | [GetSpawnInfo](../scripting/functions/GetSpawnInfo) | | [GetPlayerBuildingsRemoved](../scripting/functions/GetPlayerBuildingsRemoved) | | [RemovePlayerWeapon](../scripting/functions/RemovePlayerWeapon) | | [AllowPlayerWeapons](../scripting/functions/AllowPlayerWeapons) | | [IsPlayerControllable](../scripting/functions/IsPlayerControllable) | | [IsPlayerCameraTargetEnabled](../scripting/functions/IsPlayerCameraTargetEnabled) | | [TogglePlayerGhostMode](../scripting/functions/TogglePlayerGhostMode) | | [GetPlayerGhostMode](../scripting/functions/GetPlayerGhostMode) | | [GetPlayerAnimationFlags](../scripting/functions/GetPlayerAnimationFlags) | | [GetDefaultPlayerColour](../scripting/functions/GetDefaultPlayerColour) | | [PlayerHasClockEnabled](../scripting/functions/PlayerHasClockEnabled) | | [IsPlayerUsingOfficialClient](../scripting/functions/IsPlayerUsingOfficialClient) | | [IsPlayerInDriveByMode](../scripting/functions/IsPlayerInDriveByMode) | | [IsPlayerCuffed](../scripting/functions/IsPlayerCuffed) | | [SetPlayerAdmin](../scripting/functions/SetPlayerAdmin) | | [GetPlayers](../scripting/functions/GetPlayers) | ## Object | Name | |---------------------------------------------------------------------------------------------------------| | [SetObjectNoCameraCollision](../scripting/functions/SetObjectNoCameraCollision) | | [SetPlayerObjectNoCameraCollision](../scripting/functions/SetPlayerObjectNoCameraCollision) | | [AttachPlayerObjectToObject](../scripting/functions/AttachPlayerObjectToObject) | | [BeginObjectEditing](../scripting/functions/BeginObjectEditing) | | [BeginObjectSelecting](../scripting/functions/BeginObjectSelecting) | | [BeginPlayerObjectEditing](../scripting/functions/BeginPlayerObjectEditing) | | [EndObjectEditing](../scripting/functions/EndObjectEditing) | | [GetObjectAttachedData](../scripting/functions/GetObjectAttachedData) | | [GetObjectAttachedOffset](../scripting/functions/GetObjectAttachedOffset) | | [GetObjectDrawDistance](../scripting/functions/GetObjectDrawDistance) | | [GetObjectMaterial](../scripting/functions/GetObjectMaterial) | | [GetObjectMaterialText](../scripting/functions/GetObjectMaterialText) | | [GetObjectMoveSpeed](../scripting/functions/GetObjectMoveSpeed) | | [GetObjectMovingTargetPos](../scripting/functions/GetObjectMovingTargetPos) | | [GetObjectMovingTargetRot](../scripting/functions/GetObjectMovingTargetRot) | | [GetObjectSyncRotation](../scripting/functions/GetObjectSyncRotation) | | [GetObjectType](../scripting/functions/GetObjectType) | | [GetPlayerCameraTargetPlayerObject](../scripting/functions/GetPlayerCameraTargetPlayerObject) | | [GetPlayerObjectAttachedData](../scripting/functions/GetPlayerObjectAttachedData) | | [GetPlayerObjectAttachedOffset](../scripting/functions/GetPlayerObjectAttachedOffset) | | [GetPlayerObjectDrawDistance](../scripting/functions/GetPlayerObjectDrawDistance) | | [GetPlayerObjectMaterial](../scripting/functions/GetPlayerObjectMaterial) | | [GetPlayerObjectMaterialText](../scripting/functions/GetPlayerObjectMaterialText) | | [GetPlayerObjectMoveSpeed](../scripting/functions/GetPlayerObjectMoveSpeed) | | [GetPlayerObjectMovingTargetPos](../scripting/functions/GetPlayerObjectMovingTargetPos) | | [GetPlayerObjectMovingTargetRot](../scripting/functions/GetPlayerObjectMovingTargetRot) | | [GetPlayerObjectSyncRotation](../scripting/functions/GetPlayerObjectSyncRotation) | | [GetPlayerSurfingPlayerObjectID](../scripting/functions/GetPlayerSurfingPlayerObjectID) | | [HasObjectCameraCollision](../scripting/functions/HasObjectCameraCollision) | | [HasPlayerObjectCameraCollision](../scripting/functions/HasPlayerObjectCameraCollision) | | [IsObjectHiddenForPlayer](../scripting/functions/IsObjectHiddenForPlayer) | | [IsObjectMaterialSlotUsed](../scripting/functions/IsObjectMaterialSlotUsed) | | [IsPlayerObjectMaterialSlotUsed](../scripting/functions/IsPlayerObjectMaterialSlotUsed) | | [SetObjectMoveSpeed](../scripting/functions/SetObjectMoveSpeed) | | [SetObjectsDefaultCameraCollision](../scripting/functions/SetObjectsDefaultCameraCollision) | | [SetPlayerObjectMoveSpeed](../scripting/functions/SetPlayerObjectMoveSpeed) | | [HideObjectForPlayer](../scripting/functions/HideObjectForPlayer) | | [ShowObjectForPlayer](../scripting/functions/ShowObjectForPlayer) | ## Pickup | Name | |---------------------------------------------------------------------------------------------------------| | [CreatePlayerPickup](../scripting/functions/CreatePlayerPickup) | | [DestroyPlayerPickup](../scripting/functions/DestroyPlayerPickup) | | [GetPickupModel](../scripting/functions/GetPickupModel) | | [GetPickupPos](../scripting/functions/GetPickupPos) | | [GetPickupType](../scripting/functions/GetPickupType) | | [GetPickupVirtualWorld](../scripting/functions/GetPickupVirtualWorld) | | [GetPlayerPickupModel](../scripting/functions/GetPlayerPickupModel) | | [GetPlayerPickupPos](../scripting/functions/GetPlayerPickupPos) | | [GetPlayerPickupType](../scripting/functions/GetPlayerPickupType) | | [GetPlayerPickupVirtualWorld](../scripting/functions/GetPlayerPickupVirtualWorld) | | [IsPickupHiddenForPlayer](../scripting/functions/IsPickupHiddenForPlayer) | | [IsPickupStreamedIn](../scripting/functions/IsPickupStreamedIn) | | [IsPlayerPickupStreamedIn](../scripting/functions/IsPlayerPickupStreamedIn) | | [IsValidPickup](../scripting/functions/IsValidPickup) | | [IsValidPlayerPickup](../scripting/functions/IsValidPlayerPickup) | | [SetPickupForPlayer](../scripting/functions/SetPickupForPlayer) | | [SetPickupModel](../scripting/functions/SetPickupModel) | | [SetPickupPos](../scripting/functions/SetPickupPos) | | [SetPickupType](../scripting/functions/SetPickupType) | | [SetPickupVirtualWorld](../scripting/functions/SetPickupVirtualWorld) | | [SetPlayerPickupModel](../scripting/functions/SetPlayerPickupModel) | | [SetPlayerPickupPos](../scripting/functions/SetPlayerPickupPos) | | [SetPlayerPickupType](../scripting/functions/SetPlayerPickupType) | | [SetPlayerPickupVirtualWorld](../scripting/functions/SetPlayerPickupVirtualWorld) | | [HidePickupForPlayer](../scripting/functions/HidePickupForPlayer) | | [ShowPickupForPlayer](../scripting/functions/ShowPickupForPlayer) | | [OnPickupStreamIn](../scripting/callbacks/OnPickupStreamIn) | | [OnPickupStreamOut](../scripting/callbacks/OnPickupStreamOut) | | [OnPlayerPickUpPlayerPickup](../scripting/callbacks/OnPlayerPickUpPlayerPickup) | | [OnPlayerPickupStreamIn](../scripting/callbacks/OnPlayerPickupStreamIn) | | [OnPlayerPickupStreamOut](../scripting/callbacks/OnPlayerPickupStreamOut) | ## Vehicle | Name | |---------------------------------------------------------------------------------------------------------| | [ChangeVehicleColours](../scripting/functions/ChangeVehicleColours) | | [GetPlayerLastSyncedVehicleID](../scripting/functions/GetPlayerLastSyncedVehicleID) | | [GetRandomVehicleColourPair](../scripting/functions/GetRandomVehicleColourPair) | | [GetVehicleCab](../scripting/functions/GetVehicleCab) | | [GetVehicleTower](../scripting/functions/GetVehicleTower) | | [GetVehicleColours](../scripting/functions/GetVehicleColours) | | [GetVehicleHydraReactorAngle](../scripting/functions/GetVehicleHydraReactorAngle) | | [GetVehicleInterior](../scripting/functions/GetVehicleInterior) | | [GetVehicleLandingGearState](../scripting/functions/GetVehicleLandingGearState) | | [GetVehicleDriver](../scripting/functions/GetVehicleDriver) | | [GetVehicleLastDriver](../scripting/functions/GetVehicleLastDriver) | | [GetVehicleMatrix](../scripting/functions/GetVehicleMatrix) | | [GetVehicleModelCount](../scripting/functions/GetVehicleModelCount) | | [GetVehicleModelsUsed](../scripting/functions/GetVehicleModelsUsed) | | [GetVehicleNumberPlate](../scripting/functions/GetVehicleNumberPlate) | | [GetVehicleOccupiedTick](../scripting/functions/GetVehicleOccupiedTick) | | [GetVehiclePaintjob](../scripting/functions/GetVehiclePaintjob) | | [GetVehicleRespawnDelay](../scripting/functions/GetVehicleRespawnDelay) | | [GetVehicleRespawnTick](../scripting/functions/GetVehicleRespawnTick) | | [GetVehicleSirenState](../scripting/functions/GetVehicleSirenState) | | [GetVehicleSpawnInfo](../scripting/functions/GetVehicleSpawnInfo) | | [GetVehicleTrainSpeed](../scripting/functions/GetVehicleTrainSpeed) | | [SetVehicleBeenOccupied](../scripting/functions/SetVehicleBeenOccupied) | | [HasVehicleBeenOccupied](../scripting/functions/HasVehicleBeenOccupied) | | [IsVehicleOccupied](../scripting/functions/IsVehicleOccupied) | | [HideVehicle](../scripting/functions/HideVehicle) | | [ShowVehicle](../scripting/functions/ShowVehicle) | | [IsVehicleHidden](../scripting/functions/IsVehicleHidden) | | [SetVehicleDead](../scripting/functions/SetVehicleDead) | | [IsVehicleDead](../scripting/functions/IsVehicleDead) | | [IsVehicleSirenEnabled](../scripting/functions/IsVehicleSirenEnabled) | | [SetVehicleOccupiedTick](../scripting/functions/SetVehicleOccupiedTick) | | [SetVehicleParamsSirenState](../scripting/functions/SetVehicleParamsSirenState) | | [SetVehicleRespawnDelay](../scripting/functions/SetVehicleRespawnDelay) | | [SetVehicleRespawnTick](../scripting/functions/SetVehicleRespawnTick) | | [SetVehicleSpawnInfo](../scripting/functions/SetVehicleSpawnInfo) | | [ToggleVehicleSirenEnabled](../scripting/functions/ToggleVehicleSirenEnabled) | | [VehicleColourIndexToColour](../scripting/functions/VehicleColourIndexToColour) | | [GetVehicleSeats](../scripting/functions/GetVehicleSeats) | | [VehicleCanHaveComponent](../scripting/functions/VehicleCanHaveComponent) | | [GetVehicles](../scripting/functions/GetVehicles) | ## TextDraw | Name | |---------------------------------------------------------------------------------------------------------| | [TextDrawColour](../scripting/functions/TextDrawColour) | | [TextDrawBoxColour](../scripting/functions/TextDrawBoxColour) | | [TextDrawBackgroundColour](../scripting/functions/TextDrawBackgroundColour) | | [TextDrawGetAlignment](../scripting/functions/TextDrawGetAlignment) | | [TextDrawGetBackgroundColor](../scripting/functions/TextDrawGetBackgroundColor) | | [TextDrawGetBackgroundColour](../scripting/functions/TextDrawGetBackgroundColour) | | [TextDrawGetBoxColor](../scripting/functions/TextDrawGetBoxColor) | | [TextDrawGetBoxColour](../scripting/functions/TextDrawGetBoxColour) | | [TextDrawGetColor](../scripting/functions/TextDrawGetColor) | | [TextDrawGetColour](../scripting/functions/TextDrawGetColour) | | [TextDrawGetFont](../scripting/functions/TextDrawGetFont) | | [TextDrawGetLetterSize](../scripting/functions/TextDrawGetLetterSize) | | [TextDrawGetOutline](../scripting/functions/TextDrawGetOutline) | | [TextDrawGetPos](../scripting/functions/TextDrawGetPos) | | [TextDrawGetPreviewModel](../scripting/functions/TextDrawGetPreviewModel) | | [TextDrawGetPreviewRot](../scripting/functions/TextDrawGetPreviewRot) | | [TextDrawGetPreviewVehicleColours](../scripting/functions/TextDrawGetPreviewVehicleColours) | | [TextDrawGetShadow](../scripting/functions/TextDrawGetShadow) | | [TextDrawGetString](../scripting/functions/TextDrawGetString) | | [TextDrawGetTextSize](../scripting/functions/TextDrawGetTextSize) | | [TextDrawIsBox](../scripting/functions/TextDrawIsBox) | | [TextDrawIsProportional](../scripting/functions/TextDrawIsProportional) | | [TextDrawIsSelectable](../scripting/functions/TextDrawIsSelectable) | | [TextDrawSetPos](../scripting/functions/TextDrawSetPos) | | [TextDrawSetPreviewVehicleColours](../scripting/functions/TextDrawSetPreviewVehicleColours) | | [TextDrawSetStringForPlayer](../scripting/functions/TextDrawSetStringForPlayer) | | [IsValidTextDraw](../scripting/functions/IsValidTextDraw) | | [IsTextDrawVisibleForPlayer](../scripting/functions/IsTextDrawVisibleForPlayer) | | [PlayerTextDrawBackgroundColour](../scripting/functions/PlayerTextDrawBackgroundColour) | | [PlayerTextDrawBoxColour](../scripting/functions/PlayerTextDrawBoxColour) | | [PlayerTextDrawColour](../scripting/functions/PlayerTextDrawColour) | | [PlayerTextDrawGetAlignment](../scripting/functions/PlayerTextDrawGetAlignment) | | [PlayerTextDrawGetBackgroundCol](../scripting/functions/PlayerTextDrawGetBackgroundCol) | | [PlayerTextDrawGetBackgroundColour](../scripting/functions/PlayerTextDrawGetBackgroundColour) | | [PlayerTextDrawGetBoxColor](../scripting/functions/PlayerTextDrawGetBoxColor) | | [PlayerTextDrawGetBoxColour](../scripting/functions/PlayerTextDrawGetBoxColour) | | [PlayerTextDrawGetColor](../scripting/functions/PlayerTextDrawGetColor) | | [PlayerTextDrawGetColour](../scripting/functions/PlayerTextDrawGetColour) | | [PlayerTextDrawGetFont](../scripting/functions/PlayerTextDrawGetFont) | | [PlayerTextDrawGetLetterSize](../scripting/functions/PlayerTextDrawGetLetterSize) | | [PlayerTextDrawGetOutline](../scripting/functions/PlayerTextDrawGetOutline) | | [PlayerTextDrawGetPos](../scripting/functions/PlayerTextDrawGetPos) | | [PlayerTextDrawGetPreviewModel](../scripting/functions/PlayerTextDrawGetPreviewModel) | | [PlayerTextDrawGetPreviewRot](../scripting/functions/PlayerTextDrawGetPreviewRot) | | [PlayerTextDrawGetPreviewVehicleColours](../scripting/functions/PlayerTextDrawGetPreviewVehicleColours) | | [PlayerTextDrawGetShadow](../scripting/functions/PlayerTextDrawGetShadow) | | [PlayerTextDrawGetString](../scripting/functions/PlayerTextDrawGetString) | | [PlayerTextDrawGetTextSize](../scripting/functions/PlayerTextDrawGetTextSize) | | [PlayerTextDrawIsBox](../scripting/functions/PlayerTextDrawIsBox) | | [PlayerTextDrawIsProportional](../scripting/functions/PlayerTextDrawIsProportional) | | [PlayerTextDrawIsSelectable](../scripting/functions/PlayerTextDrawIsSelectable) | | [PlayerTextDrawSetPos](../scripting/functions/PlayerTextDrawSetPos) | | [PlayerTextDrawSetPreviewVehicleColours](../scripting/functions/PlayerTextDrawSetPreviewVehicleColours) | | [IsValidPlayerTextDraw](../scripting/functions/IsValidPlayerTextDraw) | | [IsPlayerTextDrawVisible](../scripting/functions/IsPlayerTextDrawVisible) | ## GameText | Name | |---------------------------------------------------------------------------------------------------------| | [GetGameText](../scripting/functions/GetGameText) | | [HasGameText](../scripting/functions/HasGameText) | | [HideGameTextForAll](../scripting/functions/HideGameTextForAll) | | [HideGameTextForPlayer](../scripting/functions/HideGameTextForPlayer) | ## GangZone | Name | |---------------------------------------------------------------------------------------------------------| | [IsValidGangZone](../scripting/functions/IsValidGangZone) | | [IsPlayerInGangZone](../scripting/functions/IsPlayerInGangZone) | | [IsGangZoneVisibleForPlayer](../scripting/functions/IsGangZoneVisibleForPlayer) | | [GangZoneGetColourForPlayer](../scripting/functions/GangZoneGetColourForPlayer) | | [GangZoneGetFlashColourForPlayer](../scripting/functions/GangZoneGetFlashColourForPlayer) | | [IsGangZoneFlashingForPlayer](../scripting/functions/IsGangZoneFlashingForPlayer) | | [GangZoneGetPos](../scripting/functions/GangZoneGetPos) | | [UseGangZoneCheck](../scripting/functions/UseGangZoneCheck) | | [CreatePlayerGangZone](../scripting/functions/CreatePlayerGangZone) | | [PlayerGangZoneDestroy](../scripting/functions/PlayerGangZoneDestroy) | | [PlayerGangZoneShow](../scripting/functions/PlayerGangZoneShow) | | [PlayerGangZoneHide](../scripting/functions/PlayerGangZoneHide) | | [PlayerGangZoneFlash](../scripting/functions/PlayerGangZoneFlash) | | [PlayerGangZoneStopFlash](../scripting/functions/PlayerGangZoneStopFlash) | | [PlayerGangZoneGetColour](../scripting/functions/PlayerGangZoneGetColour) | | [PlayerGangZoneGetFlashColour](../scripting/functions/PlayerGangZoneGetFlashColour) | | [PlayerGangZoneGetPos](../scripting/functions/PlayerGangZoneGetPos) | | [IsValidPlayerGangZone](../scripting/functions/IsValidPlayerGangZone) | | [IsPlayerInPlayerGangZone](../scripting/functions/IsPlayerInPlayerGangZone) | | [IsPlayerGangZoneVisible](../scripting/functions/IsPlayerGangZoneVisible) | | [IsPlayerGangZoneFlashing](../scripting/functions/IsPlayerGangZoneFlashing) | | [UsePlayerGangZoneCheck](../scripting/functions/UsePlayerGangZoneCheck) | | [OnPlayerEnterGangZone](../scripting/callbacks/OnPlayerEnterGangZone) | | [OnPlayerLeaveGangZone](../scripting/callbacks/OnPlayerLeaveGangZone) | | [OnPlayerEnterPlayerGangZone](../scripting/callbacks/OnPlayerEnterPlayerGangZone) | | [OnPlayerLeavePlayerGangZone](../scripting/callbacks/OnPlayerLeavePlayerGangZone) | | [OnPlayerClickGangZone](../scripting/callbacks/OnPlayerClickGangZone) | | [OnPlayerClickPlayerGangZone](../scripting/callbacks/OnPlayerClickPlayerGangZone) | ## Checkpoint | Name | |---------------------------------------------------------------------------------------------------------| | [IsPlayerCheckpointActive](../scripting/functions/IsPlayerCheckpointActive) | | [GetPlayerCheckpoint](../scripting/functions/GetPlayerCheckpoint) | | [IsPlayerRaceCheckpointActive](../scripting/functions/IsPlayerRaceCheckpointActive) | | [GetPlayerRaceCheckpoint](../scripting/functions/GetPlayerRaceCheckpoint) | ## Actor | Name | |---------------------------------------------------------------------------------------------------------| | [SetActorSkin](../scripting/functions/SetActorSkin) | | [GetActorSkin](../scripting/functions/GetActorSkin) | | [GetActorAnimation](../scripting/functions/GetActorAnimation) | | [GetActorSpawnInfo](../scripting/functions/GetActorSpawnInfo) | | [GetActors](../scripting/functions/GetActors) | ## 3D TextLabel | Name | |---------------------------------------------------------------------------------------------------------| | [Is3DTextLabelStreamedIn](../scripting/functions/Is3DTextLabelStreamedIn) | | [Get3DTextLabelText](../scripting/functions/Get3DTextLabelText) | | [Get3DTextLabelColor](../scripting/functions/Get3DTextLabelColor) | | [Get3DTextLabelColour](../scripting/functions/Get3DTextLabelColour) | | [Get3DTextLabelPos](../scripting/functions/Get3DTextLabelPos) | | [Set3DTextLabelDrawDistance](../scripting/functions/Set3DTextLabelDrawDistance) | | [Get3DTextLabelDrawDistance](../scripting/functions/Get3DTextLabelDrawDistance) | | [Get3DTextLabelLOS](../scripting/functions/Get3DTextLabelLOS) | | [Set3DTextLabelLOS](../scripting/functions/Set3DTextLabelLOS) | | [Get3DTextLabelVirtualWorld](../scripting/functions/Get3DTextLabelVirtualWorld) | | [Set3DTextLabelVirtualWorld](../scripting/functions/Set3DTextLabelVirtualWorld) | | [Get3DTextLabelAttachedData](../scripting/functions/Get3DTextLabelAttachedData) | | [IsValid3DTextLabel](../scripting/functions/IsValid3DTextLabel) | | [IsValidPlayer3DTextLabel](../scripting/functions/IsValidPlayer3DTextLabel) | | [GetPlayer3DTextLabelText](../scripting/functions/GetPlayer3DTextLabelText) | | [GetPlayer3DTextLabelColor](../scripting/functions/GetPlayer3DTextLabelColor) | | [GetPlayer3DTextLabelColour](../scripting/functions/GetPlayer3DTextLabelColour) | | [GetPlayer3DTextLabelPos](../scripting/functions/GetPlayer3DTextLabelPos) | | [SetPlayer3DTextLabelDrawDistance](../scripting/functions/SetPlayer3DTextLabelDrawDistance) | | [GetPlayer3DTextLabelDrawDistance](../scripting/functions/GetPlayer3DTextLabelDrawDistance) | | [GetPlayer3DTextLabelLOS](../scripting/functions/GetPlayer3DTextLabelLOS) | | [GetPlayer3DTextLabelVirtualWorld](../scripting/functions/GetPlayer3DTextLabelVirtualWorld) | | [SetPlayer3DTextLabelVirtualWorld](../scripting/functions/SetPlayer3DTextLabelVirtualWorld) | | [GetPlayer3DTextLabelAttached](../scripting/functions/GetPlayer3DTextLabelAttached) | | [GetPlayer3DTextLabelAttachedData](../scripting/functions/GetPlayer3DTextLabelAttachedData) | ## Class | Name | |---------------------------------------------------------------------------------------------------------| | [GetAvailableClasses](../scripting/functions/GetAvailableClasses) | | [EditPlayerClass](../scripting/functions/EditPlayerClass) | | [GetPlayerClass](../scripting/functions/GetPlayerClass) | ## Menu | Name | |---------------------------------------------------------------------------------------------------------| | [GetMenuItem](../scripting/functions/GetMenuItem) | | [GetMenuItems](../scripting/functions/GetMenuItems) | | [GetMenuColumns](../scripting/functions/GetMenuColumns) | | [GetMenuColumnHeader](../scripting/functions/GetMenuColumnHeader) | | [GetMenuPos](../scripting/functions/GetMenuPos) | | [GetMenuColumnWidth](../scripting/functions/GetMenuColumnWidth) | | [IsMenuDisabled](../scripting/functions/IsMenuDisabled) | | [IsMenuRowDisabled](../scripting/functions/IsMenuRowDisabled) | ## Database | Name | |---------------------------------------------------------------------------------------------------------| | [DB_ExecuteQuery](../scripting/functions/DB_ExecuteQuery) | | [DB_FreeResultSet](../scripting/functions/DB_FreeResultSet) | | [DB_GetDatabaseConnectionCount](../scripting/functions/DB_GetDatabaseConnectionCount) | | [DB_GetDatabaseResultSetCount](../scripting/functions/DB_GetDatabaseResultSetCount) | | [DB_GetFieldCount](../scripting/functions/DB_GetFieldCount) | | [DB_GetFieldFloat](../scripting/functions/DB_GetFieldFloat) | | [DB_GetFieldFloatByName](../scripting/functions/DB_GetFieldFloatByName) | | [DB_GetFieldInt](../scripting/functions/DB_GetFieldInt) | | [DB_GetFieldIntByName](../scripting/functions/DB_GetFieldIntByName) | | [DB_GetFieldName](../scripting/functions/DB_GetFieldName) | | [DB_GetFieldString](../scripting/functions/DB_GetFieldString) | | [DB_GetFieldStringByName](../scripting/functions/DB_GetFieldStringByName) | | [DB_GetLegacyDBResult](../scripting/functions/DB_GetLegacyDBResult) | | [DB_GetMemHandle](../scripting/functions/DB_GetMemHandle) | | [DB_GetRowCount](../scripting/functions/DB_GetRowCount) | | [DB_SelectNextRow](../scripting/functions/DB_SelectNextRow) | ## Core | Name | |---------------------------------------------------------------------------------------------------------| | [SetModeRestartTime](../scripting/functions/SetModeRestartTime) | | [GetModeRestartTime](../scripting/functions/GetModeRestartTime) | | [IsAdminTeleportAllowed](../scripting/functions/IsAdminTeleportAllowed) | | [AreAllAnimationsEnabled](../scripting/functions/AreAllAnimationsEnabled) | | [EnableAllAnimations](../scripting/functions/EnableAllAnimations) | | [IsValidAnimationLibrary](../scripting/functions/IsValidAnimationLibrary) | | [ArePlayerWeaponsAllowed](../scripting/functions/ArePlayerWeaponsAllowed) | | [AreInteriorWeaponsAllowed](../scripting/functions/AreInteriorWeaponsAllowed) | | [GetWeaponSlot](../scripting/functions/GetWeaponSlot) | | [GetWeather](../scripting/functions/GetWeather) | | [GetWorldTime](../scripting/functions/GetWorldTime) | | [ToggleChatTextReplacement](../scripting/functions/ToggleChatTextReplacement) | | [ChatTextReplacementToggled](../scripting/functions/ChatTextReplacementToggled) | | [AllowNickNameCharacter](../scripting/functions/AllowNickNameCharacter) | | [IsNickNameCharacterAllowed](../scripting/functions/IsNickNameCharacterAllowed) | | [IsValidNickName](../scripting/functions/IsValidNickName) | | [ClearBanList](../scripting/functions/ClearBanList) | | [IsBanned](../scripting/functions/IsBanned) | ## Server Rule | Name | |---------------------------------------------------------------------------------------------------------| | [AddServerRule](../scripting/functions/AddServerRule) | | [RemoveServerRule](../scripting/functions/RemoveServerRule) | | [IsValidServerRule](../scripting/functions/IsValidServerRule) | | [SetServerRule](../scripting/functions/SetServerRule) | | [SetServerRuleFlags](../scripting/functions/SetServerRuleFlags) | | [GetServerRuleFlags](../scripting/functions/GetServerRuleFlags) | ## Timer | Name | |---------------------------------------------------------------------------------------------------------| | [IsValidTimer](../scripting/functions/IsValidTimer) | | [IsRepeatingTimer](../scripting/functions/IsRepeatingTimer) | | [GetTimerInterval](../scripting/functions/GetTimerInterval) | | [GetTimerRemaining](../scripting/functions/GetTimerRemaining) | | [CountRunningTimers](../scripting/functions/CountRunningTimers) | | [GetRunningTimers](../scripting/functions/GetRunningTimers) | ## Custom Model | Name | |---------------------------------------------------------------------------------------------------------| | [IsValidCustomModel](../scripting/functions/IsValidCustomModel) | | [GetCustomModelPath](../scripting/functions/GetCustomModelPath) | ## String | Name | |---------------------------------------------------------------------------------------------------------| | [strcopy](../scripting/functions/strcopy) | | [strequal](../scripting/functions/strequal) | ## Float | Name | |---------------------------------------------------------------------------------------------------------| | [strfloat](../scripting/functions/strfloat) | ## File | Name | |---------------------------------------------------------------------------------------------------------| | [ftell](../scripting/functions/ftell) | | [fstat](../scripting/functions/fstat) | | [frename](../scripting/functions/frename) | | [filecrc](../scripting/functions/filecrc) | | [fflush](../scripting/functions/fflush) | | [fcreatedir](../scripting/functions/fcreatedir) | | [fcopy](../scripting/functions/fcopy) | | [fattrib](../scripting/functions/fattrib) | | [diskfree](../scripting/functions/diskfree) |
openmultiplayer/web/docs/server/omp-functions.md/0
{ "file_path": "openmultiplayer/web/docs/server/omp-functions.md", "repo_id": "openmultiplayer", "token_count": 22578 }
339
--- title: OnNPCEnterVehicle description: Ovaj callback je pozvan kada NPC uđe u vozilo. tags: ["npc"] --- ## Deskripcija Ovaj callback je pozvan kada NPC uđe u vozilo. | Ime | Deskripcija | | ------------ | ------------------------------------------------------- | | vehicleid | ID vozila u koje NPC ulazi. | | seatid | ID sjedišta na kojem NPC sjedi. | ## Primjeri ```c public OnNPCEnterVehicle(vehicleid, seatid) { printf("OnNPCEnterVehicle ID: %d Sjedište: %d", vehicleid, seatid); return 1; } ``` ## Srodne Funkcije Slijedeći callbackovi mogu biti korisni, zato što su povezani sa ovim callback-om na neki način. - [OnNPCExitVehicle](OnNPCExitVehicle): Ovaj callback je pozvan kada NPC izađe iz vozila.
openmultiplayer/web/docs/translations/bs/scripting/callbacks/OnNPCEnterVehicle.md/0
{ "file_path": "openmultiplayer/web/docs/translations/bs/scripting/callbacks/OnNPCEnterVehicle.md", "repo_id": "openmultiplayer", "token_count": 404 }
340
--- title: OnPlayerExitedMenu description: Pozvano kada igrač napusti meni. tags: ["player", "menu"] --- ## Deskripcija Pozvano kada igrač napusti meni. | Ime | Deskripcija | | -------- | ------------------------------- | | playerid | ID igrača koji je napustio meni | ## Returns Uvijek je pozvana prva u gamemode-u. ## Primjeri ```c public OnPlayerExitedMenu(playerid) { TogglePlayerControllable(playerid,1); // odledi igrača kada napusti meni return 1; } ``` ## Srodne Funkcije - [CreateMenu](../functions/CreateMenu.md): Kreiraj meni. - [DestroyMenu](../functions/DestroyMenu.md): Uništi meni.
openmultiplayer/web/docs/translations/bs/scripting/callbacks/OnPlayerExitedMenu.md/0
{ "file_path": "openmultiplayer/web/docs/translations/bs/scripting/callbacks/OnPlayerExitedMenu.md", "repo_id": "openmultiplayer", "token_count": 266 }
341
--- title: OnPlayerStateChange description: Ovaj callback je pozvan kada igrač promijeni stanje. tags: ["player"] --- ## Deskripcija Ovaj callback je pozvan kada igrač promijeni stanje. Naprimjer, kada igrač promijeni stanje votača vozila u stanje da bude na nogama (on-foot) (napustio vozilo). | Ime | Deskripcija | | -------- | ------------------------------------ | | playerid | ID igrača koji je promijenio stanje. | | newstate | Igračevo novo stanje. | | oldstate | Igračevo prethodno stanje. | Pogledajte [Igračeva stanja/Player States](../resources/playerstates.md) za listu svih dostupnih stanja igrača. ## Returns Uvijek je pozvan prvo u filterskripti. ## Primjeri ```c public OnPlayerStateChange(playerid, PLAYER_STATE:newstate, PLAYER_STATE:oldstate) { if (oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER) // Igrač ušao u vozilo kao vozač { new vehicleid = GetPlayerVehicleID(playerid); AddVehicleComponent(vehicleid, 1010); // Dodaje nitro na vozilo } return 1; } ``` ## Zabilješke :::tip Ovaj callback pozvat će i NPC. ::: ## Srodne Funkcije - [GetPlayerState](../functions/GetPlayerState.md): Dobij trenutno igračevo stanje. - [GetPlayerSpecialAction](../functions/GetPlayerSpecialAction.md): Dobij trenutnu igračevu specijalnu akciju (special action). - [SetPlayerSpecialAction](../functions/SetPlayerSpecialAction.md): Postavi igraču specijalnu akciju (special action).
openmultiplayer/web/docs/translations/bs/scripting/callbacks/OnPlayerStateChange.md/0
{ "file_path": "openmultiplayer/web/docs/translations/bs/scripting/callbacks/OnPlayerStateChange.md", "repo_id": "openmultiplayer", "token_count": 624 }
342
--- title: OnVehicleRespray description: Ovaj callback je pozvan kada igrač napusti mod shop, bilo da boja jeste ili nije promijenjena. tags: ["vehicle"] --- ## Deskripcija Ovaj callback je pozvan kada igrač napusti mod shop (respray mod shop), bilo da boja jeste ili nije promijenjena. Pripazi, ime je dvosmisleno, Pay 'n' Spray shopovine pozivaju ovaj callback. | Ime | Deskripcija | | --------- | -------------------------------------------- | | playerid | ID igrača koji vozi vozilo. | | vehicleid | ID vozila koje je respray-ovano. | | color1 | Primarna boja vozila koja je promijenjena. | | color2 | Sekundarna boja vozila koja je promijenjena. | ## Returns Uvijek je pozvan prvo u gamemodeu tako da će return-ovanje 0 ovdje blokirati ostale skripte da ga vide. ## Primjeri ```c public OnVehicleRespray(playerid, vehicleid, color1, color2) { new string[48]; format(string, sizeof(string), "You resprayed vehicle %d to colors %d and %d!", vehicleid, color1, color2); SendClientMessage(playerid, COLOR_GREEN, string); return 1; } ``` ## Zabilješke :::tip Ovaj callback nije pozvan od strane `ChangeVehicleColor`. Zavaravajući, ovaj callback nije pozvan za pay 'n' spray (samo modshopovi). Rješenje ovdje: http://pastebin.com/G81da7N1 ::: :::warning Poznati bug(ovi): pregled komponente unutar mod shopa može pozvati ovaj callback. ::: ## Srodne Funkcije - [ChangeVehicleColor](../functions/ChangeVehicleColor.md): Postavi boju vozila. - [ChangeVehiclePaintjob](../functions/ChangeVehiclePaintjob.md): Promijeni paintjob vozila. - [OnVehiclePaintjob](OnVehiclePaintjob.md): Pozvano kada se paintjob vozila promijeni. - [OnVehicleMod](OnVehicleMod.md): Pozvano kada se vozilo modira/uredi. - [OnEnterExitModShop](OnEnterExitModShop.md): Pozvano kada vozilo uđe ili izađe u/iz mod shopa.
openmultiplayer/web/docs/translations/bs/scripting/callbacks/OnVehicleRespray.md/0
{ "file_path": "openmultiplayer/web/docs/translations/bs/scripting/callbacks/OnVehicleRespray.md", "repo_id": "openmultiplayer", "token_count": 796 }
343
--- title: AllowInteriorWeapons description: O(ne)mogućava da li je korištenje oružja u enterijerima dozvoljeno ili nije. tags: [] --- ## Deskripcija O(ne)mogućava da li je korištenje oružja u interijerima dozvoljeno ili nije. | Ime | Deskripcija | | ----- | --------------------------------------------------------------------------------------------------------------------------- | | allow | 1 da odobrite oružja u enterijerima (Po zadanim postavkama je odobreno), 0 da onemogućite korištenje oružja u enterijerima. | ## Returns Ova funkcija ne return-a nikakve specifične vrijednosti. ## Primjeri ```c public OnGameModeInit() { // Ovo dozvoljava da se oružja koriste u enterijerima. AllowInteriorWeapons(1); return 1; } ``` ## Zabilješke :::warning Ova funkcija ne radi u trenutnoj verziji SA:MP-a! ::: ## Srodne Funkcije - [SetPlayerInterior](SetPlayerInterior.md): Postavi igraču enterijer. - [GetPlayerInterior](GetPlayerInterior.md): Doznaj igračev trenutni enterijer. - [OnPlayerInteriorChange](../callbacks/OnPlayerInteriorChange.md): Pozvan kada igrač promijeni enterijer.
openmultiplayer/web/docs/translations/bs/scripting/functions/AllowInteriorWeapons.md/0
{ "file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/AllowInteriorWeapons.md", "repo_id": "openmultiplayer", "token_count": 538 }
344
--- title: BlockIpAddress description: Blokira IP adresu iz daljnje komunikacije sa serverom na određeno vrijeme (uz dopuštene zamjenske znakove). tags: ["ip address"] --- ## Deskripcija Blokira IP adresu iz daljnje komunikacije sa serverom na određeno vrijeme (uz dopuštene zamjenske znakove). Igrači koji se pokušaju povezati na server s blokiranom IP adresom primit će generičku "You are banned from this server." poruku. Igrači koji su na mreži na navedenoj IP adresi,prije nego što će blokada isteći nakon nekoliko sekundi,nakon ponovnog povezivanja,primit će istu poruku. | Ime | Deskripcija | | ---------- | ---------------------------------------------------------------------------------------------------------- | | ip_address | IP koji se blokira | | timems | Vrijeme (u milisekundama) za koje će veza biti blokirana. 0 se može koristiti za neodređeni blok | ## Returns Ova funkcija ne vraća nikakve posebne vrijednosti. ## Primjeri ```c public OnRconLoginAttempt(ip[], password[], success) { if (!success) // ako su isporučili lošu lozinku { BlockIpAddress(ip, 60 * 1000); // blokira konekcije sa IP-a na jedan minut } return 1; } ``` ## Zabilješke :::tip Sa ovom funkcijom mogu se koristiti zamjenski znakovi, na primjer, blokiranjem IP-a '6.9 ._._' blokirat će se sve IP-ove gdje su prva dva okteta 6, odnosno 9. Bilo koji broj može biti umjesto zvjezdice. ::: ## Srodne Funkcije - [UnBlockIpAddress](UnBlockIpAddress): Uklanja blokadu za IP adresu koja je prethodno bila blokirana. - [OnIncomingConnection](../callbacks/OnIncomingConnection): Poziva se kada se igrač pokuša povezati na server.
openmultiplayer/web/docs/translations/bs/scripting/functions/BlockIpAddress.md/0
{ "file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/BlockIpAddress.md", "repo_id": "openmultiplayer", "token_count": 899 }
345
--- title: CreatePickup description: Ova funkcija radi u potpunosti isto kao i AddStaticPickup, osim što returna (vraća) ID pickupa koji se može upotrijebiti za njegovo uništavanje nakon čega se može pratiti pomoću OnPlayerPickUpPickup. tags: [] --- ## Deskripcija Ova funkcija radi u potpunosti isto kao i AddStaticPickup, osim što returna (vraća) ID pickupa koji se može upotrijebiti za njegovo uništavanje nakon čega se može pratiti pomoću OnPlayerPickUpPickup. | Ime | Deskripcija | | -------------------------------- | ------------------------------------------------------------------------------------- | | [model](../resources/pickupids) | Model pickupa. | | [type](../resources/pickuptypes) | Tip pickupa. Određuje kako će pickup reagovati. | | Float:X | X kordinata za kreirati pickup. | | Float:Y | Y kordinata za kreirati pickup. | | Float:Z | Z kordinata za kreirati pickup. | | virtualworld | ID virtualnog svijeta pickupa. Koristi -1 da bi se pickup prikazao u svim svjetovima. | ## Returns ID kreiranog pickupa, -1 ukoliko dođe do greške (pickup max limit). ## Primjeri ```c new pickup; // kreiramo varijablu u koju ćemo sačuvati ID pickupa public OnGameModeInit() { pickup = CreatePickup(1242, 2, 1503.3359, 1432.3585, 10.1191, -1); // Kreiramo armor pickup i čuvamo ga u 'pickup' varijablu return 1; } // Kasnije.. DestroyPickup(pickup); // Primjer korištenja Pickup ID-a pickup = 0; // varijablu pickupa treba resetirati kako bi se izbjegli budući problemi ``` ## Zabilješke :::tip Jedina vrsta pickupa koja se može pokupiti iz vozila je 14 (osim posebnih pickupa poput bribe-a). Pickupi su prikazani i mogu ih pokupiti svi igrači. Moguće je da ako se DestroyPickup () koristi kada se podiže, više od jednog igrača može pokupiti pickup zbog zaostajanja. To se može zaobići korištenjem varijabli. Određene vrste pickupa dolaze s "automatskim odgovorima", na primjer, upotreba modela M4 u pickupa automatski će dati igraču oružje i malo streljiva. Za potpuno skriptirane pickupe treba koristiti tip 1. ::: :::warning Poznati Bug(ovi): Pickupi koji imaju X ili Y niži od -4096,0 ili veći od 4096,0 neće se pojaviti niti će pokrenuti OnPlayerPickUpPickup. ::: ## Srodne Funkcije - [AddStaticPickup](AddStaticPickup): Dodaj statični pickup. - [DestroyPickup](DestroyPickup): Uništi pickup. - [OnPlayerPickUpPickup](../callbacks/OnPlayerPickUpPickup): Pozvano kada igrač pokupi pickup.
openmultiplayer/web/docs/translations/bs/scripting/functions/CreatePickup.md/0
{ "file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/CreatePickup.md", "repo_id": "openmultiplayer", "token_count": 1459 }
346
--- title: DisableInteriorEnterExits description: Onemogućite sve unutrašnje ulaze i izlaze u igri (žute strelice na vratima). tags: [] --- ## Deskripcija Onemogućite sve unutrašnje ulaze i izlaze u igri (žute strelice na vratima). ## Primjeri ```c public OnGameModeInit() { DisableInteriorEnterExits(); return 1; } ``` ## Zabilješke :::tip Ova funkcija će raditi samo ukoliko se iskoristi prije nego što se igrač konektuje (preporučeno je da se koristi unutar OnGameModeInit). Neće ukloniti markere povezanog igrača. ::: :::warning Ukoliko se gamemode promijeni nakon što se iskoristi ova funkcija, novi gamemode neće onemogućiti markere, markeri se neće pojaviti već povezanim igračima (ali će biti za nove povezane igrača). ::: ## Srodne Funkcije - [AllowInteriorWeapons](AllowInteriorWeapons): Odredi da li oružja mogu da se koriste u enterijerima.
openmultiplayer/web/docs/translations/bs/scripting/functions/DisableInteriorEnterExits.md/0
{ "file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/DisableInteriorEnterExits.md", "repo_id": "openmultiplayer", "token_count": 382 }
347
--- title: FindModelFileNameFromCRC description: Pronađite postojeću prilagođenu kožu ili datoteku jednostavnog objektnog modela. tags: [] --- :::warning Ova funkcija je dodana u SA-MP 0.3.DL R1 i ne radi u nižim verzijama! ::: ## Deskripcija Pronađite postojeću prilagođenu kožu ili datoteku jednostavnog objektnog modela. Datoteke modela se prema zadanim postavkama nalaze u direktoriju poslužitelja modela (postavka artpath). | Ime | Deskripcija | | ----------- | ---------------------------------------------------------------------- | | crc | CRC kontrolna suma datoteke prilagođenog modela. | | retstr[] | Niz u koji treba pohraniti .dff ime datoteke, proslijeđeno referencom. | | retstr_size | Dužina niza koji treba pohraniti. | ## Returns 1: Funkcija uspješno izvršena. 0: Funkcija neuspješno izvršena. ## Srodne Funkcije - [OnPlayerFinishedDownloading](../callbacks/OnPlayerFinishedDownloading): Pozvano kada igrač dovrši preuzimanje prilagođenih modela.
openmultiplayer/web/docs/translations/bs/scripting/functions/FindModelFileNameFromCRC.md/0
{ "file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/FindModelFileNameFromCRC.md", "repo_id": "openmultiplayer", "token_count": 535 }
348
--- title: GetActorFacingAngle description: Dobij ugao posmatranja actora. tags: ["actor"] --- <VersionWarn version='SA-MP 0.3.7' /> ## Deskripcija Pogledaj ugao posmatranja actora | Ime | Deskripcija | | ---------- | ------------------------------------------------------------------------------------------- | | actorid | ID actora za dobivanje ugla posmatranja. Returnan (vraćen) od CreateActor funkcije. | | &Float:ang | Float varijabla proslijeđena referencom, u kojoj će biti pohranjen ugao gledanja actora. | ## Returns 1: Funkcija je uspješno izvršena. 0: Funkcija nije uspjela da se izvrši. Navedeni actor ne postoji. Ugao gledanja actora je pohranjen u navedenoj varijabli. ## Primjeri ```c new Float:facingAngle; GetActorFacingAngle(actorid, facingAngle); ``` ## Povezane Funkcije - [SetActorFacingAngle](SetActorFacingAngle): Postaviti ugao gledanja actora. - [GetActorPos](GetActorPos): Dobiti poziciju actora.
openmultiplayer/web/docs/translations/bs/scripting/functions/GetActorFacingAngle.md/0
{ "file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/GetActorFacingAngle.md", "repo_id": "openmultiplayer", "token_count": 453 }
349
--- title: GetPVarFloat description: Dobija varijablu igrača kao float. tags: ["pvar"] --- ## Deskripcija Dobija varijablu igrača kao float. | Ime | Deskripcija | | -------- | ----------------------------------------------- | | playerid | ID igrača za dobiti varijablu igrača u float-u. | | varname | Ime varijable igrača. | ## Returns Float navedene varijable igrača. ## Primjeri ```c forward LoadPos(playerid); public LoadPos(playerid) { SetPlayerPos(playerid, GetPVarFloat(playerid,"xpos"), GetPVarFloat(playerid,"ypos"), GetPVarFloat(playerid,"zpos")); return 1; } ``` ## Zabilješke :::tip Varijable se resetiraju tek nakon što se pozove OnPlayerDisconnect, tako da su vrijednosti i dalje dostupne u OnPlayerDisconnect. ::: ## Srodne Funkcije - [SetPVarInt](SetPVarInt): Postavi cijeli broj za igračevu varijablu. - [GetPVarInt](GetPVarInt): Dobij prethodno postavljeni cijeli broj iz igračeve varijable. - [SetPVarString](SetPVarString): Postavi string za igračevu varijablu. - [GetPVarString](GetPVarString): Dobij prethodno postavljeni string iz igračeve varijable. - [SetPVarFloat](SetPVarFloat): Postavi float za igračevu varijablu. - [DeletePVar](DeletePVar): Ukloni igračevu varijablu.
openmultiplayer/web/docs/translations/bs/scripting/functions/GetPVarFloat.md/0
{ "file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/GetPVarFloat.md", "repo_id": "openmultiplayer", "token_count": 559 }
350
--- title: GetPlayerVehicleID description: Ova funkcija dobija ID vozila u kojem je igrač trenutno. tags: ["player", "vehicle"] --- ## Deskripcija Ova funkcija dobija ID vozila u kojem je igrač trenutno. Zabilješka: NE ID modela vozila. Pogledaj GetVehicleModel za to. | Ime | Deskripcija | | -------- | ------------------------------------------------------- | | playerid | ID player in the vehicle that you want to get the ID of | ## Returns ID vozila ili 0 ako nije u vozilu. ## Primjeri ```c // Dodaj 10x Nitro ako je igrač u vozilu. Može biti pozvan u komandi. new vehicleId; vehicleId = GetPlayerVehicleID(playerid); if (vehicleId != 0) { AddVehicleComponent(vehicleId, 1010); } ``` ## Srodne Funkcije - [IsPlayerInVehicle](IsPlayerInVehicle): Provjerite je li igrač u određenom vozilu. - [IsPlayerInAnyVehicle](IsPlayerInAnyVehicle): Provjerite je li igrač u bilo kojem vozilu. - [GetPlayerVehicleSeat](GetPlayerVehicleSeat): Provjeri u kojem je igrač sjedištu. - [GetVehicleModel](GetVehicleModel): Dobij ID modela vozila.
openmultiplayer/web/docs/translations/bs/scripting/functions/GetPlayerVehicleID.md/0
{ "file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/GetPlayerVehicleID.md", "repo_id": "openmultiplayer", "token_count": 453 }
351
--- title: GetServerVarAsBool description: Dobij boolean vrijednost server varijable. tags: [] --- :::warning This function, as of 0.3.7 R2, is deprecated. Please see GetConsoleVarAsBool ::: ## Deskripcija Dobij boolean vrijednost server varijable. | Ime | Deskripcija | | --------------- | ------------------------------------------- | | const varname[] | Ime boolean varijable za dobiti vrijednost. | ## Returns Vrijednost navedene varijable poslužitelja. 0 ako navedena varijabla servera nije logička ili ne postoji. ## Primjeri ```c public OnGameModeInit() { new queryEnabled = GetServerVarAsBool("query"); if (!queryEnabled) { print("WARNING: Upit je onemogućen. Server će se pojaviti van mreže u pretraživaču servera."); } return 1; } ``` ## Zabilješke :::tip Napiši 'varlist' u server konzoli da prikažeš listu dostupnih server varijabli i njihovih tipova. ::: ## Srodne Funkcije - [GetServerVarAsString](GetServerVarAsString): Dohvatite server varijablu kao string. - [GetServerVarAsInt](GetServerVarAsInt): Dohvatite server varijablu kao cijeli broj.
openmultiplayer/web/docs/translations/bs/scripting/functions/GetServerVarAsBool.md/0
{ "file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/GetServerVarAsBool.md", "repo_id": "openmultiplayer", "token_count": 481 }
352
--- title: GetVehiclePos description: Dobija poziciju vozila. tags: ["vehicle"] --- ## Deskripcija Dobija poziciju vozila. | Ime | Deskripcija | | --------- | ------------------------------------------------------------------ | | vehicleid | ID vozila za dobiti njegovu poziciju. | | &Float:x | Float varijabla za pohraniti X kordinatu, proslijeđeno referencom. | | &Float:y | Float varijabla za pohraniti Y kordinatu, proslijeđeno referencom. | | &Float:z | Float varijabla za pohraniti Z kordinatu, proslijeđeno referencom. | ## Returns 1: Funkcija uspješno izvršena. 0: Funkcija neuspješno izvršena. Navedeno vozilo ne postoji. ## Primjeri ```c public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp(cmdtext, "/vehpos", true) == 0) { new playerVehicle; playerVehicle = GetPlayerVehicleID(playerid); // ako je playerVehicle jednako 0 if (!playerVehicle) { return SendClientMessage(playerid, -1, "Nisi u vozilu!"); } new Float: vehX, Float: vehY, Float: vehZ, clientMessage[96]; GetVehiclePos(playerVehicle, vehX, vehY, vehZ); format(clientMessage, sizeof(clientMessage), "Trenutna pozicija vozila je: %f, %f, %f", vehX, vehY, vehZ); SendClientMessage(playerid, 0xFFFFFFFF, clientMessage); return 1; } return 0; } ``` ## Srodne Funkcije - [GetVehicleDistanceFromPoint](GetVehicleDistanceFromPoint): Dobij razmak između vozila i tačke. - [SetVehiclePos](SetVehiclePos): Postavi poziciju vozila. - [GetVehicleZAngle](GetVehicleZAngle): Provjerite trenutni ugao vozila. - [GetVehicleRotationQuat](GetVehicleRotationQuat): Nabavite rotaciju kvaderiona vozila.
openmultiplayer/web/docs/translations/bs/scripting/functions/GetVehiclePos.md/0
{ "file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/GetVehiclePos.md", "repo_id": "openmultiplayer", "token_count": 880 }
353
--- title: IsObjectMaterialSlotUsed description: Provjerava da li je slot objekta materijala zauzet. tags: ["object"] --- <VersionWarn version='omp v1.1.0.2612' /> ## Deskripcija Provjerava da li je slot objekta materijala zauzet. | Ime | Deskripcija | |---------------|---------------------------------------------| | objectid | ID objekta. | | materialIndex | Indeks materijala na objektu. (0 do 15) | ## Returns Funkcija vraća vrstu upotrebe slota za materijal. `0` - Nijedan `1` - Materijal `2` - Tekst ## Primjeri ```c new objectid = CreateObject(19371, 978.71143, -925.25708, 42.63720, 0.00000, 0.00000, 2.00000); SetObjectMaterial(objectid, 0, 19341, "egg_texts", "easter_egg01", 0xFFFFFFFF); new type = IsObjectMaterialSlotUsed(objectid, 0); // type = 1 ``` Još jedan primjer: ```c new objectid = CreateObject(19174, 986.42767, -983.14850, 40.95220, 0.00000, 0.00000, 186.00000); SetObjectMaterialText(objectid, "OPEN.MP", 0, OBJECT_MATERIAL_SIZE_256x128, "Arial", 38, true, 0xFF0000FF, 0x00000000, OBJECT_MATERIAL_TEXT_ALIGN_LEFT); new type = IsObjectMaterialSlotUsed(objectid, 0); // type = 2 ``` ## Srodne Funkcije - [SetObjectMaterial](SetObjectMaterial): Zamijeni teksturu objekta s teksturom iz drugog modela u igri. - [SetObjectMaterialText](SetObjectMaterialText): Zamijeni teksturu objekta sa tekstom. - [GetObjectMaterial](GetObjectMaterial): Uzmi materijalne podatke iz indeksa objekta. - [GetObjectMaterialText](GetObjectMaterialText): Uzmi materijalne tekstualne podatke iz indeksa objekta. - [IsPlayerObjectMaterialSlotUsed](IsPlayerObjectMaterialSlotUsed): Provjerava da li je slot player-objekta materijala zauzet.
openmultiplayer/web/docs/translations/bs/scripting/functions/IsObjectMaterialSlotUsed.md/0
{ "file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/IsObjectMaterialSlotUsed.md", "repo_id": "openmultiplayer", "token_count": 709 }
354
--- title: IsValidMenu description: Provjerava da li je ID menija važeći. tags: [] --- ## Deskripcija Provjerava da li je ID menija važeći. | Ime | Deskripcija | | ------ | ------------------------ | | menuid | ID menija ta provjeriti. | ## Returns 1 - Meni je važeći. 0 - Meni je nevažeći. ## Srodne Funkcije - [CreateMenu](CreateMenu): Kreiraj meni - [DestroyMenu](DestroyMenu): Uništava postojeći meni. - [DisableMenu](DisableMenu): Onemogući meni. - [DisableMenuRow](DisableMenuRow): Onemogućite određeni red u meniju za sve igrače. - [AddMenuItem](AddMenuItem): Dodaje artikal u određeni meni. - [SetMenuColumnHeader](SetMenuColumnHeader): Postavi zaglavlje za jednu kolonu u meniju. - [OnPlayerSelectedMenuRow](../callbacks/OnPlayerSelectedMenuRow): Pozvano kada igrač odabere red u meniju. - [OnPlayerExitedMenu](../callbacks/OnPlayerExitedMenu): Pozvano kada igrač napusti meni.
openmultiplayer/web/docs/translations/bs/scripting/functions/IsValidMenu.md/0
{ "file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/IsValidMenu.md", "repo_id": "openmultiplayer", "token_count": 370 }
355
--- title: NetStats_GetConnectedTime description: Dobija količinu vremena (u milisekundama) za koje je igrač povezan na server. tags: [] --- ## Deskripcija Dobija količinu vremena (u milisekundama) za koje je igrač povezan na server. | Ime | Deskripcija | | -------- | -------------------------------------- | | playerid | ID igrača za dobiti vrijeme konekcije. | ## Returns Ova funkcija vraća količinu vremena (u milisekundama) za koje je igrač povezan sa serverom. 0 je vraćeno ako igrač nije konektovan. ## Primjeri ```c public OnPlayerCommandText(playerid,cmdtext[]) { if (!strcmp(cmdtext, "/connectedtime")) { new szString[144]; format(szString, sizeof(szString), "Konektovan si %i milisekundi na server.", NetStats_GetConnectedTime(playerid)); SendClientMessage(playerid, -1, szString); } return 1; } ``` ## Zabilješke :::tip The return value is not reset to zero after changing the game mode (using the RCON command "gmx"). ::: ## Srodne Funkcije - [GetPlayerNetworkStats](GetPlayerNetworkStats): Dobija mrežne statistike igrača i pohranjuje ih u string. - [GetNetworkStats](GetNetworkStats): Dobija mrežne statistike servera i sprema ih u string. - [NetStats_MessagesReceived](NetStats_MessagesReceived): Dohvatite broj mrežnih poruka koje je server primio od igrača. - [NetStats_BytesReceived](NetStats_BytesReceived): Dohvatite količinu informacija (u bajtovima) koju je poslužitelj primio od igrača. - [NetStats_MessagesSent](NetStats_MessagesSent): Dohvatite broj mrežnih poruka koje je server poslao igraču. - [NetStats_BytesSent](NetStats_BytesSent): Dohvatite količinu informacija (u bajtovima) koje je poslužitelj poslao uređaju za reprodukciju. - [NetStats_MessagesRecvPerSecond](NetStats_MessagesRecvPerSecond): Dohvatite broj mrežnih poruka koje je poslužitelj primio od igrača u posljednjoj sekundi. - [NetStats_PacketLossPercent](NetStats_PacketLossPercent): Dobijte packet loss procenat igrača. - [NetStats_ConnectionStatus](NetStats_ConnectionStatus): Dohvatite status veze igrača. - [NetStats_GetIpPort](NetStats_GetIpPort): Nabavite IP adresu i port igrača.
openmultiplayer/web/docs/translations/bs/scripting/functions/NetStats_GetConnectedTime.md/0
{ "file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/NetStats_GetConnectedTime.md", "repo_id": "openmultiplayer", "token_count": 880 }
356
--- title: PlayerTextDrawFont description: Promijeni font player-textdrawa. tags: ["player", "textdraw", "playertextdraw"] --- ## Deskripcija Promijeni font player-textdrawa. | Ime | Deskripcija | | -------- | ----------------------------------------------------------------------------------------------------------------------------------- | | playerid | ID igrača čijem player-textdrawu treba izmijeniti font. | | text | ID player-textdrawa za izmijeniti font. | | font | Postoje četiri stila fontova kao što je prikazano dolje. Vrijednost fonta veća od 3 se ne prikazuje, a sve veće od 16 ruši klijent. | Dostupni stilovi: ![Available Styles](images/textdraws/Textdraw_font_styles.png) Dostupni fontovi: ![Available Fonts](images/textdraws/Textdraw_Fonts.png) ## Returns Ova funkcija ne returna (vraća) nikakve posebne vrijednosti. ## Primjeri ```c new PlayerText:gWelcomeText[MAX_PLAYERS]; public OnPlayerConnect(playerid) { // Prvo kreiramo textdraw gWelcomeText[playerid] = CreatePlayerTextDraw(playerid, 240.0, 580.0, "Welcome to my SA-MP server"); // Postavi mu font na 2 PlayerTextDrawFont(playerid, gWelcomeText[playerid], 2); } public OnPlayerDisconnect(playerid) { PlayerTextDrawHide(playerid, gWelcomeText[playerid]); } ``` ## Srodne Funkcije - [CreatePlayerTextDraw](CreatePlayerTextDraw): Kreiraj player-textdraw. - [PlayerTextDrawDestroy](PlayerTextDrawDestroy): Uništi player-textdraw. - [PlayerTextDrawColor](PlayerTextDrawColor): Postavi boju teksta u player-textdrawu. - [PlayerTextDrawBoxColor](PlayerTextDrawBoxColor): Postavi boju box-a od player-textdrawa. - [PlayerTextDrawBackgroundColor](PlayerTextDrawBackgroundColor): Postavi boju pozadine player-textdrawa. - [PlayerTextDrawAlignment](PlayerTextDrawAlignment): Postavi poravnanje player-textdrawa. - [PlayerTextDrawLetterSize](PlayerTextDrawLetterSize): Postavi veličinu slova u tekstu player-textdrawa. - [PlayerTextDrawTextSize](PlayerTextDrawTextSize): Postavi veličinu box-a player-textdrawa (ili dijela koji reaguje na klik za PlayerTextDrawSetSelectable). - [PlayerTextDrawSetOutline](PlayerTextDrawSetOutline): Omogući/onemogući korišćenje outline-a za player-textdraw. - [PlayerTextDrawSetShadow](PlayerTextDrawSetShadow): Postavi sjenu na player-textdraw. - [PlayerTextDrawSetProportional](PlayerTextDrawSetProportional): Razmjeri razmak teksta u player-textdrawu na proporcionalni omjer. - [PlayerTextDrawUseBox](PlayerTextDrawUseBox): Omogući/onemogući korišćenje box-a za player-textdraw. - [PlayerTextDrawSetString](PlayerTextDrawSetString): Postavi tekst player-textdrawa. - [PlayerTextDrawShow](PlayerTextDrawShow): Prikaži player-textdraw. - [PlayerTextDrawHide](PlayerTextDrawHide): Sakrij player-textdraw.
openmultiplayer/web/docs/translations/bs/scripting/functions/PlayerTextDrawFont.md/0
{ "file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/PlayerTextDrawFont.md", "repo_id": "openmultiplayer", "token_count": 1230 }
357
--- title: RemoveBuildingForPlayer description: Uklanja standardni model San Andreasa za jednog igrača u određenom opsegu. tags: ["player"] --- ## Deskripcija Uklanja standardni model San Andreasa za jednog igrača u određenom opsegu. | Ime | Deskripcija | | ------------- | ---------------------------------------------------------------------- | | playerid | ID igrača za ukloniti objekte. | | modelid | Model za ukloniti. | | Float:fX | X kordinata oko koje će objekat biti obrisan. | | Float:fY | Y kordinata oko koje će objekat biti obrisan. | | Float:fZ | Z kordinata oko koje će objekat biti obrisan. | | Float:fRadius | Radijus oko navedene točke za uklanjanje objekata s navedenim modelom. | ## Returns Ova funkcija ne returna (vraća) nikakve posebne vrijednosti. ## Primjeri ```c public OnPlayerConnect(playerid) { // Kada se igrač konektuje, objekat sa modelom 615 će biti uklonjen u // rasponu od 200.0 od tačke 0.0, 0.0, 0.0, koja je centar San Andreas-a. RemoveBuildingForPlayer(playerid, 615, 0.0, 0.0, 0.0, 200.0); return 1; } public OnPlayerConnect(playerid) { // Kada se igrač konektuje, svi objekti sa mape će se ukloniti. RemoveBuildingForPlayer(playerid, -1, 0.0, 0.0, 0.0, 6000.0); return 1; } ``` ## Zabilješke :::tip U SA-MP 0.3.7 možete koristiti -1 za Modelid za uklanjanje svih objekata unutar navedenog radijusa. ::: :::warning Čini se da postoji ograničenje od oko 1000 linija/objekata. Zaobilazno rješenje nema. Kada uklonite isti predmet za igrača, oni će se srušiti. Obično se igrači sruše pri ponovnom povezivanju s serverom jer server uklanja zgrade na OnPlayerConnectu. ::: ## Srodne Funkcije - [DestroyObject](DestroyObject): Uništi objekat. - [DestroyPlayerObject](DestroyPlayerObject): Uništi player objekat.
openmultiplayer/web/docs/translations/bs/scripting/functions/RemoveBuildingForPlayer.md/0
{ "file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/RemoveBuildingForPlayer.md", "repo_id": "openmultiplayer", "token_count": 1015 }
358
--- title: SendPlayerMessageToPlayer description: Pošalji poruku u ime drugog igrača nekom drugom igraču na serveru. tags: ["player"] --- ## Deskripcija Pošalji poruku u ime drugog igrača nekom drugom igraču na serveru. Poruka će se pojaviti u chat boxu ali će je vidjeti samo igrač naveden kao 'playerid'. Linija će početi sa imenom pošiljaoca u njegovoj boji, prateći poruku u bijeloj boji. | Ime | Deskripcija | | --------------- | --------------------------------------------------------- | | playerid | ID igrača koji će primiti poruku. | | senderid | ID pošiljatelja. Ako je nevažeći, poruka se neće poslati. | | const message[] | Poruka koja će biti poslana. | ## Returns 1: Funkcija uspješno izvršena. 0: Funkcija neuspješno izvršena. Ovo znači da navedeni igrač ne postoji. ## Primjeri ```c public OnPlayerCommandText(playerid, cmdtext[]) { if (!strcmp(cmdtext, "/hello", true)) { SendPlayerMessageToPlayer(0, playerid, "Hello ID 0!"); // Poslati će poruku korisniku sa ID-em 0 u igri u ime igrača koji je napisao '/hello'. // Pod pretpostavkom da se 'playerid' zove Tenpenny, izlaz će biti 'Tenpenny: Hello ID 0!' return 1; } return 0; } ``` ## Zabilješke :::warning Izbjegavajte koristiti specifikatore formata u svojim porukama bez formatiranja poslanog stringa. U suprotnom će rezultirati padovima. ::: ## Srodne Funkcije - [SendPlayerMessageToAll](SendPlayerMessageToAll): Prisilite igrača da pošalje tekst za sve igrače. - [SendClientMessage](SendClientMessage): Pošalji poruku određenom igraču. - [SendClientMessageToAll](SendClientMessageToAll): Pošalji poruku svim igračima. - [OnPlayerText](../callbacks/OnPlayerText): Pozvano kada igrač pošalje poruku putem chata.
openmultiplayer/web/docs/translations/bs/scripting/functions/SendPlayerMessageToPlayer.md/0
{ "file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/SendPlayerMessageToPlayer.md", "repo_id": "openmultiplayer", "token_count": 839 }
359
--- title: SetObjectPos description: Promijeni poziciju objekta. tags: [] --- ## Deskripcija Promijeni poziciju objekta. | Ime | Deskripcija | | -------- | -------------------------------------------------------------------- | | objectid | ID objekta za postaviti poziciju. Returnovan/vraćen od CreateObject. | | Float:X | X kordinata za pozicionirati objekat. | | Float:Y | Y kordinata za pozicionirati objekat. | | Float:Z | Z kordinata za pozicionirati objekat. | ## Returns Ova funkcija uvijek returna (vraća) 1, even if Navedeni objekat ne postoji. ## Primjeri ```c SetObjectPos(objectid, 2001.195679, 1547.113892, 14.283400); ``` ## Srodne Funkcije - [CreateObject](CreateObject): Kreiraj objekat. - [DestroyObject](DestroyObject): Uništi objekat. - [IsValidObject](IsValidObject): Provjeri da li je određeni objekat validan. - [MoveObject](MoveObject): Pomjeri objekat. - [StopObject](StopObject): Zaustavi objekat od kretanja. - [SetObjectRot](SetObjectRot): Postavi rotaciju objekta. - [GetObjectPos](GetObjectPos): Lociraj objekat. - [GetObjectRot](GetObjectRot): Provjeri rotaciju objekta. - [AttachObjectToPlayer](AttachObjectToPlayer): Prikvači objekat za igrača. - [CreatePlayerObject](CreatePlayerObject): Kreiraj objekat za samo jednog igrača. - [DestroyPlayerObject](DestroyPlayerObject): Uništi player objekat. - [IsValidPlayerObject](IsValidPlayerObject): Provjeri da li je određeni player objekat validan. - [MovePlayerObject](MovePlayerObject): Pomjeri player objekat. - [StopPlayerObject](StopPlayerObject): Zaustavi player objekat od kretanja. - [SetPlayerObjectPos](SetPlayerObjectPos): Postavi poziciju player objekta. - [SetPlayerObjectRot](SetPlayerObjectRot): Postavi rotaciju player objekta. - [GetPlayerObjectPos](GetPlayerObjectPos): Lociraj player objekat. - [GetPlayerObjectRot](GetPlayerObjectRot): Provjeri rotaciju player objekta. - [AttachPlayerObjectToPlayer](AttachPlayerObjectToPlayer): Prikvači player objekat za igrača.
openmultiplayer/web/docs/translations/bs/scripting/functions/SetObjectPos.md/0
{ "file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/SetObjectPos.md", "repo_id": "openmultiplayer", "token_count": 849 }
360
--- title: SetPlayerDrunkLevel description: Postavlja nivo pijanosti igrača zbog kojeg se igračeva kamera njiše i vozila teško kontroliraju. tags: ["player"] --- ## Deskripcija Postavlja nivo pijanosti igrača zbog kojeg se igračeva kamera njiše i vozila teško kontroliraju. | Ime | Deskripcija | | -------- | --------------------------------- | | playerid | ID igrača za postaviti pijanstvo. | | level | Nivo pijanstva za postaviti. | ## Returns 1: Funkcija uspješno izvršena. 0: Funkcija neuspješno izvršena. Ovo znači da igrač nije konektovan. ## Primjeri ```c if (strcmp(cmdtext, "/drunk", true) == 0) { SetPlayerDrunkLevel (playerid, 4000); SendClientMessage(playerid, 0xFFFFFFAA, "Sada si pijan; nemoj da piješ i voziš!"); return 1; } ``` ## Zabilješke :::tip Pijani nivo igrača automatski će se smanjiti s vremenom, na osnovu njihovog FPS-a (igrači sa 50 FPS-a izgubit će 50 'nivoa' u sekundi. Ovo je korisno za određivanje FPS-a igrača!). U 0.3a nivo pijanca će se smanjiti i zaustaviti na 2000. U 0.3b + nivo pijanca se smanjuje na nulu.) Nivoi preko 2000 čine igrača pijanim (njihanje kamere i vozila teško kontrolirati). Maksimalni nivo pijanosti je 50000. Dok je nivo pijanosti iznad 5000, HUD igrača (radar itd.) će biti sakriven. ::: ## Srodne Funkcije - [GetPlayerDrunkLevel](GetPlayerDrunkLevel): Vraća trenutni nivo pijanstva igrača.
openmultiplayer/web/docs/translations/bs/scripting/functions/SetPlayerDrunkLevel.md/0
{ "file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/SetPlayerDrunkLevel.md", "repo_id": "openmultiplayer", "token_count": 661 }
361
--- title: SetPlayerPosFindZ description: Ovo postavlja poziciju igrača a potom prilagođava igračevu Z-kordinatu na najbliže čvrsto tlo ispod pozicije (položaja). tags: ["player"] --- ## Deskripcija Ovo postavlja poziciju igrača a potom prilagođava igračevu Z-kordinatu na najbliže čvrsto tlo ispod pozicije (položaja). | Ime | Deskripcija | | -------- | ------------------------------------ | | playerid | ID igrača za postaviti poziciju. | | Float:x | X kordinata za pozicionirati igrača. | | Float:y | X kordinata za pozicionirati igrača. | | Float:z | Z kordinata za pozicionirati igrača. | ## Returns 1: Funkcija uspješno izvršena. 0: Funkcija neuspješno izvršena. Ovo znači da navedeni igrač ne postoji. ## Primjeri ```c SetPlayerPosFindZ(playerid, 1234.5, 1234.5, 1000.0); ``` ## Zabilješke :::warning Ova funkcija ne radi ako su nove kordinate mnogo daleko od pozicije na kojima je igrač trenutno. Z visina će biti 0 što će igrača u većini slučajeva staviti pod zemlju. Vrlo je preporučljivo da koristite MapAndreas ili ColAndreas plugine umjesto ovoga. ::: ## Srodne Funkcije - [SetPlayerPos](SetPlayerPos): Postavite poziciju igrača. - [OnPlayerClickMap](../callbacks/OnPlayerClickMap): Pozvano kada igrač postavi marker ili target na mapi u pause meniju.
openmultiplayer/web/docs/translations/bs/scripting/functions/SetPlayerPosFindZ.md/0
{ "file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/SetPlayerPosFindZ.md", "repo_id": "openmultiplayer", "token_count": 606 }
362
--- title: SetSVarString description: Postavi string server varijablu. tags: [] --- :::warning Ova funkcija je dodana u SA-MP 0.3.7 R2 i ne radi u nižim verzijama! ::: ## Deskripcija Postavi string server varijablu. | Ime | Deskripcija | | -------------- | --------------------- | | varname[] | Ime server varijable. | | string_value[] | String za postaviti. | ## Returns 1: Funkcija uspješno izvršena. 0: Funkcija neuspješno izvršena. Ime varijable je prazno ili je preko 40 karaktera. ## Primjeri ```c // postavi "Version" SetSVarString("Version", "0.3.7"); // ispisati će verziju koju server ima new string[5 + 1]; GetSVarString("Version", string, sizeof(string)); printf("Version: %s", string); ``` ## Srodne Funkcije - [SetSVarInt](SetSVarInt): Postavite cijeli broj za varijablu servera. - [GetSVarInt](GetSVarInt): Dobij cjelobrojnu vrijednost server varijable. - [GetSVarString](GetSVarString): Dobij prethodno postavljeni string iz server varijable. - [SetSVarFloat](SetSVarFloat): Postavi float za server varijablu. - [GetSVarFloat](GetSVarFloat): Dobij prethodno postavljeni float iz server varijable. - [DeleteSVar](DeleteSVar): Obriši server varijablu.
openmultiplayer/web/docs/translations/bs/scripting/functions/SetSVarString.md/0
{ "file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/SetSVarString.md", "repo_id": "openmultiplayer", "token_count": 491 }
363
--- title: SetVehicleZAngle description: Postavi Z rotaciju (yaw) vozila. tags: ["vehicle"] --- ## Deskripcija Postavi Z rotaciju (yaw) vozila. | Ime | Deskripcija | | ------------- | -------------------------------- | | vehicleid | ID vozila za postaviti rotaciju. | | Float:z_angle | Z ugao za postaviti. | ## Returns 1: Funkcija uspješno izvršena. 0: Funkcija neuspješno izvršena. Navedeno vozilo ne postoji. ## Primjeri ```c public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp(cmdtext, "/flip", true) == 0) { new currentVehicle, Float: angle; currentVehicle = GetPlayerVehicleID(playerid); GetVehicleZAngle(currentVehicle, angle); SetVehicleZAngle(currentVehicle, angle); SendClientMessage(playerid, 0xFFFFFFFF, "Tvoje vozilo je prevrnuto."); return 1; } return 0; } ``` ## Zabilješke :::**tip** Kada se koristi ova funkcija, okretanje vozila X i Y (nagib i kotrljanje) resetirat će se. Rotacije X i Y ne mogu se postaviti. Ova funkcija ne radi na neuzetim vozilima (vjeruje se da je to GTA ograničenje). ::: ## Srodne Funkcije - [GetVehicleZAngle](GetVehicleZAngle): Provjerite trenutni ugao vozila. - [SetVehiclePos](SetVehiclePos): Postavi poziciju vozila.
openmultiplayer/web/docs/translations/bs/scripting/functions/SetVehicleZAngle.md/0
{ "file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/SetVehicleZAngle.md", "repo_id": "openmultiplayer", "token_count": 611 }
364
--- title: TextDrawAlignment description: Postavite poravnanje teksta u textdrawu. tags: ["textdraw"] --- ## Deskripcija Postavite poravnanje teksta u textdrawu. | Ime | Deskripcija | | --------- | ------------------------------------- | | Text:text | ID textdrawa za postaviti poravnanje. | | alignment | 1-lijevo 2-centrirano 3-desno. | ## Returns Note Za poravnanje 2 (centrirano) x i y vrijednosti TextSize-a treba zamijeniti, pogledaj zabilješke na TextDrawTextSize, zakođer pozicija kordinata postaje pozicija centra textdrawa a ne lijevi/gornji rubovi. ## Primjeri ```c new Text: gMyTextdraw; public OnGameModeInit() { gMyTextdraw = TextDrawCreate(320.0, 425.0, "Ovo je primjer textdrawa"); TextDrawAlignment(gMyTextdraw, 2); // Poravnajte tekst za textdraw u sredinu (centar) return 1; } ``` ## Zabilješke :::tip Ako je textdraw već prikazan, on mora biti ponovno prikazan (TextDrawShowForAll/TextDrawShowForPlayer) kako bi se prikazale promjene ove funkcije. ::: ## Srodne Funkcije - [TextDrawCreate](TextDrawCreate): Kreiraj textdraw. - [TextDrawDestroy](TextDrawDestroy): Uništi textdraw. - [TextDrawColor](TextDrawColor): Postavi boju teksta u textdrawu. - [TextDrawBoxColor](TextDrawBoxColor): Postavi boju boxa u textdrawu. - [TextDrawBackgroundColor](TextDrawBackgroundColor): Postavi boju pozadine textdrawa. - [TextDrawFont](TextDrawFont): Postavi font textdrawa. - [TextDrawLetterSize](TextDrawLetterSize): Postavi veličinu znakova teksta u textdrawu. - [TextDrawTextSize](TextDrawTextSize): Postavi veličinu boxa u textdrawu. - [TextDrawSetOutline](TextDrawSetOutline): Odluči da li da tekst ima outline. - [TextDrawSetShadow](TextDrawSetShadow): Uključi/isključi sjene (shadows) na textdrawu. - [TextDrawSetProportional](TextDrawSetProportional): Razmjestite razmak između teksta u texstdrawu na proporcionalni omjer. - [TextDrawUseBox](TextDrawUseBox): Uključite ili isključite da li textdraw koristi box ili ne. - [TextDrawSetString](TextDrawSetString): Postavi tekst u već postojećem textdrawu. - [TextDrawShowForPlayer](TextDrawShowForPlayer): Prikaži textdraw za određenog igrača. - [TextDrawHideForPlayer](TextDrawHideForPlayer): Sakrij textdraw za određenog igrača. - [TextDrawShowForAll](TextDrawShowForAll): Prikaži textdraw za sve igrače. - [TextDrawHideForAll](TextDrawHideForAll): Sakrij textdraw za sve igrače.
openmultiplayer/web/docs/translations/bs/scripting/functions/TextDrawAlignment.md/0
{ "file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/TextDrawAlignment.md", "repo_id": "openmultiplayer", "token_count": 942 }
365
--- title: TextDrawSetShadow description: Postavlja veličinu sjene teksta u textdrawu. tags: ["textdraw"] --- ## Deskripcija Postavlja veličinu sjene teksta u textdrawu. | Ime | Deskripcija | | ---- | --------------------------------------------------------------------------------------------------- | | text | ID textdrawa za postaviti veličinu sjene teksta. | | size | Veličina sjene. 1 se najčešće koristi za normalnu veličinu sjene. 0 onemogućava sjenu u potpunosti. | ## Returns 1: Funkcija uspješno izvršena. 0: Funkcija neuspješno izvršena. Textdraw ne postoji. ## Primjeri ```c new Text: gMyTextdraw; public OnGameModeInit() { gMyTextdraw = TextDrawCreate(100.0, 33.0, "Primjer Textdrawa"); TextDrawSetShadow(gMyTextdraw, 1); return 1; } ``` ## Zabilješke :::tip Sjena može biti presječena/odrezana od strane područja boxa ako je postavljena veličina previše velika za područje. ::: :::tip Ako želite promijeniti sjenu textdrawa koji je već prikazan, ne morate ga ponovno kreirati. Prosto koristite TextDrawShowForPlayer/TextDrawShowForAll nakon uređivanja i promjena će biti vidljiva. ::: ## Srodne Funkcije - [TextDrawCreate](TextDrawCreate): Kreiraj textdraw. - [TextDrawDestroy](TextDrawDestroy): Uništi textdraw. - [TextDrawColor](TextDrawColor): Postavi boju teksta u textdrawu. - [TextDrawBoxColor](TextDrawBoxColor): Postavi boju boxa u textdrawu. - [TextDrawBackgroundColor](TextDrawBackgroundColor): Postavi boju pozadine textdrawa. - [TextDrawAlignment](TextDrawAlignment): Postavi poravnanje textdrawa. - [TextDrawFont](TextDrawFont): Postavi font textdrawa. - [TextDrawLetterSize](TextDrawLetterSize): Postavi veličinu znakova teksta u textdrawu. - [TextDrawTextSize](TextDrawTextSize): Postavi veličinu boxa u textdrawu. - [TextDrawSetOutline](TextDrawSetOutline): Odluči da li da tekst ima outline. - [TextDrawSetProportional](TextDrawSetProportional): Razmjestite razmak između teksta u texstdrawu na proporcionalni omjer. - [TextDrawUseBox](TextDrawUseBox): Uključite ili isključite da li textdraw koristi box ili ne. - [TextDrawSetString](TextDrawSetString): Postavi tekst u već postojećem textdrawu. - [TextDrawShowForPlayer](TextDrawShowForPlayer): Prikaži textdraw za određenog igrača. - [TextDrawHideForPlayer](TextDrawHideForPlayer): Sakrij textdraw za određenog igrača. - [TextDrawShowForAll](TextDrawShowForAll): Prikaži textdraw za sve igrače. - [TextDrawHideForAll](TextDrawHideForAll): Sakrij textdraw za sve igrače.
openmultiplayer/web/docs/translations/bs/scripting/functions/TextDrawSetShadow.md/0
{ "file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/TextDrawSetShadow.md", "repo_id": "openmultiplayer", "token_count": 1094 }
366
--- title: acos description: . tags: [] --- :::warning Ova funkcija započinje malim slovom. ::: ## Deskripcija Dobijte obrnutu vrijednost kosinusa luka u radijanima. | Ime | Deskripcija | | ----------- | --------------------- | | Float:value | unos u kosinusu luka. | ## Returns Glavni kosinus luka od x, u intervalu [0, pi] radijana. Jedan radijan je jednak 180 / PI stepeni. ## Primjeri ```c //Glavni kosinus od 0.500000 je 60.000000 stepeni. public OnGameModeInit() { new Float:param, Float:result; param = 0.5; result = acos (param) * 180.0 / PI; printf ("Glavni kosinus od %f je %f stepeni.\n", param, result); return 0; } ``` ## Srodne Funkcije - [floatsin](floatsin.md): Doznajte sinus iz određenog ugla. - [floatcos](floatcos.md): Doznajte kosinus iz određenog ugla. - [floattan](floattan.md): Doznajte tangent iz određenog ugla.
openmultiplayer/web/docs/translations/bs/scripting/functions/acos.md/0
{ "file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/acos.md", "repo_id": "openmultiplayer", "token_count": 402 }
367
--- title: floatabs description: Ova funkcija vraća apsolutnu vrijednost float-a. tags: [] --- :::warning Ova funkcija započinje malim slovom. ::: ## Deskripcija Ova funkcija vraća apsolutnu vrijednost float-a. | Ime | Deskripcija | | ----------- | ---------------------------------------------------- | | Float:value | Float vrijednost za dobivanje apsolutne vrijednosti. | ## Returns Apsolutna vrijednost float-a (kao float-vrijednost). ## Primjeri ```c floatabs(47.0); // Ovo će returnovati/vratiti 47.0. floatabs(-47.0); // Ovo će returnovati/vratiti isto ``` ## Srodne Funkcije
openmultiplayer/web/docs/translations/bs/scripting/functions/floatabs.md/0
{ "file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/floatabs.md", "repo_id": "openmultiplayer", "token_count": 304 }
368
--- title: fopen description: Otvorite datoteku (za čitanje ili pisanje). tags: [] --- :::warning Ova funkcija započinje malim slovom. ::: ## Deskripcija Otvorite datoteku (za čitanje ili pisanje). | Ime | Deskripcija | | ------ | -------------------------------------------------------------------------------------------------------------------------------------- | | name[] | Path do datoteke koju treba otvoriti (ako je navedeno samo ime datoteke, otvorit će datoteku s imenom navedenim u mapi 'scriptfiles'). | | mode | Režim kojim treba otvoriti datoteku (zadano: io_readwrite). | ## Returns Vraća upravitelj datoteke. Ovaj upravitelj se koristi za čitanje i pisanje. 0 ako nije uspjelo otvoriti datoteku. ## Primjeri ```c // Otvori "file.txt" u "read only" modu (samo čitanje) new File:handle = fopen("file.txt", io_read), // Inicijalizirajte "buf" buf[128]; // Provjerite je li datoteka otvorena if (handle) { // Uspješno // Čitajte cijelu datoteku while(fread(handle, buf)) print(buf); // Zatvori fajl/datoteku fclose(handle); } else { // Error print("The file \"file.txt\" does not exists, or can't be opened."); } // 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\"."); } ``` ```p io_read Čita iz fajla. io_write Upišite u datoteku ili kreirajte datoteku ako ona ne postoji. Briše sve postojeće sadržaje. io_readwrite Čita datoteku ili je kreira ako već ne postoji. io_append Dodaje (dodaje) u datoteku, samo za pisanje. Ako datoteka ne postoji, ona se kreira. ``` ## Zabilješke :::warning Ako koristite io_read, a datoteka ne postoji, vratit će NULL referencu. Korištenje nevažećih referenci na funkcijama datoteka srušit će vaš server! ::: ## 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/fopen.md/0
{ "file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/fopen.md", "repo_id": "openmultiplayer", "token_count": 1926 }
369
--- title: ispacked description: Provjerava je li zadati string spakovan. tags: [] --- :::warning Ova funkcija započinje malim slovom. ::: ## Deskripcija Provjerava je li zadati string spakovan. | Ime | Deskripcija | | ------ | --------------------- | | string | String za provjeriti. | ## Returns 1 ako je string upakovan, 0 if ako je raspakiran. ## Primjeri ```c // Kreiraj upakovani string new string[24 char]; if (ispacked(string)) { print("String je spakovan."); } ``` ## Srodne Funkcije
openmultiplayer/web/docs/translations/bs/scripting/functions/ispacked.md/0
{ "file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/ispacked.md", "repo_id": "openmultiplayer", "token_count": 211 }
370
--- title: strfind description: Potraži podstring u stringu. tags: [] --- :::warning Ova funkcija započinje malim slovom. ::: ## Deskripcija Potraži podstring u stringu. | Ime | Deskripcija | | --------------------- | --------------------------------------------------------------------------------------------------------------------------------- | | const string[] | String u kojem želite tražiti (haystack). | | const sub[] | String kojeg želite tražiti (needle). | | ignorecase (optional) | Kada je postavljeno na 'true', velika slova nemaju veze - HeLLo je isto kao Hello. Kada je postavljeno na 'false', oni nisu isti. | | Position (optional) | Pomak od kojeg treba započeti pretragu. | ## Returns Broj znakova prije podstringa (početna pozicija podstringa) ili -1 ako nije pronađen. ## Primjeri ```c if (strfind("Are you in here?", "you", true) != -1) //vraća 4, zato što početak od 'you' (y) je na indexu 4 u stringu { SendClientMessageToAll(0xFFFFFFFF, "Pronašao sam te!"); } ``` ## Srodne Funkcije - [strcmp](strcmp): Uporedi dva stringa kako bi provjerio da li su isti. - [strdel](strdel): Obriši dio stringa. - [strins](strins): Unesi tekst u string. - [strlen](strlen): Dobij dužinu stringa. - [strmid](strmid): Izdvoji dio stringa u drugi string. - [strpack](strpack): Upakuj string u odredišni string. - [strval](strval): Pretvori string u cijeli broj. - [strcat](strcat): Spojite dva stringa u odredišnu referencu.
openmultiplayer/web/docs/translations/bs/scripting/functions/strfind.md/0
{ "file_path": "openmultiplayer/web/docs/translations/bs/scripting/functions/strfind.md", "repo_id": "openmultiplayer", "token_count": 974 }
371
--- title: "ID Kostiju" --- :::note Ova stranica sadrži sve ID-ove kostiju koje koristi [SetPlayerAttachedObject](../functions/SetPlayerAttachedObject). ::: | ID | Kost | | --- | -------------------------- | | 1 | Kičma | | 2 | Glava | | 3 | Lijeva nadlaktica | | 4 | Desna nadlaktica | | 5 | Lijeva ruka | | 6 | Desna ruka | | 7 | Lijevo bedro | | 8 | Desno bedro | | 9 | Lijevo stopalo | | 10 | Desno stopalo | | 11 | Desni list | | 12 | Lijevi list | | 13 | Lijeva podlaktica | | 14 | Desna podlaktica | | 15 | Lijeva ključna kost (rame) | | 16 | Desna ključna kost (rame) | | 17 | Vrat | | 18 | Vilica |
openmultiplayer/web/docs/translations/bs/scripting/resources/boneid.md/0
{ "file_path": "openmultiplayer/web/docs/translations/bs/scripting/resources/boneid.md", "repo_id": "openmultiplayer", "token_count": 566 }
372
--- title: OnClientMessage description: Dieses Callback wird ausgeführt wenn ein NPC eine ClientMessage erkennt. tags: [] --- ## Description Dieses Callback wird ausgeführt wenn ein NPC eine ClientMessage erkennt. Er erkennt die ClientMessage bei Benutzung von SendClientMessageToAll oder wenn SendClientMessage direkt an den NPC gesendet wird.function is used and everytime a SendClientMessage function is sent towards the NPC. ACHTUNG: Das Callback wird nicht ausgeführt, wenn jemand in den Chat schreibt. Für eine Version mit Spieler Text, siehe NPC:OnPlayerText. | Name | Beschreibung | | ------ | ------------------------------- | | color | The color the ClientMessage is. | | text[] | The actual message. | ## Rückgabe(return value) Dieses Callback hat keinen Rückgabewert. ## Beispiele ```c public OnClientMessage(color, text[]) { if (strfind(text,"Kontostand: $0") != -1) { SendClientMessage(playerid, -1, "Ich bin arm :("); } } ```
openmultiplayer/web/docs/translations/de/scripting/callbacks/OnClientMessage.md/0
{ "file_path": "openmultiplayer/web/docs/translations/de/scripting/callbacks/OnClientMessage.md", "repo_id": "openmultiplayer", "token_count": 381 }
373
--- title: ¡Bienvenido! sidebar_label: ¡Bienvenido! --- ¡Bienvenido a la wiki de SA:MP, mantenida por el equipo de open.mp y la extensa comunidad de SA:MP! Éste sitio tiene como objetivo proveer acceso y la posibilidad de contribuir a la documentación de SA:MP (y, eventualmente, open.mp). ## La Wiki de SA:MP cerró Desafortunadamente, la wiki de SA:MP fue cerrada en fines de septiembre (aunque gran parte de su contenido puede ser encontrado en el archivo público de internet). ¡Necesitamos ayuda de la comunidad para transferir el contenido de la vieja wiki a su nuevo hogar, aquí! Si estás interesado, mira este [link](/docs/meta/Contributing) para obtener instrucciones de como convertir contenido. Si no tienes experiencia utilizando GitHub o convirtiendo HTML, ¡no te preocupes! Puedes ayudar con solo avisarnos acerca de problemas (mediante Discord[https://discord.gg/samp], [el foro](https://forum.open.mp) u otras redes sociales) y lo más importante: _¡Difundir este sitio!_, así que asegúrate de agregar este sitio a tus marcadores y compartirlo con cualquiera que conozcas y sepas que precisa la ya inexistente wiki de SA:MP. Sean bienvenidas las contribuciones y mejoras a la documentación al igual que los tutoriales o guías para tareas comunes como crear modos de juego (gamemodes) simples y el uso de librerías y plugins comunes. Si estás interesado en contribuir entonces dirígete a la [página de GitHub](https://github.com/openmultiplayer/web).
openmultiplayer/web/docs/translations/es/index.md/0
{ "file_path": "openmultiplayer/web/docs/translations/es/index.md", "repo_id": "openmultiplayer", "token_count": 535 }
374
--- título: OnPlayerClickPlayerTextDraw descripción: Este callback se llama cuando un jugador clickea en un player-textdraw. tags: ["player", "textdraw", "playertextdraw"] --- ## Descripción Este callback se llama cuando un jugador clickea en un player-textdraw. No se llama cuando el jugador cancela el modo de selección (ESC), sin embargo, OnPlayerClickTextdraw sí. | Nombre | Descripción | | ------------ | ------------------------------------------------------- | | playerid | El ID del jugador que seleccionó un textdraw. | | playertextid | El ID del player-textdraw que el jugador seleccionó. | ## Devoluciones 1 - Prevendrá a otros filterscripts de recibir este callback. 0 - Indica que este callback será pasado al siguiente filterscript. Siempre se llama primero en filterscripts. ## Ejemplos ```c new PlayerText:gPlayerTextDraw[MAX_PLAYERS]; public OnPlayerConnect(playerid) { // Create the textdraw gPlayerTextDraw[playerid] = CreatePlayerTextDraw(playerid, 10.000000, 141.000000, "MyTextDraw"); PlayerTextDrawTextSize(playerid, gPlayerTextDraw[playerid], 60.000000, 20.000000); PlayerTextDrawAlignment(playerid, gPlayerTextDraw[playerid],0); PlayerTextDrawBackgroundColor(playerid, gPlayerTextDraw[playerid],0x000000ff); PlayerTextDrawFont(playerid, gPlayerTextDraw[playerid], 1); PlayerTextDrawLetterSize(playerid, gPlayerTextDraw[playerid], 0.250000, 1.000000); PlayerTextDrawColor(playerid, gPlayerTextDraw[playerid], 0xffffffff); PlayerTextDrawSetProportional(playerid, gPlayerTextDraw[playerid], 1); PlayerTextDrawSetShadow(playerid, gPlayerTextDraw[playerid], 1); // Make it selectable PlayerTextDrawSetSelectable(playerid, gPlayerTextDraw[playerid], 1); // Show it to the player PlayerTextDrawShow(playerid, gPlayerTextDraw[playerid]); return 1; } public OnPlayerKeyStateChange(playerid, KEY:newkeys, KEY:oldkeys) { if (newkeys == KEY_SUBMISSION) { SelectTextDraw(playerid, 0xFF4040AA); } return 1; } public OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid) { if (playertextid == gPlayerTextDraw[playerid]) { SendClientMessage(playerid, 0xFFFFFFAA, "Clickeaste en un textdraw."); CancelSelectTextDraw(playerid); return 1; } return 0; } ``` ## Notas :::warning Cuando un jugador presiona ESC para cancelar la selección de un textdraw, OnPlayerClickTextDraw es llamado con un textdraw ID 'INVALID_TEXT_DRAW'. En estos casos, OnPlayerClickPlayerTextDraw no se llamará. ::: ## Funciones Relacionadas - [PlayerTextDrawSetSelectable](../functions/PlayerTextDrawSetSelectable): Establece si un player-textdraw es seleccionable mediante SelectTextDraw. - [OnPlayerClickTextDraw](OnPlayerClickTextDraw): Se llama cuando un jugador clickea en un textdraw. - [OnPlayerClickPlayer](OnPlayerClickPlayer): Se llama cuando un jugador clickea en otro (scoreboard).
openmultiplayer/web/docs/translations/es/scripting/callbacks/OnPlayerClickPlayerTextDraw.md/0
{ "file_path": "openmultiplayer/web/docs/translations/es/scripting/callbacks/OnPlayerClickPlayerTextDraw.md", "repo_id": "openmultiplayer", "token_count": 1082 }
375
--- título: OnPlayerInteriorChange descripción: Se llama cuando un jugador cambia de interior. tags: ["player"] --- ## Descripción Se llama cuando un jugador cambia de interior. Puede ser desencadenada por SetPlayerInterior o cuando un jugador entra o sale de un edificio. | Nombre | Descripción | | ------------- | ---------------------------------------------- | | playerid | El ID del jugador que cambió de interior. | | newinteriorid | El interior en el que el jugador está ahora. | | oldinteriorid | El interior en el que el jugador estaba antes. | ## Devoluciones Siempre se llama primero en el gamemode. ## Ejemplos ```c public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid) { new string[42]; format(string, sizeof(string), "Cambiaste del interior %d al interior %d!", oldinteriorid, newinteriorid); SendClientMessage(playerid, COLOR_ORANGE, string); return 1; } ``` ## Funciones Relacionadas - [SetPlayerInterior](../functions/SetPlayerInterior): Establecer el interior a un jugador. - [GetPlayerInterior](../functions/GetPlayerInterior): Obtener el interior actual de un jugador. - [LinkVehicleToInterior](../functions/LinkVehicleToInterior): Cambiar el interior en el que un vehículo es visible. - [OnPlayerStateChange](OnPlayerStateChange): Se llama cuando el estado de un jugador cambia.
openmultiplayer/web/docs/translations/es/scripting/callbacks/OnPlayerInteriorChange.md/0
{ "file_path": "openmultiplayer/web/docs/translations/es/scripting/callbacks/OnPlayerInteriorChange.md", "repo_id": "openmultiplayer", "token_count": 494 }
376
--- título: OnPlayerText descripción: Se llama cuando un jugador envía un mensaje en el chat. tags: ["player"] --- ## Descripción Se llama cuando un jugador envía un mensaje en el chat. | Nombre | Descripción | | -------- | ---------------------------------------- | | playerid | El ID del jugador que escribió el texto. | | text[] | El texto que escribió el jugador. | ## 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 OnPlayerText(playerid, text[]) { new pText[144]; format(pText, sizeof (pText), "(%d) %s", playerid, text); SendPlayerMessageToAll(playerid, pText); return 0; // ignora el texto predeterminado y envía el personalizado } ``` ## Notas <TipNPCCallbacksES /> ## Funciones Relacionadas - [SendPlayerMessageToPlayer](../functions/SendPlayerMessageToPlayer): Obliga a un jugador a enviar mensajes de texto para un jugador. - [SendPlayerMessageToAll](../functions/SendPlayerMessageToAll): Obliga a un jugador a enviar texto para todos los jugadores.
openmultiplayer/web/docs/translations/es/scripting/callbacks/OnPlayerText.md/0
{ "file_path": "openmultiplayer/web/docs/translations/es/scripting/callbacks/OnPlayerText.md", "repo_id": "openmultiplayer", "token_count": 446 }
377
--- título: OnVehicleStreamOut descripción: Este callback se llama cuando un vehículo es dejado de cargar (deja de ser visible) por el cliente de un jugador. tags: ["vehicle"] --- ## Descripción Este callback se llama cuando un vehículo es dejado de cargar (deja de ser visible) por el cliente de un jugador. | Nombre | Descripción | | ----------- | ------------------------------------------------------------ | | vehicleid | El ID del vehículo que es dejado de cargar. | | forplayerid | El ID del jugador que dejó de cargar el vehículo. | ## Devoluciones Siempre se llama primero en filterscripts. ## Ejemplos ```c public OnVehicleStreamOut(vehicleid, forplayerid) { new string[48]; format(string, sizeof(string), "Tu cliente dejó de cargar el vehículo %d", vehicleid); SendClientMessage(forplayerid, 0xFFFFFFFF, string); return 1; } ``` ## Notas <TipNPCCallbacksES /> ## Funciones Relacionadas
openmultiplayer/web/docs/translations/es/scripting/callbacks/OnVehicleStreamOut.md/0
{ "file_path": "openmultiplayer/web/docs/translations/es/scripting/callbacks/OnVehicleStreamOut.md", "repo_id": "openmultiplayer", "token_count": 412 }
378
--- title: SendClientMessage description: این تابع با یک رنگ انتخاب شده در چت پیامی را به یک بازیکن خاص ارسال می کند. tags: [] --- <div dir="rtl" style={{ textAlign: "right" }}> ## توضیحات این تابع با یک رنگ انتخاب شده در چت پیامی را به یک بازیکن خاص ارسال می کند. کل خط در جعبه چت به رنگ تعیین شده خواهد بود مگر اینکه جاسازی رنگ استفاده شود. | اسم | توضیح | | --------------- | ----------------------------------------------------- | | playerid | شناسه بازیکن برای نمایش پیام | | color | رنگ پیام (0xRRGGBBAA Hex format). | | const message[] | متنی که نمایش داده می شود (حداکثر 144 کاراکتر). | ## مقادیر برگشتی 1: تابع با موفقیت اجرا شد. وقتی رشته بیش از 144 کاراکتر باشد ، موفقیت گزارش داده می شود ، اما پیام ارسال نمی شود. 0: تابع اجرا نشد. بازیکن متصل نیست. ## مثال ها </div> ```c #define COLOR_RED 0xFF0000FF public OnPlayerConnect(playerid) { SendClientMessage(playerid, COLOR_RED, "In matn ghermez ast"); SendClientMessage(playerid, 0x00FF00FF, "In matn sabz ast"); SendClientMessage(playerid, -1, "In matn sefid ast."); return 1; } ``` <div dir="rtl" style={{ textAlign: "right" }}> ## نکته ها :::tip می توانید از جاسازی رنگ برای چندین رنگ در پیام استفاده کنید. با استفاده از "-1" به عنوان رنگ ، متن سفید می شود (به همین دلیل ساده که -1 ، اگر در نماد hexadecimal نشان داده شود ، 0xFFFFFFFF است). ::: :::warning اگر پیامی بیش از 144 کاراکتر داشته باشد، ارسال نمی شود. برای جلوگیری از این امر می توان از کوتاه کردن استفاده کرد. نمایش پیام در چندین خط نیز این مسئله را حل می کند. از استفاده از علامت درصد (یا مشخص کننده های فرمت) در متن پیام واقعی بدون فرار صحیح از آن خودداری کنید (مانند ٪٪). در غیر این صورت منجر به crash(خرابی) می شود. ::: ## تابع های مرتبط - [SendClientMessageToAll](SendClientMessageToAll): فرستادن پیام به همه بازیکن ها. - [SendPlayerMessageToPlayer](SendPlayerMessageToPlayer) - [SendPlayerMessageToAll](SendPlayerMessageToAll) </div>
openmultiplayer/web/docs/translations/fa/scripting/functions/SendClientMessage.md/0
{ "file_path": "openmultiplayer/web/docs/translations/fa/scripting/functions/SendClientMessage.md", "repo_id": "openmultiplayer", "token_count": 1581 }
379
--- title: OnDialogResponse description: This callback is called when a player responds to a dialog shown using ShowPlayerDialog by either clicking a button, pressing ENTER/ESC or double-clicking a list item (if using a list style dialog). tags: [] --- ## Deskripsyon Ang callback na ito ay na cacall kapag ang player ay nag respond sa isang dialog na ipinakita gamit ang ShowPlayerDialog gamit ang pag click sa isang button, pagpindot ng `ENTER/ESC` o pag `Double Click` sa isang laman ng list. (kung ang dialog ay DIALOG_STYLE_LIST). | Pangala | Deskripsyon | | ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | | playerid | Ang ID ng player na nag respond sa dialog. | | dialogid | Ang ID ng dialog na pinag respond ng player, naka assign ito sa ShowPlayerDialog. | | response | 1 para sa unang button (kaliwa) at 0 para sa pangalawang button (kanan), kung isa lang ang button, ang 1 ang magagamit. | | listitem | Ang ID ng nilalaman ng list na pinili ng isang player (nag uumpisa sa 0) (kapag lamang gumagamit ng DIALOG_STYLE_LIST, kung hindi ito ay magiging -1. | | inputtext[] | Ang text/sulat na nilagay ng player sa input box o ang piniling nilalaman ng list. | ## Returns Lagi itong na cacall una sa mga filterscript kaya kapag nag return ng 1 binoblock ang ibang filterscript mula sa pagtingin dito. ## Mga Halimbawa ```c // Dito ilalagay ang ID ng isang dialog #define DIALOG_RULES 1 // Sa isang command ShowPlayerDialog(playerid, DIALOG_RULES, DIALOG_STYLE_MSGBOX, "Server Rules", "- No Cheating\n- No Spamming\n- Respect Admins\n\nDo you agree to these rules?", "Yes", "No"); public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if (dialogid == DIALOG_RULES) { if (response) // Kung pinili nila ang `YES` o pinindot ang `ENTER` { SendClientMessage(playerid, COLOR_GREEN, "Thank you for agreeing to the server rules!"); } else // Kapag pinili ang `NO`, pinindot ang `ESC` o hindi sumagot. { Kick(playerid); } return 1; // Gumamit tayo ng dialog kaya return 1 parang sa OnPlayerCommandText. } return 0; // Kailangan mag return 0 dito! Kamuka lang ng sa OnPlayerCommandText. } // Panagalawang halimbawa #define DIALOG_LOGIN 2 // Sa isang command ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Login", "Please enter your password:", "Login", "Cancel"); public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if (dialogid == DIALOG_LOGIN) { if (!response) // Kapag pinili ang `Cancel`, pinindot ang `ESC` o hindi sumagot. { Kick(playerid); } else // Kung pinili nila ang `LOGIN` o pinindot ang `ENTER` { if (CheckPassword(playerid, inputtext)) { SendClientMessage(playerid, COLOR_RED, "You are now logged in!"); } else { SendClientMessage(playerid, COLOR_RED, "LOGIN FAILED."); // Ipakita muli ang Dialog. ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Login", "Please enter your password:", "Login", "Cancel"); } } return 1; // Gumamit tayo ng dialog kaya return 1 parang sa OnPlayerCommandText. } return 0; // Kailangan mag return 0 dito! Kamuka lang ng sa OnPlayerCommandText. } // Pangatlong halimbawa #define DIALOG_WEAPONS 3 // Sa isang command ShowPlayerDialog(playerid, DIALOG_WEAPONS, DIALOG_STYLE_LIST, "Weapons", "Desert Eagle\nAK-47\nCombat Shotgun", "Select", "Close"); public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if (dialogid == DIALOG_WEAPONS) { if (response) // Kung pinili ang `Select` o pumili sa isang baril na nakalista { // Ibibigay ang baril na pinili switch(listitem) { case 0: GivePlayerWeapon(playerid, WEAPON_DEAGLE, 14); // Magbibigay ng ID 24 na baril o (Deagle) case 1: GivePlayerWeapon(playerid, WEAPON_AK47, 120); // Magbibigay ng ID 30 na baril o (AK-47) case 2: GivePlayerWeapon(playerid, WEAPON_SHOTGSPA, 28); // Magbibigay ng ID 27 na baril o (Combat Shotgun) } } return 1; // Gumamit tayo ng dialog kaya return 1 parang sa OnPlayerCommandText. } return 0; // Kailangan mag return 0 dito! Kamuka lang ng sa OnPlayerCommandText. } // Pangatlong halimbawa pero ibang paraan at ibang mga baril #define DIALOG_WEAPONS 3 // In some command ShowPlayerDialog(playerid, DIALOG_WEAPONS, DIALOG_STYLE_LIST, "Weapons", "Weapon\tAmmo\tPrice\n\ M4\t120\t500\n\ MP5\t90\t350\n\ AK-47\t120\t400", "Select", "Close"); public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if (dialogid == DIALOG_WEAPONS) { if (response) // Kung pinili ang `Select` o pumili sa isang baril na nakalista { // Ibibigay ang baril na pinili switch(listitem) { case 0: GivePlayerWeapon(playerid, WEAPON_M4, 120); // Magbibigay ng ID 31 na baril o (M4) case 1: GivePlayerWeapon(playerid, WEAPON_MP5, 90); // Magbibigay ng ID 29 na baril o (MP5) case 2: GivePlayerWeapon(playerid, WEAPON_AK47, 120); // Magbibigay ng ID 30 na baril o (AK-47) } } return 1; // Gumamit tayo ng dialog kaya return 1 parang sa OnPlayerCommandText. } return 0; // Kailangan mag return 0 dito! Kamuka lang ng sa OnPlayerCommandText. } ``` ## Mga Dapat Unawain :::tip Ang mga parameters ay maaaring lagyan ng iba't ibang values base sa style ng isang dialog. ([tignan ito](../resources/dialogstyles.md)). ::: :::tip Magandang gumamit ng switch para sa iyong mga dialogids kung marami kang dialogs. ::: :::warning Ang dialog ng isang player ay hindi mawawala kapag nag restart ang server, nagdadahilan dito ang pag print ng "Warning: PlayerDialogResponse PlayerId: 0 dialog ID doesn't match last sent dialog ID" kapag ang player ay nag respond sa dialog katapos ng restart. ::: ## Mga Kaugnay na Functions - [ShowPlayerDialog](../functions/ShowPlayerDialog.md): Ipakita ang dialog sa player.
openmultiplayer/web/docs/translations/fil/scripting/callbacks/OnDialogResponse.md/0
{ "file_path": "openmultiplayer/web/docs/translations/fil/scripting/callbacks/OnDialogResponse.md", "repo_id": "openmultiplayer", "token_count": 2959 }
380
--- title: OnPlayerClickPlayer description: Called when a player double-clicks on a player on the scoreboard. tags: ["player"] --- ## Description Itinatawag kapag ang player ay nag-double-click sa isang player sa scoreboard. (Tab) | Name | Description | | --------------- | ---------------------------------------------------------------- | | playerid | Ang ID ng player na nag-pindot ng isang player sa scoreboard. | | clickedplayerid | Ang ID ng player na ipinindot. | | source | Ang source na pinagpindutan ng player. | ## Returns 1 - Ay pipigilan ang ibang filterscripts na tanggapin itong callback. 0 - Ipinapahiwatig na ang callback na ito ay ipapasa sa susunod na filterscript. Ito ay palaging itinatawag una sa mga filterscripts. ## Examples ```c public OnPlayerClickPlayer(playerid, clickedplayerid, CLICK_SOURCE:source) { new message[32]; format(message, sizeof(message), "Ipinindot mo si player id: %d", clickedplayerid); SendClientMessage(playerid, 0xFFFFFFFF, message); return 1; } ``` ## Mga Dapat Unawain :::tip Sa kasalukuyan, isa lang ang 'source' (0 - CLICK_SOURCE_SCOREBOARD). Ang existence ng argument na ito ay nagmumungkahi na pwede magkaroon ng iba pang sources na darating. ::: ## Mga Kaugnay na Functions - [OnPlayerClickTextDraw](../callbacks/OnPlayerClickTextDraw.md): Itinatawag kapag ang player ay pumindot ng TextDraw.
openmultiplayer/web/docs/translations/fil/scripting/callbacks/OnPlayerClickPlayer.md/0
{ "file_path": "openmultiplayer/web/docs/translations/fil/scripting/callbacks/OnPlayerClickPlayer.md", "repo_id": "openmultiplayer", "token_count": 589 }
381
--- title: AddCharModel description: Nagdaragdag ng bagong custom na modelo ng character para sa pag-download. tags: [] --- <VersionWarn version='SA-MP 0.3.DL R1' /> ## Description Nagdaragdag ng bagong custom na modelo ng character para sa pag-download. Ang mga file ng modelo ay maiimbak sa Documents\GTA San Andreas User Files\SAMP\cache ng player sa ilalim ng Server IP at Port folder sa isang CRC-form file name. | Name | Description | | ------- | ---------------------------------------------------------------------------------------------------------------------------- | | baseid | Ang base skin model ID na gagamitin (gawi ng character at orihinal na character na gagamitin kapag nabigo ang pag-download). | | newid | Ang bagong skin model ID ay mula 20000 hanggang 30000 (10000 slots) na gagamitin mamaya sa SetPlayerSkin | | dffname | Pangalan ng .dff model collision file na matatagpuan sa folder ng server ng mga modelo bilang default (setting ng artpath). | | txdname | Pangalan ng .txd model texture file na matatagpuan sa folder ng server ng mga modelo bilang default (setting ng artpath). | ## Returns 1: Matagumpay na naisakatuparan ang function. 0: Nabigong maisagawa ang function. ## Examples ```c public OnGameModeInit() { AddCharModel(305, 20001, "lvpdpc2.dff", "lvpdpc2.txd"); AddCharModel(305, 20002, "lapdpd2.dff", "lapdpd2.txd"); return 1; } ``` ```c AddCharModel(305, 20001, "lvpdpc2.dff", "lvpdpc2.txd"); AddCharModel(305, 20002, "lapdpd2.dff", "lapdpd2.txd"); ``` ## Notes :::tip ang useartwork ay dapat munang paganahin sa mga setting ng server upang ito ay gumana ::: :::warning Kasalukuyang walang mga paghihigpit sa kung kailan mo maaaring tawagan ang function na ito, ngunit magkaroon ng kamalayan na kung hindi mo sila tatawagan sa loob ng OnFilterScriptInit/OnGameModeInit, magkakaroon ka ng panganib na ang ilang mga manlalaro, na nasa server na, ay maaaring hindi na-download ang mga modelo. ::: ## Related Functions - [SetPlayerSkin](SetPlayerSkin): Itakda ang pananamit ng isang manlalaro.
openmultiplayer/web/docs/translations/fil/scripting/functions/AddCharModel.md/0
{ "file_path": "openmultiplayer/web/docs/translations/fil/scripting/functions/AddCharModel.md", "repo_id": "openmultiplayer", "token_count": 840 }
382