diff --git a/frontend/docs/scripting/callbacks/OnClientMessage.md b/frontend/docs/scripting/callbacks/OnClientMessage.md index 84f3b73c65c..ffacdae586b 100644 --- a/frontend/docs/scripting/callbacks/OnClientMessage.md +++ b/frontend/docs/scripting/callbacks/OnClientMessage.md @@ -5,6 +5,12 @@ description: This callback gets called whenever the NPC sees a ClientMessage. tags: [] --- +:::warning + +This callback is deprecated. + +::: + ## Description This callback gets called whenever the NPC sees a ClientMessage. This will be everytime a [SendClientMessageToAll](../functions/SendClientMessageToAll) function is used and everytime a [SendClientMessage](../functions/SendClientMessage) function is sent towards the NPC. This callback won't be called when someone says something. For a version of this with player text, see [NPC:OnPlayerText](OnPlayerText). diff --git a/frontend/docs/scripting/callbacks/OnNPCChangeNode.md b/frontend/docs/scripting/callbacks/OnNPCChangeNode.md new file mode 100644 index 00000000000..6dd1d042fe9 --- /dev/null +++ b/frontend/docs/scripting/callbacks/OnNPCChangeNode.md @@ -0,0 +1,64 @@ +--- +title: OnNPCChangeNode +sidebar_label: OnNPCChangeNode +description: This callback is called when an NPC attempts to change from one navigation node to another during node-based movement. +tags: ["npc", "node", "navigation"] +--- + + + +## Description + +This callback is called when an NPC attempts to change from one navigation node to another during node-based movement. This allows you to control whether the node change should be allowed or denied. + +| Name | Description | +| --------- | ----------------------------------------------- | +| npcid | The ID of the NPC attempting to change nodes | +| newnodeid | The ID of the new node the NPC wants to move to | +| oldnodeid | The ID of the current node the NPC is on | + +## Returns + +Return `true` to allow the node change, or `false` to deny it. + +## Examples + +```c +public OnNPCChangeNode(npcid, newnodeid, oldnodeid) +{ + printf("[NPC] NPC %d changed from node %d to node %d", npcid, oldnodeid, newnodeid); + + // Notify players tracking this NPC + for (new playerid = 0; playerid < MAX_PLAYERS; playerid++) + { + if (!IsPlayerConnected(playerid)) + continue; + + if (PlayerNPC[playerid] == npcid) + { + SendClientMessage(playerid, 0x00FF00FF, "NPC %d changed from node %d to node %d", npcid, oldnodeid, newnodeid); + } + } + return 1; +} +``` + +## Notes + +- This callback is only called when NPCs are using node-based navigation via `NPC_PlayNode` +- Returning `false` will prevent the NPC from changing nodes and may cause it to stop navigation +- Node files must be loaded using `NPC_OpenNode` before NPCs can navigate between them + +## Related Functions + +The following functions might be useful, as they're related to this callback in one way or another. + +- [NPC_PlayNode](../functions/NPC_PlayNode): Start NPC node-based navigation +- [NPC_OpenNode](../functions/NPC_OpenNode): Open a navigation node file +- [NPC_CloseNode](../functions/NPC_CloseNode): Close a navigation node file +- [NPC_StopPlayingNode](../functions/NPC_StopPlayingNode): Stop NPC node navigation + +## Related Callbacks + +- [OnNPCFinishNode](OnNPCFinishNode): Called when NPC finishes navigating a complete node +- [OnNPCFinishNodePoint](OnNPCFinishNodePoint): Called when NPC reaches a specific point in a node diff --git a/frontend/docs/scripting/callbacks/OnNPCConnect.md b/frontend/docs/scripting/callbacks/OnNPCConnect.md deleted file mode 100644 index cfcc8ca1513..00000000000 --- a/frontend/docs/scripting/callbacks/OnNPCConnect.md +++ /dev/null @@ -1,31 +0,0 @@ ---- -title: OnNPCConnect -sidebar_label: OnNPCConnect -description: This callback is called when a NPC successfully connects to the server. -tags: ["npc"] ---- - -## Description - -This callback is called when a NPC successfully connects to the server. - -| Name | Description | -| ---------- | ----------------------------------- | -| myplayerid | The playerid the NPC has been given | - -## Examples - -```c -public OnNPCConnect(myplayerid) -{ - printf("I successfully connected the server with ID %i!", myplayerid); -} -``` - -## Related Callbacks - -The following callbacks might be useful, as they're related to this callback in one way or another. - -- [OnNPCDisconnect](OnNPCDisconnect): This callback is called when the NPC gets disconnected from the server. -- [OnPlayerConnect](OnPlayerConnect): This callback is called when a player connects to the server. -- [OnPlayerDisconnect](OnPlayerDisconnect): This callback is called when a player leaves the server. diff --git a/frontend/docs/scripting/callbacks/OnNPCCreate.md b/frontend/docs/scripting/callbacks/OnNPCCreate.md new file mode 100644 index 00000000000..b577300f0fd --- /dev/null +++ b/frontend/docs/scripting/callbacks/OnNPCCreate.md @@ -0,0 +1,53 @@ +--- +title: OnNPCCreate +sidebar_label: OnNPCCreate +description: This callback is called when an NPC is successfully created. +tags: ["npc"] +--- + + + +## Description + +This callback is called when an NPC is successfully created and added to the server. + +| Name | Description | +| ----- | ---------------------------------- | +| npcid | The ID of the NPC that was created | + +## Examples + +```c +public OnNPCCreate(npcid) +{ + printf("[NPC] NPC %d has been created", npcid); + + // Notify all connected players + for (new playerid = 0; playerid < MAX_PLAYERS; playerid++) + { + if (!IsPlayerConnected(playerid)) + continue; + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d has been created", npcid); + } + return 1; +} +``` + +## Notes + +- This callback is called immediately after the NPC is created but before it's spawned +- The NPC will need to be spawned using `NPC_Spawn` to become visible in the game world + +## Related Functions + +The following functions might be useful, as they're related to this callback in one way or another. + +- [NPC_Create](../functions/NPC_Create): Create a new NPC +- [NPC_Destroy](../functions/NPC_Destroy): Destroy an existing NPC +- [NPC_Spawn](../functions/NPC_Spawn): Spawn the NPC in the game world + +## Related Callbacks + +- [OnNPCDestroy](OnNPCDestroy): Called when an NPC is destroyed +- [OnNPCSpawn](OnNPCSpawn): Called when an NPC is spawned diff --git a/frontend/docs/scripting/callbacks/OnNPCDeath.md b/frontend/docs/scripting/callbacks/OnNPCDeath.md new file mode 100644 index 00000000000..e73d22ac7b0 --- /dev/null +++ b/frontend/docs/scripting/callbacks/OnNPCDeath.md @@ -0,0 +1,68 @@ +--- +title: OnNPCDeath +sidebar_label: OnNPCDeath +description: This callback is called when an NPC dies. +tags: ["npc"] +--- + + + +## Description + +This callback is called when an NPC dies. + +| Name | Description | +| -------- | --------------------------------------------------------------------------- | +| npcid | The ID of the NPC that died | +| killerid | The ID of the player/NPC that killed the NPC (or INVALID_PLAYER_ID if none) | +| reason | The reason for death (weapon ID or death cause) | + +## Examples + +```c +public OnNPCDeath(npcid, killerid, WEAPON:reason) +{ + printf("[NPC] NPC %d died (killer: %d, weapon: %d)", npcid, killerid, _:reason); + + // Notify players tracking this NPC + for (new playerid = 0; playerid < MAX_PLAYERS; playerid++) + { + if (!IsPlayerConnected(playerid)) + continue; + + if (PlayerNPC[playerid] == npcid) + { + if (killerid == INVALID_PLAYER_ID) + { + SendClientMessage(playerid, 0xFF0000FF, "Your tracked NPC %d died (weapon: %d)", npcid, _:reason); + } + else + { + SendClientMessage(playerid, 0xFF0000FF, "Your tracked NPC %d was killed by player %d (weapon: %d)", npcid, killerid, _:reason); + } + } + } + return 1; +} +``` + +## Notes + +- The `killerid` parameter will be `INVALID_PLAYER_ID` if the NPC death was not player inflicted +- The `reason` parameter contains the weapon ID that caused the death (255 for unknown/other causes) + +## Related Functions + +The following functions might be useful, as they're related to this callback in one way or another. + +- [NPC_Kill](../functions/NPC_Kill): Kill an NPC +- [NPC_Respawn](../functions/NPC_Respawn): Respawn a dead NPC +- [NPC_GetHealth](../functions/NPC_GetHealth): Get NPC's health +- [NPC_SetHealth](../functions/NPC_SetHealth): Set NPC's health + +## Related Callbacks + +- [OnNPCSpawn](OnNPCSpawn): Called when an NPC spawns +- [OnNPCRespawn](OnNPCRespawn): Called when an NPC respawns +- [OnNPCTakeDamage](OnNPCTakeDamage): Called when an NPC takes damage +- [OnPlayerDeath](OnPlayerDeath): Called when a player dies diff --git a/frontend/docs/scripting/callbacks/OnNPCDestroy.md b/frontend/docs/scripting/callbacks/OnNPCDestroy.md new file mode 100644 index 00000000000..be6329a8267 --- /dev/null +++ b/frontend/docs/scripting/callbacks/OnNPCDestroy.md @@ -0,0 +1,61 @@ +--- +title: OnNPCDestroy +sidebar_label: OnNPCDestroy +description: This callback is called when an NPC is destroyed. +tags: ["npc"] +--- + + + +## Description + +This callback is called when an NPC is destroyed and removed from the server. + +| Name | Description | +| ----- | ------------------------------------ | +| npcid | The ID of the NPC that was destroyed | + +## Examples + +```c +public OnNPCDestroy(npcid) +{ + printf("[NPC] NPC %d has been destroyed", npcid); + + // Clear any player tracking this NPC and notify + for (new playerid = 0; playerid < MAX_PLAYERS; playerid++) + { + if (!IsPlayerConnected(playerid)) + continue; + + if (PlayerNPC[playerid] == npcid) + { + PlayerNPC[playerid] = INVALID_NPC_ID; + SendClientMessage(playerid, 0xFF0000FF, "Your tracked NPC %d has been destroyed", npcid); + } + else + { + SendClientMessage(playerid, 0xFFFF00FF, "NPC %d has been destroyed", npcid); + } + } + return 1; +} + +``` + +## Notes + +- This callback is called immediately before the NPC is removed from the server +- The NPC will be disconnected and its player slot freed after this callback + +## Related Functions + +The following functions might be useful, as they're related to this callback in one way or another. + +- [NPC_Create](../functions/NPC_Create): Create a new NPC +- [NPC_Destroy](../functions/NPC_Destroy): Destroy an existing NPC +- [NPC_IsValid](../functions/NPC_IsValid): Check if NPC ID is valid + +## Related Callbacks + +- [OnNPCCreate](OnNPCCreate): Called when an NPC is created diff --git a/frontend/docs/scripting/callbacks/OnNPCDisconnect.md b/frontend/docs/scripting/callbacks/OnNPCDisconnect.md deleted file mode 100644 index 6918f3197b1..00000000000 --- a/frontend/docs/scripting/callbacks/OnNPCDisconnect.md +++ /dev/null @@ -1,31 +0,0 @@ ---- -title: OnNPCDisconnect -sidebar_label: OnNPCDisconnect -description: This callback is called when the NPC gets disconnected from the server. -tags: ["npc"] ---- - -## Description - -This callback is called when the NPC gets disconnected from the server. - -| Name | Description | -| -------- | ------------------------------------------------------- | -| reason[] | The reason why the bot has disconnected from the server | - -## Examples - -```c -public OnNPCDisconnect(reason[]) -{ - printf("Disconnected from the server. %s", reason); -} -``` - -## Related Callbacks - -The following callbacks might be useful, as they're related to this callback in one way or another. - -- [OnNPCConnect](OnNPCConnect): This callback is called when the NPC successfully connects to the server. -- [OnPlayerDisconnect](OnPlayerDisconnect): This callback is called when a player leaves the server. -- [OnPlayerConnect](OnPlayerConnect): This callback is called when a player connects to the server. diff --git a/frontend/docs/scripting/callbacks/OnNPCEnterVehicle.md b/frontend/docs/scripting/callbacks/OnNPCEnterVehicle.md deleted file mode 100644 index db0b19ca186..00000000000 --- a/frontend/docs/scripting/callbacks/OnNPCEnterVehicle.md +++ /dev/null @@ -1,31 +0,0 @@ ---- -title: OnNPCEnterVehicle -sidebar_label: OnNPCEnterVehicle -description: This callback is called when a NPC enters a vehicle. -tags: ["npc"] ---- - -## Description - -This callback is called when a NPC enters a vehicle. - -| Name | Description | -| --------- | ---------------------------- | -| vehicleid | The vehicle ID the NPC enter | -| seatid | The seatid the NPC uses | - -## Examples - -```c -public OnNPCEnterVehicle(vehicleid, seatid) -{ - printf("OnNPCEnterVehicle ID: %d Seat: %d", vehicleid, seatid); - return 1; -} -``` - -## Related Callbacks - -The following callbacks might be useful, as they're related to this callback in one way or another. - -- [OnNPCExitVehicle](OnNPCExitVehicle): This callback is called when a NPC leaves a Vehicle. diff --git a/frontend/docs/scripting/callbacks/OnNPCExitVehicle.md b/frontend/docs/scripting/callbacks/OnNPCExitVehicle.md deleted file mode 100644 index 1791855d2b3..00000000000 --- a/frontend/docs/scripting/callbacks/OnNPCExitVehicle.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -title: OnNPCExitVehicle -sidebar_label: OnNPCExitVehicle -description: This callback is called when a NPC leaves a vehicle. -tags: ["npc"] ---- - -## Description - -This callback is called when a NPC leaves a vehicle. - -## Examples - -```c -public OnNPCExitVehicle() -{ - print("The NPC left the vehicle"); - return 1; -} -``` - -## Related Callbacks - -The following callbacks might be useful, as they're related to this callback in one way or another. - -- [OnNPCEnterVehicle](OnNPCEnterVehicle): This callback is called when a NPC enters a vehicle. diff --git a/frontend/docs/scripting/callbacks/OnNPCFinishMove.md b/frontend/docs/scripting/callbacks/OnNPCFinishMove.md new file mode 100644 index 00000000000..6ef0e6478b7 --- /dev/null +++ b/frontend/docs/scripting/callbacks/OnNPCFinishMove.md @@ -0,0 +1,60 @@ +--- +title: OnNPCFinishMove +sidebar_label: OnNPCFinishMove +description: This callback is called when an NPC finishes moving to its target destination. +tags: ["npc", "movement"] +--- + + + +## Description + +This callback is called when an NPC finishes moving to its target destination. + +| Name | Description | +| ----- | -------------------------------------- | +| npcid | The ID of the NPC that finished moving | + +## Examples + +```c +public OnNPCFinishMove(npcid) +{ + // Find all players tracking this NPC + for (new playerid = 0; playerid < MAX_PLAYERS; playerid++) + { + if (!IsPlayerConnected(playerid)) + continue; + + if (PlayerNPC[playerid] == npcid) + { + new Float:x, Float:y, Float:z; + NPC_GetPos(npcid, x, y, z); + SendClientMessage(playerid, 0x00FF00FF, "NPC %d finished moving to position (%.2f, %.2f, %.2f)", npcid, x, y, z); + } + } + return 1; +} +``` + +## Notes + +- This callback is called for all types of NPC movement (walk, run, sprint, drive) +- It is called when the NPC reaches the target position set by movement functions +- For path-based movement, this is called when the entire path is completed (see `OnNPCFinishMovePath` for path-specific callback) +- For player following, this is called when the NPC stops following (if auto-restart is disabled) + +## Related Functions + +The following functions might be useful, as they're related to this callback in one way or another. + +- [NPC_Move](../functions/NPC_Move): Make NPC move to a position +- [NPC_MoveToPlayer](../functions/NPC_MoveToPlayer): Make NPC follow a player +- [NPC_StopMove](../functions/NPC_StopMove): Stop NPC movement +- [NPC_IsMoving](../functions/NPC_IsMoving): Check if NPC is currently moving + +## Related Callbacks + +- [OnNPCFinishNodePoint](OnNPCFinishNodePoint): Called when NPC reaches a node point +- [OnNPCFinishNode](OnNPCFinishNode): Called when NPC finishes node navigation +- [OnNPCFinishMovePath](OnNPCFinishMovePath): Called when NPC finishes moving along a path diff --git a/frontend/docs/scripting/callbacks/OnNPCFinishMovePath.md b/frontend/docs/scripting/callbacks/OnNPCFinishMovePath.md new file mode 100644 index 00000000000..471ef8d092a --- /dev/null +++ b/frontend/docs/scripting/callbacks/OnNPCFinishMovePath.md @@ -0,0 +1,55 @@ +--- +title: OnNPCFinishMovePath +sidebar_label: OnNPCFinishMovePath +description: This callback is called when an NPC finishes moving along a predefined path. +tags: ["npc", "movement", "path"] +--- + + + +## Description + +This callback is called when an NPC finishes moving along a predefined path. + +| Name | Description | +| ------ | ---------------------------------------- | +| npcid | The ID of the NPC that finished the path | +| pathid | The ID of the path that was completed | + +## Examples + +```c +public OnNPCFinishMovePath(npcid, pathid) +{ + // Find all players tracking this NPC + for (new playerid = 0; playerid < MAX_PLAYERS; playerid++) + { + if (!IsPlayerConnected(playerid)) + continue; + + if (PlayerNPC[playerid] == npcid) + { + SendClientMessage(playerid, 0x00FF00FF, "NPC %d finished moving along path %d", npcid, pathid); + } + } + return 1; +} + +``` + +## Notes + +- This callback is triggered when an NPC reaches the final point of a path +- The NPC stops moving automatically when this callback is called + +## Related Functions + +- [NPC_MoveByPath](../functions/NPC_MoveByPath): Make NPC follow a path +- [NPC_CreatePath](../functions/NPC_CreatePath): Create a new movement path +- [NPC_IsValidPath](../functions/NPC_IsValidPath): Check if path is valid + +## Related Callbacks + +- [OnNPCFinishMove](OnNPCFinishMove): Called when NPC finishes any movement +- [OnNPCFinishNode](OnNPCFinishNode): Called when NPC finishes node navigation +- [OnNPCFinishNodePoint](OnNPCFinishNodePoint): Called when NPC reaches a node point diff --git a/frontend/docs/scripting/callbacks/OnNPCFinishMovePathPoint.md b/frontend/docs/scripting/callbacks/OnNPCFinishMovePathPoint.md new file mode 100644 index 00000000000..ab44015321b --- /dev/null +++ b/frontend/docs/scripting/callbacks/OnNPCFinishMovePathPoint.md @@ -0,0 +1,57 @@ +--- +title: OnNPCFinishMovePathPoint +sidebar_label: OnNPCFinishMovePathPoint +description: Called when an NPC finishes moving to a specific point in a path. +tags: ["npc", "path", "movement"] +--- + + + +## Description + +This callback is called when an NPC finishes moving to a specific point in a path. + +| Name | Description | +| ------- | ------------------------------------------------ | +| npcid | The ID of the NPC that finished the path point | +| pathid | The ID of the path being followed | +| pointid | The index of the point that was reached | + +## Examples + +```c +public OnNPCFinishMovePathPoint(npcid, pathid, pointid) +{ + // Find all players tracking this NPC + for (new playerid = 0; playerid < MAX_PLAYERS; playerid++) + { + if (!IsPlayerConnected(playerid)) + continue; + + if (PlayerNPC[playerid] == npcid) + { + SendClientMessage(playerid, 0xFFFF00FF, "NPC %d reached point %d on path %d", npcid, pointid, pathid); + } + } + return 1; +} + +``` + +## Notes + +- This callback is triggered for each point in the path +- Use [OnNPCFinishMovePath](OnNPCFinishMovePath) to detect when the entire path is completed +- The NPC must be moving along a path using [NPC_MoveByPath](../functions/NPC_MoveByPath) + +## Related Functions + +- [NPC_MoveByPath](../functions/NPC_MoveByPath): Make NPC follow a path +- [NPC_CreatePath](../functions/NPC_CreatePath): Create a new path +- [NPC_AddPointToPath](../functions/NPC_AddPointToPath): Add a point to a path +- [NPC_GetCurrentPathPointIndex](../functions/NPC_GetCurrentPathPointIndex): Get current path point + +## Related Callbacks + +- [OnNPCFinishMovePath](OnNPCFinishMovePath): Called when NPC finishes entire path +- [OnNPCFinishMove](OnNPCFinishMove): Called when NPC finishes any movement diff --git a/frontend/docs/scripting/callbacks/OnNPCFinishNode.md b/frontend/docs/scripting/callbacks/OnNPCFinishNode.md new file mode 100644 index 00000000000..62ded63ed8d --- /dev/null +++ b/frontend/docs/scripting/callbacks/OnNPCFinishNode.md @@ -0,0 +1,58 @@ +--- +title: OnNPCFinishNode +sidebar_label: OnNPCFinishNode +description: This callback is called when an NPC finishes navigating a complete node. +tags: ["npc", "node", "navigation"] +--- + + + +## Description + +This callback is called when an NPC finishes navigating a complete node during node-based movement. + +| Name | Description | +| ------ | ---------------------------------------- | +| npcid | The ID of the NPC that finished the node | +| nodeid | The ID of the node that was completed | + +## Examples + +```c +public OnNPCFinishNodePoint(npcid, nodeid, pointid) +{ + // Notify players tracking this NPC + for (new playerid = 0; playerid < MAX_PLAYERS; playerid++) + { + if (!IsPlayerConnected(playerid)) + continue; + + if (PlayerNPC[playerid] == npcid) + { + SendClientMessage(playerid, 0xFFFF00FF, "NPC %d reached node %d point %d", npcid, nodeid, pointid); + } + } + return 1; +} +``` + +## Notes + +- This callback is only called when NPCs are using node-based navigation via `NPC_PlayNode` +- It's called when the NPC has completed navigation through all points in the node +- The node navigation stops automatically when this callback is triggered + +## Related Functions + +The following functions might be useful, as they're related to this callback in one way or another. + +- [NPC_PlayNode](../functions/NPC_PlayNode): Start NPC node-based navigation +- [NPC_StopPlayingNode](../functions/NPC_StopPlayingNode): Stop NPC node navigation +- [NPC_IsPlayingNode](../functions/NPC_IsPlayingNode): Check if NPC is navigating a node +- [NPC_OpenNode](../functions/NPC_OpenNode): Open a navigation node file + +## Related Callbacks + +- [OnNPCFinishNodePoint](OnNPCFinishNodePoint): Called when NPC reaches a specific point in a node +- [OnNPCChangeNode](OnNPCChangeNode): Called when NPC attempts to change nodes +- [OnNPCFinishMove](OnNPCFinishMove): Called when NPC finishes any type of movement diff --git a/frontend/docs/scripting/callbacks/OnNPCFinishNodePoint.md b/frontend/docs/scripting/callbacks/OnNPCFinishNodePoint.md new file mode 100644 index 00000000000..cb511cfe818 --- /dev/null +++ b/frontend/docs/scripting/callbacks/OnNPCFinishNodePoint.md @@ -0,0 +1,61 @@ +--- +title: OnNPCFinishNodePoint +sidebar_label: OnNPCFinishNodePoint +description: This callback is called when an NPC reaches a specific point during node-based navigation. +tags: ["npc", "node", "navigation"] +--- + + + +## Description + +This callback is called when an NPC reaches a specific point during node-based navigation. + +| Name | Description | +| ------- | --------------------------------------------- | +| npcid | The ID of the NPC that reached the node point | +| nodeid | The ID of the node being navigated | +| pointid | The ID of the specific point that was reached | + +## Examples + +```c +public OnNPCFinishNode(npcid, nodeid) +{ + printf("[NPC] NPC %d finished node %d", npcid, nodeid); + + // Notify players tracking this NPC + for (new playerid = 0; playerid < MAX_PLAYERS; playerid++) + { + if (!IsPlayerConnected(playerid)) + continue; + + if (PlayerNPC[playerid] == npcid) + { + SendClientMessage(playerid, 0x00FF00FF, "NPC %d finished node %d", npcid, nodeid); + } + } + return 1; +} +``` + +## Notes + +- This callback is only called when NPCs are using node-based navigation via `NPC_PlayNode` +- It's called each time the NPC reaches a waypoint within the node +- The `pointid` corresponds to the specific waypoint index within the node file + +## Related Functions + +The following functions might be useful, as they're related to this callback in one way or another. + +- [NPC_PlayNode](../functions/NPC_PlayNode): Start NPC node-based navigation +- [NPC_PausePlayingNode](../functions/NPC_PausePlayingNode): Pause NPC node navigation +- [NPC_ResumePlayingNode](../functions/NPC_ResumePlayingNode): Resume paused node navigation +- [NPC_StopPlayingNode](../functions/NPC_StopPlayingNode): Stop NPC node navigation + +## Related Callbacks + +- [OnNPCFinishNode](OnNPCFinishNode): Called when NPC finishes navigating a complete node +- [OnNPCChangeNode](OnNPCChangeNode): Called when NPC attempts to change nodes +- [OnNPCFinishMove](OnNPCFinishMove): Called when NPC finishes any type of movement diff --git a/frontend/docs/scripting/callbacks/OnNPCGiveDamage.md b/frontend/docs/scripting/callbacks/OnNPCGiveDamage.md new file mode 100644 index 00000000000..d739862da93 --- /dev/null +++ b/frontend/docs/scripting/callbacks/OnNPCGiveDamage.md @@ -0,0 +1,66 @@ +--- +title: OnNPCGiveDamage +sidebar_label: OnNPCGiveDamage +description: This callback is called when an NPC gives damage to a player. +tags: ["npc", "damage"] +--- + + + +## Description + +This callback is called when an NPC gives damage to a player. + +| Name | Description | +| --------- | ---------------------------------------------------- | +| npcid | The ID of the NPC that gave the damage | +| damagedid | The ID of the player that received the damage | +| damage | The amount of damage that was given | +| weaponid | The weapon ID used to give the damage | +| bodypart | The [body part](../resources/bodyparts) that was hit | + +## Returns + +Return `false` to prevent the damage from being applied, or `true` to allow it. + +## Examples + +```c +public OnNPCGiveDamage(npcid, damagedid, Float:damage, WEAPON:weaponid, bodypart) +{ + // Only notify players tracking this NPC + for (new playerid = 0; playerid < MAX_PLAYERS; playerid++) + { + if (!IsPlayerConnected(playerid)) + continue; + + if (PlayerNPC[playerid] == npcid) + { + SendClientMessage(playerid, 0xFF8800FF, "NPC %d dealt %.1f damage to player %d (weapon: %d, bodypart: %d)", + npcid, damage, damagedid, _:weaponid, bodypart); + } + } + return 1; +} +``` + +## Notes + +- This callback is called before the damage is actually applied to the player +- Returning `false` will prevent the damage from being applied +- The `bodypart` parameter uses the same values as `OnPlayerTakeDamage` + +## Related Functions + +The following functions might be useful, as they're related to this callback in one way or another. + +- [NPC_AimAt](../functions/NPC_AimAt): Make NPC aim at a position +- [NPC_AimAtPlayer](../functions/NPC_AimAtPlayer): Make NPC aim at a player +- [NPC_Shoot](../functions/NPC_Shoot): Make NPC shoot +- [NPC_SetWeapon](../functions/NPC_SetWeapon): Set NPC's weapon + +## Related Callbacks + +- [OnNPCTakeDamage](OnNPCTakeDamage): Called when an NPC takes damage +- [OnPlayerTakeDamage](OnPlayerTakeDamage): Called when a player takes damage +- [OnPlayerGiveDamage](OnPlayerGiveDamage): Called when a player gives damage diff --git a/frontend/docs/scripting/callbacks/OnNPCModeExit.md b/frontend/docs/scripting/callbacks/OnNPCModeExit.md deleted file mode 100644 index 21bca7d0b75..00000000000 --- a/frontend/docs/scripting/callbacks/OnNPCModeExit.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -title: OnNPCModeExit -sidebar_label: OnNPCModeExit -description: This callback is called when a NPC script unloaded. -tags: ["npc"] ---- - -## Description - -This callback is called when a NPC script unloaded. - -## Examples - -```c -public OnNPCModeExit() -{ - print("NPC script unloaded"); - return 1; -} -``` - -## Related Callbacks - -The following callbacks might be useful, as they're related to this callback in one way or another. - -- [OnNPCModeInit](OnNPCModeInit): This callback is called when a NPC script loaded. diff --git a/frontend/docs/scripting/callbacks/OnNPCModeInit.md b/frontend/docs/scripting/callbacks/OnNPCModeInit.md deleted file mode 100644 index 55f00a55c39..00000000000 --- a/frontend/docs/scripting/callbacks/OnNPCModeInit.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -title: OnNPCModeInit. -sidebar_label: OnNPCModeInit. -description: This callback is called when a NPC script is loaded. -tags: ["npc"] ---- - -## Description - -This callback is called when a NPC script is loaded. - -## Examples - -```c -public OnNPCModeInit() -{ - print("NPC script loaded."); - return 1; -} -``` - -## Related Callbacks - -The following callbacks might be useful, as they're related to this callback in one way or another. - -- [OnNPCModeExit](OnNPCModeExit): This callback is called when a NPC script unloaded. diff --git a/frontend/docs/scripting/callbacks/OnNPCPlaybackEnd.md b/frontend/docs/scripting/callbacks/OnNPCPlaybackEnd.md new file mode 100644 index 00000000000..25ebd2b3e11 --- /dev/null +++ b/frontend/docs/scripting/callbacks/OnNPCPlaybackEnd.md @@ -0,0 +1,59 @@ +--- +title: OnNPCPlaybackEnd +sidebar_label: OnNPCPlaybackEnd +description: This callback is called when an NPC finishes playback of a recorded file. +tags: ["npc", "playback", "recording"] +--- + + + +## Description + +This callback is called when an NPC finishes playback of a recorded file. + +| Name | Description | +| -------- | ------------------------------------------ | +| npcid | The ID of the NPC that finished playback | +| recordid | The ID of the record that finished playing | + +## Examples + +```c +public OnNPCPlaybackEnd(npcid, recordid) +{ + printf("[NPC] NPC %d finished playback (record: %d)", npcid, recordid); + + // Notify players tracking this NPC + for (new playerid = 0; playerid < MAX_PLAYERS; playerid++) + { + if (!IsPlayerConnected(playerid)) + continue; + + if (PlayerNPC[playerid] == npcid) + { + SendClientMessage(playerid, 0x00FF00FF, "NPC %d finished playback (record ID: %d)", npcid, recordid); + } + } + return 1; +} + +``` + +## Notes + +- This callback is called when the recording reaches its end naturally +- It's also called when playback is stopped manually using `NPC_StopPlayback` +- The `recordid` corresponds to the loaded record file + +## Related Functions + +The following functions might be useful, as they're related to this callback in one way or another. + +- [NPC_StartPlayback](../functions/NPC_StartPlayback): Start NPC playback of a recording +- [NPC_StopPlayback](../functions/NPC_StopPlayback): Stop NPC playback +- [NPC_PausePlayback](../functions/NPC_PausePlayback): Pause/unpause NPC playback +- [NPC_IsPlayingPlayback](../functions/NPC_IsPlayingPlayback): Check if NPC is playing a recording + +## Related Callbacks + +- [OnNPCPlaybackStart](OnNPCPlaybackStart): Called when NPC starts playing a recording diff --git a/frontend/docs/scripting/callbacks/OnNPCPlaybackStart.md b/frontend/docs/scripting/callbacks/OnNPCPlaybackStart.md new file mode 100644 index 00000000000..cc05a7077a9 --- /dev/null +++ b/frontend/docs/scripting/callbacks/OnNPCPlaybackStart.md @@ -0,0 +1,59 @@ +--- +title: OnNPCPlaybackStart +sidebar_label: OnNPCPlaybackStart +description: This callback is called when an NPC starts playback of a recorded file. +tags: ["npc", "playback", "recording"] +--- + + + +## Description + +This callback is called when an NPC starts playback of a recorded file. + +| Name | Description | +| -------- | ----------------------------------------- | +| npcid | The ID of the NPC that started playback | +| recordid | The ID of the record that started playing | + +## Examples + +```c +public OnNPCPlaybackStart(npcid, recordid) +{ + printf("[NPC] NPC %d started playback (record: %d)", npcid, recordid); + + // Notify players tracking this NPC + for (new playerid = 0; playerid < MAX_PLAYERS; playerid++) + { + if (!IsPlayerConnected(playerid)) + continue; + + if (PlayerNPC[playerid] == npcid) + { + SendClientMessage(playerid, 0x00FF00FF, "NPC %d started playback (record ID: %d)", npcid, recordid); + } + } + return 1; +} + +``` + +## Notes + +- This callback is called immediately when `NPC_StartPlayback` is successfully executed +- The `recordid` corresponds to the loaded record file +- The NPC will follow the recorded movements from the file + +## Related Functions + +The following functions might be useful, as they're related to this callback in one way or another. + +- [NPC_StartPlayback](../functions/NPC_StartPlayback): Start NPC playback of a recording +- [NPC_StopPlayback](../functions/NPC_StopPlayback): Stop NPC playback +- [NPC_PausePlayback](../functions/NPC_PausePlayback): Pause/unpause NPC playback +- [NPC_IsPlayingPlayback](../functions/NPC_IsPlayingPlayback): Check if NPC is playing a recording + +## Related Callbacks + +- [OnNPCPlaybackEnd](OnNPCPlaybackEnd): Called when NPC finishes playing a recording diff --git a/frontend/docs/scripting/callbacks/OnNPCRespawn.md b/frontend/docs/scripting/callbacks/OnNPCRespawn.md new file mode 100644 index 00000000000..72db5a13d6f --- /dev/null +++ b/frontend/docs/scripting/callbacks/OnNPCRespawn.md @@ -0,0 +1,59 @@ +--- +title: OnNPCRespawn +sidebar_label: OnNPCRespawn +description: This callback is called when an NPC respawns. +tags: ["npc"] +--- + + + +## Description + +This callback is called when an NPC respawns. + +| Name | Description | +| ----- | -------------------------------- | +| npcid | The ID of the NPC that respawned | + +## Examples + +```c +public OnNPCRespawn(npcid) +{ + printf("[NPC] NPC %d has respawned", npcid); + + // Notify players tracking this NPC + for (new playerid = 0; playerid < MAX_PLAYERS; playerid++) + { + if (!IsPlayerConnected(playerid)) + continue; + + if (PlayerNPC[playerid] == npcid) + { + SendClientMessage(playerid, 0x00FF00FF, "Your tracked NPC %d has respawned", npcid); + } + } + return 1; +} +``` + +## Notes + +- This callback is called after the NPC has been respawned using `NPC_Respawn` +- The NPC's health and armor are automatically restored during respawn +- Any ongoing movement, playback, etc, are stopped when respawning + +## Related Functions + +The following functions might be useful, as they're related to this callback in one way or another. + +- [NPC_Respawn](../functions/NPC_Respawn): Respawn an NPC +- [NPC_Spawn](../functions/NPC_Spawn): Spawn an NPC for the first time +- [NPC_SetHealth](../functions/NPC_SetHealth): Set NPC's health +- [NPC_SetPosition](../functions/NPC_SetPosition): Set NPC's position + +## Related Callbacks + +- [OnNPCSpawn](OnNPCSpawn): Called when an NPC spawns for the first time +- [OnNPCDeath](OnNPCDeath): Called when an NPC dies +- [OnPlayerSpawn](OnPlayerSpawn): Called when a player spawns diff --git a/frontend/docs/scripting/callbacks/OnNPCSpawn.md b/frontend/docs/scripting/callbacks/OnNPCSpawn.md index f5e1ef1febb..7a1b599b960 100644 --- a/frontend/docs/scripting/callbacks/OnNPCSpawn.md +++ b/frontend/docs/scripting/callbacks/OnNPCSpawn.md @@ -1,21 +1,59 @@ --- title: OnNPCSpawn sidebar_label: OnNPCSpawn -description: This callback is called when a NPC spawned. +description: This callback is called when an NPC spawns. tags: ["npc"] --- ## Description -This callback is called when a NPC spawned. +This callback is called when an NPC spawns. + +| Name | Description | +| ----- | ------------------------------ | +| npcid | The ID of the NPC that spawned | ## Examples ```c -public OnNPCSpawn() +public OnNPCSpawn(npcid) { - print("NPC spawned"); - SendChat("Hello World. I'm a bot."); + printf("[NPC] NPC %d has spawned", npcid); + + // Notify players tracking this NPC + for (new playerid = 0; playerid < MAX_PLAYERS; playerid++) + { + if (!IsPlayerConnected(playerid)) + continue; + + if (PlayerNPC[playerid] == npcid) + { + new Float:x, Float:y, Float:z; + NPC_GetPos(npcid, x, y, z); + SendClientMessage(playerid, 0x00FF00FF, "Your tracked NPC %d spawned at (%.2f, %.2f, %.2f)", npcid, x, y, z); + } + } return 1; } ``` + +## Notes + +- This callback is called when `NPC_Spawn` is successfully executed +- The NPC becomes visible and interactive in the game world +- You can set initial NPC properties and behaviors in this callback +- The NPC's stats are automatically set to default values (100 health, 0 armor, fists weapon) + +## Related Functions + +- [NPC_Spawn](../functions/NPC_Spawn): Spawn an NPC in the game world +- [NPC_Respawn](../functions/NPC_Respawn): Respawn a dead NPC +- [NPC_SetHealth](../functions/NPC_SetHealth): Set NPC's health +- [NPC_SetWeapon](../functions/NPC_SetWeapon): Set NPC's weapon + +## Related Callbacks + +- [OnNPCCreate](OnNPCCreate): Called when an NPC is created +- [OnNPCRespawn](OnNPCRespawn): Called when an NPC respawns +- [OnNPCDeath](OnNPCDeath): Called when an NPC dies +- [OnPlayerSpawn](OnPlayerSpawn): Called when a player spawns diff --git a/frontend/docs/scripting/callbacks/OnNPCTakeDamage.md b/frontend/docs/scripting/callbacks/OnNPCTakeDamage.md new file mode 100644 index 00000000000..115edf727df --- /dev/null +++ b/frontend/docs/scripting/callbacks/OnNPCTakeDamage.md @@ -0,0 +1,75 @@ +--- +title: OnNPCTakeDamage +sidebar_label: OnNPCTakeDamage +description: This callback is called when an NPC takes damage. +tags: ["npc", "damage"] +--- + + + +## Description + +This callback is called when an NPC takes damage from a player or another NPC. + +| Name | Description | +| --------- | ---------------------------------------------------- | +| npcid | The ID of the NPC that took damage | +| damagerid | The ID of the player/NPC that caused the damage | +| damage | The amount of damage that was taken | +| weaponid | The weapon ID used to cause the damage | +| bodypart | The [body part](../resources/bodyparts) that was hit | + +## Returns + +Return `false` to prevent the damage from being applied, or `true` to allow it. + +## Examples + +```c +public OnNPCTakeDamage(npcid, damagerid, Float:damage, WEAPON:weaponid, bodypart) +{ + // Only notify players tracking this NPC + for (new playerid = 0; playerid < MAX_PLAYERS; playerid++) + { + if (!IsPlayerConnected(playerid)) + continue; + + if (PlayerNPC[playerid] == npcid) + { + if (damagerid == INVALID_PLAYER_ID) + { + SendClientMessage(playerid, 0xFF8800FF, "NPC %d took %.1f damage (weapon: %d, bodypart: %d)", + npcid, damage, _:weaponid, bodypart); + } + else + { + SendClientMessage(playerid, 0xFF8800FF, "NPC %d took %.1f damage from player %d (weapon: %d, bodypart: %d)", + npcid, damage, damagerid, _:weaponid, bodypart); + } + } + } + return 1; +} +``` + +## Notes + +- This callback is called before the damage is actually applied to the NPC +- Returning `false` will prevent the damage from being applied +- The `damagerid` parameter will be `INVALID_PLAYER_ID` if damage is not caused by player +- Body parts use the same constants as `OnPlayerTakeDamage` + +## Related Functions + +The following functions might be useful, as they're related to this callback in one way or another. + +- [NPC_GetHealth](../functions/NPC_GetHealth): Get NPC's current health +- [NPC_SetHealth](../functions/NPC_SetHealth): Set NPC's health +- [NPC_GetArmour](../functions/NPC_GetArmour): Get NPC's armor +- [NPC_SetArmour](../functions/NPC_SetArmour): Set NPC's armor + +## Related Callbacks + +- [OnNPCGiveDamage](OnNPCGiveDamage): Called when an NPC gives damage to a player +- [OnNPCDeath](OnNPCDeath): Called when an NPC dies +- [OnPlayerTakeDamage](OnPlayerTakeDamage): Called when a player takes damage diff --git a/frontend/docs/scripting/callbacks/OnNPCWeaponShot.md b/frontend/docs/scripting/callbacks/OnNPCWeaponShot.md new file mode 100644 index 00000000000..1c7f057720c --- /dev/null +++ b/frontend/docs/scripting/callbacks/OnNPCWeaponShot.md @@ -0,0 +1,78 @@ +--- +title: OnNPCWeaponShot +sidebar_label: OnNPCWeaponShot +description: This callback is called when an NPC fires a weapon. +tags: ["npc", "weapon", "shooting"] +--- + + + +## Description + +This callback is called when an NPC fires a weapon. + +| Name | Description | +| -------- | ------------------------------------------ | +| npcid | The ID of the NPC that fired the weapon | +| weaponid | The weapon ID that was fired | +| hittype | The type of entity that was hit (if any) | +| hitid | The ID of the entity that was hit (if any) | +| fX | The X coordinate where the bullet hit | +| fY | The Y coordinate where the bullet hit | +| fZ | The Z coordinate where the bullet hit | + +## Returns + +Return `false` to prevent the shot from being processed, or `true` to allow it. + +## Examples + +```c +public OnNPCWeaponShot(npcid, WEAPON:weaponid, BULLET_HIT_TYPE:hittype, hitid, Float:fX, Float:fY, Float:fZ) +{ + // Only notify players tracking this NPC + for (new playerid = 0; playerid < MAX_PLAYERS; playerid++) + { + if (!IsPlayerConnected(playerid)) + continue; + + if (PlayerNPC[playerid] == npcid) + { + static hitTypeNames[5][32] = { + "None", + "Player", + "Vehicle", + "Object", + "Player Object" + }; + + SendClientMessage(playerid, 0xFFFF00FF, "NPC %d fired weapon %d at %s %d (%.2f, %.2f, %.2f)", + npcid, _:weaponid, hitTypeNames[_:hittype], hitid, fX, fY, fZ); + } + } + return 1; +} +``` + +## Notes + +- This callback is called for each shot fired by the NPC +- The `hittype` parameter indicates what was hit (none, player, vehicle, object, etc.) +- The `hitid` parameter contains the ID of the hit entity (player ID, vehicle ID, etc.) +- Hit coordinates show where the bullet impacted +- Returning `false` prevents the shot from being processed by the server + +## Related Functions + +The following functions might be useful, as they're related to this callback in one way or another. + +- [NPC_AimAt](../functions/NPC_AimAt): Make NPC aim at a position +- [NPC_AimAtPlayer](../functions/NPC_AimAtPlayer): Make NPC aim at a player +- [NPC_StopAim](../functions/NPC_StopAim): Stop NPC from aiming +- [NPC_SetWeapon](../functions/NPC_SetWeapon): Set NPC's weapon +- [NPC_GetAmmo](../functions/NPC_GetAmmo): Get NPC's ammo count + +## Related Callbacks + +- [OnNPCGiveDamage](OnNPCGiveDamage): Called when NPC gives damage to a player +- [OnPlayerWeaponShot](OnPlayerWeaponShot): Called when a player fires a weapon diff --git a/frontend/docs/scripting/callbacks/OnNPCWeaponStateChange.md b/frontend/docs/scripting/callbacks/OnNPCWeaponStateChange.md new file mode 100644 index 00000000000..567e31fe94f --- /dev/null +++ b/frontend/docs/scripting/callbacks/OnNPCWeaponStateChange.md @@ -0,0 +1,66 @@ +--- +title: OnNPCWeaponStateChange +sidebar_label: OnNPCWeaponStateChange +description: This callback is called when an NPC's weapon state changes. +tags: ["npc", "weapon"] +--- + + + +## Description + +This callback is called when an NPC's weapon state changes (e.g., reloading, running out of ammo, etc.). + +| Name | Description | +| -------- | ------------------------- | +| npcid | The ID of the NPC | +| newstate | The new weapon state | +| oldstate | The previous weapon state | + +## Examples + +```c +public OnNPCWeaponStateChange(npcid, newState, oldState) +{ + static weaponStates[5][64] = { + "Unknown", + "No ammo remaining", + "Single bullet left", + "More than one bullet left", + "Reloading" + }; + + // Only notify players tracking this NPC + for (new playerid = 0; playerid < MAX_PLAYERS; playerid++) + { + if (!IsPlayerConnected(playerid)) + continue; + + if (PlayerNPC[playerid] == npcid) + { + SendClientMessage(playerid, 0xFFFF00FF, "NPC %d weapon state: %s -> %s", + npcid, weaponStates[oldState], weaponStates[newState]); + } + } + return 1; +} +``` + +## Notes + +- This callback is triggered automatically based on NPC's ammo count and weapon actions +- Weapon states include: no bullets, reloading, more bullets, last bullet, unknown + +## Related Functions + +The following functions might be useful, as they're related to this callback in one way or another. + +- [NPC_GetWeaponState](../functions/NPC_GetWeaponState): Get NPC's current weapon state +- [NPC_GetAmmo](../functions/NPC_GetAmmo): Get NPC's ammo count +- [NPC_SetAmmo](../functions/NPC_SetAmmo): Set NPC's ammo count +- [NPC_GetAmmoInClip](../functions/NPC_GetAmmoInClip): Get ammo in current clip +- [NPC_EnableReloading](../functions/NPC_EnableReloading): Enable/disable automatic reloading + +## Related Callbacks + +- [OnNPCWeaponShot](OnNPCWeaponShot): Called when NPC fires a weapon diff --git a/frontend/docs/scripting/callbacks/OnPlayerKeyStateChange.md b/frontend/docs/scripting/callbacks/OnPlayerKeyStateChange.md index 020e20e026d..55c26c1ea27 100644 --- a/frontend/docs/scripting/callbacks/OnPlayerKeyStateChange.md +++ b/frontend/docs/scripting/callbacks/OnPlayerKeyStateChange.md @@ -9,11 +9,11 @@ tags: ["player"] This callback is called when the state of any [supported](../resources/keys) key is changed (pressed/released).
Directional keys do not trigger OnPlayerKeyStateChange (up/down/left/right). -| Name | Description | -| -------- | --------------------------------------------------------------------------------------------- | -| playerid | The ID of the player that pressed or released a key. | -| KEY:newkeys | A map (bitmask) of the keys currently held - [see here](../resources/keys) | -| KEY:oldkeys | A map (bitmask) of the keys held prior to the current change - [see here](../resources/keys). | +| Name | Description | +| ----------- | --------------------------------------------------------------------------------------------- | +| playerid | The ID of the player that pressed or released a key. | +| KEY:newkeys | A map (bitmask) of the keys currently held - [see here](../resources/keys) | +| KEY:oldkeys | A map (bitmask) of the keys held prior to the current change - [see here](../resources/keys). | ## Returns diff --git a/frontend/docs/scripting/functions/ConnectNPC.md b/frontend/docs/scripting/functions/ConnectNPC.md index 34481e6cd34..e5b9371917d 100644 --- a/frontend/docs/scripting/functions/ConnectNPC.md +++ b/frontend/docs/scripting/functions/ConnectNPC.md @@ -5,6 +5,12 @@ description: Connect an NPC to the server. tags: ["npc"] --- +:::warning + +This function is deprecated. Please see [NPC_Create](NPC_Create). + +::: + ## Description Connect an NPC to the server. diff --git a/frontend/docs/scripting/functions/DestroyPlayerPickup.md b/frontend/docs/scripting/functions/DestroyPlayerPickup.md index 5e65d4b516b..2b6407c4e81 100644 --- a/frontend/docs/scripting/functions/DestroyPlayerPickup.md +++ b/frontend/docs/scripting/functions/DestroyPlayerPickup.md @@ -12,7 +12,7 @@ tags: ["player", "pickup", "playerpickup"] Destroys a player-pickup created with [CreatePlayerPickup](CreatePlayerPickup). | Name | Description | -|----------|--------------------------------------------------------------------------| +| -------- | ------------------------------------------------------------------------ | | playerid | The ID of the player. | | pickupid | The ID of the player-pickup to destroy (returned by CreatePlayerPickup). | diff --git a/frontend/docs/scripting/functions/EditPlayerClass.md b/frontend/docs/scripting/functions/EditPlayerClass.md index a5d1222e13a..654e12e9f10 100644 --- a/frontend/docs/scripting/functions/EditPlayerClass.md +++ b/frontend/docs/scripting/functions/EditPlayerClass.md @@ -12,7 +12,7 @@ tags: ["class"] 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. | diff --git a/frontend/docs/scripting/functions/GameTextForAll.md b/frontend/docs/scripting/functions/GameTextForAll.md index c4e19bb7c21..e5fd2475bf5 100644 --- a/frontend/docs/scripting/functions/GameTextForAll.md +++ b/frontend/docs/scripting/functions/GameTextForAll.md @@ -10,7 +10,7 @@ tags: ["gametext"] Shows 'game text' (on-screen text) for a certain length of time for all players. | Name | Description | -|------------------|-------------------------------------------------------------------| +| ---------------- | ----------------------------------------------------------------- | | const format[] | The text to be displayed. | | time | The duration of the text being shown in milliseconds. | | style | The [style](../resources/gametextstyles) of text to be displayed. | diff --git a/frontend/docs/scripting/functions/GameTextForPlayer.md b/frontend/docs/scripting/functions/GameTextForPlayer.md index 825ddc462d3..c4962094f13 100644 --- a/frontend/docs/scripting/functions/GameTextForPlayer.md +++ b/frontend/docs/scripting/functions/GameTextForPlayer.md @@ -10,7 +10,7 @@ tags: ["player", "gametext"] Shows 'game text' (on-screen text) for a certain length of time for a specific player. | Name | Description | -|------------------|-------------------------------------------------------------------| +| ---------------- | ----------------------------------------------------------------- | | playerid | The ID of the player to show the gametext for. | | const format[] | The text to be displayed. | | time | The duration of the text being shown in milliseconds. | diff --git a/frontend/docs/scripting/functions/GangZoneCreate.md b/frontend/docs/scripting/functions/GangZoneCreate.md index 4ea1849e376..999b34b9fe4 100644 --- a/frontend/docs/scripting/functions/GangZoneCreate.md +++ b/frontend/docs/scripting/functions/GangZoneCreate.md @@ -49,7 +49,7 @@ public OnGameModeInit() :::warning -- There is a limit of 1024 gangzones. +- There is a limit of 1024 gangzones. - Putting the parameters in the wrong order results in glitchy behavior. ::: diff --git a/frontend/docs/scripting/functions/GangZoneGetColourForPlayer.md b/frontend/docs/scripting/functions/GangZoneGetColourForPlayer.md index d00ad0c59b4..f4a55f4f321 100644 --- a/frontend/docs/scripting/functions/GangZoneGetColourForPlayer.md +++ b/frontend/docs/scripting/functions/GangZoneGetColourForPlayer.md @@ -11,10 +11,10 @@ tags: ["player", "gangzone"] Get the colour of a gangzone for player. -| Name | Description | -| ----------- | ----------------------------------------- | -| playerid | The ID of the player you need to get. | -| zoneid | The ID of the gangzone. | +| Name | Description | +| -------- | ------------------------------------- | +| playerid | The ID of the player you need to get. | +| zoneid | The ID of the gangzone. | ## Returns @@ -35,4 +35,4 @@ Colour of gangzone for player. - [GangZoneStopFlashForAll](GangZoneStopFlashForAll): Stop a gangzone flashing for all players. - [IsValidGangZone](IsValidGangZone): Check if the gangzone valid. - [IsPlayerInGangZone](IsPlayerInGangZone): Check if the player in gangzone. -- [IsGangZoneVisibleForPlayer](IsGangZoneVisibleForPlayer): Check if the gangzone is visible for player. \ No newline at end of file +- [IsGangZoneVisibleForPlayer](IsGangZoneVisibleForPlayer): Check if the gangzone is visible for player. diff --git a/frontend/docs/scripting/functions/GangZoneGetFlashColourForPlayer.md b/frontend/docs/scripting/functions/GangZoneGetFlashColourForPlayer.md index 42d5b386d07..21184403584 100644 --- a/frontend/docs/scripting/functions/GangZoneGetFlashColourForPlayer.md +++ b/frontend/docs/scripting/functions/GangZoneGetFlashColourForPlayer.md @@ -11,10 +11,10 @@ tags: ["player", "gangzone"] Get the flashing colour of a gangzone for player. -| Name | Description | -| ----------- | ----------------------------------------- | -| playerid | The ID of the player you need to get. | -| zoneid | The ID of the gangzone. | +| Name | Description | +| -------- | ------------------------------------- | +| playerid | The ID of the player you need to get. | +| zoneid | The ID of the gangzone. | ## Returns @@ -35,4 +35,4 @@ Flashing color of gangzone for player. - [GangZoneStopFlashForAll](GangZoneStopFlashForAll): Stop a gangzone flashing for all players. - [IsValidGangZone](IsValidGangZone): Check if the gangzone valid. - [IsPlayerInGangZone](IsPlayerInGangZone): Check if the player in gangzone. -- [IsGangZoneVisibleForPlayer](IsGangZoneVisibleForPlayer): Check if the gangzone is visible for player. \ No newline at end of file +- [IsGangZoneVisibleForPlayer](IsGangZoneVisibleForPlayer): Check if the gangzone is visible for player. diff --git a/frontend/docs/scripting/functions/GangZoneGetPos.md b/frontend/docs/scripting/functions/GangZoneGetPos.md index 97f8d57105f..9f3a449105f 100644 --- a/frontend/docs/scripting/functions/GangZoneGetPos.md +++ b/frontend/docs/scripting/functions/GangZoneGetPos.md @@ -32,12 +32,12 @@ public OnGameModeInit() { gangZone = GangZoneCreate(1248.011, 2072.804, 1439.348, 2204.319); - new + new Float:minX, Float:minY, Float:maxX, Float:maxY; - + GangZoneGetPos(gangZone, minX, minY, maxX, maxY); return 1; } @@ -58,4 +58,4 @@ public OnGameModeInit() - [IsPlayerInGangZone](IsPlayerInGangZone): Check if the player in gangzone. - [IsGangZoneVisibleForPlayer](IsGangZoneVisibleForPlayer): Check if the gangzone is visible for player. - [GangZoneGetFlashColourForPlayer](GangZoneGetFlashColourForPlayer): Get the flashing colour of a gangzone for player. -- [IsGangZoneFlashingForPlayer](IsGangZoneFlashingForPlayer): Check if the gangzone is flashing for player. \ No newline at end of file +- [IsGangZoneFlashingForPlayer](IsGangZoneFlashingForPlayer): Check if the gangzone is flashing for player. diff --git a/frontend/docs/scripting/functions/Get3DTextLabelText.md b/frontend/docs/scripting/functions/Get3DTextLabelText.md index 608b94900a2..e153bad7bb5 100644 --- a/frontend/docs/scripting/functions/Get3DTextLabelText.md +++ b/frontend/docs/scripting/functions/Get3DTextLabelText.md @@ -25,7 +25,7 @@ new Text3D:gMyLabel; public OnGameModeInit() { gMyLabel = Create3DTextLabel("Hello World!", 0x008080FF, 30.0, 40.0, 50.0, 40.0, 0, false); - + new text[16]; Get3DTextLabelText(gMyLabel, text, sizeof(text)); // The `text` will be 'Hello World!' diff --git a/frontend/docs/scripting/functions/GetActorAnimation.md b/frontend/docs/scripting/functions/GetActorAnimation.md index 2e2e72ac395..d7a71439105 100644 --- a/frontend/docs/scripting/functions/GetActorAnimation.md +++ b/frontend/docs/scripting/functions/GetActorAnimation.md @@ -12,7 +12,7 @@ tags: ["actor"] Get the animation the actor is currently performing. | Name | Description | -|--------------------|----------------------------------------------------------------------------| +| ------------------ | -------------------------------------------------------------------------- | | actorid | The ID of the actor to get the animation of. | | animationLibrary[] | An array into which to store the animationLibrary in, passed by reference. | | librarySize | The size of the animationLibrary array. | @@ -47,7 +47,7 @@ public OnGameModeInit() bool:lockY, bool:freeze, time; - + GetActorAnimation(gMyActor, animationLibrary, sizeof animationLibrary, animationName, sizeof animationName, delta, loop, lockX, lockY, freeze, time); return 1; } diff --git a/frontend/docs/scripting/functions/GetActorHealth.md b/frontend/docs/scripting/functions/GetActorHealth.md index 8b6d858ac21..20866a64704 100644 --- a/frontend/docs/scripting/functions/GetActorHealth.md +++ b/frontend/docs/scripting/functions/GetActorHealth.md @@ -32,7 +32,7 @@ new gMyActor; public OnGameModeInit() { gMyActor = CreateActor(179, 316.1, -134.0, 999.6, 90.0); // Actor as salesperson in Ammunation - + SetActorHealth(gMyActor, 100.0); new Float:actorHealth; diff --git a/frontend/docs/scripting/functions/GetActorSkin.md b/frontend/docs/scripting/functions/GetActorSkin.md index 5cf8ace1d42..f27091a53e3 100644 --- a/frontend/docs/scripting/functions/GetActorSkin.md +++ b/frontend/docs/scripting/functions/GetActorSkin.md @@ -12,7 +12,7 @@ tags: ["actor"] Get the skin of the actor. | Name | Description | -|---------|-----------------------------| +| ------- | --------------------------- | | actorid | The ID of the actor to get. | ## Return Values @@ -27,7 +27,7 @@ new gMyActor; public OnGameModeInit() { gMyActor = CreateActor(179, 1153.9640, -1772.3915, 16.5920, 0.0000); - + new actorSkinID = GetActorSkin(gMyActor); // The value of `actorSkinID` is now 179 return 1; diff --git a/frontend/docs/scripting/functions/GetActorSpawnInfo.md b/frontend/docs/scripting/functions/GetActorSpawnInfo.md index 85e25e77ef3..31da23b4a02 100644 --- a/frontend/docs/scripting/functions/GetActorSpawnInfo.md +++ b/frontend/docs/scripting/functions/GetActorSpawnInfo.md @@ -12,7 +12,7 @@ tags: ["actor"] Get the initial spawn point of the actor. | Name | Description | -|-------------------|------------------------------------------------------------------------------| +| ----------------- | ---------------------------------------------------------------------------- | | actorid | The ID of the actor to get the spawn point of | | &skin | A variable into which to store the skin in, passed by reference. | | &Float:spawnX | A float variable into which to store the spawnX in, passed by reference. | @@ -38,7 +38,7 @@ public OnGameModeInit() Float:spawnY, Float:spawnZ, Float:spawnAngle; - + GetActorSpawnInfo(gMyActor, skin, spawnX, spawnY, spawnZ, spawnAngle); return 1; } diff --git a/frontend/docs/scripting/functions/GetActors.md b/frontend/docs/scripting/functions/GetActors.md index 7dad22b3c83..172996983b7 100644 --- a/frontend/docs/scripting/functions/GetActors.md +++ b/frontend/docs/scripting/functions/GetActors.md @@ -11,10 +11,10 @@ tags: ["actor"] Gets an array variable of the IDs of the created actors on the server. -| Name | Description | -| ------------- | ------------------------------------------------------------------ | -| actors[] | An array into which to store the actor IDs, passed by reference. | -| size | The size of the array. | +| Name | Description | +| -------- | ---------------------------------------------------------------- | +| actors[] | An array into which to store the actor IDs, passed by reference. | +| size | The size of the array. | ## Returns diff --git a/frontend/docs/scripting/functions/GetCustomModelPath.md b/frontend/docs/scripting/functions/GetCustomModelPath.md index f207567fb66..349a1ced5a2 100644 --- a/frontend/docs/scripting/functions/GetCustomModelPath.md +++ b/frontend/docs/scripting/functions/GetCustomModelPath.md @@ -31,7 +31,7 @@ GetCustomModelPath(modelid, dffPath, sizeof(dffPath), txdPath, sizeof(txdPath)); printf("[Custom model id %d path]\n\ dff: %s\n\ - txd: %s", + txd: %s", modelid, dffPath, txdPath); ``` diff --git a/frontend/docs/scripting/functions/GetDefaultPlayerColour.md b/frontend/docs/scripting/functions/GetDefaultPlayerColour.md index ff83d1ace4b..9934de1f4c9 100644 --- a/frontend/docs/scripting/functions/GetDefaultPlayerColour.md +++ b/frontend/docs/scripting/functions/GetDefaultPlayerColour.md @@ -11,9 +11,9 @@ tags: ["player"] Gets the default colour for the player ID. -| Name | Description | -| -------- | ------------------------------------------------------------------------- | -| playerid | The ID of the player to get the colour of. Doesn't need to be connected. | +| Name | Description | +| -------- | ------------------------------------------------------------------------ | +| playerid | The ID of the player to get the colour of. Doesn't need to be connected. | ## Returns diff --git a/frontend/docs/scripting/functions/GetGameText.md b/frontend/docs/scripting/functions/GetGameText.md index 2dc2d8ccd6f..1362657b81c 100644 --- a/frontend/docs/scripting/functions/GetGameText.md +++ b/frontend/docs/scripting/functions/GetGameText.md @@ -12,7 +12,7 @@ tags: ["player"] Returns all the information on the given game text style. | Name | Description | -|------------------------|-----------------------------------------------------------------------| +| ---------------------- | --------------------------------------------------------------------- | | playerid | The ID of the player to get the rotation of. | | style | The [style](../resources/gametextstyles) of text to get the data for. | | message[] | Return array for the text string. | @@ -33,7 +33,7 @@ public OnPlayerConnect(playerid) { GameTextForPlayer(playerid, "Welcome to the server!", 5000, 3); - new + new message[32], time, remaining; diff --git a/frontend/docs/scripting/functions/GetMenuItem.md b/frontend/docs/scripting/functions/GetMenuItem.md index b7b05936361..89a6e377914 100644 --- a/frontend/docs/scripting/functions/GetMenuItem.md +++ b/frontend/docs/scripting/functions/GetMenuItem.md @@ -11,13 +11,13 @@ tags: ["menu"] Get the text in the specified cell - addressed by column and row. -| Name | Description | -| --------- | ----------------------------------------------------------------- | -| Menu:menuid | The ID of the menu. | -| column | The column. | -| row | The row to get the text of. | -| cell[] | An array into which to store the text, passed by reference. | -| len | The length of the string that should be stored. | +| Name | Description | +| ----------- | ----------------------------------------------------------- | +| Menu:menuid | The ID of the menu. | +| column | The column. | +| row | The row to get the text of. | +| cell[] | An array into which to store the text, passed by reference. | +| len | The length of the string that should be stored. | ## Returns diff --git a/frontend/docs/scripting/functions/GetMyFacingAngle.md b/frontend/docs/scripting/functions/GetMyFacingAngle.md index 431aef26f07..aa18a59ac6f 100644 --- a/frontend/docs/scripting/functions/GetMyFacingAngle.md +++ b/frontend/docs/scripting/functions/GetMyFacingAngle.md @@ -5,13 +5,19 @@ description: Get the current facing angle of the NPC. tags: [] --- +:::warning + +This function is deprecated. Please see [NPC_GetFacingAngle](NPC_GetFacingAngle). + +::: + ## Description Get the current facing angle of the NPC. -| Name | Description | -| -------------------- | ---------------------------------------------------------------- | -| &Float:Angle | A float to save the angle in, passed by reference. | +| Name | Description | +| ------------ | -------------------------------------------------- | +| &Float:Angle | A float to save the angle in, passed by reference. | ## Returns diff --git a/frontend/docs/scripting/functions/GetMyPos.md b/frontend/docs/scripting/functions/GetMyPos.md index 6f127b31a54..cbb0609b05e 100644 --- a/frontend/docs/scripting/functions/GetMyPos.md +++ b/frontend/docs/scripting/functions/GetMyPos.md @@ -5,19 +5,25 @@ description: Get position of the NPC tags: ["npc"] --- +:::warning + +This function is deprecated. Please see [NPC_GetPos](NPC_GetPos). + +::: + ## Description -Get the position of the NPC. - -| Name | Description | -| --------- | -------------------------------------------------------| -| &Float:x | A float to save the X coordinate, passed by reference. | -| &Float:y | A float to save the Y coordinate, passed by reference. | -| &Float:z | A float to save the Z coordinate, passed by reference. | +Get the position of the NPC. + +| Name | Description | +| -------- | ------------------------------------------------------ | +| &Float:x | A float to save the X coordinate, passed by reference. | +| &Float:y | A float to save the Y coordinate, passed by reference. | +| &Float:z | A float to save the Z coordinate, passed by reference. | ## Returns -This function does not return any specific values. +This function does not return any specific values. ## Example diff --git a/frontend/docs/scripting/functions/GetObjectAttachedData.md b/frontend/docs/scripting/functions/GetObjectAttachedData.md index ec6528c6e0c..2331b6273d4 100644 --- a/frontend/docs/scripting/functions/GetObjectAttachedData.md +++ b/frontend/docs/scripting/functions/GetObjectAttachedData.md @@ -12,7 +12,7 @@ tags: ["object"] Get the attachment data of an object. | Name | Description | -|----------------|-------------------------------------------------------------------------| +| -------------- | ----------------------------------------------------------------------- | | objectid | The ID of the object to get the attachment data of | | &parentVehicle | A variable in which to store the parentVehicle ID, passed by reference. | | &parentObject | A variable in which to store the parentObject ID, passed by reference. | @@ -27,7 +27,7 @@ Get the attachment data of an object. ## Examples ```c -new +new parentVehicle, parentObject, parentPlayer; diff --git a/frontend/docs/scripting/functions/GetObjectAttachedOffset.md b/frontend/docs/scripting/functions/GetObjectAttachedOffset.md index 36b475417ac..fa5b359ffe1 100644 --- a/frontend/docs/scripting/functions/GetObjectAttachedOffset.md +++ b/frontend/docs/scripting/functions/GetObjectAttachedOffset.md @@ -12,7 +12,7 @@ tags: ["object"] Get the attachment offset and rotation of an object. | Name | Description | -|------------------|-----------------------------------------------------------------------------------| +| ---------------- | --------------------------------------------------------------------------------- | | objectid | The ID of the object to get the offset and rotation of. | | &Float:offsetX | A float variable in which to store the offsetX coordinate, passed by reference. | | &Float:offsetY | A float variable in which to store the offsetY coordinate, passed by reference. | @@ -30,7 +30,7 @@ Get the attachment offset and rotation of an object. ## Examples ```c -new +new Float:offsetX, Float:offsetY, Float:offsetZ, diff --git a/frontend/docs/scripting/functions/GetObjectDrawDistance.md b/frontend/docs/scripting/functions/GetObjectDrawDistance.md index 7cc448063e5..1056b1107a2 100644 --- a/frontend/docs/scripting/functions/GetObjectDrawDistance.md +++ b/frontend/docs/scripting/functions/GetObjectDrawDistance.md @@ -12,7 +12,7 @@ tags: ["object"] Get the draw distance of an object. | Name | Description | -|----------|--------------------------------------------------| +| -------- | ------------------------------------------------ | | objectid | The ID of the object to get the draw distance of | ## Returns diff --git a/frontend/docs/scripting/functions/GetObjectMaterial.md b/frontend/docs/scripting/functions/GetObjectMaterial.md index 56b3efad80b..6c2a27da0ed 100644 --- a/frontend/docs/scripting/functions/GetObjectMaterial.md +++ b/frontend/docs/scripting/functions/GetObjectMaterial.md @@ -12,7 +12,7 @@ tags: ["object"] Get the material data from an index of the object. | Name | Description | -|--------------------|-----------------------------------------------------------------------| +| ------------------ | --------------------------------------------------------------------- | | objectid | The ID of the object. | | materialIndex | The material index on the object. (0 to 15) | | &modelid | A variable in which to store the model ID, passed by reference. | @@ -34,7 +34,7 @@ Get the material data from an index of the object. 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 +new modelid, textureLibrary[16], textureName[16], diff --git a/frontend/docs/scripting/functions/GetObjectMaterialText.md b/frontend/docs/scripting/functions/GetObjectMaterialText.md index 3b5ad79cea0..c09cf855ba5 100644 --- a/frontend/docs/scripting/functions/GetObjectMaterialText.md +++ b/frontend/docs/scripting/functions/GetObjectMaterialText.md @@ -12,7 +12,7 @@ tags: ["object"] Get the material text data from an index of the object. | Name | Description | -|-------------------------------------------|-------------------------------------------------------------------------| +| ----------------------------------------- | ----------------------------------------------------------------------- | | objectid | The ID of the object. | | materialIndex | The material index on the object. (0 to 15) | | text[] | An array into which to store the text, passed by reference. | @@ -38,7 +38,7 @@ Get the material text data from an index of the object. 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 +new text[16], OBJECT_MATERIAL_SIZE:materialSize, fontFace[16], diff --git a/frontend/docs/scripting/functions/GetObjectModel.md b/frontend/docs/scripting/functions/GetObjectModel.md index e821d3ada17..f0e2d0c85a6 100644 --- a/frontend/docs/scripting/functions/GetObjectModel.md +++ b/frontend/docs/scripting/functions/GetObjectModel.md @@ -27,7 +27,7 @@ The model ID of the object. public OnGameModeInit() { new objectid = CreateObject(19609, 666.57239, 1750.79749, 4.95627, 0.00000, 0.00000, -156.00000); - + new modelid = GetObjectModel(objectid); printf("Object model: %d", modelid); // Output: "Object model: 19609" return 1; diff --git a/frontend/docs/scripting/functions/GetObjectMoveSpeed.md b/frontend/docs/scripting/functions/GetObjectMoveSpeed.md index 1bc4ce1ae6c..d51c467c60d 100644 --- a/frontend/docs/scripting/functions/GetObjectMoveSpeed.md +++ b/frontend/docs/scripting/functions/GetObjectMoveSpeed.md @@ -12,7 +12,7 @@ tags: ["object"] Get the move speed of an object. | Name | Description | -|----------|------------------------------------------------| +| -------- | ---------------------------------------------- | | objectid | The ID of the object to get the move speed of. | ## Returns diff --git a/frontend/docs/scripting/functions/GetObjectMovingTargetPos.md b/frontend/docs/scripting/functions/GetObjectMovingTargetPos.md index abc2de1f098..8a7f22bcd06 100644 --- a/frontend/docs/scripting/functions/GetObjectMovingTargetPos.md +++ b/frontend/docs/scripting/functions/GetObjectMovingTargetPos.md @@ -12,7 +12,7 @@ tags: ["object"] Get the move target position of an object. | Name | Description | -|----------------|---------------------------------------------------------------------------------| +| -------------- | ------------------------------------------------------------------------------- | | objectid | The ID of the object to get the move target position of. | | &Float:targetX | A float variable in which to store the targetX coordinate, passed by reference. | | &Float:targetY | A float variable in which to store the targetY coordinate, passed by reference. | @@ -30,7 +30,7 @@ Get the move target position of an object. new objectid = CreateObject(985, 1003.39154, -643.33423, 122.35060, 0.00000, 1.00000, 24.00000); MoveObject(objectid, 1003.3915, -643.3342, 114.5122, 0.8); -new +new Float:targetX, Float:targetY, Float:targetZ; diff --git a/frontend/docs/scripting/functions/GetObjectMovingTargetRot.md b/frontend/docs/scripting/functions/GetObjectMovingTargetRot.md index cc9bfd284ff..b5768dac976 100644 --- a/frontend/docs/scripting/functions/GetObjectMovingTargetRot.md +++ b/frontend/docs/scripting/functions/GetObjectMovingTargetRot.md @@ -12,7 +12,7 @@ tags: ["object"] Get the move target rotation of an object. | Name | Description | -|------------------|-----------------------------------------------------------------------------------| +| ---------------- | --------------------------------------------------------------------------------- | | objectid | The ID of the object to get the move target rotation of. | | &Float:rotationX | A float variable in which to store the rotationX coordinate, passed by reference. | | &Float:rotationY | A float variable in which to store the rotationY coordinate, passed by reference. | @@ -30,7 +30,7 @@ Get the move target rotation of an object. new objectid = CreateObject(968, 1023.79541, -943.75879, 42.31450, 0.00000, 0.00000, 10.00000); MoveObject(objectid, 1023.79541, -943.75879, 42.31450, 0.8, 0.00000, -90.00000, 10.00000); -new +new Float:rotationX, Float:rotationY, Float:rotationZ; diff --git a/frontend/docs/scripting/functions/GetObjectSyncRotation.md b/frontend/docs/scripting/functions/GetObjectSyncRotation.md index 6319c543d62..f51f9901567 100644 --- a/frontend/docs/scripting/functions/GetObjectSyncRotation.md +++ b/frontend/docs/scripting/functions/GetObjectSyncRotation.md @@ -12,7 +12,7 @@ tags: ["object"] Get the sync rotation of an object. | Name | Description | -|----------|-----------------------| +| -------- | --------------------- | | objectid | The ID of the object. | ## Returns diff --git a/frontend/docs/scripting/functions/GetObjectType.md b/frontend/docs/scripting/functions/GetObjectType.md index 4ca1410088f..f47f2a3a6ce 100644 --- a/frontend/docs/scripting/functions/GetObjectType.md +++ b/frontend/docs/scripting/functions/GetObjectType.md @@ -12,7 +12,7 @@ tags: ["object"] Get the type of an object. (global or player) | Name | Description | -|----------|------------------------------------------| +| -------- | ---------------------------------------- | | playerid | The ID of the player. | | objectid | The ID of the object to get the type of. | diff --git a/frontend/docs/scripting/functions/GetPickupModel.md b/frontend/docs/scripting/functions/GetPickupModel.md index 0fd832077b7..cdedd600397 100644 --- a/frontend/docs/scripting/functions/GetPickupModel.md +++ b/frontend/docs/scripting/functions/GetPickupModel.md @@ -12,7 +12,7 @@ tags: ["pickup"] Gets the model ID of a pickup. | Name | Description | -|----------|----------------------------------------------| +| -------- | -------------------------------------------- | | pickupid | The ID of the pickup to get the model ID of. | ## Returns diff --git a/frontend/docs/scripting/functions/GetPickupPos.md b/frontend/docs/scripting/functions/GetPickupPos.md index 630d85fe56f..53dbd2d1941 100644 --- a/frontend/docs/scripting/functions/GetPickupPos.md +++ b/frontend/docs/scripting/functions/GetPickupPos.md @@ -12,7 +12,7 @@ tags: ["pickup"] Gets the coordinates of a pickup. | Name | Description | -|----------|---------------------------------------------------------------------------| +| -------- | ------------------------------------------------------------------------- | | pickupid | The ID of the pickup to get the position of. | | &Float:x | A float variable in which to store the x coordinate, passed by reference. | | &Float:y | A float variable in which to store the y coordinate, passed by reference. | @@ -33,7 +33,7 @@ public OnGameModeInit() { g_Pickup = CreatePickup(1239, 1, 1686.6160, 1455.4277, 10.7705, -1); - new + new Float:x, Float:y, Float:z; diff --git a/frontend/docs/scripting/functions/GetPickupType.md b/frontend/docs/scripting/functions/GetPickupType.md index 1a1b062aa39..6e591a052ab 100644 --- a/frontend/docs/scripting/functions/GetPickupType.md +++ b/frontend/docs/scripting/functions/GetPickupType.md @@ -12,7 +12,7 @@ tags: ["pickup"] Gets the type of a pickup. | Name | Description | -|----------|------------------------------------------| +| -------- | ---------------------------------------- | | pickupid | The ID of the pickup to get the type of. | ## Returns diff --git a/frontend/docs/scripting/functions/GetPickupVirtualWorld.md b/frontend/docs/scripting/functions/GetPickupVirtualWorld.md index 8b5dbed704c..19d20121c6c 100644 --- a/frontend/docs/scripting/functions/GetPickupVirtualWorld.md +++ b/frontend/docs/scripting/functions/GetPickupVirtualWorld.md @@ -12,7 +12,7 @@ tags: ["pickup"] Gets the virtual world ID of a pickup. | Name | Description | -|----------|------------------------------------------------------| +| -------- | ---------------------------------------------------- | | pickupid | The ID of the pickup to get the virtual world ID of. | ## Returns diff --git a/frontend/docs/scripting/functions/GetPlayer3DTextLabelAttached.md b/frontend/docs/scripting/functions/GetPlayer3DTextLabelAttached.md index 46e3a2948c1..188bff6f48c 100644 --- a/frontend/docs/scripting/functions/GetPlayer3DTextLabelAttached.md +++ b/frontend/docs/scripting/functions/GetPlayer3DTextLabelAttached.md @@ -15,12 +15,12 @@ This function is deprecated. Please see [GetPlayer3DTextLabelAttachedData](GetPl Gets the player's 3D text label attached data. -| Name | Description | -| --------- | ------------------------------------------------------------------------- | -| playerid | The ID of the player. | -| PlayerText3D:textid | The ID of the player's 3D text label to get the attached data of. | -| &parentPlayerid | A variable into which to store the parentPlayerid, passed by reference. | -| &parentVehicleid | A variable into which to store the parentVehicleid, passed by reference. | +| Name | Description | +| ------------------- | ------------------------------------------------------------------------ | +| playerid | The ID of the player. | +| PlayerText3D:textid | The ID of the player's 3D text label to get the attached data of. | +| &parentPlayerid | A variable into which to store the parentPlayerid, passed by reference. | +| &parentVehicleid | A variable into which to store the parentVehicleid, passed by reference. | ## Examples diff --git a/frontend/docs/scripting/functions/GetPlayerAnimFlags.md b/frontend/docs/scripting/functions/GetPlayerAnimFlags.md index d6fe72c8f5a..fad4344afdc 100644 --- a/frontend/docs/scripting/functions/GetPlayerAnimFlags.md +++ b/frontend/docs/scripting/functions/GetPlayerAnimFlags.md @@ -11,8 +11,8 @@ tags: ["player", "animation"] Get the player animation flags. -| Name | Description | -| -------- | ---------------------------------------- | +| Name | Description | +| -------- | ------------------------------------------------------ | | playerid | The player id you want to get the animation flags from | ## Returns diff --git a/frontend/docs/scripting/functions/GetPlayerAnimationFlags.md b/frontend/docs/scripting/functions/GetPlayerAnimationFlags.md index 5d6f852f498..93888f47879 100644 --- a/frontend/docs/scripting/functions/GetPlayerAnimationFlags.md +++ b/frontend/docs/scripting/functions/GetPlayerAnimationFlags.md @@ -11,8 +11,8 @@ tags: ["player", "animation"] Get the player animation flags. -| Name | Description | -| -------- | ---------------------------------------- | +| Name | Description | +| -------- | ------------------------------------------------------ | | playerid | The player id you want to get the animation flags from | ## Returns diff --git a/frontend/docs/scripting/functions/GetPlayerAnimationIndex.md b/frontend/docs/scripting/functions/GetPlayerAnimationIndex.md index a591774207c..b9df30ed5ab 100644 --- a/frontend/docs/scripting/functions/GetPlayerAnimationIndex.md +++ b/frontend/docs/scripting/functions/GetPlayerAnimationIndex.md @@ -30,7 +30,7 @@ public OnPlayerUpdate(playerid) string[128]; GetAnimationName(GetPlayerAnimationIndex(playerid), animationLibrary, sizeof (animationLibrary), animationName, sizeof (animationName)); - + format(string, sizeof (string), "Running anim: %s %s", animationLibrary, animationName); SendClientMessage(playerid, 0xFFFFFFFF, string); } diff --git a/frontend/docs/scripting/functions/GetPlayerAttachedObject.md b/frontend/docs/scripting/functions/GetPlayerAttachedObject.md index 76bb24eadae..8e9548a5973 100644 --- a/frontend/docs/scripting/functions/GetPlayerAttachedObject.md +++ b/frontend/docs/scripting/functions/GetPlayerAttachedObject.md @@ -36,12 +36,12 @@ Always returns true. ## Examples ```c -new - modelid, - bone, - Float:offsetX, Float:offsetY, Float:offsetZ, - Float:rotationX, Float:rotationY, Float:rotationZ, - Float:scaleX, Float:scaleY, Float:scaleZ, +new + modelid, + bone, + Float:offsetX, Float:offsetY, Float:offsetZ, + Float:rotationX, Float:rotationY, Float:rotationZ, + Float:scaleX, Float:scaleY, Float:scaleZ, materialColour1, materialColour2; // Get the attached data of index 3 @@ -53,4 +53,4 @@ GetPlayerAttachedObject(playerid, 3, modelid, bone, offsetX, offsetY, offsetZ, r - [SetPlayerAttachedObject](SetPlayerAttachedObject): Attach an object to a player - [RemovePlayerAttachedObject](RemovePlayerAttachedObject): Remove an attached object from a player - [IsPlayerAttachedObjectSlotUsed](IsPlayerAttachedObjectSlotUsed): Check whether an object is attached to a player in a specified index -- [EditAttachedObject](EditAttachedObject): Edit an attached object. \ No newline at end of file +- [EditAttachedObject](EditAttachedObject): Edit an attached object. diff --git a/frontend/docs/scripting/functions/GetPlayerBuildingsRemoved.md b/frontend/docs/scripting/functions/GetPlayerBuildingsRemoved.md index 88b62713b82..66b4e925d57 100644 --- a/frontend/docs/scripting/functions/GetPlayerBuildingsRemoved.md +++ b/frontend/docs/scripting/functions/GetPlayerBuildingsRemoved.md @@ -12,7 +12,7 @@ tags: ["player"] Gets the number of removed buildings for a player. | Name | Description | -|----------|-----------------------| +| -------- | --------------------- | | playerid | The ID of the player. | ## Returns diff --git a/frontend/docs/scripting/functions/GetPlayerCameraTargetPlayerObject.md b/frontend/docs/scripting/functions/GetPlayerCameraTargetPlayerObject.md index 0bb8c72981b..0a1e0782e28 100644 --- a/frontend/docs/scripting/functions/GetPlayerCameraTargetPlayerObject.md +++ b/frontend/docs/scripting/functions/GetPlayerCameraTargetPlayerObject.md @@ -17,7 +17,7 @@ Allows you to retrieve the ID of the player-object the player is looking at. ## Returns -The ID of the player-object the player is looking at. +The ID of the player-object the player is looking at. If `INVALID_OBJECT_ID` (65535) is returned, player isn't looking at any object. diff --git a/frontend/docs/scripting/functions/GetPlayerClass.md b/frontend/docs/scripting/functions/GetPlayerClass.md index 121d187ada5..137e357d948 100644 --- a/frontend/docs/scripting/functions/GetPlayerClass.md +++ b/frontend/docs/scripting/functions/GetPlayerClass.md @@ -11,21 +11,21 @@ tags: ["class"] Get the class data. -| Name | Description | -| ------------- | ------------------------------------------------------------- | -| classid | The class id to get data from. | -| &team | A variable in which to store the team in, passed by reference. | -| &skin | A variable in which to store the skin in, passed by reference. | -| &Float:spawnX | A float variable in which to store the X coordinate in, passed by reference. | -| &Float:spawnY | A float variable in which to store the Y coordinate in, passed by reference. | -| &Float:spawnZ | A float variable in which to store the Z coordinate in, passed by reference. | -| &Float:angle | A float variable in which to store the angle coordinate in, passed by reference. | -| &WEAPON:weapon1 | A variable in which to store the weapon1 in, passed by reference. | -| &ammo1 | A variable in which to store the ammo1 in, passed by reference. | -| &WEAPON:weapon2 | A variable in which to store the weapon2 in, passed by reference. | -| &ammo2 | A variable in which to store the ammo2 in, passed by reference. | -| &WEAPON:weapon3 | A variable in which to store the weapon3 in, passed by reference. | -| &ammo3 | A variable in which to store the ammo3 in, passed by reference. | +| Name | Description | +| --------------- | -------------------------------------------------------------------------------- | +| classid | The class id to get data from. | +| &team | A variable in which to store the team in, passed by reference. | +| &skin | A variable in which to store the skin in, passed by reference. | +| &Float:spawnX | A float variable in which to store the X coordinate in, passed by reference. | +| &Float:spawnY | A float variable in which to store the Y coordinate in, passed by reference. | +| &Float:spawnZ | A float variable in which to store the Z coordinate in, passed by reference. | +| &Float:angle | A float variable in which to store the angle coordinate in, passed by reference. | +| &WEAPON:weapon1 | A variable in which to store the weapon1 in, passed by reference. | +| &ammo1 | A variable in which to store the ammo1 in, passed by reference. | +| &WEAPON:weapon2 | A variable in which to store the weapon2 in, passed by reference. | +| &ammo2 | A variable in which to store the ammo2 in, passed by reference. | +| &WEAPON:weapon3 | A variable in which to store the weapon3 in, passed by reference. | +| &ammo3 | A variable in which to store the ammo3 in, passed by reference. | ## Examples @@ -59,7 +59,7 @@ printf("[Class id %d data]\n\ weapon2: %d\n\ ammo2: %d\n\ weapon3: %d\n\ - ammo3: %d", + ammo3: %d", classid, team, skin, spawnX, spawnY, spawnZ, angle, weapon1, ammo1, weapon2, ammo2, weapon3, ammo3); ``` diff --git a/frontend/docs/scripting/functions/GetPlayerDialog.md b/frontend/docs/scripting/functions/GetPlayerDialog.md index 1856611995a..f510cb580ae 100644 --- a/frontend/docs/scripting/functions/GetPlayerDialog.md +++ b/frontend/docs/scripting/functions/GetPlayerDialog.md @@ -16,7 +16,7 @@ This function is deprecated. Use [GetPlayerDialogID](GetPlayerDialogID). Get the ID of the dialog currently show to the player. | Name | Description | -|----------|-----------------------| +| -------- | --------------------- | | playerid | The ID of the player. | ## Return Values diff --git a/frontend/docs/scripting/functions/GetPlayerDialogData.md b/frontend/docs/scripting/functions/GetPlayerDialogData.md index 2f442baa36d..cd8b57d9864 100644 --- a/frontend/docs/scripting/functions/GetPlayerDialogData.md +++ b/frontend/docs/scripting/functions/GetPlayerDialogData.md @@ -12,7 +12,7 @@ tags: ["player", "dialog"] Get the data of the dialog currently show to the player. | Name | Description | -|---------------------|-------------------------------------------------------------------------| +| ------------------- | ----------------------------------------------------------------------- | | playerid | The ID of the player to get the data. | | &DIALOG_STYLE:style | A variable into which to store the style, passed by reference. | | title[] | An array variable into which to store the title, passed by reference. | @@ -40,7 +40,7 @@ enum ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Login", "Enter your password below:", "Login", "Cancel"); -new +new DIALOG_STYLE:style, title[32], body[64], diff --git a/frontend/docs/scripting/functions/GetPlayerDialogID.md b/frontend/docs/scripting/functions/GetPlayerDialogID.md index 697e63366a4..233d2732c96 100644 --- a/frontend/docs/scripting/functions/GetPlayerDialogID.md +++ b/frontend/docs/scripting/functions/GetPlayerDialogID.md @@ -12,7 +12,7 @@ tags: ["player", "dialog"] Get the ID of the dialog currently show to the player. | Name | Description | -|----------|-----------------------| +| -------- | --------------------- | | playerid | The ID of the player. | ## Return Values diff --git a/frontend/docs/scripting/functions/GetPlayerFightingStyle.md b/frontend/docs/scripting/functions/GetPlayerFightingStyle.md index a229622a8b0..0c2b40ebf18 100644 --- a/frontend/docs/scripting/functions/GetPlayerFightingStyle.md +++ b/frontend/docs/scripting/functions/GetPlayerFightingStyle.md @@ -56,7 +56,7 @@ public OnPlayerCommandText(playerid, cmdtext[]) styleName = "elbow"; } } - + format(string, sizeof(string), "You are using %s fighting style!", styleName); SendClientMessage(playerid, 0xFFFFFFAA, string); return 1; diff --git a/frontend/docs/scripting/functions/GetPlayerGhostMode.md b/frontend/docs/scripting/functions/GetPlayerGhostMode.md index 023bd4fa25c..cda868203a4 100644 --- a/frontend/docs/scripting/functions/GetPlayerGhostMode.md +++ b/frontend/docs/scripting/functions/GetPlayerGhostMode.md @@ -11,8 +11,8 @@ tags: ["player"] Get player's ghost mode. -| Name | Description | -| -------- | ----------------------------------------------------- | +| Name | Description | +| -------- | ---------------------------------------------- | | playerid | The ID of the player to get the ghost mode of. | ## Returns diff --git a/frontend/docs/scripting/functions/GetPlayerGravity.md b/frontend/docs/scripting/functions/GetPlayerGravity.md index 2fb9abd6d41..7cf58c9b830 100644 --- a/frontend/docs/scripting/functions/GetPlayerGravity.md +++ b/frontend/docs/scripting/functions/GetPlayerGravity.md @@ -39,4 +39,4 @@ public OnPlayerCommandText(playerid, cmdtext[]) - [SetPlayerGravity](SetPlayerGravity): Set a player's gravity. - [GetGravity](GetGravity): Get the currently global gravity. -- [SetGravity](SetGravity): Set the gravity for all players. \ No newline at end of file +- [SetGravity](SetGravity): Set the gravity for all players. diff --git a/frontend/docs/scripting/functions/GetPlayerHealth.md b/frontend/docs/scripting/functions/GetPlayerHealth.md index caa02ce6cdd..eb0ccb88ba2 100644 --- a/frontend/docs/scripting/functions/GetPlayerHealth.md +++ b/frontend/docs/scripting/functions/GetPlayerHealth.md @@ -31,10 +31,10 @@ public OnPlayerCommandText(playerid, cmdtext[]) { // Sets players health to 50 if it was lower than // 50 before, as soon as he typed /doctor - + new Float:health; GetPlayerHealth(playerid, health); - + if (health < 50.0) { SetPlayerHealth(playerid, 50.0); diff --git a/frontend/docs/scripting/functions/GetPlayerHydraReactorAngle.md b/frontend/docs/scripting/functions/GetPlayerHydraReactorAngle.md index 76e1d16bf1f..e639fe1b096 100644 --- a/frontend/docs/scripting/functions/GetPlayerHydraReactorAngle.md +++ b/frontend/docs/scripting/functions/GetPlayerHydraReactorAngle.md @@ -14,7 +14,7 @@ Gets the hydra reactor angle of the player's vehicle. ## Parameters | Name | Description | -|----------|-----------------------| +| -------- | --------------------- | | playerid | The ID of the player. | ## Examples diff --git a/frontend/docs/scripting/functions/GetPlayerIp.md b/frontend/docs/scripting/functions/GetPlayerIp.md index d4af24e84f4..06c6c7fa249 100644 --- a/frontend/docs/scripting/functions/GetPlayerIp.md +++ b/frontend/docs/scripting/functions/GetPlayerIp.md @@ -44,7 +44,7 @@ PAWN is case-sensitive. GetPlayerIP will not work. :::warning -**SA-MP server**: This function **does not work** when used in [OnPlayerDisconnect](../callbacks/OnPlayerDisconnect) because the player is already disconnected. It will return an invalid IP (255.255.255.255). +**SA-MP server**: This function **does not work** when used in [OnPlayerDisconnect](../callbacks/OnPlayerDisconnect) because the player is already disconnected. It will return an invalid IP (255.255.255.255). Save players' IPs under [OnPlayerConnect](../callbacks/OnPlayerConnect) if they need to be used under [OnPlayerDisconnect](../callbacks/OnPlayerDisconnect). **open.mp server**: This function **work** when used in [OnPlayerDisconnect](../callbacks/OnPlayerDisconnect). diff --git a/frontend/docs/scripting/functions/GetPlayerLandingGearState.md b/frontend/docs/scripting/functions/GetPlayerLandingGearState.md index 8d066648d30..146b77a72c5 100644 --- a/frontend/docs/scripting/functions/GetPlayerLandingGearState.md +++ b/frontend/docs/scripting/functions/GetPlayerLandingGearState.md @@ -14,7 +14,7 @@ Gets the [landing gear state](../resources/landinggearstate) of the current play ## Parameters | Name | Description | -|----------|-----------------------| +| -------- | --------------------- | | playerid | The ID of the player. | ## Examples diff --git a/frontend/docs/scripting/functions/GetPlayerLastShotVectors.md b/frontend/docs/scripting/functions/GetPlayerLastShotVectors.md index 7b161781ab7..910b04ab989 100644 --- a/frontend/docs/scripting/functions/GetPlayerLastShotVectors.md +++ b/frontend/docs/scripting/functions/GetPlayerLastShotVectors.md @@ -39,7 +39,7 @@ public OnPlayerCommandText(playerid, cmdtext[]) Float:hitPosX, Float:hitPosY, Float:hitPosZ; GetPlayerLastShotVectors(playerid, originX, originY, originZ, hitPosX, hitPosY, hitPosZ); - + format(string, sizeof(string), "Last Shot Information: Origin: %f, %f, %f. Hit position: %f, %f, %f", originX, originY, originZ, hitPosX, hitPosY, hitPosZ); SendClientMessage(playerid, -1, string); return 1; diff --git a/frontend/docs/scripting/functions/GetPlayerLastSyncedTrailerID.md b/frontend/docs/scripting/functions/GetPlayerLastSyncedTrailerID.md index a08b2190a90..3054140787a 100644 --- a/frontend/docs/scripting/functions/GetPlayerLastSyncedTrailerID.md +++ b/frontend/docs/scripting/functions/GetPlayerLastSyncedTrailerID.md @@ -20,7 +20,7 @@ Gets the player's last synced trailer ID. ## Parameters | Name | Description | -|----------|-----------------------| +| -------- | --------------------- | | playerid | The ID of the player. | ## Return Values diff --git a/frontend/docs/scripting/functions/GetPlayerLastSyncedVehicleID.md b/frontend/docs/scripting/functions/GetPlayerLastSyncedVehicleID.md index 1e7ce212d70..7ec62141f07 100644 --- a/frontend/docs/scripting/functions/GetPlayerLastSyncedVehicleID.md +++ b/frontend/docs/scripting/functions/GetPlayerLastSyncedVehicleID.md @@ -20,7 +20,7 @@ Gets the player's last synced vehicle ID. ## Parameters | Name | Description | -|----------|-----------------------| +| -------- | --------------------- | | playerid | The ID of the player. | ## Return Values diff --git a/frontend/docs/scripting/functions/GetPlayerMarkerForPlayer.md b/frontend/docs/scripting/functions/GetPlayerMarkerForPlayer.md index ff66ed7bfc1..07799c790d7 100644 --- a/frontend/docs/scripting/functions/GetPlayerMarkerForPlayer.md +++ b/frontend/docs/scripting/functions/GetPlayerMarkerForPlayer.md @@ -11,10 +11,10 @@ tags: ["player"] Get the colour of a player's **nametag** and **radar blip** for another player. -| Name | Description | -| -------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | -| playerid | The player that can see the player's changed blip/nametag colour | | -| targetid | The player whose colour has been changed. | +| Name | Description | +| -------- | ---------------------------------------------------------------- | --- | +| playerid | The player that can see the player's changed blip/nametag colour | | +| targetid | The player whose colour has been changed. | ## Returns diff --git a/frontend/docs/scripting/functions/GetPlayerObjectAttachedData.md b/frontend/docs/scripting/functions/GetPlayerObjectAttachedData.md index 0b125bbbfea..b6d6c056c23 100644 --- a/frontend/docs/scripting/functions/GetPlayerObjectAttachedData.md +++ b/frontend/docs/scripting/functions/GetPlayerObjectAttachedData.md @@ -12,7 +12,7 @@ tags: ["player", "object", "playerobject"] Get the attachment data of a player-object. | Name | Description | -|----------------|-------------------------------------------------------------------------| +| -------------- | ----------------------------------------------------------------------- | | playerid | The ID of the player | | objectid | The ID of the player-object to get the attachment data of | | &parentVehicle | A variable in which to store the parentVehicle ID, passed by reference. | @@ -28,7 +28,7 @@ Get the attachment data of a player-object. ## Examples ```c -new +new parentVehicle, parentObject, parentPlayer; diff --git a/frontend/docs/scripting/functions/GetPlayerObjectAttachedOffset.md b/frontend/docs/scripting/functions/GetPlayerObjectAttachedOffset.md index 23413e3a6c2..649f6089e29 100644 --- a/frontend/docs/scripting/functions/GetPlayerObjectAttachedOffset.md +++ b/frontend/docs/scripting/functions/GetPlayerObjectAttachedOffset.md @@ -12,7 +12,7 @@ tags: ["player", "object", "playerobject"] Get the attachment offset and rotation of a player-object. | Name | Description | -|------------------|-----------------------------------------------------------------------------------| +| ---------------- | --------------------------------------------------------------------------------- | | playerid | The ID of the player. | | objectid | The ID of the player-object to get the offset and rotation of. | | &Float:offsetX | A float variable in which to store the offsetX coordinate, passed by reference. | @@ -31,7 +31,7 @@ Get the attachment offset and rotation of a player-object. ## Examples ```c -new +new Float:offsetX, Float:offsetY, Float:offsetZ, diff --git a/frontend/docs/scripting/functions/GetPlayerObjectDrawDistance.md b/frontend/docs/scripting/functions/GetPlayerObjectDrawDistance.md index d12c3c819a3..5d0ee5f939b 100644 --- a/frontend/docs/scripting/functions/GetPlayerObjectDrawDistance.md +++ b/frontend/docs/scripting/functions/GetPlayerObjectDrawDistance.md @@ -12,7 +12,7 @@ tags: ["player", "object", "playerobject"] Get the draw distance of a player-object. | Name | Description | -|----------|---------------------------------------------------------| +| -------- | ------------------------------------------------------- | | playerid | The ID of the player | | objectid | The ID of the player-object to get the draw distance of | diff --git a/frontend/docs/scripting/functions/GetPlayerObjectMaterial.md b/frontend/docs/scripting/functions/GetPlayerObjectMaterial.md index 4cefb576276..06af60471b7 100644 --- a/frontend/docs/scripting/functions/GetPlayerObjectMaterial.md +++ b/frontend/docs/scripting/functions/GetPlayerObjectMaterial.md @@ -12,7 +12,7 @@ tags: ["player", "object", "playerobject"] Get the material data from an index of the player-object. | Name | Description | -|--------------------|-----------------------------------------------------------------------| +| ------------------ | --------------------------------------------------------------------- | | playerid | The ID of the player. | | objectid | The ID of the player-object. | | materialIndex | The material index on the object. (0 to 15) | @@ -35,7 +35,7 @@ Get the material data from an index of the player-object. new playerobjectid = CreatePlayerObject(playerid, 19371, 978.71143, -925.25708, 42.63720, 0.00000, 0.00000, 2.00000); SetPlayerObjectMaterial(playerid, playerobjectid, 0, 19341, "egg_texts", "easter_egg01", 0xFFFFFFFF); -new +new modelid, textureLibrary[16], textureName[16], diff --git a/frontend/docs/scripting/functions/GetPlayerObjectMaterialText.md b/frontend/docs/scripting/functions/GetPlayerObjectMaterialText.md index 42866030c4b..ce2773b7b6c 100644 --- a/frontend/docs/scripting/functions/GetPlayerObjectMaterialText.md +++ b/frontend/docs/scripting/functions/GetPlayerObjectMaterialText.md @@ -12,7 +12,7 @@ tags: ["player", "object", "playerobject"] Get the material text data from an index of the player-object. | Name | Description | -|-------------------------------------------|-------------------------------------------------------------------------| +| ----------------------------------------- | ----------------------------------------------------------------------- | | playerid | The ID of the player. | | objectid | The ID of the player-object. | | materialIndex | The material index on the object. (0 to 15) | @@ -39,7 +39,7 @@ Get the material text data from an index of the player-object. new playerobjectid = CreatePlayerObject(playerid, 19174, 986.42767, -983.14850, 40.95220, 0.00000, 0.00000, 186.00000); SetPlayerObjectMaterialText(playerid, playerobjectid, "OPEN.MP", 0, OBJECT_MATERIAL_SIZE_256x128, "Arial", 38, true, 0xFF0000FF, 0x00000000, OBJECT_MATERIAL_TEXT_ALIGN_LEFT); -new +new text[16], OBJECT_MATERIAL_SIZE:materialSize, fontFace[16], diff --git a/frontend/docs/scripting/functions/GetPlayerObjectMoveSpeed.md b/frontend/docs/scripting/functions/GetPlayerObjectMoveSpeed.md index 9cca90bebeb..8c30e9f9ba7 100644 --- a/frontend/docs/scripting/functions/GetPlayerObjectMoveSpeed.md +++ b/frontend/docs/scripting/functions/GetPlayerObjectMoveSpeed.md @@ -12,7 +12,7 @@ tags: ["player", "object", "playerobject"] Get the move speed of a player-object. | Name | Description | -|----------|-------------------------------------------------------| +| -------- | ----------------------------------------------------- | | playerid | The ID of the player. | | objectid | The ID of the player-object to get the move speed of. | diff --git a/frontend/docs/scripting/functions/GetPlayerObjectMovingTargetPos.md b/frontend/docs/scripting/functions/GetPlayerObjectMovingTargetPos.md index 85bc87d5bad..c163b9878e0 100644 --- a/frontend/docs/scripting/functions/GetPlayerObjectMovingTargetPos.md +++ b/frontend/docs/scripting/functions/GetPlayerObjectMovingTargetPos.md @@ -12,7 +12,7 @@ tags: ["player", "object", "playerobject"] Get the move target position of a player-object. | Name | Description | -|----------------|---------------------------------------------------------------------------------| +| -------------- | ------------------------------------------------------------------------------- | | playerid | The ID of the player. | | objectid | The ID of the player-object to get the move target position of. | | &Float:targetX | A float variable in which to store the targetX coordinate, passed by reference. | @@ -31,7 +31,7 @@ Get the move target position of a player-object. new playerobjectid = CreatePlayerObject(playerid, 985, 1003.39154, -643.33423, 122.35060, 0.00000, 1.00000, 24.00000); MovePlayerObject(playerid, playerobjectid, 1003.3915, -643.3342, 114.5122, 0.8); -new +new Float:targetX, Float:targetY, Float:targetZ; diff --git a/frontend/docs/scripting/functions/GetPlayerObjectMovingTargetRot.md b/frontend/docs/scripting/functions/GetPlayerObjectMovingTargetRot.md index a77198a9488..c9a95753073 100644 --- a/frontend/docs/scripting/functions/GetPlayerObjectMovingTargetRot.md +++ b/frontend/docs/scripting/functions/GetPlayerObjectMovingTargetRot.md @@ -12,7 +12,7 @@ tags: ["player", "object", "playerobject"] Get the move target rotation of a player-object. | Name | Description | -|------------------|-----------------------------------------------------------------------------------| +| ---------------- | --------------------------------------------------------------------------------- | | playerid | The ID of the player. | | objectid | The ID of the player-object to get the move target rotation of. | | &Float:rotationX | A float variable in which to store the rotationX coordinate, passed by reference. | @@ -31,7 +31,7 @@ Get the move target rotation of a player-object. new playerobjectid = CreatePlayerObject(playerid, 968, 1023.79541, -943.75879, 42.31450, 0.00000, 0.00000, 10.00000); MovePlayerObject(playerid, playerobjectid, 1023.79541, -943.75879, 42.31450, 0.8, 0.00000, -90.00000, 10.00000); -new +new Float:rotationX, Float:rotationY, Float:rotationZ; diff --git a/frontend/docs/scripting/functions/GetPlayerObjectSyncRotation.md b/frontend/docs/scripting/functions/GetPlayerObjectSyncRotation.md index 5ef8f2be4ae..a0fb5d035b0 100644 --- a/frontend/docs/scripting/functions/GetPlayerObjectSyncRotation.md +++ b/frontend/docs/scripting/functions/GetPlayerObjectSyncRotation.md @@ -12,7 +12,7 @@ tags: ["player", "object", "playerobject"] Get the sync rotation of a player-object. | Name | Description | -|----------|------------------------------| +| -------- | ---------------------------- | | playerid | The ID of the player. | | objectid | The ID of the player-object. | diff --git a/frontend/docs/scripting/functions/GetPlayerPickupModel.md b/frontend/docs/scripting/functions/GetPlayerPickupModel.md index ecb3e8954b8..97e50bf7fdf 100644 --- a/frontend/docs/scripting/functions/GetPlayerPickupModel.md +++ b/frontend/docs/scripting/functions/GetPlayerPickupModel.md @@ -12,7 +12,7 @@ tags: ["player", "pickup", "playerpickup"] Gets the model ID of a player-pickup. | Name | Description | -|----------|-----------------------------------------------------| +| -------- | --------------------------------------------------- | | playerid | The ID of the player. | | pickupid | The ID of the player-pickup to get the model ID of. | diff --git a/frontend/docs/scripting/functions/GetPlayerPickupPos.md b/frontend/docs/scripting/functions/GetPlayerPickupPos.md index a7591c01ea7..952e1a25320 100644 --- a/frontend/docs/scripting/functions/GetPlayerPickupPos.md +++ b/frontend/docs/scripting/functions/GetPlayerPickupPos.md @@ -12,7 +12,7 @@ tags: ["player", "pickup", "playerpickup"] Gets the coordinates of a player-pickup. | Name | Description | -|----------|---------------------------------------------------------------------------| +| -------- | ------------------------------------------------------------------------- | | playerid | The ID of the player. | | pickupid | The ID of the player-pickup to get the position of. | | &Float:x | A float variable in which to store the x coordinate, passed by reference. | diff --git a/frontend/docs/scripting/functions/GetPlayerPickupType.md b/frontend/docs/scripting/functions/GetPlayerPickupType.md index a8d75ac2474..6a287575795 100644 --- a/frontend/docs/scripting/functions/GetPlayerPickupType.md +++ b/frontend/docs/scripting/functions/GetPlayerPickupType.md @@ -12,7 +12,7 @@ tags: ["player", "pickup", "playerpickup"] Gets the type of a player-pickup. | Name | Description | -|----------|-------------------------------------------------| +| -------- | ----------------------------------------------- | | playerid | The ID of the player. | | pickupid | The ID of the player-pickup to get the type of. | diff --git a/frontend/docs/scripting/functions/GetPlayerPickupVirtualWorld.md b/frontend/docs/scripting/functions/GetPlayerPickupVirtualWorld.md index d259da1f7b0..1ef3b3c86d5 100644 --- a/frontend/docs/scripting/functions/GetPlayerPickupVirtualWorld.md +++ b/frontend/docs/scripting/functions/GetPlayerPickupVirtualWorld.md @@ -12,7 +12,7 @@ tags: ["player", "pickup", "playerpickup"] 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. | diff --git a/frontend/docs/scripting/functions/GetPlayerPing.md b/frontend/docs/scripting/functions/GetPlayerPing.md index c6af116cb59..906fb9436b7 100644 --- a/frontend/docs/scripting/functions/GetPlayerPing.md +++ b/frontend/docs/scripting/functions/GetPlayerPing.md @@ -61,7 +61,7 @@ public Ping_Timer(playerid) new string[128]; format(string, sizeof(string), "You have been kicked from the server. Reason: high ping (%d)", ping); SendClientMessage(playerid, -1, string); - + Kick(playerid); } return 1; diff --git a/frontend/docs/scripting/functions/GetPlayerPoolSize.md b/frontend/docs/scripting/functions/GetPlayerPoolSize.md index 806ce993f71..fb7d59559c7 100644 --- a/frontend/docs/scripting/functions/GetPlayerPoolSize.md +++ b/frontend/docs/scripting/functions/GetPlayerPoolSize.md @@ -9,7 +9,7 @@ tags: ["player"] ## Description -Gets the highest playerid currently in use on the server. Note that in SA:MP this function is broken and will return `0` even when there are no players. fixes.inc and open.mp correct this to return `-1`, but also deprecate the function in favour of `MAX_PLAYERS` or `foreach`. +Gets the highest playerid currently in use on the server. Note that in SA:MP this function is broken and will return `0` even when there are no players. fixes.inc and open.mp correct this to return `-1`, but also deprecate the function in favour of `MAX_PLAYERS` or `foreach`. ## Examples diff --git a/frontend/docs/scripting/functions/GetPlayerRawIp.md b/frontend/docs/scripting/functions/GetPlayerRawIp.md index 970baabd7e2..e68fc96d09b 100644 --- a/frontend/docs/scripting/functions/GetPlayerRawIp.md +++ b/frontend/docs/scripting/functions/GetPlayerRawIp.md @@ -34,7 +34,7 @@ public OnPlayerConnect(playerid) :::tip -PAWN is case-sensitive. GetPlayerRawIP will not work. +PAWN is case-sensitive. GetPlayerRawIP will not work. ::: diff --git a/frontend/docs/scripting/functions/GetPlayerRotationQuat.md b/frontend/docs/scripting/functions/GetPlayerRotationQuat.md index ef1de79b398..1d22e241ee3 100644 --- a/frontend/docs/scripting/functions/GetPlayerRotationQuat.md +++ b/frontend/docs/scripting/functions/GetPlayerRotationQuat.md @@ -12,7 +12,7 @@ tags: ["player"] Returns a player's rotation on all axes as a quaternion. | Name | Description | -|----------|--------------------------------------------------------------------------------------| +| -------- | ------------------------------------------------------------------------------------ | | playerid | The ID of the player to get the rotation of. | | &Float:w | A float variable in which to store the first quaternion angle, passed by reference. | | &Float:x | A float variable in which to store the second quaternion angle, passed by reference. | @@ -30,7 +30,7 @@ The player's rotation is stored in the specified variables. ## Examples ```c -new +new Float:w, Float:x, Float:y, diff --git a/frontend/docs/scripting/functions/GetPlayerSirenState.md b/frontend/docs/scripting/functions/GetPlayerSirenState.md index d34fedeac54..6bfcc61cf7c 100644 --- a/frontend/docs/scripting/functions/GetPlayerSirenState.md +++ b/frontend/docs/scripting/functions/GetPlayerSirenState.md @@ -14,7 +14,7 @@ Gets the siren state of the player's vehicle. ## Parameters | Name | Description | -|----------|-----------------------| +| -------- | --------------------- | | playerid | The ID of the player. | ## Return Values diff --git a/frontend/docs/scripting/functions/GetPlayerSkillLevel.md b/frontend/docs/scripting/functions/GetPlayerSkillLevel.md index 2f8147b894b..40e5612139f 100644 --- a/frontend/docs/scripting/functions/GetPlayerSkillLevel.md +++ b/frontend/docs/scripting/functions/GetPlayerSkillLevel.md @@ -30,7 +30,7 @@ public OnPlayerCommandText(playerid, cmdtext[]) if (!strcmp(cmdtext, "/skill", true)) { new string[64]; - + new skill = GetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL); format(string, sizeof(string), "Your pistol skill level is %d", skill); diff --git a/frontend/docs/scripting/functions/GetPlayerSpectateID.md b/frontend/docs/scripting/functions/GetPlayerSpectateID.md index 8263215e059..551983f9ed9 100644 --- a/frontend/docs/scripting/functions/GetPlayerSpectateID.md +++ b/frontend/docs/scripting/functions/GetPlayerSpectateID.md @@ -12,7 +12,7 @@ tags: ["player"] Gets the ID of the player or vehicle the player is spectating (watching). | Name | Description | -|----------|-----------------------| +| -------- | --------------------- | | playerid | The ID of the player. | ## Returns diff --git a/frontend/docs/scripting/functions/GetPlayerSpectateType.md b/frontend/docs/scripting/functions/GetPlayerSpectateType.md index 5c5aec8d3e3..c33a5182fcf 100644 --- a/frontend/docs/scripting/functions/GetPlayerSpectateType.md +++ b/frontend/docs/scripting/functions/GetPlayerSpectateType.md @@ -12,7 +12,7 @@ tags: ["player"] Returns the player's spectate type (vehicle or player). | Name | Description | -|----------|-----------------------| +| -------- | --------------------- | | playerid | The ID of the player. | ## Returns diff --git a/frontend/docs/scripting/functions/GetPlayerSurfingOffsets.md b/frontend/docs/scripting/functions/GetPlayerSurfingOffsets.md index 55bcbcc5930..960cb421fdd 100644 --- a/frontend/docs/scripting/functions/GetPlayerSurfingOffsets.md +++ b/frontend/docs/scripting/functions/GetPlayerSurfingOffsets.md @@ -12,7 +12,7 @@ tags: ["player"] 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. | @@ -28,13 +28,13 @@ This function does not return any specific value. new surfingVehicleId = GetPlayerSurfingVehicleID(playerid); if (surfingVehicleId != INVALID_VEHICLE_ID) { - new + new Float:offsetX, Float:offsetY, Float:offsetZ; GetPlayerSurfingOffsets(playerid, offsetX, offsetY, offsetZ); - + SendClientMessage(playerid, -1, "offsetX = %.2f offsetY = %.2f offsetZ = %.2f", offsetX, offsetY, offsetZ); } ``` diff --git a/frontend/docs/scripting/functions/GetPlayerTrainSpeed.md b/frontend/docs/scripting/functions/GetPlayerTrainSpeed.md index 848b5a8892f..b118d63a8bb 100644 --- a/frontend/docs/scripting/functions/GetPlayerTrainSpeed.md +++ b/frontend/docs/scripting/functions/GetPlayerTrainSpeed.md @@ -14,7 +14,7 @@ Gets the speed of the player's train. ## Parameters | Name | Description | -|----------|-----------------------| +| -------- | --------------------- | | playerid | The ID of the player. | ## Examples diff --git a/frontend/docs/scripting/functions/GetPlayerVelocity.md b/frontend/docs/scripting/functions/GetPlayerVelocity.md index 006bb29e670..fd7346fb066 100644 --- a/frontend/docs/scripting/functions/GetPlayerVelocity.md +++ b/frontend/docs/scripting/functions/GetPlayerVelocity.md @@ -32,7 +32,7 @@ public OnPlayerCommandText(playerid, cmdtext[]) string[128]; GetPlayerVelocity(playerid, x, y, z); - + format(string, sizeof(string), "You are going at a velocity of X: %f, Y: %f, Z: %f", x, y, z); SendClientMessage(playerid, 0xFFFFFFFF, string); return 1; diff --git a/frontend/docs/scripting/functions/GetPlayerWeaponData.md b/frontend/docs/scripting/functions/GetPlayerWeaponData.md index 4ef1e017422..f06a35e90de 100644 --- a/frontend/docs/scripting/functions/GetPlayerWeaponData.md +++ b/frontend/docs/scripting/functions/GetPlayerWeaponData.md @@ -10,7 +10,7 @@ tags: ["player"] Get the weapon and ammo in a specific player's weapon slot (e.g. the weapon in the 'SMG' slot). | Name | Description | -|------------------|--------------------------------------------------------------------------------------------| +| ---------------- | ------------------------------------------------------------------------------------------ | | playerid | The ID of the player whose weapon data to retrieve. | | WEAPON_SLOT:slot | The [weapon slot](../resources/weaponslots) to get data for (0-12). | | &WEAPON:weapons | A variable in which to store the [weapon ID](../resources/weaponids), passed by reference. | @@ -39,7 +39,7 @@ for (new i = 0; i <= 12; i++) Another example: ```c -new +new weaponid, ammo; diff --git a/frontend/docs/scripting/functions/GetPlayerWeaponState.md b/frontend/docs/scripting/functions/GetPlayerWeaponState.md index 2f2ec171ca4..bf00f0c361e 100644 --- a/frontend/docs/scripting/functions/GetPlayerWeaponState.md +++ b/frontend/docs/scripting/functions/GetPlayerWeaponState.md @@ -28,7 +28,7 @@ public OnPlayerCommandText(playerid, cmdtext[]) { new WEAPONSTATE:state = GetPlayerWeaponState(playerid); - static weaponStates[4][64] = + static weaponStates[4][64] = { "Current weapon has no ammo remaining", "Current weapon has a single bullet left", diff --git a/frontend/docs/scripting/functions/GetPlayerWeather.md b/frontend/docs/scripting/functions/GetPlayerWeather.md index 7d4b7237d4a..c7dbfe767c0 100644 --- a/frontend/docs/scripting/functions/GetPlayerWeather.md +++ b/frontend/docs/scripting/functions/GetPlayerWeather.md @@ -11,8 +11,8 @@ tags: ["player"] Get a player's weather. -| Name | Description | -| -------- | ---------------------------------------- | +| Name | Description | +| -------- | ------------------------------------------- | | playerid | The ID of the player to get the weather of. | ## Returns diff --git a/frontend/docs/scripting/functions/GetPlayerWorldBounds.md b/frontend/docs/scripting/functions/GetPlayerWorldBounds.md index 23957b28d61..df5d8a96989 100644 --- a/frontend/docs/scripting/functions/GetPlayerWorldBounds.md +++ b/frontend/docs/scripting/functions/GetPlayerWorldBounds.md @@ -12,7 +12,7 @@ tags: ["player"] Get a player's world boundaries. | Name | Description | -|-------------|------------------------------------------------------------------------------| +| ----------- | ---------------------------------------------------------------------------- | | playerid | The ID of the player. | | &Float:maxX | A float variable in which to store the maxX coordinate, passed by reference. | | &Float:minX | A float variable in which to store the minX coordinate, passed by reference. | diff --git a/frontend/docs/scripting/functions/GetPlayerZAim.md b/frontend/docs/scripting/functions/GetPlayerZAim.md index 0cd22425010..66584b9e38a 100644 --- a/frontend/docs/scripting/functions/GetPlayerZAim.md +++ b/frontend/docs/scripting/functions/GetPlayerZAim.md @@ -12,7 +12,7 @@ tags: ["player"] Gets a player's Z Aim. (related to the camera and aiming) | Name | Description | -|----------|-----------------------| +| -------- | --------------------- | | playerid | The ID of the player. | ## Returns diff --git a/frontend/docs/scripting/functions/GetPlayers.md b/frontend/docs/scripting/functions/GetPlayers.md index 43e32d79de1..3b750b9de93 100644 --- a/frontend/docs/scripting/functions/GetPlayers.md +++ b/frontend/docs/scripting/functions/GetPlayers.md @@ -11,10 +11,10 @@ tags: ["player"] Gets an array variable of the IDs of the current players on the server. -| Name | Description | -| ------------- | ----------------------------------------------------------------- | -| players[] | An array into which to store the player IDs, passed by reference. | -| size | The size of the array. | +| Name | Description | +| --------- | ----------------------------------------------------------------- | +| players[] | An array into which to store the player IDs, passed by reference. | +| size | The size of the array. | ## Returns diff --git a/frontend/docs/scripting/functions/GetRandomVehicleColourPair.md b/frontend/docs/scripting/functions/GetRandomVehicleColourPair.md index fe86a882b2e..1bd28b3d3f5 100644 --- a/frontend/docs/scripting/functions/GetRandomVehicleColourPair.md +++ b/frontend/docs/scripting/functions/GetRandomVehicleColourPair.md @@ -14,7 +14,7 @@ Get random colour indexes that are valid for the given vehicle model. ## Parameters | Name | Description | -|--------------|----------------------------------------------------------------------| +| ------------ | -------------------------------------------------------------------- | | modelid | The ID of the [vehicle model](../resources/vehicleid). | | &colour1 | A variable in which to store the colour1 value, passed by reference. | | &colour2 | A variable in which to store the colour2 value, passed by reference. | diff --git a/frontend/docs/scripting/functions/GetSpawnInfo.md b/frontend/docs/scripting/functions/GetSpawnInfo.md index c2d86088600..eba4a170b19 100644 --- a/frontend/docs/scripting/functions/GetSpawnInfo.md +++ b/frontend/docs/scripting/functions/GetSpawnInfo.md @@ -11,21 +11,21 @@ tags: ["player"] Return the current spawn data for a player, where they will spawn next. -| Name | Description | -|-----------------|---------------------------------------------------------------------------------| -| playerid | The ID of the player you want to get spawn information from. | -| &team | A variable into which to store the team ID, passed by reference. | -| &skin | A variable into which to store the skin ID, passed by reference. | -| &Float:spawnX | A Float variable into which to store the X-coordinate, passed by reference. | -| &Float:spawnY | A Float variable into which to store the Y-coordinate, passed by reference. | -| &Float:spawnZ | A Float variable into which to store the Z-coordinate, passed by reference. | +| Name | Description | +| --------------- | --------------------------------------------------------------------------- | +| playerid | The ID of the player you want to get spawn information from. | +| &team | A variable into which to store the team ID, passed by reference. | +| &skin | A variable into which to store the skin ID, passed by reference. | +| &Float:spawnX | A Float variable into which to store the X-coordinate, passed by reference. | +| &Float:spawnY | A Float variable into which to store the Y-coordinate, passed by reference. | +| &Float:spawnZ | A Float variable into which to store the Z-coordinate, passed by reference. | | &Float:angle | A Float variable into which to store the Facing angle, passed by reference. | -| &WEAPON:weapon1 | A variable into which to store the weapon1, passed by reference. | -| &ammo1 | A variable into which to store the ammo1, passed by reference. | -| &WEAPON:weapon2 | A variable into which to store the weapon2, passed by reference. | -| &ammo2 | A variable into which to store the ammo2, passed by reference. | -| &WEAPON:weapon3 | A variable into which to store the weapon3, passed by reference. | -| &ammo3 | A variable into which to store the ammo3, passed by reference. | +| &WEAPON:weapon1 | A variable into which to store the weapon1, passed by reference. | +| &ammo1 | A variable into which to store the ammo1, passed by reference. | +| &WEAPON:weapon2 | A variable into which to store the weapon2, passed by reference. | +| &ammo2 | A variable into which to store the ammo2, passed by reference. | +| &WEAPON:weapon3 | A variable into which to store the weapon3, passed by reference. | +| &ammo3 | A variable into which to store the ammo3, passed by reference. | ## Returns @@ -40,7 +40,7 @@ public OnPlayerRequestClass(playerid, classid) { SetSpawnInfo(playerid, NO_TEAM, 293, 1139.4786, -1761.3989, 13.5844, 0.0000, WEAPON_SAWEDOFF, 36, WEAPON_UZI, 150, WEAPON_FIST, 0); - new + new team, skin, Float:spawnX, @@ -53,7 +53,7 @@ public OnPlayerRequestClass(playerid, classid) ammo2, WEAPON:weapon3, ammo3; - + GetSpawnInfo(playerid, team, skin, spawnX, spawnY, spawnZ, angle, weapon1, ammo1, weapon2, ammo2, weapon3, ammo3); // team = NO_TEAM // skin = 293 diff --git a/frontend/docs/scripting/functions/GetTickCount.md b/frontend/docs/scripting/functions/GetTickCount.md index 9f28672cba6..4f1e1b826c1 100644 --- a/frontend/docs/scripting/functions/GetTickCount.md +++ b/frontend/docs/scripting/functions/GetTickCount.md @@ -40,7 +40,7 @@ public OnPlayerCommandText(playerid, cmdtext[]) :::warning -The difference in values that `GetTickCount` can handle is limited to just under 25 days (2147483647 milliseconds). As long as the events being compared are less than that amount apart this function works perfectly with one small caveat. Due to integer overflow, the following code may not work: +The difference in values that `GetTickCount` can handle is limited to just under 25 days (2147483647 milliseconds). As long as the events being compared are less than that amount apart this function works perfectly with one small caveat. Due to integer overflow, the following code may not work: ```c new start = GetTickCount(); @@ -52,7 +52,7 @@ if (start + 2000 > end) } ``` -If `start` is very high this code will wrap around and may cause the check to pass erroneously. However, solving this is very simple: +If `start` is very high this code will wrap around and may cause the check to pass erroneously. However, solving this is very simple: ```c new start = GetTickCount(); @@ -64,7 +64,7 @@ if (end - start < 2000) } ``` -Simply rearranging the comparison such that `start` and `end` are on the same side fixes the issue entirely. Those familiar with formula rearrangements should recognise that the two pieces of code are entirely equivalent, but the latter is more correct in modulo arithmetic. +Simply rearranging the comparison such that `start` and `end` are on the same side fixes the issue entirely. Those familiar with formula rearrangements should recognise that the two pieces of code are entirely equivalent, but the latter is more correct in modulo arithmetic. ::: diff --git a/frontend/docs/scripting/functions/GetTimerInterval.md b/frontend/docs/scripting/functions/GetTimerInterval.md index bbb7282256a..55dac8f65d0 100644 --- a/frontend/docs/scripting/functions/GetTimerInterval.md +++ b/frontend/docs/scripting/functions/GetTimerInterval.md @@ -14,7 +14,7 @@ Gets the interval of a timer. ## Parameters | Name | Description | -|---------|---------------------------------------------| +| ------- | ------------------------------------------- | | timerid | The ID of the timer to get the interval of. | ## Return Values @@ -44,4 +44,4 @@ public OnGameModeInit() - [IsValidTimer](IsValidTimer): Checks if a timer is valid. - [IsRepeatingTimer](IsRepeatingTimer): Checks if a timer is set to repeat. - [GetTimerRemaining](GetTimerRemaining): Gets the remaining interval of a timer. -- [CountRunningTimers](CountRunningTimers): Get the running timers. \ No newline at end of file +- [CountRunningTimers](CountRunningTimers): Get the running timers. diff --git a/frontend/docs/scripting/functions/GetTimerRemaining.md b/frontend/docs/scripting/functions/GetTimerRemaining.md index 032a826f32a..35e8c4cd67c 100644 --- a/frontend/docs/scripting/functions/GetTimerRemaining.md +++ b/frontend/docs/scripting/functions/GetTimerRemaining.md @@ -14,7 +14,7 @@ Gets the remaining interval of a timer. ## Parameters | Name | Description | -|---------|-------------------------------------------------------| +| ------- | ----------------------------------------------------- | | timerid | The ID of the timer to get the remaining interval of. | ## Return Values @@ -44,4 +44,4 @@ public OnGameModeInit() - [IsValidTimer](IsValidTimer): Checks if a timer is valid. - [IsRepeatingTimer](IsRepeatingTimer): Checks if a timer is set to repeat. - [GetTimerInterval](GetTimerInterval): Gets the interval of a timer. -- [CountRunningTimers](CountRunningTimers): Get the running timers. \ No newline at end of file +- [CountRunningTimers](CountRunningTimers): Get the running timers. diff --git a/frontend/docs/scripting/functions/GetVehicleCab.md b/frontend/docs/scripting/functions/GetVehicleCab.md index 817d35036ca..b5470b5553a 100644 --- a/frontend/docs/scripting/functions/GetVehicleCab.md +++ b/frontend/docs/scripting/functions/GetVehicleCab.md @@ -11,9 +11,9 @@ tags: ["vehicle"] Get the ID of the cab attached to a vehicle. -| Name | Description | -| --------- | -------------------------------------------- | -| vehicleid | The ID of the vehicle to get the cab of. | +| Name | Description | +| --------- | ---------------------------------------- | +| vehicleid | The ID of the vehicle to get the cab of. | ## Returns diff --git a/frontend/docs/scripting/functions/GetVehicleColours.md b/frontend/docs/scripting/functions/GetVehicleColours.md index 1f85ff546b7..0d92ebf20a7 100644 --- a/frontend/docs/scripting/functions/GetVehicleColours.md +++ b/frontend/docs/scripting/functions/GetVehicleColours.md @@ -14,7 +14,7 @@ Gets the vehicle colours. ## Parameters | Name | Description | -|-----------|----------------------------------------------------------------------| +| --------- | -------------------------------------------------------------------- | | vehicleid | The ID of the vehicle. | | &colour1 | A variable in which to store the colour1 value, passed by reference. | | &colour2 | A variable in which to store the colour2 value, passed by reference. | @@ -26,7 +26,7 @@ public OnGameModeInit() { new vehicleid = CreateVehicle(560, 2096.1917, -1328.5150, 25.1059, 0.0000, 6, 0, 100); - new + new colour1, colour2; diff --git a/frontend/docs/scripting/functions/GetVehicleComponentInSlot.md b/frontend/docs/scripting/functions/GetVehicleComponentInSlot.md index a21b8039252..7820c53aad0 100644 --- a/frontend/docs/scripting/functions/GetVehicleComponentInSlot.md +++ b/frontend/docs/scripting/functions/GetVehicleComponentInSlot.md @@ -52,7 +52,7 @@ public OnPlayerCommandText(playerid, cmdtext[]) Known Bug(s): - Doesn't work for CARMODTYPE_STEREO. -- Both front bull bars and front bumper components are saved in the CARMODTYPE_FRONT_BUMPER slot. If a vehicle has both of them installed, this function will only return the one which was installed last. +- Both front bull bars and front bumper components are saved in the CARMODTYPE_FRONT_BUMPER slot. If a vehicle has both of them installed, this function will only return the one which was installed last. - Both rear bull bars and rear bumper components are saved in the CARMODTYPE_REAR_BUMPER slot. If a vehicle has both of them installed, this function will only return the one which was installed last. - Both left side skirt and right side skirt are saved in the CARMODTYPE_SIDESKIRT slot. If a vehicle has both of them installed, this function will only return the one which was installed last. diff --git a/frontend/docs/scripting/functions/GetVehicleDamageStatus.md b/frontend/docs/scripting/functions/GetVehicleDamageStatus.md index 5ed9f831aeb..0d9ebaee003 100644 --- a/frontend/docs/scripting/functions/GetVehicleDamageStatus.md +++ b/frontend/docs/scripting/functions/GetVehicleDamageStatus.md @@ -32,7 +32,7 @@ Retrieve the damage statuses of a vehicle. ## Examples ```c -new +new VEHICLE_PANEL_STATUS:panels, VEHICLE_DOOR_STATUS:doors, VEHICLE_LIGHT_STATUS:lights, diff --git a/frontend/docs/scripting/functions/GetVehicleDistanceFromPoint.md b/frontend/docs/scripting/functions/GetVehicleDistanceFromPoint.md index 5a7f65af724..74b197f96db 100644 --- a/frontend/docs/scripting/functions/GetVehicleDistanceFromPoint.md +++ b/frontend/docs/scripting/functions/GetVehicleDistanceFromPoint.md @@ -31,7 +31,7 @@ public OnPlayerText(playerid, text[]) new string[64], vehicleid = GetPlayerVehicleID(playerid); - + new Float:distance = GetVehicleDistanceFromPoint(vehicleid, 237.9, 115.6, 1010.2); diff --git a/frontend/docs/scripting/functions/GetVehicleDriver.md b/frontend/docs/scripting/functions/GetVehicleDriver.md index 2a0eac8bd7a..2a6ae4daf0b 100644 --- a/frontend/docs/scripting/functions/GetVehicleDriver.md +++ b/frontend/docs/scripting/functions/GetVehicleDriver.md @@ -9,12 +9,12 @@ tags: ["vehicle"] ## Description -Get the playerid of the person driving the vehicle. +Get the playerid of the person driving the vehicle. ## Parameters | Name | Description | -|-----------|---------------------------------------------| +| --------- | ------------------------------------------- | | vehicleid | The ID of the vehicle to get the driver of. | ## Returns diff --git a/frontend/docs/scripting/functions/GetVehicleHydraReactorAngle.md b/frontend/docs/scripting/functions/GetVehicleHydraReactorAngle.md index e6830266711..0048f00b51e 100644 --- a/frontend/docs/scripting/functions/GetVehicleHydraReactorAngle.md +++ b/frontend/docs/scripting/functions/GetVehicleHydraReactorAngle.md @@ -14,7 +14,7 @@ Gets the hydra reactor angle of the vehicle. ## Parameters | Name | Description | -|-----------|------------------------| +| --------- | ---------------------- | | vehicleid | The ID of the vehicle. | ## Examples diff --git a/frontend/docs/scripting/functions/GetVehicleInterior.md b/frontend/docs/scripting/functions/GetVehicleInterior.md index d8c743c5aa0..6f2a5c8d6f3 100644 --- a/frontend/docs/scripting/functions/GetVehicleInterior.md +++ b/frontend/docs/scripting/functions/GetVehicleInterior.md @@ -14,7 +14,7 @@ Get the interior id of a vehicle. ## Parameters | Name | Description | -|-----------|------------------------| +| --------- | ---------------------- | | vehicleid | The ID of the vehicle. | ## Return Values diff --git a/frontend/docs/scripting/functions/GetVehicleLandingGearState.md b/frontend/docs/scripting/functions/GetVehicleLandingGearState.md index b8508319cbb..7195410a341 100644 --- a/frontend/docs/scripting/functions/GetVehicleLandingGearState.md +++ b/frontend/docs/scripting/functions/GetVehicleLandingGearState.md @@ -14,7 +14,7 @@ Gets the current vehicle [landing gear state](../resources/landinggearstate) fro ## Parameters | Name | Description | -|-----------|------------------------| +| --------- | ---------------------- | | vehicleid | The ID of the vehicle. | ## Examples diff --git a/frontend/docs/scripting/functions/GetVehicleLastDriver.md b/frontend/docs/scripting/functions/GetVehicleLastDriver.md index f8c92129236..1928790980a 100644 --- a/frontend/docs/scripting/functions/GetVehicleLastDriver.md +++ b/frontend/docs/scripting/functions/GetVehicleLastDriver.md @@ -14,7 +14,7 @@ Get the last driver of a vehicle. ## Parameters | Name | Description | -|-----------|------------------------| +| --------- | ---------------------- | | vehicleid | The ID of the vehicle. | ## Return Values diff --git a/frontend/docs/scripting/functions/GetVehicleMatrix.md b/frontend/docs/scripting/functions/GetVehicleMatrix.md index b85fe0e430b..3e3597e5b42 100644 --- a/frontend/docs/scripting/functions/GetVehicleMatrix.md +++ b/frontend/docs/scripting/functions/GetVehicleMatrix.md @@ -14,7 +14,7 @@ Gets the actual rotation matrix of the vehicle. ## Parameters | Name | Description | -|---------------|--------------------------------------------------------------------------------| +| ------------- | ------------------------------------------------------------------------------ | | vehicleid | The ID of the vehicle. | | &Float:rightX | A float variable in which to store the rightX coordinate, passed by reference. | | &Float:rightY | A float variable in which to store the rightY coordinate, passed by reference. | @@ -29,7 +29,7 @@ Gets the actual rotation matrix of the vehicle. ## Examples ```c -new +new Float:rightX, Float:rightY, Float:rightZ, diff --git a/frontend/docs/scripting/functions/GetVehicleModelCount.md b/frontend/docs/scripting/functions/GetVehicleModelCount.md index 3a142d69497..063c7c157fe 100644 --- a/frontend/docs/scripting/functions/GetVehicleModelCount.md +++ b/frontend/docs/scripting/functions/GetVehicleModelCount.md @@ -14,7 +14,7 @@ Gets the model count of a vehicle model. ## Parameters | Name | Description | -|---------|--------------------------------------------------------| +| ------- | ------------------------------------------------------ | | modelid | The ID of the [vehicle model](../resources/vehicleid). | ## Examples diff --git a/frontend/docs/scripting/functions/GetVehicleNumberPlate.md b/frontend/docs/scripting/functions/GetVehicleNumberPlate.md index 3ca359956ce..b2bc51200fa 100644 --- a/frontend/docs/scripting/functions/GetVehicleNumberPlate.md +++ b/frontend/docs/scripting/functions/GetVehicleNumberPlate.md @@ -14,7 +14,7 @@ Get the number plate of a vehicle. ## Parameters | Name | Description | -|----------------------|-------------------------------------------------------------| +| -------------------- | ----------------------------------------------------------- | | vehicleid | The ID of the vehicle. | | plate[] | An array into which to store the name, passed by reference. | | len = sizeof (plate) | The length of the plate that should be stored. | diff --git a/frontend/docs/scripting/functions/GetVehicleOccupiedTick.md b/frontend/docs/scripting/functions/GetVehicleOccupiedTick.md index 5acd5d37d50..3fa51aed9a7 100644 --- a/frontend/docs/scripting/functions/GetVehicleOccupiedTick.md +++ b/frontend/docs/scripting/functions/GetVehicleOccupiedTick.md @@ -14,7 +14,7 @@ Get the occupied tick of a vehicle. ## Parameters | Name | Description | -|-----------|------------------------| +| --------- | ---------------------- | | vehicleid | The ID of the vehicle. | ## Return Values diff --git a/frontend/docs/scripting/functions/GetVehiclePaintjob.md b/frontend/docs/scripting/functions/GetVehiclePaintjob.md index 519982798cc..2d1b2694019 100644 --- a/frontend/docs/scripting/functions/GetVehiclePaintjob.md +++ b/frontend/docs/scripting/functions/GetVehiclePaintjob.md @@ -14,7 +14,7 @@ Gets the vehicle's paintjob id. ## Parameters | Name | Description | -|-----------|------------------------| +| --------- | ---------------------- | | vehicleid | The ID of the vehicle. | ## Return Values diff --git a/frontend/docs/scripting/functions/GetVehiclePoolSize.md b/frontend/docs/scripting/functions/GetVehiclePoolSize.md index d8940f82135..f1d94771732 100644 --- a/frontend/docs/scripting/functions/GetVehiclePoolSize.md +++ b/frontend/docs/scripting/functions/GetVehiclePoolSize.md @@ -9,7 +9,7 @@ tags: ["vehicle"] ## Description -Gets the highest vehicleid currently in use on the server. Note that in SA:MP this function is broken and will return `0` even when there are no vehicles. fixes.inc and open.mp correct this to return `-1`, but also deprecate the function in favour of `MAX_VEHICLES` or `foreach`. +Gets the highest vehicleid currently in use on the server. Note that in SA:MP this function is broken and will return `0` even when there are no vehicles. fixes.inc and open.mp correct this to return `-1`, but also deprecate the function in favour of `MAX_VEHICLES` or `foreach`. ## Examples diff --git a/frontend/docs/scripting/functions/GetVehicleRespawnDelay.md b/frontend/docs/scripting/functions/GetVehicleRespawnDelay.md index d96329f0b11..baa1dfa1f94 100644 --- a/frontend/docs/scripting/functions/GetVehicleRespawnDelay.md +++ b/frontend/docs/scripting/functions/GetVehicleRespawnDelay.md @@ -14,7 +14,7 @@ Get the respawn delay of a vehicle. ## Parameters | Name | Description | -|-----------|------------------------| +| --------- | ---------------------- | | vehicleid | The ID of the vehicle. | ## Examples diff --git a/frontend/docs/scripting/functions/GetVehicleRespawnTick.md b/frontend/docs/scripting/functions/GetVehicleRespawnTick.md index 72b76322837..8f4bc10a0a2 100644 --- a/frontend/docs/scripting/functions/GetVehicleRespawnTick.md +++ b/frontend/docs/scripting/functions/GetVehicleRespawnTick.md @@ -14,7 +14,7 @@ Get the respawn tick of a vehicle. ## Parameters | Name | Description | -|-----------|------------------------| +| --------- | ---------------------- | | vehicleid | The ID of the vehicle. | ## Return Values diff --git a/frontend/docs/scripting/functions/GetVehicleRotation.md b/frontend/docs/scripting/functions/GetVehicleRotation.md new file mode 100644 index 00000000000..9e1155be11d --- /dev/null +++ b/frontend/docs/scripting/functions/GetVehicleRotation.md @@ -0,0 +1,51 @@ +--- +title: GetVehicleRotation +sidebar_label: GetVehicleRotation +description: Returns a vehicle's rotation as euler. +tags: ["vehicle"] +--- + +## Description + +Returns a vehicle's rotation as euler. + +| Name | Description | +| --------- | ------------------------------------------------------------------------- | +| vehicleid | The ID of the vehicle to get the rotation of. | +| &Float:x | A float variable in which to store the X axis angle, passed by reference. | +| &Float:y | A float variable in which to store the Y axis angle, passed by reference. | +| &Float:z | A float variable in which to store the Z asix angle, passed by reference. | + +## Returns + +**true** - The function was executed successfully. + +**false** - The function failed to execute. This means the vehicle specified does not exist. + +The vehicle's rotation is stored in the specified variables. + +## Examples + +```c +new + Float:x, + Float:y, + Float:z; + +GetVehicleRotation(vehicleid, x, y, z); +``` + +## Notes + +:::tip + +- There is no 'set' variation of this function; you can not SET a vehicle's rotation (apart from the Z angle) +- This function may return incorrect values for unoccupied vehicles. The reason is that the third row of the vehicle's internal rotation matrix gets corrupted if it gets updated while unoccupied. + +::: + +## Related Functions + +- [GetVehicleZAngle](GetVehicleZAngle): Check the current angle of a vehicle. +- [GetVehicleRotationQuat](GetVehicleRotationQuat): Get the rotation of a vehicle on all axes as a quaternion. +- [GetVehicleMatrix](GetVehicleMatrix): Gets the actual rotation matrix of the vehicle. diff --git a/frontend/docs/scripting/functions/GetVehicleRotationQuat.md b/frontend/docs/scripting/functions/GetVehicleRotationQuat.md index 246dc7ffaf0..dc474cb3ba6 100644 --- a/frontend/docs/scripting/functions/GetVehicleRotationQuat.md +++ b/frontend/docs/scripting/functions/GetVehicleRotationQuat.md @@ -28,7 +28,7 @@ The vehicle's rotation is stored in the specified variables. ## Examples ```c -new +new Float:w, Float:x, Float:y, diff --git a/frontend/docs/scripting/functions/GetVehicleSeats.md b/frontend/docs/scripting/functions/GetVehicleSeats.md index 2d1ad101ebb..67ed261b9fc 100644 --- a/frontend/docs/scripting/functions/GetVehicleSeats.md +++ b/frontend/docs/scripting/functions/GetVehicleSeats.md @@ -11,8 +11,8 @@ tags: ["vehicle"] Gets the number of seats in the vehicle. -| Name | Description | -| --------- | ------------------ | +| Name | Description | +| ------- | ------------------------ | | modelid | ID of the vehicle model. | ## Return Values diff --git a/frontend/docs/scripting/functions/GetVehicleSirenState.md b/frontend/docs/scripting/functions/GetVehicleSirenState.md index 5ad6a03c086..8b5d789a5f6 100644 --- a/frontend/docs/scripting/functions/GetVehicleSirenState.md +++ b/frontend/docs/scripting/functions/GetVehicleSirenState.md @@ -14,7 +14,7 @@ Gets the siren state of the vehicle. ## Parameters | Name | Description | -|-----------|------------------------| +| --------- | ---------------------- | | vehicleid | The ID of the vehicle. | ## Return Values diff --git a/frontend/docs/scripting/functions/GetVehicleSpawnInfo.md b/frontend/docs/scripting/functions/GetVehicleSpawnInfo.md index d20bc1d1edd..e67f69fde47 100644 --- a/frontend/docs/scripting/functions/GetVehicleSpawnInfo.md +++ b/frontend/docs/scripting/functions/GetVehicleSpawnInfo.md @@ -14,7 +14,7 @@ Gets the vehicle spawn location and colours. ## Parameters | Name | Description | -|---------------|--------------------------------------------------------------------------------| +| ------------- | ------------------------------------------------------------------------------ | | vehicleid | The ID of the vehicle. | | &Float:spawnX | A float variable in which to store the spawnX coordinate, passed by reference. | | &Float:spawnY | A float variable in which to store the spawnY coordinate, passed by reference. | @@ -30,7 +30,7 @@ public OnGameModeInit() { new vehicleid = CreateVehicle(560, 2096.1917, -1328.5150, 25.1059, 0.0000, 6, 0, 100); - new + new Float:spawnX, Float:spawnY, Float:spawnZ, diff --git a/frontend/docs/scripting/functions/GetVehicleTower.md b/frontend/docs/scripting/functions/GetVehicleTower.md index 21cf0e61053..fa1551abc5f 100644 --- a/frontend/docs/scripting/functions/GetVehicleTower.md +++ b/frontend/docs/scripting/functions/GetVehicleTower.md @@ -15,9 +15,9 @@ This function is deprecated, See [GetVehicleCab](GetVehicleCab). Get the ID of the cab attached to a vehicle. -| Name | Description | -| --------- | -------------------------------------------- | -| vehicleid | The ID of the vehicle to get the cab of. | +| Name | Description | +| --------- | ---------------------------------------- | +| vehicleid | The ID of the vehicle to get the cab of. | ## Returns diff --git a/frontend/docs/scripting/functions/GetVehicleTrainSpeed.md b/frontend/docs/scripting/functions/GetVehicleTrainSpeed.md index e5c789a2da7..fcc913c9e6a 100644 --- a/frontend/docs/scripting/functions/GetVehicleTrainSpeed.md +++ b/frontend/docs/scripting/functions/GetVehicleTrainSpeed.md @@ -14,7 +14,7 @@ Gets the speed of the train. ## Parameters | Name | Description | -|-----------|------------------------| +| --------- | ---------------------- | | vehicleid | The ID of the vehicle. | ## Examples diff --git a/frontend/docs/scripting/functions/GetVehicleVelocity.md b/frontend/docs/scripting/functions/GetVehicleVelocity.md index 30bfa8f729f..a235aab7cef 100644 --- a/frontend/docs/scripting/functions/GetVehicleVelocity.md +++ b/frontend/docs/scripting/functions/GetVehicleVelocity.md @@ -41,7 +41,7 @@ public OnPlayerCommandText(playerid, cmdtext[]) string[128]; GetVehicleVelocity(GetPlayerVehicleID(playerid), vehVelocity[0], vehVelocity[1], vehVelocity[2]); - + format(string, sizeof(string), "You are going at a velocity of X%f, Y%f, Z%f", vehVelocity[0], vehVelocity[1], vehVelocity[2]); SendClientMessage(playerid, 0xFFFFFFFF, string); return 1; diff --git a/frontend/docs/scripting/functions/GetVehicleZAngle.md b/frontend/docs/scripting/functions/GetVehicleZAngle.md index af8a8ed1c36..0fc10194526 100644 --- a/frontend/docs/scripting/functions/GetVehicleZAngle.md +++ b/frontend/docs/scripting/functions/GetVehicleZAngle.md @@ -35,9 +35,9 @@ public OnPlayerCommandText(playerid, cmdtext[]) string[64]; vehicleid = GetPlayerVehicleID(playerid); - + GetVehicleZAngle(vehicleid, rotZ); - + format(string, sizeof(string), "The current vehicle rotation is: %.0f", rotZ); SendClientMessage(playerid, 0xFFFFFFFF, string); return 1; diff --git a/frontend/docs/scripting/functions/GetVehicles.md b/frontend/docs/scripting/functions/GetVehicles.md index 506ce231cd2..bc89df92522 100644 --- a/frontend/docs/scripting/functions/GetVehicles.md +++ b/frontend/docs/scripting/functions/GetVehicles.md @@ -11,10 +11,10 @@ tags: ["vehicle"] Gets an array variable of the IDs of the created vehicles on the server. -| Name | Description | -| ------------- | ------------------------------------------------------------------ | -| vehicles[] | An array into which to store the vehicle IDs, passed by reference. | -| size | The size of the array. | +| Name | Description | +| ---------- | ------------------------------------------------------------------ | +| vehicles[] | An array into which to store the vehicle IDs, passed by reference. | +| size | The size of the array. | ## Returns diff --git a/frontend/docs/scripting/functions/GetWorldTime.md b/frontend/docs/scripting/functions/GetWorldTime.md index a71af28820c..be1341551e3 100644 --- a/frontend/docs/scripting/functions/GetWorldTime.md +++ b/frontend/docs/scripting/functions/GetWorldTime.md @@ -23,4 +23,4 @@ printf("Current world time: %d", GetWorldTime()); ## Related Functions - [SetWorldTime](SetWorldTime): Sets the world time (for all players) to a specific hour. -- [SetPlayerTime](SetPlayerTime): Set a player's time. \ No newline at end of file +- [SetPlayerTime](SetPlayerTime): Set a player's time. diff --git a/frontend/docs/scripting/functions/GivePlayerWeapon.md b/frontend/docs/scripting/functions/GivePlayerWeapon.md index 3553977cbed..5c3d27dd2e4 100644 --- a/frontend/docs/scripting/functions/GivePlayerWeapon.md +++ b/frontend/docs/scripting/functions/GivePlayerWeapon.md @@ -10,7 +10,7 @@ tags: ["player"] Give a player a weapon with a specified amount of ammo. | Name | Description | -|-----------------|-----------------------------------------------------------------------| +| --------------- | --------------------------------------------------------------------- | | playerid | The ID of the player to give a weapon to. | | WEAPON:weaponid | The [ID of the weapon](../resources/weaponids) to give to the player. | | ammo | The amount of ammo to give to the player. | diff --git a/frontend/docs/scripting/functions/HTTP.md b/frontend/docs/scripting/functions/HTTP.md index 936a0087512..97b2507da58 100644 --- a/frontend/docs/scripting/functions/HTTP.md +++ b/frontend/docs/scripting/functions/HTTP.md @@ -10,7 +10,7 @@ tags: ["http"] Sends a threaded HTTP request. | Name | Description | -|--------------------|---------------------------------------------------------------------------------------------| +| ------------------ | ------------------------------------------------------------------------------------------- | | index | ID used to differentiate requests that are sent to the same callback (useful for playerids) | | HTTP_METHOD:method | The [type](../resources/http-request-methods) of request you wish to send. | | const url[] | The URL you want to request. **(Without 'http://')** | diff --git a/frontend/docs/scripting/functions/HasGameText.md b/frontend/docs/scripting/functions/HasGameText.md index fbfbfd8f4d8..4344d8ac1d4 100644 --- a/frontend/docs/scripting/functions/HasGameText.md +++ b/frontend/docs/scripting/functions/HasGameText.md @@ -12,7 +12,7 @@ tags: ["player"] Does the player currently have text in the given gametext style displayed? | Name | Description | -|----------|------------------------------------------------------------| +| -------- | ---------------------------------------------------------- | | playerid | The ID of the player to check the gametext for. | | style | The [style](../resources/gametextstyles) of text to check. | diff --git a/frontend/docs/scripting/functions/HasObjectCameraCollision.md b/frontend/docs/scripting/functions/HasObjectCameraCollision.md index 12aaa8b0287..183b45be2ef 100644 --- a/frontend/docs/scripting/functions/HasObjectCameraCollision.md +++ b/frontend/docs/scripting/functions/HasObjectCameraCollision.md @@ -12,7 +12,7 @@ tags: ["object"] Checks if an object has camera collision enabled. ([SetObjectNoCameraCollision](SetObjectNoCameraCollision)) | Name | Description | -|----------|--------------------------------| +| -------- | ------------------------------ | | objectid | The ID of the object to check. | ## Returns diff --git a/frontend/docs/scripting/functions/HasPlayerObjectCameraCollision.md b/frontend/docs/scripting/functions/HasPlayerObjectCameraCollision.md index fc140ee8ebb..93d5243329d 100644 --- a/frontend/docs/scripting/functions/HasPlayerObjectCameraCollision.md +++ b/frontend/docs/scripting/functions/HasPlayerObjectCameraCollision.md @@ -12,7 +12,7 @@ tags: ["player", "object", "playerobject"] Checks if a player-object has camera collision enabled. ([SetPlayerObjectNoCameraCollision](SetPlayerObjectNoCameraCollision)) | Name | Description | -|----------|--------------------------------| +| -------- | ------------------------------ | | playerid | The ID of the player. | | objectid | The ID of the object to check. | diff --git a/frontend/docs/scripting/functions/HasVehicleBeenOccupied.md b/frontend/docs/scripting/functions/HasVehicleBeenOccupied.md index 6558be7ed61..72a48e1f0fc 100644 --- a/frontend/docs/scripting/functions/HasVehicleBeenOccupied.md +++ b/frontend/docs/scripting/functions/HasVehicleBeenOccupied.md @@ -14,7 +14,7 @@ Check if a vehicle is occupied. ## Parameters | Name | Description | -|-----------|------------------------| +| --------- | ---------------------- | | vehicleid | The ID of the vehicle. | ## Return Values diff --git a/frontend/docs/scripting/functions/HideGameTextForAll.md b/frontend/docs/scripting/functions/HideGameTextForAll.md index 8849b3f6f68..9218f452a27 100644 --- a/frontend/docs/scripting/functions/HideGameTextForAll.md +++ b/frontend/docs/scripting/functions/HideGameTextForAll.md @@ -11,9 +11,9 @@ tags: ["player", "gametext"] Stop showing a gametext style for all players. -| Name | Description | -| -------------- | ----------------------------------------------------------------- | -| style | The [style](../resources/gametextstyles) of text to hide. | +| Name | Description | +| ----- | --------------------------------------------------------- | +| style | The [style](../resources/gametextstyles) of text to hide. | ## Returns diff --git a/frontend/docs/scripting/functions/HideGameTextForPlayer.md b/frontend/docs/scripting/functions/HideGameTextForPlayer.md index 6792903b135..072f614c3e8 100644 --- a/frontend/docs/scripting/functions/HideGameTextForPlayer.md +++ b/frontend/docs/scripting/functions/HideGameTextForPlayer.md @@ -11,10 +11,10 @@ tags: ["player", "gametext"] Stop showing a gametext style to a player. -| Name | Description | -| -------------- | ----------------------------------------------------------------- | -| playerid | The ID of the player to hide the gametext for. | -| style | The [style](../resources/gametextstyles) of text to hide. | +| Name | Description | +| -------- | --------------------------------------------------------- | +| playerid | The ID of the player to hide the gametext for. | +| style | The [style](../resources/gametextstyles) of text to hide. | ## Returns diff --git a/frontend/docs/scripting/functions/HideObjectForPlayer.md b/frontend/docs/scripting/functions/HideObjectForPlayer.md index 63ad0ad3796..71a6e56c743 100644 --- a/frontend/docs/scripting/functions/HideObjectForPlayer.md +++ b/frontend/docs/scripting/functions/HideObjectForPlayer.md @@ -14,7 +14,7 @@ Hide an object for a player. ## Parameters | Name | Description | -|----------|------------------------------------------| +| -------- | ---------------------------------------- | | playerid | The ID of the player. | | objectid | The ID of the object to hide for player. | diff --git a/frontend/docs/scripting/functions/HidePickupForPlayer.md b/frontend/docs/scripting/functions/HidePickupForPlayer.md index cb2e5d188d0..6aa7eae1790 100644 --- a/frontend/docs/scripting/functions/HidePickupForPlayer.md +++ b/frontend/docs/scripting/functions/HidePickupForPlayer.md @@ -12,7 +12,7 @@ tags: ["player", "pickup"] Hides a pickup for a specific player. | Name | Description | -|----------|----------------------------------------------| +| -------- | -------------------------------------------- | | playerid | The ID of the player. | | pickupid | The ID of the pickup to hide for the player. | diff --git a/frontend/docs/scripting/functions/HidePlayerDialog.md b/frontend/docs/scripting/functions/HidePlayerDialog.md index 7fbe541f12d..62406d33172 100644 --- a/frontend/docs/scripting/functions/HidePlayerDialog.md +++ b/frontend/docs/scripting/functions/HidePlayerDialog.md @@ -11,9 +11,9 @@ tags: ["player", "dialog"] Hides any dialog the player may currently be able to see. -| Name | Description | -| -------- | ------------------------------------------------------------------------ | -| playerid | The ID of the player to hide their current dialog from. | +| Name | Description | +| -------- | ------------------------------------------------------- | +| playerid | The ID of the player to hide their current dialog from. | ## Returns @@ -29,13 +29,13 @@ public OnPlayerConnect(playerid) if (IsAccountRegistered(playerid)) // Imaginary function to check if the player name is registered { ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Insert Your Password", "Login", ""); // shows login dialog to player - + new ipAddress[16]; GetPlayerIp(playerid, ipAddress, sizeof(ipAddress)); // get player's ip address - + if (IsBanned(ipAddress)) // check if the player ip is banned { - SendClientMessage(playerid, 0xFF0000FF, "You are banned from this server!"); + SendClientMessage(playerid, 0xFF0000FF, "You are banned from this server!"); HidePlayerDialog(playerid); // Hides login dialog } } diff --git a/frontend/docs/scripting/functions/HideVehicle.md b/frontend/docs/scripting/functions/HideVehicle.md index 9467c3516a0..bdce74e178c 100644 --- a/frontend/docs/scripting/functions/HideVehicle.md +++ b/frontend/docs/scripting/functions/HideVehicle.md @@ -20,7 +20,7 @@ Hides a vehicle from the game. ## Parametes | Name | Description | -|-----------|--------------------------------| +| --------- | ------------------------------ | | vehicleid | The ID of the vehicle to hide. | ## Examples diff --git a/frontend/docs/scripting/functions/IsActorInvulnerable.md b/frontend/docs/scripting/functions/IsActorInvulnerable.md index 5bf0396e313..58f21ab7a64 100644 --- a/frontend/docs/scripting/functions/IsActorInvulnerable.md +++ b/frontend/docs/scripting/functions/IsActorInvulnerable.md @@ -29,7 +29,7 @@ new gMyActor; public OnGameModeInit() { gMyActor = CreateActor(179, 316.1, -134.0, 999.6, 90.0); // Actor as a salesperson in Ammunation. - + if (IsActorInvulnerable(gMyActor)) { print("Actor is invulnerable."); diff --git a/frontend/docs/scripting/functions/IsGangZoneFlashingForPlayer.md b/frontend/docs/scripting/functions/IsGangZoneFlashingForPlayer.md index 044898abe4b..c30792ba53e 100644 --- a/frontend/docs/scripting/functions/IsGangZoneFlashingForPlayer.md +++ b/frontend/docs/scripting/functions/IsGangZoneFlashingForPlayer.md @@ -11,10 +11,10 @@ tags: ["player", "gangzone"] Check if the gangzone is flashing for player. -| Name | Description | -| ----------- | ----------------------------------------- | -| playerid | The ID of the player to be checked. | -| zoneid | The ID of the gangzone. | +| Name | Description | +| -------- | ----------------------------------- | +| playerid | The ID of the player to be checked. | +| zoneid | The ID of the gangzone. | ## Returns @@ -35,4 +35,4 @@ Check if the gangzone is flashing for player. - [GangZoneStopFlashForAll](GangZoneStopFlashForAll): Stop a gangzone flashing for all players. - [IsValidGangZone](IsValidGangZone): Check if the gangzone valid. - [IsPlayerInGangZone](IsPlayerInGangZone): Check if the player in gangzone. -- [IsGangZoneVisibleForPlayer](IsGangZoneVisibleForPlayer): Check if the gangzone is visible for player. \ No newline at end of file +- [IsGangZoneVisibleForPlayer](IsGangZoneVisibleForPlayer): Check if the gangzone is visible for player. diff --git a/frontend/docs/scripting/functions/IsGangZoneVisibleForPlayer.md b/frontend/docs/scripting/functions/IsGangZoneVisibleForPlayer.md index 12d51920eda..ad077337109 100644 --- a/frontend/docs/scripting/functions/IsGangZoneVisibleForPlayer.md +++ b/frontend/docs/scripting/functions/IsGangZoneVisibleForPlayer.md @@ -11,10 +11,10 @@ tags: ["player", "gangzone"] Check if the gangzone is visible for player. -| Name | Description | -| ----------- | ----------------------------------------- | -| playerid | The ID of the player to check for. | -| zoneid | The ID of the gangzone. | +| Name | Description | +| -------- | ---------------------------------- | +| playerid | The ID of the player to check for. | +| zoneid | The ID of the gangzone. | ## Returns @@ -34,4 +34,4 @@ Check if the gangzone is visible for player. - [GangZoneStopFlashForPlayer](GangZoneStopFlashForPlayer): Stop a gangzone flashing for a player. - [GangZoneStopFlashForAll](GangZoneStopFlashForAll): Stop a gangzone flashing for all players. - [IsValidGangZone](IsValidGangZone): Check if the gangzone valid. -- [IsPlayerInGangZone](IsPlayerInGangZone): Check if the player in gangzone. \ No newline at end of file +- [IsPlayerInGangZone](IsPlayerInGangZone): Check if the player in gangzone. diff --git a/frontend/docs/scripting/functions/IsObjectHiddenForPlayer.md b/frontend/docs/scripting/functions/IsObjectHiddenForPlayer.md index 6308ce3c221..d9f45feec7f 100644 --- a/frontend/docs/scripting/functions/IsObjectHiddenForPlayer.md +++ b/frontend/docs/scripting/functions/IsObjectHiddenForPlayer.md @@ -14,7 +14,7 @@ Checks if an object is hidden for a player. ## Parameters | Name | Description | -|----------|--------------------------------| +| -------- | ------------------------------ | | playerid | The ID of the player. | | objectid | The ID of the object to check. | diff --git a/frontend/docs/scripting/functions/IsObjectMaterialSlotUsed.md b/frontend/docs/scripting/functions/IsObjectMaterialSlotUsed.md index 928ac411beb..bb27f27bee2 100644 --- a/frontend/docs/scripting/functions/IsObjectMaterialSlotUsed.md +++ b/frontend/docs/scripting/functions/IsObjectMaterialSlotUsed.md @@ -12,7 +12,7 @@ tags: ["object"] Checks if a slot of object material is used. | Name | Description | -|---------------|---------------------------------------------| +| ------------- | ------------------------------------------- | | objectid | The ID of the object. | | materialIndex | The material index on the object. (0 to 15) | diff --git a/frontend/docs/scripting/functions/IsPickupHiddenForPlayer.md b/frontend/docs/scripting/functions/IsPickupHiddenForPlayer.md index c696058cab7..19cdb55c882 100644 --- a/frontend/docs/scripting/functions/IsPickupHiddenForPlayer.md +++ b/frontend/docs/scripting/functions/IsPickupHiddenForPlayer.md @@ -12,7 +12,7 @@ tags: ["player", "pickup"] Checks if a pickup is hidden for a specific player. | Name | Description | -|----------|-----------------------| +| -------- | --------------------- | | playerid | The ID of the player. | | pickupid | The ID of the pickup. | diff --git a/frontend/docs/scripting/functions/IsPickupStreamedIn.md b/frontend/docs/scripting/functions/IsPickupStreamedIn.md index d36a50d8c0d..1412b337d37 100644 --- a/frontend/docs/scripting/functions/IsPickupStreamedIn.md +++ b/frontend/docs/scripting/functions/IsPickupStreamedIn.md @@ -12,7 +12,7 @@ tags: ["player", "pickup"] Checks if a pickup is streamed in for a specific player. | Name | Description | -|----------|-----------------------| +| -------- | --------------------- | | playerid | The ID of the player. | | pickupid | The ID of the pickup. | diff --git a/frontend/docs/scripting/functions/IsPlayerControllable.md b/frontend/docs/scripting/functions/IsPlayerControllable.md index 525b8511f41..1d46bfc5416 100644 --- a/frontend/docs/scripting/functions/IsPlayerControllable.md +++ b/frontend/docs/scripting/functions/IsPlayerControllable.md @@ -11,8 +11,8 @@ tags: ["player"] Check if the player is controllable. -| Name | Description | -| -------- | ------------------- | +| Name | Description | +| -------- | --------------------- | | playerid | The ID of the player. | ## Returns diff --git a/frontend/docs/scripting/functions/IsPlayerCuffed.md b/frontend/docs/scripting/functions/IsPlayerCuffed.md index 3fc3f6c740e..37803184d0c 100644 --- a/frontend/docs/scripting/functions/IsPlayerCuffed.md +++ b/frontend/docs/scripting/functions/IsPlayerCuffed.md @@ -11,9 +11,9 @@ tags: ["player"] Checks if the player special action is cuffed. -| Name | Description | -| -------- | ----------------------------------------------------------- | -| playerid | The ID of the player to check. | +| Name | Description | +| -------- | ------------------------------ | +| playerid | The ID of the player to check. | ## Returns @@ -29,4 +29,3 @@ if (IsPlayerCuffed(playerid)) // do something } ``` - diff --git a/frontend/docs/scripting/functions/IsPlayerGangZoneFlashing.md b/frontend/docs/scripting/functions/IsPlayerGangZoneFlashing.md index 1d284e19663..c9ce0386758 100644 --- a/frontend/docs/scripting/functions/IsPlayerGangZoneFlashing.md +++ b/frontend/docs/scripting/functions/IsPlayerGangZoneFlashing.md @@ -11,10 +11,10 @@ tags: ["player", "gangzone", "playergangzone"] Check if the player gangzone is flashing. -| Name | Description | -| ----------- | ---------------------------------------------------------------- | -| playerid | The ID of the player to whom player gangzone is bound. | -| zoneid | The ID of the player gangzone. | +| Name | Description | +| -------- | ------------------------------------------------------ | +| playerid | The ID of the player to whom player gangzone is bound. | +| zoneid | The ID of the player gangzone. | ## Returns @@ -39,7 +39,7 @@ public OnPlayerConnect(playerid) public OnPlayerSpawn(playerid) { - // Start player gangzone flash + // Start player gangzone flash PlayerGangZoneFlash(playerid, gGangZoneID[playerid], 0x45D1ABFF); return 1; } @@ -68,4 +68,4 @@ public OnPlayerDeath(playerid, killerid, WEAPON:reason) - [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. -- [UsePlayerGangZoneCheck](UsePlayerGangZoneCheck): Enables the callback when a player enters/leaves this zone. \ No newline at end of file +- [UsePlayerGangZoneCheck](UsePlayerGangZoneCheck): Enables the callback when a player enters/leaves this zone. diff --git a/frontend/docs/scripting/functions/IsPlayerGangZoneVisible.md b/frontend/docs/scripting/functions/IsPlayerGangZoneVisible.md index 906db7f0a27..98c4f7bb2f1 100644 --- a/frontend/docs/scripting/functions/IsPlayerGangZoneVisible.md +++ b/frontend/docs/scripting/functions/IsPlayerGangZoneVisible.md @@ -11,10 +11,10 @@ tags: ["player", "gangzone", "playergangzone"] Check if the player gangzone is visible. -| Name | Description | -| ----------- | ---------------------------------------------------------------- | -| playerid | The ID of the player to whom player gangzone is bound. | -| zoneid | The ID of the player gangzone. | +| Name | Description | +| -------- | ------------------------------------------------------ | +| playerid | The ID of the player to whom player gangzone is bound. | +| zoneid | The ID of the player gangzone. | ## Returns @@ -69,4 +69,4 @@ public OnPlayerCommandText(playerid, cmdtext[]) - [IsValidPlayerGangZone](IsValidPlayerGangZone): Check if the player gangzone valid. - [IsPlayerInPlayerGangZone](IsPlayerInPlayerGangZone): Check if the player in player gangzone. - [IsPlayerGangZoneFlashing](IsPlayerGangZoneFlashing): Check if the player gangzone is flashing. -- [UsePlayerGangZoneCheck](UsePlayerGangZoneCheck): Enables the callback when a player enters/leaves this zone. \ No newline at end of file +- [UsePlayerGangZoneCheck](UsePlayerGangZoneCheck): Enables the callback when a player enters/leaves this zone. diff --git a/frontend/docs/scripting/functions/IsPlayerInDriveByMode.md b/frontend/docs/scripting/functions/IsPlayerInDriveByMode.md index 61831da11a5..2abd7e4cf66 100644 --- a/frontend/docs/scripting/functions/IsPlayerInDriveByMode.md +++ b/frontend/docs/scripting/functions/IsPlayerInDriveByMode.md @@ -11,9 +11,9 @@ tags: ["player"] Check if the player is in driveby mode. -| Name | Description | -| -------- | ----------------------------------------------------------- | -| playerid | The ID of the player to check. | +| Name | Description | +| -------- | ------------------------------ | +| playerid | The ID of the player to check. | ## Returns @@ -27,4 +27,3 @@ if (IsPlayerInDriveByMode(playerid)) // do something } ``` - diff --git a/frontend/docs/scripting/functions/IsPlayerInGangZone.md b/frontend/docs/scripting/functions/IsPlayerInGangZone.md index e631eb5f412..251c7cb508d 100644 --- a/frontend/docs/scripting/functions/IsPlayerInGangZone.md +++ b/frontend/docs/scripting/functions/IsPlayerInGangZone.md @@ -11,10 +11,10 @@ tags: ["player", "gangzone"] Check if the player in gangzone. -| Name | Description | -| ----------- | ----------------------------------------------------------- | -| playerid | The ID of the player to check if he is in a gangzone. | -| zoneid | The ID of the gangzone. | +| Name | Description | +| -------- | ----------------------------------------------------- | +| playerid | The ID of the player to check if he is in a gangzone. | +| zoneid | The ID of the gangzone. | ## Returns diff --git a/frontend/docs/scripting/functions/IsPlayerInModShop.md b/frontend/docs/scripting/functions/IsPlayerInModShop.md index 33318b9eb9c..7700611ec42 100644 --- a/frontend/docs/scripting/functions/IsPlayerInModShop.md +++ b/frontend/docs/scripting/functions/IsPlayerInModShop.md @@ -14,7 +14,7 @@ Check if the player is in the mod shop. ## Parameters | Name | Description | -|----------|--------------------------------| +| -------- | ------------------------------ | | playerid | The ID of the player to check. | ## Return Values @@ -38,13 +38,13 @@ else ## Related Functions -The following functions might be useful, as they're related to this callback in one way or another. +The following functions might be useful, as they're related to this callback in one way or another. - [AddVehicleComponent](AddVehicleComponent): Add a component to a vehicle. ## Related Callbacks -The following callbacks might be useful, as they're related to this callback in one way or another. +The following callbacks might be useful, as they're related to this callback in one way or another. - [OnVehicleMod](../callbacks/OnVehicleMod): This callback is called when a vehicle is modded. - [OnVehicleRespray](../callbacks/OnVehicleRespray): This callback is called when a player exits a mod shop, even if the colors weren't changed. diff --git a/frontend/docs/scripting/functions/IsPlayerInPlayerGangZone.md b/frontend/docs/scripting/functions/IsPlayerInPlayerGangZone.md index 7e00d9167ca..8916c4584ad 100644 --- a/frontend/docs/scripting/functions/IsPlayerInPlayerGangZone.md +++ b/frontend/docs/scripting/functions/IsPlayerInPlayerGangZone.md @@ -11,10 +11,10 @@ tags: ["player", "gangzone", "playergangzone"] Check if the player in player gangzone. -| Name | Description | -| ----------- | ---------------------------------------------------------------- | -| playerid | The ID of the player to whom player gangzone is bound. | -| zoneid | The ID of the player gangzone. | +| Name | Description | +| -------- | ------------------------------------------------------ | +| playerid | The ID of the player to whom player gangzone is bound. | +| zoneid | The ID of the player gangzone. | ## Returns @@ -66,4 +66,4 @@ public OnPlayerCommandText(playerid, cmdtext[]) - [IsValidPlayerGangZone](IsValidPlayerGangZone): Check if the player gangzone valid. - [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. \ No newline at end of file +- [UsePlayerGangZoneCheck](UsePlayerGangZoneCheck): Enables the callback when a player enters/leaves this zone. diff --git a/frontend/docs/scripting/functions/IsPlayerObjectMaterialSlotUsed.md b/frontend/docs/scripting/functions/IsPlayerObjectMaterialSlotUsed.md index b9076918fb5..9301ef232dc 100644 --- a/frontend/docs/scripting/functions/IsPlayerObjectMaterialSlotUsed.md +++ b/frontend/docs/scripting/functions/IsPlayerObjectMaterialSlotUsed.md @@ -12,7 +12,7 @@ tags: ["player", "object", "playerobject"] Checks if a slot of player-object material is used. | Name | Description | -|---------------|---------------------------------------------| +| ------------- | ------------------------------------------- | | playerid | The ID of the player. | | objectid | The ID of the player-object. | | materialIndex | The material index on the object. (0 to 15) | diff --git a/frontend/docs/scripting/functions/IsPlayerObjectMoving.md b/frontend/docs/scripting/functions/IsPlayerObjectMoving.md index 6db928ab1e9..aa6575da9c9 100644 --- a/frontend/docs/scripting/functions/IsPlayerObjectMoving.md +++ b/frontend/docs/scripting/functions/IsPlayerObjectMoving.md @@ -28,7 +28,7 @@ public OnPlayerConnect(playerid) gPlayerObject[playerid] = CreatePlayerObject(playerid, 2587, 2001.195679, 1547.113892, 14.283400, 0.0, 0.0, 96.0); MovePlayerObject(playerid, gPlayerObject[playerid], 2001.195679, 1547.113892, 10.000000, 2.0); - + if (IsPlayerObjectMoving(playerid, gPlayerObject[playerid])) { StopPlayerObject(playerid, gPlayerObject[playerid]); diff --git a/frontend/docs/scripting/functions/IsPlayerPickupStreamedIn.md b/frontend/docs/scripting/functions/IsPlayerPickupStreamedIn.md index 534569be419..906a2edbc81 100644 --- a/frontend/docs/scripting/functions/IsPlayerPickupStreamedIn.md +++ b/frontend/docs/scripting/functions/IsPlayerPickupStreamedIn.md @@ -12,7 +12,7 @@ tags: ["player", "pickup", "playerpickup"] Checks if a player-pickup is streamed in for the player. | Name | Description | -|----------|------------------------------| +| -------- | ---------------------------- | | playerid | The ID of the player. | | pickupid | The ID of the player-pickup. | diff --git a/frontend/docs/scripting/functions/IsPlayerSpawned.md b/frontend/docs/scripting/functions/IsPlayerSpawned.md index a5c2cccc7c7..229d4a2e137 100644 --- a/frontend/docs/scripting/functions/IsPlayerSpawned.md +++ b/frontend/docs/scripting/functions/IsPlayerSpawned.md @@ -12,7 +12,7 @@ tags: ["player"] Checks if a player is spawned. | Name | Description | -|----------|--------------------------------| +| -------- | ------------------------------ | | playerid | The ID of the player to check. | ## Returns diff --git a/frontend/docs/scripting/functions/IsPlayerUsingOfficialClient.md b/frontend/docs/scripting/functions/IsPlayerUsingOfficialClient.md index 551058b7c8e..5927cbb9654 100644 --- a/frontend/docs/scripting/functions/IsPlayerUsingOfficialClient.md +++ b/frontend/docs/scripting/functions/IsPlayerUsingOfficialClient.md @@ -11,9 +11,9 @@ tags: ["player"] Check if the player is using the official SA-MP client. -| Name | Description | -| -------- | ----------------------------------------------------------- | -| playerid | The ID of the player to check. | +| Name | Description | +| -------- | ------------------------------ | +| playerid | The ID of the player to check. | ## Returns diff --git a/frontend/docs/scripting/functions/IsPlayerUsingOmp.md b/frontend/docs/scripting/functions/IsPlayerUsingOmp.md index 9fb307859cd..afe645ae1c8 100644 --- a/frontend/docs/scripting/functions/IsPlayerUsingOmp.md +++ b/frontend/docs/scripting/functions/IsPlayerUsingOmp.md @@ -11,9 +11,9 @@ tags: ["player"] Check if the player is using the open.mp launcher. -| Name | Description | -| -------- | ----------------------------------------------------------- | -| playerid | The ID of the player to check. | +| Name | Description | +| -------- | ------------------------------ | +| playerid | The ID of the player to check. | ## Returns diff --git a/frontend/docs/scripting/functions/IsPlayerWidescreenToggled.md b/frontend/docs/scripting/functions/IsPlayerWidescreenToggled.md index c30bc2d7f2f..2bcc04f58d9 100644 --- a/frontend/docs/scripting/functions/IsPlayerWidescreenToggled.md +++ b/frontend/docs/scripting/functions/IsPlayerWidescreenToggled.md @@ -12,7 +12,7 @@ tags: ["player"] Checks if a player widescreen is on or off. | Name | Description | -|----------|--------------------------------| +| -------- | ------------------------------ | | playerid | The ID of the player to check. | ## Returns diff --git a/frontend/docs/scripting/functions/IsRepeatingTimer.md b/frontend/docs/scripting/functions/IsRepeatingTimer.md index b4c62d695b7..3ad363360b0 100644 --- a/frontend/docs/scripting/functions/IsRepeatingTimer.md +++ b/frontend/docs/scripting/functions/IsRepeatingTimer.md @@ -14,7 +14,7 @@ Checks if a timer is set to repeat. ## Parameters | Name | Description | -|---------|-------------------------------| +| ------- | ----------------------------- | | timerid | The ID of the timer to check. | ## Return Values @@ -46,4 +46,4 @@ public OnGameModeInit() - [SetTimerEx](SetTimerEx): Set a timer with parameters. - [KillTimer](KillTimer): Stop a timer. - [IsValidTimer](IsValidTimer): Checks if a timer is valid. -- [CountRunningTimers](CountRunningTimers): Get the running timers. \ No newline at end of file +- [CountRunningTimers](CountRunningTimers): Get the running timers. diff --git a/frontend/docs/scripting/functions/IsTextDrawVisibleForPlayer.md b/frontend/docs/scripting/functions/IsTextDrawVisibleForPlayer.md index 4ea8d48ef41..d10e148347c 100644 --- a/frontend/docs/scripting/functions/IsTextDrawVisibleForPlayer.md +++ b/frontend/docs/scripting/functions/IsTextDrawVisibleForPlayer.md @@ -11,10 +11,10 @@ tags: ["textdraw"] Checks if a textdraw is shown for a player. -| Name | Description | -| ----------- | -------------------------------- | -| playerid | The ID of the player to check. | -| Text:textid | The ID of the textdraw. | +| Name | Description | +| ----------- | ------------------------------ | +| playerid | The ID of the player to check. | +| Text:textid | The ID of the textdraw. | ## Returns diff --git a/frontend/docs/scripting/functions/IsValidActor.md b/frontend/docs/scripting/functions/IsValidActor.md index c4dd35c2310..82e2effb817 100644 --- a/frontend/docs/scripting/functions/IsValidActor.md +++ b/frontend/docs/scripting/functions/IsValidActor.md @@ -29,7 +29,7 @@ new gMyActor; public OnGameModeInit() { gMyActor = CreateActor(179, 316.1, -134.0, 999.6, 90.0); // Actor as a salesperson in Ammunation. - + if (IsValidActor(gMyActor)) { SetActorHealth(gMyActor, 100.0); diff --git a/frontend/docs/scripting/functions/IsValidAnimationLibrary.md b/frontend/docs/scripting/functions/IsValidAnimationLibrary.md index e060169dfd3..2cd3cfd2d87 100644 --- a/frontend/docs/scripting/functions/IsValidAnimationLibrary.md +++ b/frontend/docs/scripting/functions/IsValidAnimationLibrary.md @@ -11,9 +11,9 @@ tags: ["animation"] Checks if the given animation library is valid. -| Name | Description | -| ------------ | ----------------------------------------------------------- | -| const name[] | The animation library name to check. | +| Name | Description | +| ------------ | ------------------------------------ | +| const name[] | The animation library name to check. | ## Returns diff --git a/frontend/docs/scripting/functions/IsValidGangZone.md b/frontend/docs/scripting/functions/IsValidGangZone.md index 8432059e4b7..36e6220deab 100644 --- a/frontend/docs/scripting/functions/IsValidGangZone.md +++ b/frontend/docs/scripting/functions/IsValidGangZone.md @@ -11,9 +11,9 @@ tags: ["gangzone"] Check if the gangzone valid. -| Name | Description | -| ----------- | -------------------------- | -| zoneid | The ID of the gangzone. | +| Name | Description | +| ------ | ----------------------- | +| zoneid | The ID of the gangzone. | ## Returns @@ -31,4 +31,4 @@ Check if the gangzone valid. - [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. \ No newline at end of file +- [GangZoneStopFlashForAll](GangZoneStopFlashForAll): Stop a gangzone flashing for all players. diff --git a/frontend/docs/scripting/functions/IsValidMenu.md b/frontend/docs/scripting/functions/IsValidMenu.md index 3a7af7b0e07..d1ba7191cea 100644 --- a/frontend/docs/scripting/functions/IsValidMenu.md +++ b/frontend/docs/scripting/functions/IsValidMenu.md @@ -29,7 +29,8 @@ Checks if a menu ID is valid. - [SetMenuColumnHeader](SetMenuColumnHeader): Set the header for one of the columns in a menu. - [IsMenuDisabled](IsMenuDisabled): Check if a menu is disabled. - [IsMenuRowDisabled](IsMenuRowDisabled): Check if a menu row is disabled. -- +- + ## Related Callbacks - [OnPlayerSelectedMenuRow](../callbacks/OnPlayerSelectedMenuRow): Called when a player selected a row in a menu. diff --git a/frontend/docs/scripting/functions/IsValidNickName.md b/frontend/docs/scripting/functions/IsValidNickName.md index d9a08888047..1b24455b4df 100644 --- a/frontend/docs/scripting/functions/IsValidNickName.md +++ b/frontend/docs/scripting/functions/IsValidNickName.md @@ -11,9 +11,9 @@ tags: [] Checks if a nick name is valid. -| Name | Description | -| ------------ | ----------------------------------------------------------- | -| const name[] | The nick name to check. | +| Name | Description | +| ------------ | ----------------------- | +| const name[] | The nick name to check. | ## Returns diff --git a/frontend/docs/scripting/functions/IsValidPickup.md b/frontend/docs/scripting/functions/IsValidPickup.md index a5849b701fb..207a5e08855 100644 --- a/frontend/docs/scripting/functions/IsValidPickup.md +++ b/frontend/docs/scripting/functions/IsValidPickup.md @@ -12,7 +12,7 @@ tags: ["pickup"] Checks if a pickup is valid. | Name | Description | -|----------|--------------------------------| +| -------- | ------------------------------ | | pickupid | The ID of the pickup to check. | ## Returns diff --git a/frontend/docs/scripting/functions/IsValidPlayerGangZone.md b/frontend/docs/scripting/functions/IsValidPlayerGangZone.md index c6d9faf2ecb..016aab56986 100644 --- a/frontend/docs/scripting/functions/IsValidPlayerGangZone.md +++ b/frontend/docs/scripting/functions/IsValidPlayerGangZone.md @@ -11,10 +11,10 @@ tags: ["player", "gangzone", "playergangzone"] Check if the player gangzone valid. -| Name | Description | -| ----------- | ---------------------------------------------------------------- | -| playerid | The ID of the player to whom player gangzone is bound. | -| zoneid | The ID of the player gangzone. | +| Name | Description | +| -------- | ------------------------------------------------------ | +| playerid | The ID of the player to whom player gangzone is bound. | +| zoneid | The ID of the player gangzone. | ## Returns @@ -60,4 +60,4 @@ public OnPlayerSpawn(playerid) - [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. \ No newline at end of file +- [UsePlayerGangZoneCheck](UsePlayerGangZoneCheck): Enables the callback when a player enters/leaves this zone. diff --git a/frontend/docs/scripting/functions/IsValidPlayerPickup.md b/frontend/docs/scripting/functions/IsValidPlayerPickup.md index b43b9a82aa4..ad29eca21f9 100644 --- a/frontend/docs/scripting/functions/IsValidPlayerPickup.md +++ b/frontend/docs/scripting/functions/IsValidPlayerPickup.md @@ -12,7 +12,7 @@ tags: ["player", "pickup", "playerpickup"] Checks if a player-pickup is valid. | Name | Description | -|----------|---------------------------------------| +| -------- | ------------------------------------- | | playerid | The ID of the player. | | pickupid | The ID of the player-pickup to check. | diff --git a/frontend/docs/scripting/functions/IsValidServerRule.md b/frontend/docs/scripting/functions/IsValidServerRule.md index 3d57893822e..0b9df9962a3 100644 --- a/frontend/docs/scripting/functions/IsValidServerRule.md +++ b/frontend/docs/scripting/functions/IsValidServerRule.md @@ -11,9 +11,9 @@ tags: ["rule"] Checks if the given server rule is valid. -| Name | Description | -| ------------ | ----------------------------------------------------------- | -| const rule[] | The server rule name to check. | +| Name | Description | +| ------------ | ------------------------------ | +| const rule[] | The server rule name to check. | ## Returns diff --git a/frontend/docs/scripting/functions/IsValidTextDraw.md b/frontend/docs/scripting/functions/IsValidTextDraw.md index 28567381c29..c59bd48f6ea 100644 --- a/frontend/docs/scripting/functions/IsValidTextDraw.md +++ b/frontend/docs/scripting/functions/IsValidTextDraw.md @@ -29,7 +29,7 @@ new Text:gMyTextdraw; public OnGameModeInit() { gMyTextdraw = TextDrawCreate(100.0, 33.0, "Example TextDraw"); - + if (IsValidTextDraw(gMyTextdraw)) { // Textdraw is valid diff --git a/frontend/docs/scripting/functions/IsValidTimer.md b/frontend/docs/scripting/functions/IsValidTimer.md index c02b871cd37..5d82b4441e5 100644 --- a/frontend/docs/scripting/functions/IsValidTimer.md +++ b/frontend/docs/scripting/functions/IsValidTimer.md @@ -14,7 +14,7 @@ Checks if a timer is valid. ## Parameters | Name | Description | -|---------|-------------------------------| +| ------- | ----------------------------- | | timerid | The ID of the timer to check. | ## Return Values @@ -55,4 +55,4 @@ public OnGameModeExit() - [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. \ No newline at end of file +- [CountRunningTimers](CountRunningTimers): Get the running timers. diff --git a/frontend/docs/scripting/functions/IsVehicleDead.md b/frontend/docs/scripting/functions/IsVehicleDead.md index 9817141135c..1104a626d1f 100644 --- a/frontend/docs/scripting/functions/IsVehicleDead.md +++ b/frontend/docs/scripting/functions/IsVehicleDead.md @@ -14,7 +14,7 @@ Check if a vehicle is dead. ## Parameters | Name | Description | -|-----------|------------------------| +| --------- | ---------------------- | | vehicleid | The ID of the vehicle. | ## Return Values diff --git a/frontend/docs/scripting/functions/IsVehicleHidden.md b/frontend/docs/scripting/functions/IsVehicleHidden.md index 04cf37ea4fa..70035a67b8b 100644 --- a/frontend/docs/scripting/functions/IsVehicleHidden.md +++ b/frontend/docs/scripting/functions/IsVehicleHidden.md @@ -20,7 +20,7 @@ Checks if a vehicle is hidden. ## Parameters | Name | Description | -|-----------|---------------------------------| +| --------- | ------------------------------- | | vehicleid | The ID of the vehicle to check. | ## Return Values diff --git a/frontend/docs/scripting/functions/IsVehicleOccupied.md b/frontend/docs/scripting/functions/IsVehicleOccupied.md index e27cbe27ac0..19c41a7db5f 100644 --- a/frontend/docs/scripting/functions/IsVehicleOccupied.md +++ b/frontend/docs/scripting/functions/IsVehicleOccupied.md @@ -14,7 +14,7 @@ Check if a vehicle is occupied. ## Parameters | Name | Description | -|-----------|------------------------| +| --------- | ---------------------- | | vehicleid | The ID of the vehicle. | ## Return Values diff --git a/frontend/docs/scripting/functions/IsVehicleSirenEnabled.md b/frontend/docs/scripting/functions/IsVehicleSirenEnabled.md index b106daf1a18..438186f6835 100644 --- a/frontend/docs/scripting/functions/IsVehicleSirenEnabled.md +++ b/frontend/docs/scripting/functions/IsVehicleSirenEnabled.md @@ -14,7 +14,7 @@ Checks if a vehicle siren is on or off. ## Parameters | Name | Description | -|-----------|---------------------------------| +| --------- | ------------------------------- | | vehicleid | The ID of the vehicle to check. | ## Return Values diff --git a/frontend/docs/scripting/functions/IsVehicleStreamedIn.md b/frontend/docs/scripting/functions/IsVehicleStreamedIn.md index 848d8e63e75..c23ccfbef32 100644 --- a/frontend/docs/scripting/functions/IsVehicleStreamedIn.md +++ b/frontend/docs/scripting/functions/IsVehicleStreamedIn.md @@ -9,10 +9,10 @@ tags: ["vehicle"] Checks if a vehicle is streamed in for a player. Only nearby vehicles are streamed in (visible) for a player. -| Name | Description | -| ----------- | ------------------------------- | -| vehicleid | The ID of the vehicle to check. | -| playerid | The ID of the player to check. | +| Name | Description | +| --------- | ------------------------------- | +| vehicleid | The ID of the vehicle to check. | +| playerid | The ID of the player to check. | ## Returns diff --git a/frontend/docs/scripting/functions/LimitGlobalChatRadius.md b/frontend/docs/scripting/functions/LimitGlobalChatRadius.md index fe150fe08db..cd6a30e483b 100644 --- a/frontend/docs/scripting/functions/LimitGlobalChatRadius.md +++ b/frontend/docs/scripting/functions/LimitGlobalChatRadius.md @@ -9,9 +9,9 @@ tags: [] Set a radius limitation for the chat. Only players at a certain distance from the player will see their message in the chat. Also changes the distance at which a player can see other players on the map at the same distance. -| Name | Description | -| ----------------- | ---------------------------------------------------- | -| Float:chatRadius | The range in which players will be able to see chat. | +| Name | Description | +| ---------------- | ---------------------------------------------------- | +| Float:chatRadius | The range in which players will be able to see chat. | ## Returns diff --git a/frontend/docs/scripting/functions/LimitPlayerMarkerRadius.md b/frontend/docs/scripting/functions/LimitPlayerMarkerRadius.md index b9dbb3eeed4..2370ac62c53 100644 --- a/frontend/docs/scripting/functions/LimitPlayerMarkerRadius.md +++ b/frontend/docs/scripting/functions/LimitPlayerMarkerRadius.md @@ -9,9 +9,9 @@ tags: ["player"] Set the player marker radius. -| Name | Description | -| ------------------- | ------------------------------------ | -| Float:markerRadius | The radius that markers will show at | +| Name | Description | +| ------------------ | ------------------------------------ | +| Float:markerRadius | The radius that markers will show at | ## Returns diff --git a/frontend/docs/scripting/functions/LinkVehicleToInterior.md b/frontend/docs/scripting/functions/LinkVehicleToInterior.md index 38ce7aa5c15..86acb48b847 100644 --- a/frontend/docs/scripting/functions/LinkVehicleToInterior.md +++ b/frontend/docs/scripting/functions/LinkVehicleToInterior.md @@ -9,10 +9,10 @@ tags: ["vehicle"] Links a vehicle to an interior. Vehicles can only be seen by players in the same interior (SetPlayerInterior). -| Name | Description | -| ---------- | ------------------------------------------------------------- | -| vehicleid | The ID of the vehicle to link to an interior. | -| interiorid | The [Interior ID](../resources/interiorids) to link it to. | +| Name | Description | +| ---------- | ---------------------------------------------------------- | +| vehicleid | The ID of the vehicle to link to an interior. | +| interiorid | The [Interior ID](../resources/interiorids) to link it to. | ## Returns diff --git a/frontend/docs/scripting/functions/NPC_AddPointToPath.md b/frontend/docs/scripting/functions/NPC_AddPointToPath.md new file mode 100644 index 00000000000..7468930172d --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_AddPointToPath.md @@ -0,0 +1,71 @@ +--- +title: NPC_AddPointToPath +sidebar_label: NPC_AddPointToPath +description: Adds a waypoint to an NPC path. +tags: ["npc", "path"] +--- + + + +## Description + +Adds a waypoint to an NPC path. + +| Name | Description | +| --------- | ------------------------------------------------------- | +| pathid | The ID of the path to add the point to | +| x | The X coordinate of the waypoint | +| y | The Y coordinate of the waypoint | +| z | The Z coordinate of the waypoint | +| stopRange | The distance from point at which to consider it reached | + +## Returns + +Returns `true` on success, `false` on failure. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/addpatrolpos", true)) + { + new Float:x, Float:y, Float:z; + GetPlayerPos(playerid, x, y, z); + + // Try to add patrol point + if (NPC_AddPointToPath(PlayerPatrolPath[playerid], x, y, z, 1.5)) + { + SendClientMessage(playerid, 0x00FF00FF, "Added point to path %d at your current location", PlayerPatrolPath[playerid]); + } + else + { + SendClientMessage(playerid, 0xFF0000FF, "Failed add point to path"); + } + return 1; + } + return 0; +} + +``` + +## Notes + +- Points are added sequentially to form the path route +- The `stopRange` parameter defines how close the NPC needs to get before moving to the next point +- A smaller `stopRange` makes the NPC follow the path more precisely +- The path must be created with `NPC_CreatePath` before adding points + +## Related Functions + +- [NPC_CreatePath](NPC_CreatePath): Create a new path +- [NPC_RemovePointFromPath](NPC_RemovePointFromPath): Remove a point from a path +- [NPC_GetPathPoint](NPC_GetPathPoint): Get details about a specific point +- [NPC_MoveByPath](NPC_MoveByPath): Make NPC follow a path +- [NPC_GetPathPointCount](NPC_GetPathPointCount): Get number of points in a path + +## Related Callbacks + +- [OnNPCFinishMovePathPoint](../callbacks/OnNPCFinishMovePathPoint): Called when NPC reaches each path point +- [OnNPCFinishMovePath](../callbacks/OnNPCFinishMovePath): Called when NPC finishes moving along a path +- [OnNPCFinishMove](../callbacks/OnNPCFinishMove): Called when NPC finishes any movement diff --git a/frontend/docs/scripting/functions/NPC_AimAt.md b/frontend/docs/scripting/functions/NPC_AimAt.md new file mode 100644 index 00000000000..cfecfdb11d8 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_AimAt.md @@ -0,0 +1,84 @@ +--- +title: NPC_AimAt +sidebar_label: NPC_AimAt +description: Makes an NPC aim at a specific position. +tags: ["npc", "weapon", "aiming"] +--- + + + +## Description + +Makes an NPC aim at specified coordinates. + +| Name | Description | +| ------------------- | --------------------------------------------- | +| npcid | The ID of the NPC | +| Float:pointX | The X coordinate to aim at | +| Float:pointY | The Y coordinate to aim at | +| Float:pointZ | The Z coordinate to aim at | +| bool:shoot | Whether to shoot while aiming | +| shootDelay | Delay between shots in milliseconds | +| bool:updateAngle | Whether to update the NPC's facing angle | +| Float:offsetFromX | The X offset from the NPC's shooting position | +| Float:offsetFromY | The Y offset from the NPC's shooting position | +| Float:offsetFromZ | The Z offset from the NPC's shooting position | +| checkInBetweenFlags | Entity check flags for collision detection | + +## Returns + +Returns `true` if the operation was successful, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/aim", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + new Float:x, Float:y, Float:z; + GetPlayerPos(playerid, x, y, z); + + NPC_AimAt(npcid, x, y, z, false, 0, true, 0.0, 0.0, 0.6, NPC_ENTITY_CHECK_NONE); + SendClientMessage(playerid, 0x00FF00FF, "NPC %d is now aiming at your position.", npcid); + return 1; + } + + if (!strcmp(cmdtext, "/aimfire", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + new Float:x, Float:y, Float:z; + GetPlayerPos(playerid, x, y, z); + + NPC_AimAt(npcid, x, y, z, true, 800, true, 0.0, 0.0, 0.6, NPC_ENTITY_CHECK_NONE); + SendClientMessage(playerid, 0x00FF00FF, "NPC %d is now firing at your position.", npcid); + return 1; + } + return 0; +} +``` + +## Notes + +- The NPC will continuously aim at the specified position until `NPC_StopAim` is called +- If `shoot` is `true`, the NPC will fire at the target position with the specified delay +- The `updateAngle` parameter controls whether the NPC turns to face the target +- Offset parameters adjust the shooting origin point relative to the NPC's position + +## Related Functions + +- [NPC_AimAtPlayer](NPC_AimAtPlayer): Make NPC aim at a player +- [NPC_StopAim](NPC_StopAim): Stop NPC from aiming +- [NPC_IsAiming](NPC_IsAiming): Check if NPC is currently aiming +- [NPC_SetWeaponAccuracy](NPC_SetWeaponAccuracy): Set weapon accuracy + +## Related Callbacks + +- [OnNPCWeaponShot](../callbacks/OnNPCWeaponShot): Called when NPC fires a weapon diff --git a/frontend/docs/scripting/functions/NPC_AimAtPlayer.md b/frontend/docs/scripting/functions/NPC_AimAtPlayer.md new file mode 100644 index 00000000000..328b9343887 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_AimAtPlayer.md @@ -0,0 +1,81 @@ +--- +title: NPC_AimAtPlayer +sidebar_label: NPC_AimAtPlayer +description: Makes an NPC aim at a player. +tags: ["npc", "weapon", "aiming"] +--- + + + +## Description + +Makes an NPC aim at a player. + +| Name | Description | +| ------------------- | --------------------------------------------- | +| npcid | The ID of the NPC | +| playerid | The ID of the player to aim at | +| shoot | Whether to shoot while aiming | +| shootDelay | Delay between shots in milliseconds | +| updateAngle | Whether to update the NPC's facing angle | +| offsetX | The X offset from the target's position | +| offsetY | The Y offset from the target's position | +| offsetZ | The Z offset from the target's position | +| offsetFromX | The X offset from the NPC's shooting position | +| offsetFromY | The Y offset from the NPC's shooting position | +| offsetFromZ | The Z offset from the NPC's shooting position | +| checkInBetweenFlags | Entity check flags for collision detection | + +## Returns + +Returns `true` if the operation was successful, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/hostile", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + NPC_AimAtPlayer(npcid, playerid, true, 800, true, 0.0, 0.0, 0.8, 0.0, 0.0, 0.6, NPC_ENTITY_CHECK_PLAYER); + SendClientMessage(playerid, 0xFF0000FF, "NPC %d is now hostile towards you!", npcid); + return 1; + } + + if (!strcmp(cmdtext, "/guard", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + NPC_AimAtPlayer(npcid, playerid, false, 0, true, 0.0, 0.0, 0.0, 0.0, 0.0, 0.6, NPC_ENTITY_CHECK_PLAYER); + SendClientMessage(playerid, 0x00FF00FF, "NPC %d is now guarding you.", npcid); + return 1; + } + return 0; +} +``` + +## Notes + +- The NPC will continuously track the player's movement while aiming +- If the target player disconnects or becomes invalid, the NPC will stop aiming/shooting +- Target offset parameters allow aiming at specific body parts (head, torso, etc.) +- The NPC automatically updates its aim as the player moves +- Use `NPC_IsAimingAtPlayer` to check if NPC is aiming at a specific player + +## Related Functions + +- [NPC_AimAt](NPC_AimAt): Make NPC aim at a position +- [NPC_StopAim](NPC_StopAim): Stop NPC from aiming +- [NPC_IsAimingAtPlayer](NPC_IsAimingAtPlayer): Check if NPC is aiming at a player +- [NPC_SetWeaponAccuracy](NPC_SetWeaponAccuracy): Set weapon accuracy + +## Related Callbacks + +- [OnNPCWeaponShot](../callbacks/OnNPCWeaponShot): Called when NPC fires a weapon +- [OnNPCGiveDamage](../callbacks/OnNPCGiveDamage): Called when NPC damages a player diff --git a/frontend/docs/scripting/functions/NPC_ApplyAnimation.md b/frontend/docs/scripting/functions/NPC_ApplyAnimation.md new file mode 100644 index 00000000000..a2daca1b186 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_ApplyAnimation.md @@ -0,0 +1,66 @@ +--- +title: NPC_ApplyAnimation +sidebar_label: NPC_ApplyAnimation +description: Applies a specific animation to an NPC. +tags: ["npc", "animation"] +--- + + + +## Description + +Applies a specific animation to an NPC using animation library and name. + +| Name | Description | +| ---------- | ------------------------------------------ | +| npcid | The ID of the NPC | +| animlib[] | The animation library name | +| animname[] | The animation name within the library | +| delta | The speed of the animation (typically 4.1) | +| loop | Whether the animation should loop | +| lockX | Lock movement on the X axis | +| lockY | Lock movement on the Y axis | +| freeze | Freeze the NPC at the end of animation | +| time | Time in milliseconds to play the animation | + +## Returns + +Returns `true` if the operation was successful, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/applydance", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + NPC_ApplyAnimation(npcid, "DANCING", "dance_loop", 4.1, true, false, false, false, 0); + SendClientMessage(playerid, 0x00FF00FF, "NPC %d has been applied animation.", npcid); + + return 1; + } + return 0; +} +``` + +## Notes + +- Use `time` parameter to set animation duration +- Lock parameters prevent movement on specific axes during animation +- Use `NPC_ClearAnimations` to stop all animations +- Delta typically ranges from 1.0 to 10.0 (4.1 is standard) + +## Related Functions + +- [NPC_SetAnimation](NPC_SetAnimation): Set animation by ID +- [NPC_ClearAnimations](NPC_ClearAnimations): Clear all animations +- [NPC_ResetAnimation](NPC_ResetAnimation): Reset animation state +- [NPC_GetAnimation](NPC_GetAnimation): Get current animation data + +## Related Callbacks + +- [OnNPCSpawn](../callbacks/OnNPCSpawn): Called when NPC spawns diff --git a/frontend/docs/scripting/functions/NPC_ChangeNode.md b/frontend/docs/scripting/functions/NPC_ChangeNode.md new file mode 100644 index 00000000000..0fb55dd919e --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_ChangeNode.md @@ -0,0 +1,77 @@ +--- +title: NPC_ChangeNode +sidebar_label: NPC_ChangeNode +description: Changes the node an NPC is currently playing. +tags: ["npc", "node", "navigation"] +--- + + + +## Description + +Changes the node an NPC is currently playing to a different node. + +| Name | Description | +| ------ | ------------------------------------- | +| npcid | The ID of the NPC | +| nodeid | The ID of the new node to change to | +| linkid | The link ID to use for the transition | + +## Returns + +Returns the new point ID in the node. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/npcchangenode ", true, 15)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new nodeid = strval(cmdtext[15]); + + if (nodeid < 0 || nodeid > 63) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid node ID. Must be between 0 and 63."); + + new idx = 15; + while (cmdtext[idx] != ' ' && cmdtext[idx] != '\0') idx++; + while (cmdtext[idx] == ' ') idx++; + + if (cmdtext[idx] == '\0') + return SendClientMessage(playerid, 0xFF0000FF, "Usage: /npcchangenode [nodeid] [linkid]"); + + new linkid = strval(cmdtext[idx]); + + NPC_ChangeNode(npcid, nodeid, linkid); + SendClientMessage(playerid, 0x00FF00FF, "NPC %d changed to node %d via link %d", npcid, nodeid, linkid); + return 1; + } + return 0; +} +``` + +## Notes + +- The NPC must be currently playing a node before changing +- The target node must be opened with `NPC_OpenNode` first +- Link ID determines the transition path between nodes +- Use this for creating complex navigation patterns + +## Related Functions + +- [NPC_PlayNode](NPC_PlayNode): Start playing a node +- [NPC_StopPlayingNode](NPC_StopPlayingNode): Stop playing current node +- [NPC_OpenNode](NPC_OpenNode): Open a node for use +- [NPC_IsPlayingNode](NPC_IsPlayingNode): Check if NPC is playing a node + +## Related Callbacks + +- [OnNPCChangeNode](../callbacks/OnNPCChangeNode): Called when NPC changes nodes +- [OnNPCFinishNode](../callbacks/OnNPCFinishNode): Called when NPC finishes a node diff --git a/frontend/docs/scripting/functions/NPC_ClearAnimations.md b/frontend/docs/scripting/functions/NPC_ClearAnimations.md new file mode 100644 index 00000000000..72590345065 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_ClearAnimations.md @@ -0,0 +1,67 @@ +--- +title: NPC_ClearAnimations +sidebar_label: NPC_ClearAnimations +description: Clears all animations from an NPC. +tags: ["npc", "animation"] +--- + + + +## Description + +Clears all animations from an NPC, returning it to its default state. + +| Name | Description | +| ----- | ----------------- | +| npcid | The ID of the NPC | + +## Returns + +Returns `true` if the operation was successful, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/applydance", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + NPC_ApplyAnimation(npcid, "DANCING", "dance_loop", 4.1, true, false, false, false, 0); + SendClientMessage(playerid, 0x00FF00FF, "NPC %d has been applied animation.", npcid); + + SetTimerEx("ClearNPCAnimations", 25000, false, "ii", playerid, npcid); + + return 1; + } + return 0; +} + +forward ClearNPCAnimations(playerid, npcid); +public ClearNPCAnimations(playerid, npcid) +{ + + NPC_ClearAnimations(npcid); + SendClientMessage(playerid, 0x00FF00FF, "NPC %d animations were cleared.", npcid); +} + +``` + +## Notes + +- This function stops all currently playing animations including looping ones +- The NPC will return to its default idle stance + +## Related Functions + +- [NPC_ApplyAnimation](NPC_ApplyAnimation): Apply animation to NPC +- [NPC_SetAnimation](NPC_SetAnimation): Set animation by ID +- [NPC_ResetAnimation](NPC_ResetAnimation): Reset animation state +- [NPC_GetAnimation](NPC_GetAnimation): Get current animation data + +## Related Callbacks + +- [OnNPCSpawn](../callbacks/OnNPCSpawn): Called when NPC spawns diff --git a/frontend/docs/scripting/functions/NPC_ClearPath.md b/frontend/docs/scripting/functions/NPC_ClearPath.md new file mode 100644 index 00000000000..64d273c4755 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_ClearPath.md @@ -0,0 +1,63 @@ +--- +title: NPC_ClearPath +sidebar_label: NPC_ClearPath +description: Clears all points from an NPC path. +tags: ["npc", "path"] +--- + + + +## Description + +Clears all points from an NPC path, making it empty. + +| Name | Description | +| ------ | --------------------------- | +| pathid | The ID of the path to clear | + +## Returns + +Returns `true` on success, `false` on failure. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/clearpatrol", true)) + { + // Get the number of points before clearing + new count = NPC_GetPathPointCount(PlayerPatrolPath[playerid]); + + // Try to clear the path + if (NPC_ClearPath(PlayerPatrolPath[playerid])) + { + SendClientMessage(playerid, 0x00FF00FF, "Cleared path %d (%d points removed)", PlayerPatrolPath[playerid], count); + } + else + { + SendClientMessage(playerid, 0xFF0000FF, "Failed to clear path"); + } + + return 1; + } + return 0; +} +``` + +## Notes + +- This function removes all waypoints from the specified path +- The path itself remains valid and can be reused +- Any NPCs currently following this path will stop moving + +## Related Functions + +- [NPC_CreatePath](NPC_CreatePath): Create a new path +- [NPC_AddPointToPath](NPC_AddPointToPath): Add a point to a path +- [NPC_RemovePointFromPath](NPC_RemovePointFromPath): Remove specific point +- [NPC_GetPathPointCount](NPC_GetPathPointCount): Get number of points in path + +## Related Callbacks + +- [OnNPCFinishMovePath](../callbacks/OnNPCFinishMovePath): Called when NPC finishes path diff --git a/frontend/docs/scripting/functions/NPC_CloseNode.md b/frontend/docs/scripting/functions/NPC_CloseNode.md new file mode 100644 index 00000000000..71617b213ce --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_CloseNode.md @@ -0,0 +1,59 @@ +--- +title: NPC_CloseNode +sidebar_label: NPC_CloseNode +description: Closes an NPC node, making it unavailable for use. +tags: ["npc", "node", "navigation"] +--- + + + +## Description + +Closes an NPC node, making it unavailable for use by NPCs. + +| Name | Description | +| ------ | --------------------------- | +| nodeid | The ID of the node to close | + +## Returns + +Returns `true` if the operation was successful, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checknodetype ", true, 15)) + { + new nodeid = strval(cmdtext[15]); + + if (nodeid < 0 || nodeid > 63) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid node ID. Must be between 0 and 63."); + + new nodetype = NPC_GetNodeType(nodeid); + + SendClientMessage(playerid, 0x00FF00FF, "Node %d type: %d", nodeid, nodetype); + return 1; + } + return 0; +} +``` + +## Notes + +- Closing a node prevents new NPCs from using it +- NPCs currently using the node will continue until they finish +- Closed nodes cannot be played until reopened with `NPC_OpenNode` + +## Related Functions + +- [NPC_OpenNode](NPC_OpenNode): Open a node for use +- [NPC_IsNodeOpen](NPC_IsNodeOpen): Check if a node is open +- [NPC_PlayNode](NPC_PlayNode): Make NPC play a node +- [NPC_GetNodeType](NPC_GetNodeType): Get node type information + +## Related Callbacks + +- [OnNPCFinishNode](../callbacks/OnNPCFinishNode): Called when NPC finishes a node +- [OnNPCChangeNode](../callbacks/OnNPCChangeNode): Called when NPC changes nodes diff --git a/frontend/docs/scripting/functions/NPC_Create.md b/frontend/docs/scripting/functions/NPC_Create.md new file mode 100644 index 00000000000..d47a4f32e8c --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_Create.md @@ -0,0 +1,74 @@ +--- +title: NPC_Create +sidebar_label: NPC_Create +description: Creates a new NPC. +tags: ["npc"] +--- + + + +## Description + +Creates a new NPC. + +| Name | Description | +| ------------ | ---------------------------------------- | +| const name[] | The name of the NPC (max 24 characters). | + +## Returns + +Returns the ID of the created NPC, or `INVALID_NPC_ID` on failure. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/createnpc", true)) + { + new name[24]; + format(name, sizeof name, "Bot_%d", g_NPCCount++); + + new npcid = NPC_Create(name); + if (NPC_IsValid(npcid)) + { + new Float:x, Float:y, Float:z; + GetPlayerPos(playerid, x, y, z); + + NPC_Spawn(npcid); + NPC_SetPos(npcid, x + 3.0, y, z); + NPC_SetWeapon(npcid, WEAPON_M4); + NPC_SetAmmo(npcid, 500); + + PlayerNPC[playerid] = npcid; + SendClientMessage(playerid, 0x00FF00FF, "NPC %s (ID %d) spawned near you!", name, npcid); + } + else + { + SendClientMessage(playerid, 0xFF0000FF, "Failed to create NPC!"); + } + return 1; + } + return 0; +} +``` + +## Notes + +:::warning + +- The NPC will not be spawned automatically. Use [NPC_Spawn](NPC_Spawn) to spawn it. +- NPC names must follow the same rules as player names. +- Maximum name length is 24 characters. + +::: + +## Related Functions + +- [NPC_Destroy](NPC_Destroy): Destroys an NPC. +- [NPC_Spawn](NPC_Spawn): Spawns an NPC. +- [NPC_IsValid](NPC_IsValid): Checks if an NPC ID is valid. + +## Related Callbacks + +- [OnNPCCreate](../callbacks/OnNPCCreate): Called when an NPC is created. diff --git a/frontend/docs/scripting/functions/NPC_CreatePath.md b/frontend/docs/scripting/functions/NPC_CreatePath.md new file mode 100644 index 00000000000..ac53f654a1e --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_CreatePath.md @@ -0,0 +1,56 @@ +--- +title: NPC_CreatePath +sidebar_label: NPC_CreatePath +description: Creates a new NPC path. +tags: ["npc", "path"] +--- + + + +## Description + +Creates a new path that can be used for NPC navigation. + +## Returns + +Returns the ID of the created path. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/createpatrol", true)) + { + new pathid = NPC_CreatePath(); + g_PatrolPath = pathid; + + // If you wanted, you could already add points to the path here + // NPC_AddPointToPath(g_PatrolPath, x, y, z, 1.5) + // NPC_AddPointToPath(g_PatrolPath, x1, y1, z1, 1.5) + // NPC_AddPointToPath(g_PatrolPath, x2, y2, z2, 1.5) + + SendClientMessage(playerid, 0x00FF00FF, "Created a patrol path %d", g_PatrolPath); + + return 1; + } + return 0; +} +``` + +## Notes + +- The path is always created empty, use `NPC_AddPointToPath` to add waypoints +- Multiple NPCs can use the same path simultaneously +- Paths remain valid until destroyed with `NPC_DestroyPath` + +## Related Functions + +- [NPC_DestroyPath](NPC_DestroyPath): Destroy a path +- [NPC_AddPointToPath](NPC_AddPointToPath): Add waypoint to path +- [NPC_MoveByPath](NPC_MoveByPath): Make NPC follow a path +- [NPC_GetPathCount](NPC_GetPathCount): Get total number of paths + +## Related Callbacks + +- [OnNPCFinishMovePath](../callbacks/OnNPCFinishMovePath): Called when NPC finishes a path diff --git a/frontend/docs/scripting/functions/NPC_Destroy.md b/frontend/docs/scripting/functions/NPC_Destroy.md new file mode 100644 index 00000000000..0fc55f7e540 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_Destroy.md @@ -0,0 +1,68 @@ +--- +title: NPC_Destroy +sidebar_label: NPC_Destroy +description: Destroys an NPC. +tags: ["npc"] +--- + + + +## Description + +Destroys an NPC. + +| Name | Description | +| ----- | ----------------------------- | +| npcid | The ID of the NPC to destroy. | + +## Returns + +Returns `true` if the NPC was destroyed successfully, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/destroynpc", true)) + { + new npcid = PlayerNPC[playerid]; + + if (!NPC_IsValid(npcid)) + { + SendClientMessage(playerid, 0xFF0000FF, "You don't have a valid NPC to destroy."); + return 1; + } + + if (NPC_Destroy(npcid)) + { + SendClientMessage(playerid, 0x00FF00FF, "Your NPC (ID %d) was destroyed.", npcid); + PlayerNPC[playerid] = INVALID_NPC_ID; // or 0 if you don't have INVALID_NPC_ID defined + } + else + { + SendClientMessage(playerid, 0xFF0000FF, "Failed to destroy your NPC (ID %d).", npcid); + } + + return 1; + } + return 0; +} +``` + +## Notes + +:::warning + +- This will remove the NPC from the server completely and the ID becomes invalid after destruction. + +::: + +## Related Functions + +- [NPC_Create](NPC_Create): Creates a new NPC. +- [NPC_IsValid](NPC_IsValid): Checks if an NPC ID is valid. + +## Related Callbacks + +- [OnNPCDestroy](../callbacks/OnNPCDestroy): Called when an NPC is destroyed. diff --git a/frontend/docs/scripting/functions/NPC_DestroyAllPath.md b/frontend/docs/scripting/functions/NPC_DestroyAllPath.md new file mode 100644 index 00000000000..f88fd3297f4 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_DestroyAllPath.md @@ -0,0 +1,56 @@ +--- +title: NPC_DestroyAllPath +sidebar_label: NPC_DestroyAllPath +description: Destroys all NPC paths. +tags: ["npc", "path"] +--- + + + +## Description + +Destroys all existing NPC paths on the server. + +## Returns + +Returns `true` if the operation was successful, `false` otherwise. + +## Examples + +```c +public OnGameModeExit() +{ + // Get number of paths before clearing + new total = NPC_GetPathCount(); + + // Try to destroy them all + if (NPC_DestroyAllPath()) + { + printf("[NPC] Destroyed all NPC paths (%d removed).", total); + } + else + { + printf("[NPC] Failed to destroy NPC paths."); + } + + return 1; +} + +``` + +## Notes + +- This function destroys ALL paths on the server and NPCs currently following paths will stop moving +- All path IDs become invalid after this function is called +- This is useful for cleanup during gamemode shutdown/restart + +## Related Functions + +- [NPC_CreatePath](NPC_CreatePath): Create a new path +- [NPC_DestroyPath](NPC_DestroyPath): Destroy a specific path +- [NPC_GetPathCount](NPC_GetPathCount): Get total number of paths +- [NPC_ClearPath](NPC_ClearPath): Clear all points from a path + +## Related Callbacks + +- [OnNPCFinishMovePath](../callbacks/OnNPCFinishMovePath): Called when NPC finishes a path diff --git a/frontend/docs/scripting/functions/NPC_DestroyPath.md b/frontend/docs/scripting/functions/NPC_DestroyPath.md new file mode 100644 index 00000000000..b8382f437c8 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_DestroyPath.md @@ -0,0 +1,73 @@ +--- +title: NPC_DestroyPath +sidebar_label: NPC_DestroyPath +description: Destroys a specific NPC path. +tags: ["npc", "path"] +--- + + + +## Description + +Destroys a specific NPC path, making it invalid. + +| Name | Description | +| ------ | ----------------------------- | +| pathid | The ID of the path to destroy | + +## Returns + +Returns `true` on success, `false` on failure. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/deletepatrol", true)) + { + // Check if path is valid first + if (!NPC_IsValidPath(PlayerPatrolPath[playerid])) + { + SendClientMessage(playerid, 0xFF0000FF, "No valid patrol path to delete."); + return 1; + } + + // Get how many points were in it + new count = NPC_GetPathPointCount(PlayerPatrolPath[playerid]); + + // Try to destroy it + if (NPC_DestroyPath(PlayerPatrolPath[playerid])) + { + SendClientMessage(playerid, 0x00FF00FF, "Destroyed path %d (%d points removed).", PlayerPatrolPath[playerid], count); + + // Reset player's path variable since it's now invalid + PlayerPatrolPath[playerid] = INVALID_PATH_ID; + StopPlayerPatrolTimer(playerid); + } + else + { + SendClientMessage(playerid, 0xFF0000FF, "Failed to destroy patrol path."); + } + + return 1; + } + return 0; +} +``` + +## Notes + +- The path ID becomes invalid after destruction +- NPCs currently following this path will stop moving since all points in the path are removed + +## Related Functions + +- [NPC_CreatePath](NPC_CreatePath): Create a new path +- [NPC_IsValidPath](NPC_IsValidPath): Check if a path is valid +- [NPC_DestroyAllPath](NPC_DestroyAllPath): Destroy all paths +- [NPC_GetPathCount](NPC_GetPathCount): Get total number of paths + +## Related Callbacks + +- [OnNPCFinishMovePath](../callbacks/OnNPCFinishMovePath): Called when NPC finishes a path diff --git a/frontend/docs/scripting/functions/NPC_EnableInfiniteAmmo.md b/frontend/docs/scripting/functions/NPC_EnableInfiniteAmmo.md new file mode 100644 index 00000000000..178e2c2ed42 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_EnableInfiniteAmmo.md @@ -0,0 +1,59 @@ +--- +title: NPC_EnableInfiniteAmmo +sidebar_label: NPC_EnableInfiniteAmmo +description: Enables or disables infinite ammo for an NPC. +tags: ["npc", "weapon", "ammo"] +--- + + + +## Description + +Enables or disables infinite ammo for an NPC. + +| Name | Description | +| ------ | -------------------------------------------------- | +| npcid | The ID of the NPC | +| enable | `true` to enable infinite ammo, `false` to disable | + +## Returns + +Returns `true` if the operation was successful, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/toggleinfiniteammo", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + new bool:infinite = NPC_IsInfiniteAmmoEnabled(npcid); + NPC_EnableInfiniteAmmo(npcid, !infinite); + SendClientMessage(playerid, 0x00FF00FF, "NPC %d infinite ammo: %s", npcid, !infinite ? "Enabled" : "Disabled"); + + return 1; + } + return 0; +} +``` + +## Notes + +- When enabled, the NPC will never run out of ammunition +- This affects all weapons the NPC uses +- The ammo count display may still decrease but weapon functionality remains + +## Related Functions + +- [NPC_IsInfiniteAmmoEnabled](NPC_IsInfiniteAmmoEnabled): Check if infinite ammo is enabled +- [NPC_SetAmmo](NPC_SetAmmo): Set NPC ammunition +- [NPC_GetAmmo](NPC_GetAmmo): Get NPC ammunition +- [NPC_SetWeapon](NPC_SetWeapon): Set NPC weapon + +## Related Callbacks + +- [OnNPCWeaponShot](../callbacks/OnNPCWeaponShot): Called when NPC fires a weapon diff --git a/frontend/docs/scripting/functions/NPC_EnableReloading.md b/frontend/docs/scripting/functions/NPC_EnableReloading.md new file mode 100644 index 00000000000..5c2b657a877 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_EnableReloading.md @@ -0,0 +1,59 @@ +--- +title: NPC_EnableReloading +sidebar_label: NPC_EnableReloading +description: Enables or disables automatic reloading for an NPC. +tags: ["npc", "weapon", "reload"] +--- + + + +## Description + +Enables or disables automatic reloading for an NPC. + +| Name | Description | +| ------ | ---------------------------------------------- | +| npcid | The ID of the NPC | +| enable | `true` to enable reloading, `false` to disable | + +## Returns + +Returns `true` if the operation was successful, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/togglereload", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + new bool:reload = NPC_IsReloadEnabled(npcid); + NPC_EnableReloading(npcid, !reload); + SendClientMessage(playerid, 0x00FF00FF, "NPC %d reloading: %s", npcid, !reload ? "Enabled" : "Disabled"); + + return 1; + } + return 0; +} +``` + +## Notes + +- When enabled, the NPC will automatically reload when its clip is empty +- When disabled, the NPC will not reload and will eventually run out of ammo in clip +- The reload time can be customized with `NPC_SetWeaponReloadTime` + +## Related Functions + +- [NPC_IsReloadEnabled](NPC_IsReloadEnabled): Check if reloading is enabled +- [NPC_IsReloading](NPC_IsReloading): Check if NPC is currently reloading +- [NPC_SetWeaponReloadTime](NPC_SetWeaponReloadTime): Set weapon reload time +- [NPC_GetWeaponReloadTime](NPC_GetWeaponReloadTime): Get weapon reload time + +## Related Callbacks + +- [OnNPCWeaponStateChange](../callbacks/OnNPCWeaponStateChange): Called when NPC weapon state changes diff --git a/frontend/docs/scripting/functions/NPC_EnterVehicle.md b/frontend/docs/scripting/functions/NPC_EnterVehicle.md new file mode 100644 index 00000000000..c863c0d37da --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_EnterVehicle.md @@ -0,0 +1,79 @@ +--- +title: NPC_EnterVehicle +sidebar_label: NPC_EnterVehicle +description: Makes an NPC enter a vehicle. +tags: ["npc", "vehicle"] +--- + + + +## Description + +Makes an NPC enter a vehicle by walking to it and getting in. + +| Name | Description | +| --------- | ----------------------------------------- | +| npcid | The ID of the NPC | +| vehicleid | The ID of the vehicle to enter | +| seatid | The seat to enter | +| moveType | The movement type to use when approaching | + +## Returns + +Returns `true` if the operation was successful, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/npcenterbike ", true, 14)) + { + new seatid = strval(cmdtext[14]); + if (cmdtext[14] == '\0') + return SendClientMessage(playerid, 0xFF0000FF, "Usage: /npcenterbike [seatid]"); + + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + new vehicleid = PlayerVehicles[playerid][0]; + if (vehicleid == INVALID_VEHICLE_ID) + return SendClientMessage(playerid, 0xFF0000FF, "Your motorcycle is not available."); + + if (NPC_EnterVehicle(npcid, vehicleid, seatid, NPC_MOVE_TYPE_JOG)) + SendClientMessage(playerid, 0x00FF00FF, "NPC %d is entering motorcycle (seat %d).", npcid, seatid); + else + SendClientMessage(playerid, 0xFF0000FF, "NPC %d failed to enter motorcycle (seat %d).", npcid, seatid); + + return 1; + } + return 0; +} +``` + +## Seat IDs + +| ID | Seat | +| --- | ---------------------------- | +| 0 | Driver | +| 1 | Front passenger | +| 2 | Back-left passenger | +| 3 | Back-right passenger | +| 4+ | Passenger seats (coach etc.) | + +## Notes + +- The NPC will try to reach the vehicle door, using the specified movement type, before entering +- If the seat is occupied, the NPC may not be able to enter + +## Related Functions + +- [NPC_ExitVehicle](NPC_ExitVehicle): Make NPC exit vehicle +- [NPC_PutInVehicle](NPC_PutInVehicle): Instantly put NPC in vehicle +- [NPC_GetVehicle](NPC_GetVehicle): Get NPC's current vehicle +- [NPC_IsEnteringVehicle](NPC_IsEnteringVehicle): Check if NPC is entering vehicle + +## Related Callbacks + +_No specific callbacks are triggered by this function._ diff --git a/frontend/docs/scripting/functions/NPC_ExitVehicle.md b/frontend/docs/scripting/functions/NPC_ExitVehicle.md new file mode 100644 index 00000000000..fdd8709f620 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_ExitVehicle.md @@ -0,0 +1,58 @@ +--- +title: NPC_ExitVehicle +sidebar_label: NPC_ExitVehicle +description: Makes an NPC exit its current vehicle. +tags: ["npc", "vehicle"] +--- + + + +## Description + +Makes an NPC exit its current vehicle. + +| Name | Description | +| ----- | ----------------- | +| npcid | The ID of the NPC | + +## Returns + +Returns `true` if the operation was successful, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/npcexitbike", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (NPC_ExitVehicle(npcid)) + SendClientMessage(playerid, 0x00FF00FF, "NPC %d is exiting motorcycle.", npcid); + else + SendClientMessage(playerid, 0xFF0000FF, "NPC %d failed to exit motorcycle.", npcid); + + return 1; + } + return 0; +} +``` + +## Notes + +- The NPC must be in a vehicle for this function to work, otherwise this function has no effect +- The NPC will perform the exit animation and after exiting, the NPC will be on foot near the vehicle + +## Related Functions + +- [NPC_EnterVehicle](NPC_EnterVehicle): Make NPC enter a vehicle +- [NPC_PutInVehicle](NPC_PutInVehicle): Instantly put NPC in vehicle +- [NPC_RemoveFromVehicle](NPC_RemoveFromVehicle): Instantly remove NPC from vehicle +- [NPC_GetVehicle](NPC_GetVehicle): Get NPC's current vehicle + +## Related Callbacks + +_No specific callbacks are triggered by this function._ diff --git a/frontend/docs/scripting/functions/NPC_GetAll.md b/frontend/docs/scripting/functions/NPC_GetAll.md new file mode 100644 index 00000000000..179cb6c23bc --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_GetAll.md @@ -0,0 +1,60 @@ +--- +title: NPC_GetAll +sidebar_label: NPC_GetAll +description: Gets all NPC IDs and stores them in an array. +tags: ["npc"] +--- + + + +## Description + +Gets all NPC IDs and stores them in an array. + +| Name | Description | +| ------ | ------------------------------------------------ | +| npcs[] | Array to store the NPC IDs, passed by reference. | +| size | Size of the array. | + +## Returns + +Returns the number of NPCs found. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/countnpcs", true)) + { + new npcs[MAX_NPCS]; + new count = NPC_GetAll(npcs); + + SendClientMessage(playerid, 0x00FF00FF, "There are %d NPCs on the server.", count); + + return 1; + } + return 0; +} +``` + +## Notes + +:::warning + +- The array must be large enough to hold all NPC IDs. +- Only valid NPCs are included in the array. +- The function returns the actual number of NPCs found. +- Use this to iterate through all NPCs on the server. + +::: + +## Related Functions + +- [NPC_Create](NPC_Create): Create a new NPC. +- [NPC_IsValid](NPC_IsValid): Check if an NPC ID is valid. +- [NPC_Destroy](NPC_Destroy): Destroy an NPC. + +## Related Callbacks + +- [OnNPCCreate](../callbacks/OnNPCCreate): Called when an NPC is created. diff --git a/frontend/docs/scripting/functions/NPC_GetAmmo.md b/frontend/docs/scripting/functions/NPC_GetAmmo.md new file mode 100644 index 00000000000..507b05bd7a1 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_GetAmmo.md @@ -0,0 +1,60 @@ +--- +title: NPC_GetAmmo +sidebar_label: NPC_GetAmmo +description: Gets the ammunition amount for an NPC's current weapon. +tags: ["npc", "weapon", "ammo"] +--- + + + +## Description + +Gets the ammunition amount for an NPC's current weapon. + +| Name | Description | +| ----- | ----------------- | +| npcid | The ID of the NPC | + +## Returns + +Returns the amount of ammunition the NPC has for its current weapon. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkammo", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new ammo = NPC_GetAmmo(npcid); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d has %d bullets remaining on total ammo", npcid, ammo); + return 1; + } + return 0; +} +``` + +## Notes + +- Returns the total ammunition count +- If the NPC has no weapon, this returns 0 +- Infinite ammo NPCs still show the original ammo count + +## Related Functions + +- [NPC_SetAmmo](NPC_SetAmmo): Set NPC ammunition +- [NPC_GetAmmoInClip](NPC_GetAmmoInClip): Get ammunition in current clip +- [NPC_SetAmmoInClip](NPC_SetAmmoInClip): Set ammunition in clip +- [NPC_GetWeapon](NPC_GetWeapon): Get NPC's current weapon + +## Related Callbacks + +- [OnNPCWeaponShot](../callbacks/OnNPCWeaponShot): Called when NPC fires a weapon diff --git a/frontend/docs/scripting/functions/NPC_GetAmmoInClip.md b/frontend/docs/scripting/functions/NPC_GetAmmoInClip.md new file mode 100644 index 00000000000..03aad47eada --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_GetAmmoInClip.md @@ -0,0 +1,59 @@ +--- +title: NPC_GetAmmoInClip +sidebar_label: NPC_GetAmmoInClip +description: Gets the ammunition in the current clip of an NPC's weapon. +tags: ["npc", "weapon", "ammo"] +--- + + + +## Description + +Gets the ammunition in the current clip of an NPC's weapon. + +| Name | Description | +| ----- | ----------------- | +| npcid | The ID of the NPC | + +## Returns + +Returns the amount of ammunition in the NPC's current weapon clip. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkclip", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new clip = NPC_GetAmmoInClip(npcid); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d has %d bullets remaining on the clip", npcid, clip); + return 1; + } + return 0; +} +``` + +## Notes + +- Returns the amount of ammunition currently loaded in the weapon's magazine (clip), unlike [NPC_GetAmmo](NPC_GetAmmo), which returns the total ammo the NPC holds. +- Clip size varies depending on the weapon type. + +## Related Functions + +- [NPC_SetAmmoInClip](NPC_SetAmmoInClip): Set ammunition in clip +- [NPC_GetAmmo](NPC_GetAmmo): Get total ammunition +- [NPC_SetAmmo](NPC_SetAmmo): Set total ammunition +- [NPC_IsReloading](NPC_IsReloading): Check if NPC is reloading + +## Related Callbacks + +- [OnNPCWeaponShot](../callbacks/OnNPCWeaponShot): Called when NPC fires a weapon diff --git a/frontend/docs/scripting/functions/NPC_GetAnimation.md b/frontend/docs/scripting/functions/NPC_GetAnimation.md new file mode 100644 index 00000000000..fd2602deb98 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_GetAnimation.md @@ -0,0 +1,71 @@ +--- +title: NPC_GetAnimation +sidebar_label: NPC_GetAnimation +description: Gets the current animation data of an NPC. +tags: ["npc", "animation"] +--- + + + +## Description + +Gets the current animation data of an NPC. + +| Name | Description | +| ------------ | ----------------------------------------- | +| npcid | The ID of the NPC | +| &animationId | Variable to store the animation ID | +| &delta | Variable to store the animation speed | +| &loop | Variable to store whether animation loops | +| &lockX | Variable to store X-axis lock state | +| &lockY | Variable to store Y-axis lock state | +| &freeze | Variable to store freeze state at end | +| &time | Variable to store animation time | + +## Returns + +Returns `true` if the operation was successful, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/getanim", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You have no NPC."); + + new animid, time; + new Float:delta; + new bool:loop, bool:lockX, bool:lockY, bool:freeze; + + if (!NPC_GetAnimation(npcid, animid, delta, loop, lockX, lockY, freeze, time)) + return SendClientMessage(playerid, 0xFF0000FF, "Failed to get animation data (maybe no active animation)."); + + SendClientMessage(playerid, 0xFFFFFFFF, "NPC %d animID: %d | delta: %.2f | loop: %d | lockX: %d | lockY: %d | freeze: %d | time: %d", + npcid, animid, delta, _:loop, _:lockX, _:lockY, _:freeze, time); + + return 1; + } + return 0; +} +``` + +## Notes + +- This won't return data if used with [NPC_SetAnimation](NPC_SetAnimation) +- All parameters except npcid are passed by reference and will be modified +- If the NPC has no active animation, animationId will be 0 + +## Related Functions + +- [NPC_SetAnimation](NPC_SetAnimation): Set animation by ID +- [NPC_ApplyAnimation](NPC_ApplyAnimation): Apply animation by name +- [NPC_ClearAnimations](NPC_ClearAnimations): Clear all animations +- [NPC_ResetAnimation](NPC_ResetAnimation): Reset animation state + +## Related Callbacks + +- [OnNPCSpawn](../callbacks/OnNPCSpawn): Called when NPC spawns diff --git a/frontend/docs/scripting/functions/NPC_GetArmour.md b/frontend/docs/scripting/functions/NPC_GetArmour.md new file mode 100644 index 00000000000..0fe85a5a01b --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_GetArmour.md @@ -0,0 +1,60 @@ +--- +title: NPC_GetArmour +sidebar_label: NPC_GetArmour +description: Gets the armour value of an NPC. +tags: ["npc", "health"] +--- + + + +## Description + +Gets the armour value of an NPC. + +| Name | Description | +| ----- | ----------------- | +| npcid | The ID of the NPC | + +## Returns + +Returns the NPC's armour as a float value (0.0 to 100.0). + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkarmour", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new Float:armour = NPC_GetArmour(npcid); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d has %.1f% armour", npcid, armour); + return 1; + } + return 0; +} +``` + +## Notes + +- Armour values range from 0.0 to 100.0 +- NPCs start with 0.0 armour by default, use [NPC_SetArmour](NPC_SetArmour) to define a higher value + +## Related Functions + +- [NPC_SetArmour](NPC_SetArmour): Set NPC armour +- [NPC_GetHealth](NPC_GetHealth): Get NPC health +- [NPC_SetHealth](NPC_SetHealth): Set NPC health +- [NPC_IsDead](NPC_IsDead): Check if NPC is dead + +## Related Callbacks + +- [OnNPCTakeDamage](../callbacks/OnNPCTakeDamage): Called when NPC takes damage +- [OnNPCDeath](../callbacks/OnNPCDeath): Called when NPC dies diff --git a/frontend/docs/scripting/functions/NPC_GetCurrentPathPointIndex.md b/frontend/docs/scripting/functions/NPC_GetCurrentPathPointIndex.md new file mode 100644 index 00000000000..d6c2e6d1a7a --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_GetCurrentPathPointIndex.md @@ -0,0 +1,102 @@ +--- +title: NPC_GetCurrentPathPointIndex +sidebar_label: NPC_GetCurrentPathPointIndex +description: Gets the current path point index an NPC is moving towards. +tags: ["npc", "path"] +--- + + + +## Description + +Gets the current path point index an NPC is moving towards. + +| Name | Description | +| ----- | ----------------- | +| npcid | The ID of the NPC | + +## Returns + +Returns the current path point index the NPC is moving towards. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + // The commands to create paths and to create points on paths + + if (!strcmp(cmdtext, "/startpatrol", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + new count = NPC_GetPathPointCount(PlayerPatrolPath[playerid]); + + if (NPC_IsValidPath(PlayerPatrolPath[playerid])) + { + NPC_MoveByPath(npcid, PlayerPatrolPath[playerid], NPC_MOVE_TYPE_WALK); + SendClientMessage(playerid, 0x00FF00FF, "NPC %d started patrol route with %d points", npcid, count); + + PlayerPatrolTimer[playerid] = SetTimerEx("CheckPathProgress", 2000, true, "i", playerid); + } + else + { + SendClientMessage(playerid, 0xFF0000FF, "Failed to start patrol route"); + } + return 1; + } + return 0; +} + +forward CheckPathProgress(playerid); +public CheckPathProgress(playerid) +{ + if (!IsPlayerConnected(playerid)) + { + // Do something about it + return 0; + } + + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID || !NPC_IsValid(npcid)) + { + // Do something about it + return 0; + } + + if (!NPC_IsValidPath(PlayerPatrolPath[playerid])) + { + // Do something about it + return 0; + } + + new currentPoint = NPC_GetCurrentPathPointIndex(npcid); + new totalPoints = NPC_GetPathPointCount(PlayerPatrolPath[playerid]); + + if (currentPoint != INVALID_NODE_ID) + { + SendClientMessage(playerid, 0xFFFF00FF, "NPC %d progress: Point %d of %d", npcid, currentPoint + 1, totalPoints); + } + return 1; +} + +``` + +## Notes + +- Returns -1 if the NPC is not following a path +- This indicates the point the NPC is currently moving towards + +## Related Functions + +- [NPC_MoveByPath](NPC_MoveByPath): Make NPC follow a path +- [NPC_CreatePath](NPC_CreatePath): Create a new path +- [NPC_AddPointToPath](NPC_AddPointToPath): Add point to path +- [NPC_GetPathPointCount](NPC_GetPathPointCount): Get total points in path + +## Related Callbacks + +- [OnNPCFinishMovePath](../callbacks/OnNPCFinishMovePath): Called when NPC finishes path +- [OnNPCFinishMove](../callbacks/OnNPCFinishMove): Called when NPC finishes movement diff --git a/frontend/docs/scripting/functions/NPC_GetCustomSkin.md b/frontend/docs/scripting/functions/NPC_GetCustomSkin.md new file mode 100644 index 00000000000..dc52e4a405e --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_GetCustomSkin.md @@ -0,0 +1,70 @@ +--- +title: NPC_GetCustomSkin +sidebar_label: NPC_GetCustomSkin +description: Gets the custom skin ID of an NPC. +tags: ["npc", "skin", "model"] +--- + + + +## Description + +Gets the custom skin ID of an NPC. + +| Name | Description | +| ----- | ----------------- | +| npcid | The ID of the NPC | + +## Returns + +Returns the custom skin ID of the NPC, or -1 if the NPC has no custom skin or is invalid. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkcustomskin", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new customskinid = NPC_GetCustomSkin(npcid); + + if (customskinid == -1) + { + SendClientMessage(playerid, 0xFF0000FF, "NPC %d has no custom skin set", npcid); + } + else + { + SendClientMessage(playerid, 0x00FF00FF, "NPC %d custom skin: %d", npcid, customskinid); + } + return 1; + } + return 0; +} +``` + +## Notes + +:::warning + +- Returns -1 if the NPC has no custom skin set or if the NPC is invalid. +- Custom skins differ from regular skins in that they typically refer to custom models added to the game. +- Use [NPC_GetSkin](NPC_GetSkin) to get the regular skin/model ID. + +::: + +## Related Functions + +- [NPC_SetSkin](NPC_SetSkin): Set NPC skin/model. +- [NPC_GetSkin](NPC_GetSkin): Get NPC's current skin/model ID. +- [NPC_IsValid](NPC_IsValid): Check if NPC is valid. + +## Related Callbacks + +- [OnNPCSpawn](../callbacks/OnNPCSpawn): Called when NPC spawns. diff --git a/frontend/docs/scripting/functions/NPC_GetEnteringVehicle.md b/frontend/docs/scripting/functions/NPC_GetEnteringVehicle.md new file mode 100644 index 00000000000..b471cfc5e4a --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_GetEnteringVehicle.md @@ -0,0 +1,100 @@ +--- +title: NPC_GetEnteringVehicle +sidebar_label: NPC_GetEnteringVehicle +description: Gets the vehicle an NPC is currently entering. +tags: ["npc", "vehicle"] +--- + + + +## Description + +Gets the vehicle an NPC is currently entering. + +| Name | Description | +| ----- | ----------------- | +| npcid | The ID of the NPC | + +## Returns + +Returns the vehicle ID the NPC is entering, or INVALID_VEHICLE_ID if not entering any vehicle. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkenterveh", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + // Start monitoring if not already running + if (PlayerEnterVehicleMonitor[playerid] == INVALID_TIMER_ID) + { + PlayerEnterVehicleMonitor[playerid] = SetTimerEx("CheckNPCEnteringVehicle", 200, true, "i", playerid); + PlayerWasEnteringVehicle[playerid] = false; + SendClientMessage(playerid, 0x00FF00FF, "Started monitoring NPC %d vehicle entry.", npcid); + } + else + { + SendClientMessage(playerid, 0xFFFF00FF, "Already monitoring NPC %d vehicle entry.", npcid); + } + return 1; + } + return 0; +} + +forward CheckNPCEnteringVehicle(playerid); +public CheckNPCEnteringVehicle(playerid) +{ + if (!IsPlayerConnected(playerid)) + { + StopPlayerEnterVehicleMonitor(playerid); + return 0; + } + + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID || !NPC_IsValid(npcid)) + { + StopPlayerEnterVehicleMonitor(playerid); + return 0; + } + + new bool:isEntering = NPC_IsEnteringVehicle(npcid); + + if (isEntering) + { + new vehicleid = NPC_GetEnteringVehicle(npcid); + new seatid = NPC_GetEnteringVehicleSeat(npcid); + + if (vehicleid != INVALID_VEHICLE_ID && vehicleid != 0) + { + SendClientMessage(playerid, 0xFFFF00FF, "NPC %d entering vehicle %d (seat %d)", npcid, vehicleid, seatid); + } + } + + return 1; +} +``` + +## Notes + +- Returns INVALID_VEHICLE_ID if the NPC is not currently entering a vehicle +- This is different from the vehicle the NPC is already in +- The NPC must be in the process of entering for this to return a valid ID + +## Related Functions + +- [NPC_EnterVehicle](NPC_EnterVehicle): Make NPC enter a vehicle +- [NPC_GetVehicle](NPC_GetVehicle): Get NPC's current vehicle +- [NPC_IsEnteringVehicle](NPC_IsEnteringVehicle): Check if NPC is entering vehicle +- [NPC_GetEnteringVehicleSeat](NPC_GetEnteringVehicleSeat): Get entering vehicle seat + +## Related Callbacks + +_No specific callbacks are triggered by this function._ diff --git a/frontend/docs/scripting/functions/NPC_GetEnteringVehicleID.md b/frontend/docs/scripting/functions/NPC_GetEnteringVehicleID.md new file mode 100644 index 00000000000..776039f8b98 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_GetEnteringVehicleID.md @@ -0,0 +1,100 @@ +--- +title: NPC_GetEnteringVehicleID +sidebar_label: NPC_GetEnteringVehicleID +description: Gets the vehicle ID an NPC is currently entering. +tags: ["npc", "vehicle"] +--- + + + +## Description + +Gets the vehicle ID an NPC is currently entering. + +| Name | Description | +| ----- | ----------------- | +| npcid | The ID of the NPC | + +## Returns + +Returns the vehicle ID the NPC is entering, or INVALID_VEHICLE_ID if not entering any vehicle. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkenterveh", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + // Start monitoring if not already running + if (PlayerEnterVehicleMonitor[playerid] == INVALID_TIMER_ID) + { + PlayerEnterVehicleMonitor[playerid] = SetTimerEx("CheckNPCEnteringVehicle", 200, true, "i", playerid); + PlayerWasEnteringVehicle[playerid] = false; + SendClientMessage(playerid, 0x00FF00FF, "Started monitoring NPC %d vehicle entry.", npcid); + } + else + { + SendClientMessage(playerid, 0xFFFF00FF, "Already monitoring NPC %d vehicle entry.", npcid); + } + return 1; + } + return 0; +} + +forward CheckNPCEnteringVehicle(playerid); +public CheckNPCEnteringVehicle(playerid) +{ + if (!IsPlayerConnected(playerid)) + { + StopPlayerEnterVehicleMonitor(playerid); + return 0; + } + + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID || !NPC_IsValid(npcid)) + { + StopPlayerEnterVehicleMonitor(playerid); + return 0; + } + + new bool:isEntering = NPC_IsEnteringVehicle(npcid); + + if (isEntering) + { + new vehicleid = NPC_GetEnteringVehicle(npcid); + new seatid = NPC_GetEnteringVehicleSeat(npcid); + + if (vehicleid != INVALID_VEHICLE_ID && vehicleid != 0) + { + SendClientMessage(playerid, 0xFFFF00FF, "NPC %d entering vehicle %d (seat %d)", npcid, vehicleid, seatid); + } + } + + return 1; +} +``` + +## Notes + +- This function is similar to NPC_GetEnteringVehicle +- Returns INVALID_VEHICLE_ID if the NPC is not in the process of entering a vehicle +- The value becomes 0 once the NPC successfully enters the vehicle + +## Related Functions + +- [NPC_GetEnteringVehicle](NPC_GetEnteringVehicle): Get entering vehicle +- [NPC_GetEnteringVehicleSeat](NPC_GetEnteringVehicleSeat): Get entering vehicle seat +- [NPC_EnterVehicle](NPC_EnterVehicle): Make NPC enter vehicle +- [NPC_IsEnteringVehicle](NPC_IsEnteringVehicle): Check if entering vehicle + +## Related Callbacks + +_No specific callbacks are triggered by this function._ diff --git a/frontend/docs/scripting/functions/NPC_GetEnteringVehicleSeat.md b/frontend/docs/scripting/functions/NPC_GetEnteringVehicleSeat.md new file mode 100644 index 00000000000..1cfe6a4b4c1 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_GetEnteringVehicleSeat.md @@ -0,0 +1,109 @@ +--- +title: NPC_GetEnteringVehicleSeat +sidebar_label: NPC_GetEnteringVehicleSeat +description: Gets the seat an NPC is entering in a vehicle. +tags: ["npc", "vehicle"] +--- + + + +## Description + +Gets the seat an NPC is entering in a vehicle. + +| Name | Description | +| ----- | ----------------- | +| npcid | The ID of the NPC | + +## Returns + +Returns the seat number the NPC is entering, or -1 if not entering. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkenterveh", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + // Start monitoring if not already running + if (PlayerEnterVehicleMonitor[playerid] == INVALID_TIMER_ID) + { + PlayerEnterVehicleMonitor[playerid] = SetTimerEx("CheckNPCEnteringVehicle", 200, true, "i", playerid); + PlayerWasEnteringVehicle[playerid] = false; + SendClientMessage(playerid, 0x00FF00FF, "Started monitoring NPC %d vehicle entry.", npcid); + } + else + { + SendClientMessage(playerid, 0xFFFF00FF, "Already monitoring NPC %d vehicle entry.", npcid); + } + return 1; + } + return 0; +} + +forward CheckNPCEnteringVehicle(playerid); +public CheckNPCEnteringVehicle(playerid) +{ + if (!IsPlayerConnected(playerid)) + { + StopPlayerEnterVehicleMonitor(playerid); + return 0; + } + + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID || !NPC_IsValid(npcid)) + { + StopPlayerEnterVehicleMonitor(playerid); + return 0; + } + + new bool:isEntering = NPC_IsEnteringVehicle(npcid); + + if (isEntering) + { + new vehicleid = NPC_GetEnteringVehicle(npcid); + new seatid = NPC_GetEnteringVehicleSeat(npcid); + + if (vehicleid != INVALID_VEHICLE_ID && vehicleid != 0) + { + SendClientMessage(playerid, 0xFFFF00FF, "NPC %d entering vehicle %d (seat %d)", npcid, vehicleid, seatid); + } + } + + return 1; +} +``` + +## Seat IDs + +| ID | Seat | +| --- | ---------------------------- | +| 0 | Driver | +| 1 | Front passenger | +| 2 | Back-left passenger | +| 3 | Back-right passenger | +| 4+ | Passenger seats (coach etc.) | + +## Notes + +- Returns -1 if the NPC is not entering any vehicle +- This information is only valid while the NPC is in the entering process + +## Related Functions + +- [NPC_GetEnteringVehicle](NPC_GetEnteringVehicle): Get entering vehicle +- [NPC_GetEnteringVehicleID](NPC_GetEnteringVehicleID): Get entering vehicle ID +- [NPC_EnterVehicle](NPC_EnterVehicle): Make NPC enter vehicle +- [NPC_GetVehicleSeat](NPC_GetVehicleSeat): Get current vehicle seat + +## Related Callbacks + +_No specific callbacks are triggered by this function._ diff --git a/frontend/docs/scripting/functions/NPC_GetFacingAngle.md b/frontend/docs/scripting/functions/NPC_GetFacingAngle.md new file mode 100644 index 00000000000..071c59e9edf --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_GetFacingAngle.md @@ -0,0 +1,67 @@ +--- +title: NPC_GetFacingAngle +sidebar_label: NPC_GetFacingAngle +description: Gets the facing angle of an NPC. +tags: ["npc", "angle"] +--- + + + +## Description + +Gets the facing angle of an NPC. + +| Name | Description | +| ------------ | -------------------------------------------------------- | +| npcid | The ID of the NPC. | +| &Float:angle | Variable to store the facing angle, passed by reference. | + +## Returns + +Returns `true` if the facing angle was retrieved successfully, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkfacingangle", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new Float:angle; + NPC_GetFacingAngle(npcid, angle); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d facing angle: %.2f", npcid, angle); + return 1; + } + + return 0; +} +``` + +## Notes + +:::warning + +- The angle is passed by reference and will be modified. +- Angles are in degrees (0.0 to 360.0). +- Angles are counter-clockwise in GTA:SA; 90 degrees would be East in the real world, but in GTA:SA 90 degrees is in fact West. North and South are still 0/360 and 180. To convert GTA:SA angles to real-world compass angles, simply do 360 - angle. + +::: + +## Related Functions + +- [NPC_SetFacingAngle](NPC_SetFacingAngle): Set NPC facing angle. +- [NPC_GetRot](NPC_GetRot): Get full 3D rotation. +- [NPC_SetRot](NPC_SetRot): Set full 3D rotation. +- [NPC_GetPos](NPC_GetPos): Get NPC position. + +## Related Callbacks + +- [OnNPCSpawn](../callbacks/OnNPCSpawn): Called when NPC spawns. diff --git a/frontend/docs/scripting/functions/NPC_GetFightingStyle.md b/frontend/docs/scripting/functions/NPC_GetFightingStyle.md new file mode 100644 index 00000000000..0f45aac1034 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_GetFightingStyle.md @@ -0,0 +1,59 @@ +--- +title: NPC_GetFightingStyle +sidebar_label: NPC_GetFightingStyle +description: Gets the fighting style of an NPC. +tags: ["npc", "fighting"] +--- + + + +## Description + +Gets the fighting style of an NPC. + +| Name | Description | +| ----- | ----------------- | +| npcid | The ID of the NPC | + +## Returns + +Returns the fighting style ID of the NPC. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkfightingstyle", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new style = NPC_GetFightingStyle(npcid); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d fighting style: %d", npcid, style); + return 1; + } + return 0; +} +``` + +## Notes + +- Fighting styles affect melee combat animations and damage +- Each style has different punch and kick animations +- The default fighting style is FIGHT_STYLE_NORMAL + +## Related Functions + +- [NPC_SetFightingStyle](NPC_SetFightingStyle): Set NPC fighting style +- [NPC_MeleeAttack](NPC_MeleeAttack): Make NPC perform melee attack +- [NPC_IsMeleeAttacking](NPC_IsMeleeAttacking): Check if NPC is attacking + +## Related Callbacks + +- [OnNPCGiveDamage](../callbacks/OnNPCGiveDamage): Called when NPC damages someone diff --git a/frontend/docs/scripting/functions/NPC_GetHealth.md b/frontend/docs/scripting/functions/NPC_GetHealth.md new file mode 100644 index 00000000000..5399f8f9b45 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_GetHealth.md @@ -0,0 +1,60 @@ +--- +title: NPC_GetHealth +sidebar_label: NPC_GetHealth +description: Gets the health value of an NPC. +tags: ["npc", "health"] +--- + + + +## Description + +Gets the health value of an NPC. + +| Name | Description | +| ----- | ----------------- | +| npcid | The ID of the NPC | + +## Returns + +Returns the NPC's health as a float value. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkhealth", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new Float:health = NPC_GetHealth(npcid); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d health: %.2f", npcid, health); + return 1; + } + return 0; +} +``` + +## Notes + +- Health values typically range from 0.0 to 100.0 +- An NPC with 0.0 health is considered dead + +## Related Functions + +- [NPC_SetHealth](NPC_SetHealth): Set NPC health +- [NPC_GetArmour](NPC_GetArmour): Get NPC armour +- [NPC_SetArmour](NPC_SetArmour): Set NPC armour +- [NPC_IsDead](NPC_IsDead): Check if NPC is dead + +## Related Callbacks + +- [OnNPCTakeDamage](../callbacks/OnNPCTakeDamage): Called when NPC takes damage +- [OnNPCDeath](../callbacks/OnNPCDeath): Called when NPC dies diff --git a/frontend/docs/scripting/functions/NPC_GetInterior.md b/frontend/docs/scripting/functions/NPC_GetInterior.md new file mode 100644 index 00000000000..35f3d9990bf --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_GetInterior.md @@ -0,0 +1,58 @@ +--- +title: NPC_GetInterior +sidebar_label: NPC_GetInterior +description: Gets the interior ID of an NPC. +tags: ["npc", "interior"] +--- + + + +## Description + +Gets the interior ID of an NPC. + +| Name | Description | +| ----- | ----------------- | +| npcid | The ID of the NPC | + +## Returns + +Returns the interior ID the NPC is currently in. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkinterior", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new interior = NPC_GetInterior(npcid); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d interior: %d", npcid, interior); + return 1; + } + return 0; +} +``` + +## Notes + +- Interior 0 is the main world (outside) + +## Related Functions + +- [NPC_SetInterior](NPC_SetInterior): Set NPC interior +- [NPC_GetVirtualWorld](NPC_GetVirtualWorld): Get NPC virtual world +- [NPC_SetVirtualWorld](NPC_SetVirtualWorld): Set NPC virtual world +- [NPC_GetPos](NPC_GetPos): Get NPC position + +## Related Callbacks + +- [OnNPCSpawn](../callbacks/OnNPCSpawn): Called when NPC spawns diff --git a/frontend/docs/scripting/functions/NPC_GetKeys.md b/frontend/docs/scripting/functions/NPC_GetKeys.md new file mode 100644 index 00000000000..4ae0fb3c704 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_GetKeys.md @@ -0,0 +1,64 @@ +--- +title: NPC_GetKeys +sidebar_label: NPC_GetKeys +description: Gets the current key states of an NPC. +tags: ["npc", "keys"] +--- + + + +## Description + +Gets the current key states of an NPC. + +| Name | Description | +| ------------- | --------------------------------------- | +| npcid | The ID of the NPC | +| &upAndDown | Variable to store up/down key states | +| &leftAndRight | Variable to store left/right key states | +| &keys | Variable to store other key states | + +## Returns + +Returns `true` if the keys were retrieved successfully, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkkeys", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new keys, updown, leftright; + NPC_GetKeys(npcid, keys, updown, leftright); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d keys: %d, updown: %d, leftright: %d", npcid, keys, updown, leftright); + return 1; + } + return 0; +} +``` + +## Notes + +- All parameters except npcid are passed by reference and will be modified +- Key states are stored as bit flags +- Use bitwise operations to check individual keys +- This reflects the NPC's current input state + +## Related Functions + +- [NPC_SetKeys](NPC_SetKeys): Set NPC key states +- [NPC_Move](NPC_Move): Make NPC move to position +- [NPC_StopMove](NPC_StopMove): Stop NPC movement + +## Related Callbacks + +- [OnNPCFinishMove](../callbacks/OnNPCFinishMove): Called when NPC finishes movement diff --git a/frontend/docs/scripting/functions/NPC_GetNodeInfo.md b/frontend/docs/scripting/functions/NPC_GetNodeInfo.md new file mode 100644 index 00000000000..63622d736e9 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_GetNodeInfo.md @@ -0,0 +1,67 @@ +--- +title: NPC_GetNodeInfo +sidebar_label: NPC_GetNodeInfo +description: Gets information about an NPC node. +tags: ["npc", "node", "navigation"] +--- + + + +## Description + +Gets information about an NPC node including vehicle, pedestrian, and navigation data. + +| Name | Description | +| --------- | --------------------------------------------- | +| nodeid | The ID of the node | +| &vehnodes | Variable to store vehicle node count | +| &pednodes | Variable to store pedestrian node count | +| &navinode | Variable to store navigation node information | + +## Returns + +Returns `true` on success, `false` on failure. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checknodeinfo ", true, 15)) + { + new nodeid = strval(cmdtext[15]); + + if (nodeid < 0 || nodeid > 63) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid node ID. Must be between 0 and 63."); + + new vehnodes, pednodes, navinode; + new bool:success = NPC_GetNodeInfo(nodeid, vehnodes, pednodes, navinode); + + if (success) + SendClientMessage(playerid, 0x00FF00FF, "Node %d info - Vehicle nodes: %d, Ped nodes: %d, Navi node: %d", nodeid, vehnodes, pednodes, navinode); + else + SendClientMessage(playerid, 0xFF0000FF, "Failed to get node %d info", nodeid); + return 1; + } + return 0; +} +``` + +## Notes + +- The node must be opened with `NPC_OpenNode` before getting info +- Vehicle nodes are for vehicle navigation paths +- Pedestrian nodes are for walking paths +- All count parameters are passed by reference + +## Related Functions + +- [NPC_OpenNode](NPC_OpenNode): Open a node for use +- [NPC_CloseNode](NPC_CloseNode): Close a node +- [NPC_IsNodeOpen](NPC_IsNodeOpen): Check if node is open +- [NPC_GetNodeType](NPC_GetNodeType): Get node type + +## Related Callbacks + +- [OnNPCFinishNode](../callbacks/OnNPCFinishNode): Called when NPC finishes node +- [OnNPCChangeNode](../callbacks/OnNPCChangeNode): Called when NPC changes nodes diff --git a/frontend/docs/scripting/functions/NPC_GetNodePointCount.md b/frontend/docs/scripting/functions/NPC_GetNodePointCount.md new file mode 100644 index 00000000000..4855fbeec47 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_GetNodePointCount.md @@ -0,0 +1,58 @@ +--- +title: NPC_GetNodePointCount +sidebar_label: NPC_GetNodePointCount +description: Gets the number of points in an NPC node. +tags: ["npc", "node", "navigation"] +--- + + + +## Description + +Gets the number of points in an NPC node. + +| Name | Description | +| ------ | ------------------ | +| nodeid | The ID of the node | + +## Returns + +Returns the number of points in the node, or 0 if the node is invalid. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checknodepointcount ", true, 21)) + { + new nodeid = strval(cmdtext[21]); + + if (nodeid < 0 || nodeid > 63) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid node ID. Must be between 0 and 63."); + + new count = NPC_GetNodePointCount(nodeid); + + SendClientMessage(playerid, 0x00FF00FF, "Node %d has %d points", nodeid, count); + return 1; + } + return 0; +} +``` + +## Notes + +- Returns 0 if the node is invalid or not opened +- The point count represents navigation waypoints within the node + +## Related Functions + +- [NPC_OpenNode](NPC_OpenNode): Open a node for use +- [NPC_SetNodePoint](NPC_SetNodePoint): Set current node point +- [NPC_GetNodePointPosition](NPC_GetNodePointPosition): Get point position +- [NPC_IsNodeOpen](NPC_IsNodeOpen): Check if node is open + +## Related Callbacks + +- [OnNPCFinishNodePoint](../callbacks/OnNPCFinishNodePoint): Called when NPC finishes a node point +- [OnNPCFinishNode](../callbacks/OnNPCFinishNode): Called when NPC finishes a node diff --git a/frontend/docs/scripting/functions/NPC_GetNodePointPosition.md b/frontend/docs/scripting/functions/NPC_GetNodePointPosition.md new file mode 100644 index 00000000000..8f5d0553ad5 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_GetNodePointPosition.md @@ -0,0 +1,65 @@ +--- +title: NPC_GetNodePointPosition +sidebar_label: NPC_GetNodePointPosition +description: Gets the position of the current point in an NPC node. +tags: ["npc", "node", "navigation", "position"] +--- + + + +## Description + +Gets the position of the current point in an NPC node. + +| Name | Description | +| ------ | ---------------------------------- | +| nodeid | The ID of the node | +| &x | Variable to store the X coordinate | +| &y | Variable to store the Y coordinate | +| &z | Variable to store the Z coordinate | + +## Returns + +Returns `true` on success, `false` on failure. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checknodepointpos ", true, 19)) + { + new nodeid = strval(cmdtext[19]); + + if (nodeid < 0 || nodeid > 63) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid node ID. Must be between 0 and 63."); + + new Float:x, Float:y, Float:z; + new bool:success = NPC_GetNodePointPosition(nodeid, x, y, z); + + if (success) + SendClientMessage(playerid, 0x00FF00FF, "Node %d point position: %.2f, %.2f, %.2f", nodeid, x, y, z); + else + SendClientMessage(playerid, 0xFF0000FF, "Failed to get node %d point position", nodeid); + return 1; + } + return 0; +} +``` + +## Notes + +- The node must be opened with `NPC_OpenNode` first +- A point must be set with `NPC_SetNodePoint` before getting its position +- All coordinate parameters are passed by reference + +## Related Functions + +- [NPC_OpenNode](NPC_OpenNode): Open a node for use +- [NPC_SetNodePoint](NPC_SetNodePoint): Set current node point +- [NPC_GetNodePointCount](NPC_GetNodePointCount): Get point count +- [NPC_PlayNode](NPC_PlayNode): Make NPC play a node + +## Related Callbacks + +- [OnNPCFinishNodePoint](../callbacks/OnNPCFinishNodePoint): Called when NPC finishes a node point diff --git a/frontend/docs/scripting/functions/NPC_GetNodeType.md b/frontend/docs/scripting/functions/NPC_GetNodeType.md new file mode 100644 index 00000000000..3e5006dba63 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_GetNodeType.md @@ -0,0 +1,61 @@ +--- +title: NPC_GetNodeType +sidebar_label: NPC_GetNodeType +description: Gets the type of an NPC node. +tags: ["npc", "node", "navigation"] +--- + + + +## Description + +Gets the type of an NPC node. + +| Name | Description | +| ------ | ------------------ | +| nodeid | The ID of the node | + +## Returns + +Returns the node type ID, or -1 if the node is invalid. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checknodetype ", true, 15)) + { + new nodeid = strval(cmdtext[15]); + + if (nodeid < 0 || nodeid > 63) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid node ID. Must be between 0 and 63."); + + new nodetype = NPC_GetNodeType(nodeid); + + SendClientMessage(playerid, 0x00FF00FF, "Node %d type: %d", nodeid, nodetype); + return 1; + } + return 0; +} +``` + +## Notes + +- Returns -1 if the node is invalid or not opened +- Different node types are designed for different movement types +- Pedestrian nodes are for walking NPCs +- Vehicle nodes are for driving NPCs +- Choose the appropriate node type for your NPC's movement style + +## Related Functions + +- [NPC_OpenNode](NPC_OpenNode): Open a node for use +- [NPC_IsNodeOpen](NPC_IsNodeOpen): Check if node is open +- [NPC_GetNodeInfo](NPC_GetNodeInfo): Get detailed node information +- [NPC_PlayNode](NPC_PlayNode): Make NPC play a node + +## Related Callbacks + +- [OnNPCFinishNode](../callbacks/OnNPCFinishNode): Called when NPC finishes a node +- [OnNPCChangeNode](../callbacks/OnNPCChangeNode): Called when NPC changes nodes diff --git a/frontend/docs/scripting/functions/NPC_GetPathCount.md b/frontend/docs/scripting/functions/NPC_GetPathCount.md new file mode 100644 index 00000000000..515de90e9ec --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_GetPathCount.md @@ -0,0 +1,48 @@ +--- +title: NPC_GetPathCount +sidebar_label: NPC_GetPathCount +description: Gets the total number of NPC paths on the server. +tags: ["npc", "path"] +--- + + + +## Description + +Gets the total number of NPC paths currently existing on the server. + +## Returns + +Returns the number of paths that exist on the server. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkpathcount", true)) + { + new count = NPC_GetPathCount(); + + SendClientMessage(playerid, 0x00FF00FF, "Total NPC paths: %d", count); + return 1; + } + return 0; +} +``` + +## Notes + +- This counts all paths, whether they have points or not +- Empty paths (no waypoints) are still counted + +## Related Functions + +- [NPC_CreatePath](NPC_CreatePath): Create a new path +- [NPC_DestroyPath](NPC_DestroyPath): Destroy a specific path +- [NPC_DestroyAllPath](NPC_DestroyAllPath): Destroy all paths +- [NPC_IsValidPath](NPC_IsValidPath): Check if a path is valid + +## Related Callbacks + +- [OnNPCFinishMovePath](../callbacks/OnNPCFinishMovePath): Called when NPC finishes a path diff --git a/frontend/docs/scripting/functions/NPC_GetPathPoint.md b/frontend/docs/scripting/functions/NPC_GetPathPoint.md new file mode 100644 index 00000000000..d69563591e9 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_GetPathPoint.md @@ -0,0 +1,73 @@ +--- +title: NPC_GetPathPoint +sidebar_label: NPC_GetPathPoint +description: Gets the coordinates and stop range of a specific point in an NPC path. +tags: ["npc", "path"] +--- + + + +## Description + +Gets the coordinates and stop range of a specific point in an NPC path. + +| Name | Description | +| ----------- | ---------------------------------------- | +| pathid | The ID of the path | +| point_index | The index of the point (starting from 0) | +| &x | Variable to store the X coordinate | +| &y | Variable to store the Y coordinate | +| &z | Variable to store the Z coordinate | +| &stopRange | Variable to store the stop range | + +## Returns + +Returns `true` on success, `false` on failure. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkpathpoint", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new pathid = PlayerPatrolPath[playerid]; + if (pathid == INVALID_PATH_ID) + return SendClientMessage(playerid, 0xFFFF00FF, "No patrol path assigned."); + + new pointindex = NPC_GetCurrentPathPointIndex(npcid); + new Float:x, Float:y, Float:z, Float:stopRange; + + if (!NPC_GetPathPoint(pathid, pointindex, x, y, z, stopRange)) + return SendClientMessage(playerid, 0xFFFF00FF, "Failed to get path point."); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d path point %d: %.2f, %.2f, %.2f", npcid, pointindex, x, y, z); + return 1; + } + return 0; +} +``` + +## Notes + +- All coordinate and stopRange parameters are passed by reference +- Point indices start from 0 +- Returns false if the path or point index is invalid + +## Related Functions + +- [NPC_AddPointToPath](NPC_AddPointToPath): Add point to path +- [NPC_RemovePointFromPath](NPC_RemovePointFromPath): Remove point from path +- [NPC_GetPathPointCount](NPC_GetPathPointCount): Get number of points +- [NPC_IsValidPath](NPC_IsValidPath): Check if path is valid + +## Related Callbacks + +- [OnNPCFinishMovePath](../callbacks/OnNPCFinishMovePath): Called when NPC finishes path diff --git a/frontend/docs/scripting/functions/NPC_GetPathPointCount.md b/frontend/docs/scripting/functions/NPC_GetPathPointCount.md new file mode 100644 index 00000000000..0ee3adc6767 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_GetPathPointCount.md @@ -0,0 +1,55 @@ +--- +title: NPC_GetPathPointCount +sidebar_label: NPC_GetPathPointCount +description: Gets the number of points in an NPC path. +tags: ["npc", "path"] +--- + + + +## Description + +Gets the number of points in an NPC path. + +| Name | Description | +| ------ | ------------------ | +| pathid | The ID of the path | + +## Returns + +Returns the number of points in the path, or 0 if the path is invalid. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkpathpointcount", true)) + { + new pathid = PlayerPatrolPath[playerid]; + if (pathid == INVALID_PATH_ID) + return SendClientMessage(playerid, 0xFFFF00FF, "No patrol path assigned."); + + new count = NPC_GetPathPointCount(pathid); + + SendClientMessage(playerid, 0x00FF00FF, "Path %d has %d points", pathid, count); + return 1; + } + return 0; +} +``` + +## Notes + +- Returns 0 if the path is invalid or empty + +## Related Functions + +- [NPC_AddPointToPath](NPC_AddPointToPath): Add point to path +- [NPC_RemovePointFromPath](NPC_RemovePointFromPath): Remove point from path +- [NPC_GetPathPoint](NPC_GetPathPoint): Get specific point data +- [NPC_ClearPath](NPC_ClearPath): Remove all points from path + +## Related Callbacks + +- [OnNPCFinishMovePath](../callbacks/OnNPCFinishMovePath): Called when NPC finishes path diff --git a/frontend/docs/scripting/functions/NPC_GetPlayerAimingAt.md b/frontend/docs/scripting/functions/NPC_GetPlayerAimingAt.md new file mode 100644 index 00000000000..022dd37ee18 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_GetPlayerAimingAt.md @@ -0,0 +1,67 @@ +--- +title: NPC_GetPlayerAimingAt +sidebar_label: NPC_GetPlayerAimingAt +description: Gets the ID of the player that an NPC is currently aiming at. +tags: ["npc", "player", "aiming", "weapon"] +--- + + + +## Description + +Gets the ID of the player that an NPC is currently aiming at. + +| Name | Description | +| ----- | ----------------- | +| npcid | The ID of the NPC | + +## Returns + +Returns the ID of the player being aimed at, or `INVALID_PLAYER_ID` if not aiming at anyone. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkwhonpcaiming", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new targetid = NPC_GetPlayerAimingAt(npcid); + + if (targetid == INVALID_PLAYER_ID) + SendClientMessage(playerid, 0x00FF00FF, "NPC %d is not aiming at any player", npcid); + else + { + new targetName[MAX_PLAYER_NAME]; + GetPlayerName(targetid, targetName, sizeof(targetName)); + SendClientMessage(playerid, 0x00FF00FF, "NPC %d is aiming at player %s (ID %d)", npcid, targetName, targetid); + } + return 1; + } + return 0; +} +``` + +## Notes + +- Returns the player ID if the NPC is aiming using [NPC_AimAtPlayer](NPC_AimAtPlayer) +- Returns `INVALID_PLAYER_ID` if the NPC is not aiming at any player + +## Related Functions + +- [NPC_AimAtPlayer](NPC_AimAtPlayer): Make NPC aim at a player +- [NPC_IsAimingAtPlayer](NPC_IsAimingAtPlayer): Check if NPC is aiming at specific player +- [NPC_IsAiming](NPC_IsAiming): Check if NPC is aiming +- [NPC_GetPlayerMovingTo](NPC_GetPlayerMovingTo): Get player NPC is moving toward + +## Related Callbacks + +- [OnNPCWeaponShot](../callbacks/OnNPCWeaponShot): Called when NPC fires weapon +- [OnNPCGiveDamage](../callbacks/OnNPCGiveDamage): Called when NPC damages a player diff --git a/frontend/docs/scripting/functions/NPC_GetPlayerMovingTo.md b/frontend/docs/scripting/functions/NPC_GetPlayerMovingTo.md new file mode 100644 index 00000000000..c5b269131a7 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_GetPlayerMovingTo.md @@ -0,0 +1,67 @@ +--- +title: NPC_GetPlayerMovingTo +sidebar_label: NPC_GetPlayerMovingTo +description: Gets the ID of the player that an NPC is currently moving toward. +tags: ["npc", "player", "movement"] +--- + + + +## Description + +Gets the ID of the player that an NPC is currently moving toward. + +| Name | Description | +| ----- | ----------------- | +| npcid | The ID of the NPC | + +## Returns + +Returns the ID of the player being moved toward, or `INVALID_PLAYER_ID` if not moving toward anyone. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkwhonpcmoving", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new targetid = NPC_GetPlayerMovingTo(npcid); + + if (targetid == INVALID_PLAYER_ID) + SendClientMessage(playerid, 0x00FF00FF, "NPC %d is not moving toward any player", npcid); + else + { + new targetName[MAX_PLAYER_NAME]; + GetPlayerName(targetid, targetName, sizeof(targetName)); + SendClientMessage(playerid, 0x00FF00FF, "NPC %d is moving toward player %s (ID %d)", npcid, targetName, targetid); + } + return 1; + } + return 0; +} +``` + +## Notes + +- Returns the player ID if the NPC is moving using [NPC_MoveToPlayer](NPC_MoveToPlayer) +- Returns `INVALID_PLAYER_ID` if the NPC is not moving toward any player +- This is different from moving to a fixed position with [NPC_Move](NPC_Move) + +## Related Functions + +- [NPC_MoveToPlayer](NPC_MoveToPlayer): Make NPC move toward a player +- [NPC_IsMovingToPlayer](NPC_IsMovingToPlayer): Check if NPC is moving toward specific player +- [NPC_IsMoving](NPC_IsMoving): Check if NPC is moving +- [NPC_GetPlayerAimingAt](NPC_GetPlayerAimingAt): Get player NPC is aiming at + +## Related Callbacks + +- [OnNPCFinishMove](../callbacks/OnNPCFinishMove): Called when NPC finishes movement diff --git a/frontend/docs/scripting/functions/NPC_GetPos.md b/frontend/docs/scripting/functions/NPC_GetPos.md new file mode 100644 index 00000000000..96e06cd0ca4 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_GetPos.md @@ -0,0 +1,67 @@ +--- +title: NPC_GetPos +sidebar_label: NPC_GetPos +description: Gets the position of an NPC. +tags: ["npc", "position"] +--- + + + +## Description + +Gets the position of an NPC. + +| Name | Description | +| -------- | -------------------------------------------------------- | +| npcid | The ID of the NPC. | +| &Float:x | Variable to store the X coordinate, passed by reference. | +| &Float:y | Variable to store the Y coordinate, passed by reference. | +| &Float:z | Variable to store the Z coordinate, passed by reference. | + +## Returns + +Returns `true` if the position was retrieved successfully, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkpos", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new Float:x, Float:y, Float:z; + NPC_GetPos(npcid, x, y, z); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d position: %.2f, %.2f, %.2f", npcid, x, y, z); + return 1; + } + return 0; +} +``` + +## Notes + +:::warning + +- All coordinate parameters are passed by reference and will be modified. + +::: + +## Related Functions + +- [NPC_SetPos](NPC_SetPos): Set NPC position. +- [NPC_GetRot](NPC_GetRot): Get NPC rotation. +- [NPC_SetRot](NPC_SetRot): Set NPC rotation. +- [NPC_GetFacingAngle](NPC_GetFacingAngle): Get facing angle. + +## Related Callbacks + +- [OnNPCSpawn](../callbacks/OnNPCSpawn): Called when NPC spawns. +- [OnNPCFinishMove](../callbacks/OnNPCFinishMove): Called when NPC finishes movement. diff --git a/frontend/docs/scripting/functions/NPC_GetPosMovingTo.md b/frontend/docs/scripting/functions/NPC_GetPosMovingTo.md new file mode 100644 index 00000000000..ae9053eaa61 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_GetPosMovingTo.md @@ -0,0 +1,71 @@ +--- +title: NPC_GetPosMovingTo +sidebar_label: NPC_GetPosMovingTo +description: Gets the position that the NPC is currently moving toward. +tags: ["npc", "position", "movement"] +--- + + + +## Description + +Gets the position that the NPC is currently moving toward. + +| Name | Description | +| -------- | ------------------------------------------------------------------ | +| npcid | The ID of the NPC | +| &Float:x | Variable to store the X coordinate of the target position, passed by reference | +| &Float:y | Variable to store the Y coordinate of the target position, passed by reference | +| &Float:z | Variable to store the Z coordinate of the target position, passed by reference | + +## Returns + +Returns `true` on success, `false` on failure. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkposmovingto", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + if (!NPC_IsMoving(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "NPC %d is not moving", npcid); + + new Float:x, Float:y, Float:z; + NPC_GetPosMovingTo(npcid, x, y, z); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d target position: %.2f, %.2f, %.2f", npcid, x, y, z); + return 1; + } + return 0; +} +``` + +## Notes + +:::warning + +- All coordinate parameters are passed by reference and will be modified. +- This function returns the target position the NPC is moving toward, not the current position. +- Use [NPC_IsMoving](NPC_IsMoving) to check if the NPC is currently moving before calling this function. + +::: + +## Related Functions + +- [NPC_Move](NPC_Move): Makes an NPC move to a specific position. +- [NPC_IsMoving](NPC_IsMoving): Check if NPC is moving. +- [NPC_GetPos](NPC_GetPos): Get NPC's current position. +- [NPC_StopMove](NPC_StopMove): Stop NPC movement. + +## Related Callbacks + +- [OnNPCFinishMove](../callbacks/OnNPCFinishMove): Called when NPC finishes movement. diff --git a/frontend/docs/scripting/functions/NPC_GetRecordCount.md b/frontend/docs/scripting/functions/NPC_GetRecordCount.md new file mode 100644 index 00000000000..ebea347f7b4 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_GetRecordCount.md @@ -0,0 +1,49 @@ +--- +title: NPC_GetRecordCount +sidebar_label: NPC_GetRecordCount +description: Gets the number of loaded NPC recording files. +tags: ["npc", "recording", "playback"] +--- + + + +## Description + +Gets the number of loaded NPC recording files on the server. + +## Returns + +Returns the number of recording files currently loaded. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkrecordcount", true)) + { + new count = NPC_GetRecordCount(); + SendClientMessage(playerid, 0x00FF00FF, "Total records loaded: %d", count); + return 1; + } + return 0; +} +``` + +## Notes + +- Returns the total number of valid recordings in memory +- Only successfully loaded recordings are counted +- Recordings persist until explicitly unloaded or server restart + +## Related Functions + +- [NPC_LoadRecord](NPC_LoadRecord): Load a recording file +- [NPC_UnloadRecord](NPC_UnloadRecord): Unload a recording +- [NPC_IsValidRecord](NPC_IsValidRecord): Check if record is valid +- [NPC_UnloadAllRecords](NPC_UnloadAllRecords): Unload all recordings + +## Related Callbacks + +- [OnNPCPlaybackStart](../callbacks/OnNPCPlaybackStart): Called when playback starts +- [OnNPCPlaybackEnd](../callbacks/OnNPCPlaybackEnd): Called when playback ends diff --git a/frontend/docs/scripting/functions/NPC_GetRot.md b/frontend/docs/scripting/functions/NPC_GetRot.md new file mode 100644 index 00000000000..b83c3544801 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_GetRot.md @@ -0,0 +1,68 @@ +--- +title: NPC_GetRot +sidebar_label: NPC_GetRot +description: Gets the rotation of an NPC. +tags: ["npc", "rotation"] +--- + + + +## Description + +Gets the rotation of an NPC in 3D space. + +| Name | Description | +| -------- | -------------------------------------------------------------- | +| npcid | The ID of the NPC. | +| &Float:x | Variable to store the X rotation (pitch), passed by reference. | +| &Float:y | Variable to store the Y rotation (yaw), passed by reference. | +| &Float:z | Variable to store the Z rotation (roll), passed by reference. | + +## Returns + +Returns `true` if the rotation was retrieved successfully, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkrot", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new Float:rotX, Float:rotY, Float:rotZ; + NPC_GetRot(npcid, rotX, rotY, rotZ); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d rotation: X=%.2f, Y=%.2f, Z=%.2f", npcid, rotX, rotY, rotZ); + return 1; + } + return 0; +} +``` + +## Notes + +:::warning + +- All rotation parameters are passed by reference and will be modified. +- X = pitch (up/down), Y = yaw (left/right), Z = roll (banking). +- For simple facing direction, use [NPC_GetFacingAngle](NPC_GetFacingAngle) instead. + +::: + +## Related Functions + +- [NPC_SetRot](NPC_SetRot): Set NPC rotation. +- [NPC_GetFacingAngle](NPC_GetFacingAngle): Get facing angle only. +- [NPC_SetFacingAngle](NPC_SetFacingAngle): Set facing angle only. +- [NPC_GetPos](NPC_GetPos): Get NPC position. + +## Related Callbacks + +- [OnNPCSpawn](../callbacks/OnNPCSpawn): Called when NPC spawns. diff --git a/frontend/docs/scripting/functions/NPC_GetSkin.md b/frontend/docs/scripting/functions/NPC_GetSkin.md new file mode 100644 index 00000000000..3df4412c8c2 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_GetSkin.md @@ -0,0 +1,58 @@ +--- +title: NPC_GetSkin +sidebar_label: NPC_GetSkin +description: Gets the skin/model ID of an NPC. +tags: ["npc", "skin", "model"] +--- + + + +## Description + +Gets the skin/model ID of an NPC. + +| Name | Description | +| ----- | ----------------- | +| npcid | The ID of the NPC | + +## Returns + +Returns the skin/model ID of the NPC, or -1 if invalid. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkskin", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new skinid = NPC_GetSkin(npcid); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d skin: %d", npcid, skinid); + return 1; + } + return 0; +} +``` + +## Notes + +- Returns the current skin/model the NPC is using +- Use [NPC_SetSkin](NPC_SetSkin) to change the NPC's skin + +## Related Functions + +- [NPC_SetSkin](NPC_SetSkin): Set NPC skin/model +- [NPC_IsValid](NPC_IsValid): Check if NPC is valid +- [NPC_IsSpawned](NPC_IsSpawned): Check if NPC is spawned + +## Related Callbacks + +- [OnNPCSpawn](../callbacks/OnNPCSpawn): Called when NPC spawns diff --git a/frontend/docs/scripting/functions/NPC_GetSpecialAction.md b/frontend/docs/scripting/functions/NPC_GetSpecialAction.md new file mode 100644 index 00000000000..07ff55dc15c --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_GetSpecialAction.md @@ -0,0 +1,58 @@ +--- +title: NPC_GetSpecialAction +sidebar_label: NPC_GetSpecialAction +description: Gets the current special action of an NPC. +tags: ["npc"] +--- + + + +## Description + +Gets the current special action of an NPC. + +| Name | Description | +| ----- | ----------------- | +| npcid | The ID of the NPC | + +## Returns + +Returns the special action ID, or `SPECIAL_ACTION_NONE` if no special action is active. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkspecialaction", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new action = NPC_GetSpecialAction(npcid); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d special action: %d", npcid, action); + return 1; + } + return 0; +} +``` + +## Notes + +- Returns the current special action constant +- Use this to check what action the NPC is currently performing + +## Related Functions + +- [NPC_SetSpecialAction](NPC_SetSpecialAction): Set NPC special action +- [NPC_ClearAnimations](NPC_ClearAnimations): Clear all animations +- [NPC_ApplyAnimation](NPC_ApplyAnimation): Apply animation to NPC + +## Related Callbacks + +- [OnNPCSpawn](../callbacks/OnNPCSpawn): Called when NPC spawns diff --git a/frontend/docs/scripting/functions/NPC_GetSurfingObject.md b/frontend/docs/scripting/functions/NPC_GetSurfingObject.md new file mode 100644 index 00000000000..da2443ae55e --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_GetSurfingObject.md @@ -0,0 +1,62 @@ +--- +title: NPC_GetSurfingObject +sidebar_label: NPC_GetSurfingObject +description: Gets the object an NPC is surfing on. +tags: ["npc", "surfing"] +--- + + + +## Description + +Gets the object an NPC is surfing on. + +| Name | Description | +| ----- | ----------------- | +| npcid | The ID of the NPC | + +## Returns + +Returns the object ID, or `INVALID_OBJECT_ID` if not surfing on an object. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checksurfingobject", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new objectid = NPC_GetSurfingObject(npcid); + + if (objectid == INVALID_OBJECT_ID) + SendClientMessage(playerid, 0xFFFF00FF, "NPC %d is not surfing on any object.", npcid); + else + SendClientMessage(playerid, 0x00FF00FF, "NPC %d is surfing on object: %d", npcid, objectid); + return 1; + } + return 0; +} +``` + +## Notes + +- Returns INVALID_OBJECT_ID if the NPC is not surfing on any object + +## Related Functions + +- [NPC_SetSurfingObject](NPC_SetSurfingObject): Sets the object an NPC is surfing on +- [NPC_GetSurfingVehicle](NPC_GetSurfingVehicle): Gets the vehicle an NPC is surfing on +- [NPC_GetSurfingPlayerObject](NPC_GetSurfingPlayerObject): Gets the player object an NPC is surfing on +- [NPC_GetSurfingOffset](NPC_GetSurfingOffsets): Gets the surfing offset for an NPC +- [NPC_ResetSurfingData](NPC_ResetSurfingData): Resets all surfing data for an NPC + +## Related Callbacks + +_No specific callbacks are triggered by this function._ diff --git a/frontend/docs/scripting/functions/NPC_GetSurfingOffsets.md b/frontend/docs/scripting/functions/NPC_GetSurfingOffsets.md new file mode 100644 index 00000000000..dfa87103560 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_GetSurfingOffsets.md @@ -0,0 +1,64 @@ +--- +title: NPC_GetSurfingOffset +sidebar_label: NPC_GetSurfingOffset +description: Gets the surfing offset for an NPC. +tags: ["npc", "surfing"] +--- + + + +## Description + +Gets the surfing offset for an NPC. + +| Name | Description | +| ----- | ----------------------------------------------------- | +| npcid | The ID of the NPC | +| &x | A variable to store the X offset, passed by reference | +| &y | A variable to store the Y offset, passed by reference | +| &z | A variable to store the Z offset, passed by reference | + +## Returns + +Returns `true` if the operation was successful, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checksurfingoffset", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new Float:offsetX, Float:offsetY, Float:offsetZ; + NPC_GetSurfingOffset(npcid, offsetX, offsetY, offsetZ); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d surfing offset: X=%.2f, Y=%.2f, Z=%.2f", npcid, offsetX, offsetY, offsetZ); + return 1; + } + return 0; +} +``` + +## Notes + +- The surfing offset represents the relative position of the NPC compared to the object/vehicle it's surfing on +- All offset values are returned as floating-point numbers + +## Related Functions + +- [NPC_SetSurfingOffset](NPC_SetSurfingOffset): Sets the surfing offset for an NPC +- [NPC_GetSurfingObject](NPC_GetSurfingObject): Gets the object an NPC is surfing on +- [NPC_GetSurfingVehicle](NPC_GetSurfingVehicle): Gets the vehicle an NPC is surfing on +- [NPC_GetSurfingPlayerObject](NPC_GetSurfingPlayerObject): Gets the player object an NPC is surfing on +- [NPC_ResetSurfingData](NPC_ResetSurfingData): Resets all surfing data for an NPC + +## Related Callbacks + +_No specific callbacks are triggered by this function._ diff --git a/frontend/docs/scripting/functions/NPC_GetSurfingPlayerObject.md b/frontend/docs/scripting/functions/NPC_GetSurfingPlayerObject.md new file mode 100644 index 00000000000..a573f1bae96 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_GetSurfingPlayerObject.md @@ -0,0 +1,63 @@ +--- +title: NPC_GetSurfingPlayerObject +sidebar_label: NPC_GetSurfingPlayerObject +description: Gets the player object an NPC is surfing on. +tags: ["npc", "surfing"] +--- + + + +## Description + +Gets the player object an NPC is surfing on. + +| Name | Description | +| ----- | ----------------- | +| npcid | The ID of the NPC | + +## Returns + +Returns the player object ID, or `INVALID_OBJECT_ID` if not surfing on a player object. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checksurfingplayerobject", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new objectid = NPC_GetSurfingPlayerObject(npcid); + + if (objectid == INVALID_OBJECT_ID) + SendClientMessage(playerid, 0xFFFF00FF, "NPC %d is not surfing on any player object.", npcid); + else + SendClientMessage(playerid, 0x00FF00FF, "NPC %d is surfing on player object: %d", npcid, objectid); + return 1; + } + return 0; +} +``` + +## Notes + +- Returns INVALID_OBJECT_ID if the NPC is not surfing on any player object +- This function only checks for player-specific objects, not global objects + +## Related Functions + +- [NPC_SetSurfingPlayerObject](NPC_SetSurfingPlayerObject): Sets the player object an NPC is surfing on +- [NPC_GetSurfingObject](NPC_GetSurfingObject): Gets the object an NPC is surfing on +- [NPC_GetSurfingVehicle](NPC_GetSurfingVehicle): Gets the vehicle an NPC is surfing on +- [NPC_GetSurfingOffset](NPC_GetSurfingOffsets): Gets the surfing offset for an NPC +- [NPC_ResetSurfingData](NPC_ResetSurfingData): Resets all surfing data for an NPC + +## Related Callbacks + +_No specific callbacks are triggered by this function._ diff --git a/frontend/docs/scripting/functions/NPC_GetSurfingVehicle.md b/frontend/docs/scripting/functions/NPC_GetSurfingVehicle.md new file mode 100644 index 00000000000..f60db385d55 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_GetSurfingVehicle.md @@ -0,0 +1,63 @@ +--- +title: NPC_GetSurfingVehicle +sidebar_label: NPC_GetSurfingVehicle +description: Gets the vehicle an NPC is surfing on. +tags: ["npc", "surfing", "vehicle"] +--- + + + +## Description + +Gets the vehicle an NPC is surfing on. + +| Name | Description | +| ----- | ----------------- | +| npcid | The ID of the NPC | + +## Returns + +Returns the vehicle ID, or `INVALID_VEHICLE_ID` if not surfing on a vehicle. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checksurfingvehicle", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new vehicleid = NPC_GetSurfingVehicle(npcid); + + if (vehicleid == INVALID_VEHICLE_ID) + SendClientMessage(playerid, 0xFFFF00FF, "NPC %d is not surfing on any vehicle.", npcid); + else + SendClientMessage(playerid, 0x00FF00FF, "NPC %d is surfing on vehicle: %d", npcid, vehicleid); + return 1; + } + return 0; +} +``` + +## Notes + +- Returns `INVALID_VEHICLE_ID` if the NPC is not surfing on any vehicle +- Surfing allows NPCs to move along with vehicles while maintaining their relative position + +## Related Functions + +- [NPC_SetSurfingVehicle](NPC_SetSurfingVehicle): Sets the vehicle an NPC is surfing on +- [NPC_GetSurfingObject](NPC_GetSurfingObject): Gets the object an NPC is surfing on +- [NPC_GetSurfingPlayerObject](NPC_GetSurfingPlayerObject): Gets the player object an NPC is surfing on +- [NPC_GetSurfingOffset](NPC_GetSurfingOffsets): Gets the surfing offset for an NPC +- [NPC_ResetSurfingData](NPC_ResetSurfingData): Resets all surfing data for an NPC + +## Related Callbacks + +_No specific callbacks are triggered by this function._ diff --git a/frontend/docs/scripting/functions/NPC_GetVehicle.md b/frontend/docs/scripting/functions/NPC_GetVehicle.md new file mode 100644 index 00000000000..08364b28ffb --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_GetVehicle.md @@ -0,0 +1,61 @@ +--- +title: NPC_GetVehicle +sidebar_label: NPC_GetVehicle +description: Gets the vehicle ID of an NPC's current vehicle. +tags: ["npc", "vehicle"] +--- + + + +## Description + +Gets the vehicle ID of an NPC's current vehicle. + +| Name | Description | +| ----- | ----------------- | +| npcid | The ID of the NPC | + +## Returns + +Returns the vehicle ID the NPC is in, or INVALID_VEHICLE_ID if not in any vehicle. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkvehicle", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new vehicleid = NPC_GetVehicle(npcid); + + if (vehicleid == INVALID_VEHICLE_ID) + SendClientMessage(playerid, 0xFFFF00FF, "NPC %d is not in any vehicle.", npcid); + else + SendClientMessage(playerid, 0x00FF00FF, "NPC %d is in vehicle: %d", npcid, vehicleid); + return 1; + } + return 0; +} +``` + +## Notes + +- Returns INVALID_VEHICLE_ID if the NPC is not in any vehicle + +## Related Functions + +- [NPC_GetVehicleID](NPC_GetVehicleID): Alternative function with identical behavior +- [NPC_GetVehicleSeat](NPC_GetVehicleSeat): Get NPC's seat in vehicle +- [NPC_PutInVehicle](NPC_PutInVehicle): Put NPC in vehicle +- [NPC_RemoveFromVehicle](NPC_RemoveFromVehicle): Remove NPC from vehicle + +## Related Callbacks + +_No specific callbacks are triggered by this function._ diff --git a/frontend/docs/scripting/functions/NPC_GetVehicleGearState.md b/frontend/docs/scripting/functions/NPC_GetVehicleGearState.md new file mode 100644 index 00000000000..dadc2bd2cc0 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_GetVehicleGearState.md @@ -0,0 +1,72 @@ +--- +title: NPC_GetVehicleGearState +sidebar_label: NPC_GetVehicleGearState +description: Gets the landing gear state of an NPC's aircraft. +tags: ["npc", "vehicle", "aircraft", "landing gear"] +--- + + + +## Description + +Gets the landing gear state of an NPC's aircraft. + +| Name | Description | +| ----- | ----------------- | +| npcid | The ID of the NPC | + +## Returns + +Returns the landing gear state of the NPC's aircraft (LANDING_GEAR_STATE_DOWN or LANDING_GEAR_STATE_UP). + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkvehiclegearstate", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + if (NPC_GetVehicle(npcid) == INVALID_VEHICLE_ID) + return SendClientMessage(playerid, 0xFFFF00FF, "NPC %d is not in any vehicle.", npcid); + + new LANDING_GEAR_STATE:gearState = NPC_GetVehicleGearState(npcid); + + if (gearState == LANDING_GEAR_STATE_UP) + SendClientMessage(playerid, 0x00FF00FF, "NPC %d: Landing gear UP", npcid); + else + SendClientMessage(playerid, 0x00FF00FF, "NPC %d: Landing gear DOWN", npcid); + + return 1; + } + return 0; +} +``` + +## Notes + +- Only works when the NPC is piloting an aircraft +- Returns the current landing gear state set by NPC_SetVehicleGearState +- Uses the same constants as [Vehicle Landing Gear States](../resources/landinggearstate): LANDING_GEAR_STATE_DOWN and LANDING_GEAR_STATE_UP +- This is the NPC equivalent of GetPlayerLandingGearState + +## Related Functions + +- [NPC_SetVehicleGearState](NPC_SetVehicleGearState): Set aircraft landing gear state +- [GetPlayerLandingGearState](GetPlayerLandingGearState): Get player's landing gear state +- [GetVehicleLandingGearState](GetVehicleLandingGearState): Get vehicle's landing gear state +- [NPC_GetVehicle](NPC_GetVehicle): Get NPC's current vehicle + +## Related Resources + +- [Vehicle Landing Gear States](../resources/landinggearstate) + +## Related Callbacks + +_No specific callbacks are triggered by this function._ diff --git a/frontend/docs/scripting/functions/NPC_GetVehicleHealth.md b/frontend/docs/scripting/functions/NPC_GetVehicleHealth.md new file mode 100644 index 00000000000..8337a26ca95 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_GetVehicleHealth.md @@ -0,0 +1,65 @@ +--- +title: NPC_GetVehicleHealth +sidebar_label: NPC_GetVehicleHealth +description: Gets the health of an NPC's vehicle. +tags: ["npc", "vehicle"] +--- + + + +## Description + +Gets the health of an NPC's vehicle. + +| Name | Description | +| ----- | ----------------- | +| npcid | The ID of the NPC | + +## Returns + +Returns the vehicle health as a float value, or 0.0 if the NPC is not in a vehicle. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkvehiclehealth", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + if (NPC_GetVehicle(npcid) == INVALID_VEHICLE_ID) + return SendClientMessage(playerid, 0xFFFF00FF, "NPC %d is not in any vehicle.", npcid); + + new Float:health; + NPC_GetVehicleHealth(npcid, health); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d vehicle health: %.2f", npcid, health); + return 1; + } + return 0; +} + +``` + +## Notes + +- Returns 0.0 if the NPC is not in a vehicle +- Vehicle health typically ranges from 0.0 to 1000.0 +- Health below 250.0 usually means the vehicle will catch fire + +## Related Functions + +- [NPC_SetVehicleHealth](NPC_SetVehicleHealth): Set vehicle health +- [NPC_GetVehicle](NPC_GetVehicle): Get NPC's current vehicle +- [NPC_GetVehicleID](NPC_GetVehicleID): Get vehicle ID +- [NPC_PutInVehicle](NPC_PutInVehicle): Put NPC in vehicle + +## Related Callbacks + +_No specific callbacks are triggered by this function._ diff --git a/frontend/docs/scripting/functions/NPC_GetVehicleHydraThrusters.md b/frontend/docs/scripting/functions/NPC_GetVehicleHydraThrusters.md new file mode 100644 index 00000000000..3d8af5e7697 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_GetVehicleHydraThrusters.md @@ -0,0 +1,68 @@ +--- +title: NPC_GetVehicleHydraThrusters +sidebar_label: NPC_GetVehicleHydraThrusters +description: Gets the thruster direction of an NPC's Hydra vehicle. +tags: ["npc", "vehicle", "hydra"] +--- + + + +## Description + +Gets the thruster direction of an NPC's Hydra vehicle. + +| Name | Description | +| ----- | ----------------- | +| npcid | The ID of the NPC | + +## Returns + +Returns the thruster direction (0 = forward, 1 = vertical), or -1 if not in a Hydra. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkvehiclehydra", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + if (NPC_GetVehicle(npcid) == INVALID_VEHICLE_ID) + return SendClientMessage(playerid, 0xFFFF00FF, "NPC %d is not in any vehicle.", npcid); + + new thrusters = NPC_GetVehicleHydraThrusters(npcid); + + if (thrusters == 0) + SendClientMessage(playerid, 0x00FF00FF, "NPC %d: Hydra thrusters FORWARD (0)", npcid); + else + SendClientMessage(playerid, 0x00FF00FF, "NPC %d: Hydra thrusters BACKWARD (1)", npcid); + + return 1; + } + return 0; +} +``` + +## Notes + +- Only works with Hydra vehicles (model 520) +- Returns -1 if the NPC is not in a Hydra or not in a vehicle +- Direction 0 = forward flight mode (jet mode) +- Direction 1 = vertical flight mode (hover mode) + +## Related Functions + +- [NPC_SetVehicleHydraThrusters](NPC_SetVehicleHydraThrusters): Set thruster direction +- [NPC_GetVehicle](NPC_GetVehicle): Get NPC's current vehicle +- [NPC_GetVehicleHealth](NPC_GetVehicleHealth): Get vehicle health +- [NPC_PutInVehicle](NPC_PutInVehicle): Put NPC in vehicle + +## Related Callbacks + +_No specific callbacks are triggered by this function._ diff --git a/frontend/docs/scripting/functions/NPC_GetVehicleID.md b/frontend/docs/scripting/functions/NPC_GetVehicleID.md new file mode 100644 index 00000000000..d25891b831b --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_GetVehicleID.md @@ -0,0 +1,61 @@ +--- +title: NPC_GetVehicleID +sidebar_label: NPC_GetVehicleID +description: Gets the vehicle ID of an NPC's current vehicle. +tags: ["npc", "vehicle"] +--- + + + +## Description + +Gets the vehicle ID of an NPC's current vehicle. + +| Name | Description | +| ----- | ----------------- | +| npcid | The ID of the NPC | + +## Returns + +Returns the vehicle ID the NPC is in, or INVALID_VEHICLE_ID if not in any vehicle. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkvehicleid", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new vehicleid = NPC_GetVehicleID(npcid); + + if (vehicleid == INVALID_VEHICLE_ID) + SendClientMessage(playerid, 0xFFFF00FF, "NPC %d is not in any vehicle.", npcid); + else + SendClientMessage(playerid, 0x00FF00FF, "NPC %d vehicle ID: %d", npcid, vehicleid); + return 1; + } + return 0; +} +``` + +## Notes + +- Returns INVALID_VEHICLE_ID if the NPC is not in any vehicle + +## Related Functions + +- [NPC_GetVehicleSeat](NPC_GetVehicleSeat): Get NPC's seat in vehicle +- [NPC_PutInVehicle](NPC_PutInVehicle): Put NPC in vehicle +- [NPC_RemoveFromVehicle](NPC_RemoveFromVehicle): Remove NPC from vehicle +- [NPC_GetVehicle](NPC_GetVehicle): Alternative function with identical behavior + +## Related Callbacks + +_No specific callbacks are triggered by this function._ diff --git a/frontend/docs/scripting/functions/NPC_GetVehicleSeat.md b/frontend/docs/scripting/functions/NPC_GetVehicleSeat.md new file mode 100644 index 00000000000..47ac023f4f0 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_GetVehicleSeat.md @@ -0,0 +1,72 @@ +--- +title: NPC_GetVehicleSeat +sidebar_label: NPC_GetVehicleSeat +description: Gets the seat ID of an NPC in a vehicle. +tags: ["npc", "vehicle"] +--- + + + +## Description + +Gets the seat ID of an NPC in a vehicle. + +| Name | Description | +| ----- | ----------------- | +| npcid | The ID of the NPC | + +## Returns + +Returns the seat ID, or -1 if not in a vehicle. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkvehicleseat", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + if (NPC_GetVehicle(npcid) == INVALID_VEHICLE_ID) + return SendClientMessage(playerid, 0xFFFF00FF, "NPC %d is not in any vehicle.", npcid); + + new seatid = NPC_GetVehicleSeat(npcid); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d vehicle seat: %d", npcid, seatid); + return 1; + } + return 0; +} +``` + +## Seat IDs + +| ID | Seat | +| --- | ---------------------------- | +| 0 | Driver | +| 1 | Front passenger | +| 2 | Back-left passenger | +| 3 | Back-right passenger | +| 4+ | Passenger seats (coach etc.) | + +## Notes + +- Returns -1 if the NPC is not in any vehicle +- Seat 0 is always the driver seat +- Maximum seat ID depends on the vehicle model + +## Related Functions + +- [NPC_GetVehicleID](NPC_GetVehicleID): Get NPC's vehicle ID +- [NPC_PutInVehicle](NPC_PutInVehicle): Put NPC in vehicle +- [NPC_RemoveFromVehicle](NPC_RemoveFromVehicle): Remove NPC from vehicle + +## Related Callbacks + +_No specific callbacks are triggered by this function._ diff --git a/frontend/docs/scripting/functions/NPC_GetVehicleTrainSpeed.md b/frontend/docs/scripting/functions/NPC_GetVehicleTrainSpeed.md new file mode 100644 index 00000000000..940fc49bb4c --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_GetVehicleTrainSpeed.md @@ -0,0 +1,61 @@ +--- +title: NPC_GetVehicleTrainSpeed +sidebar_label: NPC_GetVehicleTrainSpeed +description: Gets the train speed for an NPC driving a train. +tags: ["npc", "vehicle", "train"] +--- + + + +## Description + +Gets the train speed for an NPC driving a train. + +| Name | Description | +| ----- | ----------------- | +| npcid | The ID of the NPC | + +## Returns + +Returns the train speed as a float, or 0.0 if not in a train. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkvehicletrainspeed", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + if (NPC_GetVehicle(npcid) == INVALID_VEHICLE_ID) + return SendClientMessage(playerid, 0xFFFF00FF, "NPC %d is not in any vehicle.", npcid); + + new Float:speed = NPC_GetVehicleTrainSpeed(npcid); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d vehicle train speed: %.2f", npcid, speed); + return 1; + } + return 0; +} +``` + +## Notes + +- Only works when the NPC is driving a train vehicle +- Returns 0.0 if the NPC is not in a train or not the driver + +## Related Functions + +- [NPC_SetVehicleTrainSpeed](NPC_SetVehicleTrainSpeed): Set train speed +- [NPC_GetVehicleID](NPC_GetVehicleID): Get NPC's vehicle +- [NPC_PutInVehicle](NPC_PutInVehicle): Put NPC in vehicle + +## Related Callbacks + +_No specific callbacks are triggered by this function._ diff --git a/frontend/docs/scripting/functions/NPC_GetVelocity.md b/frontend/docs/scripting/functions/NPC_GetVelocity.md new file mode 100644 index 00000000000..a3fa7b8d206 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_GetVelocity.md @@ -0,0 +1,65 @@ +--- +title: NPC_GetVelocity +sidebar_label: NPC_GetVelocity +description: Gets the velocity of an NPC. +tags: ["npc", "velocity", "movement"] +--- + + + +## Description + +Gets the velocity of an NPC. + +| Name | Description | +| -------- | -------------------------------------------------------- | +| npcid | The ID of the NPC | +| &Float:x | Variable to store the X velocity component, passed by reference | +| &Float:y | Variable to store the Y velocity component, passed by reference | +| &Float:z | Variable to store the Z velocity component, passed by reference | + +## Returns + +Returns `true` on success, `false` on failure. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkvelocity", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new Float:velX, Float:velY, Float:velZ; + NPC_GetVelocity(npcid, velX, velY, velZ); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d velocity: X=%.2f, Y=%.2f, Z=%.2f", npcid, velX, velY, velZ); + return 1; + } + return 0; +} +``` + +## Notes + +:::warning + +- All velocity parameters are passed by reference and will be modified + +::: + +## Related Functions + +- [NPC_SetVelocity](NPC_SetVelocity): Set NPC velocity +- [NPC_GetPos](NPC_GetPos): Get NPC position +- [NPC_Move](NPC_Move): Make NPC move to position + +## Related Callbacks + +- [OnNPCFinishMove](../callbacks/OnNPCFinishMove): Called when NPC finishes movement diff --git a/frontend/docs/scripting/functions/NPC_GetVirtualWorld.md b/frontend/docs/scripting/functions/NPC_GetVirtualWorld.md new file mode 100644 index 00000000000..91fcf825543 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_GetVirtualWorld.md @@ -0,0 +1,63 @@ +--- +title: NPC_GetVirtualWorld +sidebar_label: NPC_GetVirtualWorld +description: Gets the virtual world an NPC is in. +tags: ["npc"] +--- + + + +## Description + +Gets the virtual world an NPC is in. + +| Name | Description | +| ----- | ------------------ | +| npcid | The ID of the NPC. | + +## Returns + +Returns the virtual world ID, or 0 on error. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkvirtualworld", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new vw = NPC_GetVirtualWorld(npcid); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d virtual world: %d", npcid, vw); + return 1; + } + return 0; +} +``` + +## Notes + +:::warning + +- Virtual worlds allow separation of NPCs and players. +- NPCs in different virtual worlds cannot see each other. +- Virtual world 0 is the default world. + +::: + +## Related Functions + +- [NPC_SetVirtualWorld](NPC_SetVirtualWorld): Set NPC virtual world. +- [NPC_GetInterior](NPC_GetInterior): Get NPC interior. +- [NPC_SetInterior](NPC_SetInterior): Set NPC interior. + +## Related Callbacks + +- [OnNPCSpawn](../callbacks/OnNPCSpawn): Called when NPC spawns. diff --git a/frontend/docs/scripting/functions/NPC_GetWeapon.md b/frontend/docs/scripting/functions/NPC_GetWeapon.md new file mode 100644 index 00000000000..74ecf4991c7 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_GetWeapon.md @@ -0,0 +1,59 @@ +--- +title: NPC_GetWeapon +sidebar_label: NPC_GetWeapon +description: Gets the current weapon an NPC is holding. +tags: ["npc", "weapon"] +--- + + + +## Description + +Gets the current weapon an NPC is holding. + +| Name | Description | +| ----- | ----------------- | +| npcid | The ID of the NPC | + +## Returns + +Returns the weapon ID that the NPC is currently holding. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkweapon", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new weapon = NPC_GetWeapon(npcid); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d weapon: %d", npcid, weapon); + return 1; + } + return 0; +} +``` + +## Notes + +- Returns 0 if the NPC has no weapon (fists) +- Weapon IDs are the same as player weapon IDs + +## Related Functions + +- [NPC_SetWeapon](NPC_SetWeapon): Set NPC weapon +- [NPC_GetAmmo](NPC_GetAmmo): Get NPC ammunition +- [NPC_SetAmmo](NPC_SetAmmo): Set NPC ammunition +- [NPC_RemoveWeapon](NPC_RemoveWeapon): Remove NPC weapon + +## Related Callbacks + +- [OnNPCWeaponShot](../callbacks/OnNPCWeaponShot): Called when NPC fires weapon diff --git a/frontend/docs/scripting/functions/NPC_GetWeaponAccuracy.md b/frontend/docs/scripting/functions/NPC_GetWeaponAccuracy.md new file mode 100644 index 00000000000..63c8c0ddeeb --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_GetWeaponAccuracy.md @@ -0,0 +1,61 @@ +--- +title: NPC_GetWeaponAccuracy +sidebar_label: NPC_GetWeaponAccuracy +description: Gets the accuracy setting for an NPC's weapon. +tags: ["npc", "weapon"] +--- + + + +## Description + +Gets the accuracy setting for an NPC's weapon. + +| Name | Description | +| -------- | ---------------------- | +| npcid | The ID of the NPC | +| weaponid | The weapon ID to check | + +## Returns + +Returns the accuracy value (0.0 to 1.0), or -1.0 on error. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkweaponaccuracy", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new weapon = NPC_GetWeapon(npcid); + new Float:accuracy = NPC_GetWeaponAccuracy(npcid, WEAPON:weapon); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d weapon %d accuracy: %.2f", npcid, weapon, accuracy); + return 1; + } + return 0; +} +``` + +## Notes + +- Accuracy is a value between 0.0 (0% accurate) and 1.0 (100% accurate) +- Returns -1.0 if the NPC ID is invalid or weapon doesn't exist + +## Related Functions + +- [NPC_SetWeaponAccuracy](NPC_SetWeaponAccuracy): Set weapon accuracy +- [NPC_GetWeapon](NPC_GetWeapon): Get NPC's current weapon +- [NPC_SetWeapon](NPC_SetWeapon): Set NPC's weapon + +## Related Callbacks + +- [OnNPCWeaponShot](../callbacks/OnNPCWeaponShot): Called when an NPC shoots +- [OnNPCWeaponStateChange](../callbacks/OnNPCWeaponStateChange): Called when weapon state changes diff --git a/frontend/docs/scripting/functions/NPC_GetWeaponActualClipSize.md b/frontend/docs/scripting/functions/NPC_GetWeaponActualClipSize.md new file mode 100644 index 00000000000..ee3a0e82755 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_GetWeaponActualClipSize.md @@ -0,0 +1,60 @@ +--- +title: NPC_GetWeaponActualClipSize +sidebar_label: NPC_GetWeaponActualClipSize +description: Gets the actual (default) clip size for an NPC's weapon. +tags: ["npc", "weapon"] +--- + + + +## Description + +Gets the actual (default) clip size for an NPC's weapon from the game data. + +| Name | Description | +| -------- | ---------------------- | +| npcid | The ID of the NPC | +| weaponid | The weapon ID to check | + +## Returns + +Returns the default clip size, or -1 on error. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkweaponactualclipsize", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new weapon = NPC_GetWeapon(npcid); + new clipsize = NPC_GetWeaponActualClipSize(npcid, WEAPON:weapon); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d weapon actual clip size: %d", npcid, clipsize); + return 1; + } + return 0; +} +``` + +## Notes + +- Returns the original game clip size for the weapon +- This is different from custom clip sizes set with `NPC_SetWeaponClipSize` + +## Related Functions + +- [NPC_SetWeaponClipSize](NPC_SetWeaponClipSize): Set custom clip size +- [NPC_GetWeaponClipSize](NPC_GetWeaponClipSize): Get current clip size +- [NPC_GetAmmo](NPC_GetAmmo): Get NPC's current ammo + +## Related Callbacks + +- [OnNPCWeaponStateChange](../callbacks/OnNPCWeaponStateChange): Called when weapon state changes diff --git a/frontend/docs/scripting/functions/NPC_GetWeaponActualReloadTime.md b/frontend/docs/scripting/functions/NPC_GetWeaponActualReloadTime.md new file mode 100644 index 00000000000..21af11a8395 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_GetWeaponActualReloadTime.md @@ -0,0 +1,60 @@ +--- +title: NPC_GetWeaponActualReloadTime +sidebar_label: NPC_GetWeaponActualReloadTime +description: Gets the actual (default) reload time for an NPC's weapon. +tags: ["npc", "weapon"] +--- + + + +## Description + +Gets the actual (default) reload time for an NPC's weapon from the game data. + +| Name | Description | +| -------- | ---------------------- | +| npcid | The ID of the NPC | +| weaponid | The weapon ID to check | + +## Returns + +Returns the default reload time in milliseconds, or -1 on error. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkweaponactualreloadtime", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new weapon = NPC_GetWeapon(npcid); + new reloadtime = NPC_GetWeaponActualReloadTime(npcid, WEAPON:weapon); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d weapon actual reload time: %d ms", npcid, reloadtime); + return 1; + } + return 0; +} +``` + +## Notes + +- Returns the original game reload time for the weapon +- This is different from custom reload times set with `NPC_SetWeaponReloadTime` + +## Related Functions + +- [NPC_SetWeaponReloadTime](NPC_SetWeaponReloadTime): Set custom reload time +- [NPC_GetWeaponReloadTime](NPC_GetWeaponReloadTime): Get current reload time +- [NPC_IsReloading](NPC_IsReloading): Check if NPC is reloading + +## Related Callbacks + +- [OnNPCWeaponStateChange](../callbacks/OnNPCWeaponStateChange): Called when weapon state changes diff --git a/frontend/docs/scripting/functions/NPC_GetWeaponClipSize.md b/frontend/docs/scripting/functions/NPC_GetWeaponClipSize.md new file mode 100644 index 00000000000..d72ca79aa58 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_GetWeaponClipSize.md @@ -0,0 +1,60 @@ +--- +title: NPC_GetWeaponClipSize +sidebar_label: NPC_GetWeaponClipSize +description: Gets the clip size setting for an NPC's weapon. +tags: ["npc", "weapon"] +--- + + + +## Description + +Gets the clip size setting for an NPC's weapon. + +| Name | Description | +| -------- | ---------------------- | +| npcid | The ID of the NPC | +| weaponid | The weapon ID to check | + +## Returns + +Returns the weapon's clip size, or -1 on error. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkweaponclipsize", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new weapon = NPC_GetWeapon(npcid); + new clipsize = NPC_GetWeaponClipSize(npcid, WEAPON:weapon); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d weapon clip size: %d", npcid, clipsize); + return 1; + } + return 0; +} +``` + +## Notes + +- Returns the current custom clip size setting +- Different weapons have different default clip sizes + +## Related Functions + +- [NPC_SetWeaponClipSize](NPC_SetWeaponClipSize): Set weapon clip size +- [NPC_GetWeapon](NPC_GetWeapon): Get NPC's current weapon +- [NPC_GetAmmo](NPC_GetAmmo): Get NPC's current ammo + +## Related Callbacks + +- [OnNPCWeaponStateChange](../callbacks/OnNPCWeaponStateChange): Called when weapon state changes diff --git a/frontend/docs/scripting/functions/NPC_GetWeaponReloadTime.md b/frontend/docs/scripting/functions/NPC_GetWeaponReloadTime.md new file mode 100644 index 00000000000..96953de4814 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_GetWeaponReloadTime.md @@ -0,0 +1,62 @@ +--- +title: NPC_GetWeaponReloadTime +sidebar_label: NPC_GetWeaponReloadTime +description: Gets the reload time of an NPC's weapon. +tags: ["npc", "weapon", "reload"] +--- + + + +## Description + +Gets the reload time of an NPC's weapon. + +| Name | Description | +| -------- | ------------------------------------ | +| npcid | The ID of the NPC | +| weaponid | The weapon ID to get reload time for | + +## Returns + +Returns the reload time in milliseconds for the specified weapon. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkweaponreloadtime", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new weapon = NPC_GetWeapon(npcid); + new reloadtime = NPC_GetWeaponReloadTime(npcid, WEAPON:weapon); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d weapon reload time: %d ms", npcid, reloadtime); + return 1; + } + return 0; +} +``` + +## Notes + +- Returns the current custom reload time setting +- Use NPC_GetWeaponActualReloadTime to get the default game reload time +- Reload time affects how long the NPC takes to reload the weapon + +## Related Functions + +- [NPC_SetWeaponReloadTime](NPC_SetWeaponReloadTime): Set reload time +- [NPC_GetWeaponActualReloadTime](NPC_GetWeaponActualReloadTime): Get default reload time +- [NPC_IsReloading](NPC_IsReloading): Check if NPC is reloading +- [NPC_EnableReloading](NPC_EnableReloading): Enable/disable reloading + +## Related Callbacks + +- [OnNPCWeaponStateChange](../callbacks/OnNPCWeaponStateChange): Called when weapon state changes diff --git a/frontend/docs/scripting/functions/NPC_GetWeaponShootTime.md b/frontend/docs/scripting/functions/NPC_GetWeaponShootTime.md new file mode 100644 index 00000000000..647391fa60f --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_GetWeaponShootTime.md @@ -0,0 +1,62 @@ +--- +title: NPC_GetWeaponShootTime +sidebar_label: NPC_GetWeaponShootTime +description: Gets the shoot time of an NPC's weapon. +tags: ["npc", "weapon"] +--- + + + +## Description + +Gets the shoot time of an NPC's weapon. + +| Name | Description | +| -------- | ----------------------------------- | +| npcid | The ID of the NPC | +| weaponid | The weapon ID to get shoot time for | + +## Returns + +Returns the shoot time in milliseconds for the specified weapon. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkweaponshoottime", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new weapon = NPC_GetWeapon(npcid); + new shoottime = NPC_GetWeaponShootTime(npcid, WEAPON:weapon); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d weapon %d shoot time: %d ms", npcid, weapon, shoottime); + return 1; + } + return 0; +} +``` + +## Notes + +- Shoot time affects the delay between shots +- Lower values mean faster firing rate +- Different weapons have different default shoot times + +## Related Functions + +- [NPC_SetWeaponShootTime](NPC_SetWeaponShootTime): Set shoot time +- [NPC_GetWeapon](NPC_GetWeapon): Get NPC's current weapon +- [NPC_Shoot](NPC_Shoot): Make NPC shoot +- [NPC_IsShooting](NPC_IsShooting): Check if NPC is shooting + +## Related Callbacks + +- [OnNPCWeaponShot](../callbacks/OnNPCWeaponShot): Called when NPC fires weapon diff --git a/frontend/docs/scripting/functions/NPC_GetWeaponSkillLevel.md b/frontend/docs/scripting/functions/NPC_GetWeaponSkillLevel.md new file mode 100644 index 00000000000..02d6ddd9cdc --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_GetWeaponSkillLevel.md @@ -0,0 +1,71 @@ +--- +title: NPC_GetWeaponSkillLevel +sidebar_label: NPC_GetWeaponSkillLevel +description: Gets the weapon skill level of an NPC. +tags: ["npc", "weapon", "skill"] +--- + + + +## Description + +Gets the weapon skill level of an NPC. + +| Name | Description | +| ----- | ----------------------------------- | +| npcid | The ID of the NPC | +| skill | The weapon skill type (WEAPONSKILL) | + +## Returns + +Returns the weapon skill level (0-999), or `UNKNOWN_WEAPONSKILL` on failure. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkweaponskill", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new pistol = NPC_GetWeaponSkillLevel(npcid, WEAPONSKILL_PISTOL); + new silenced = NPC_GetWeaponSkillLevel(npcid, WEAPONSKILL_PISTOL_SILENCED); + new deagle = NPC_GetWeaponSkillLevel(npcid, WEAPONSKILL_DESERT_EAGLE); + new shotgun = NPC_GetWeaponSkillLevel(npcid, WEAPONSKILL_SHOTGUN); + new micro = NPC_GetWeaponSkillLevel(npcid, WEAPONSKILL_MICRO_UZI); + new mp5 = NPC_GetWeaponSkillLevel(npcid, WEAPONSKILL_MP5); + new ak47 = NPC_GetWeaponSkillLevel(npcid, WEAPONSKILL_AK47); + new m4 = NPC_GetWeaponSkillLevel(npcid, WEAPONSKILL_M4); + new sniper = NPC_GetWeaponSkillLevel(npcid, WEAPONSKILL_SNIPERRIFLE); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d weapon skills:", npcid); + SendClientMessage(playerid, 0xFFFFFFFF, "Pistol:%d Silenced:%d Deagle:%d Shotgun:%d", pistol, silenced, deagle, shotgun); + SendClientMessage(playerid, 0xFFFFFFFF, "Micro:%d MP5:%d AK47:%d M4:%d Sniper:%d", micro, mp5, ak47, m4, sniper); + return 1; + } + return 0; +} +``` + +## Notes + +- Weapon skill affects accuracy and shooting behavior +- Skill level ranges from 0 (poor) to 999 (hitman) +- Returns `UNKNOWN_WEAPONSKILL` if the NPC is invalid or skill type is invalid + +## Related Functions + +- [NPC_SetWeaponSkillLevel](NPC_SetWeaponSkillLevel): Set NPC weapon skill level +- [NPC_GetWeaponAccuracy](NPC_GetWeaponAccuracy): Get weapon accuracy +- [NPC_SetWeaponAccuracy](NPC_SetWeaponAccuracy): Set weapon accuracy +- [NPC_GetWeapon](NPC_GetWeapon): Get NPC weapon + +## Related Callbacks + +- [OnNPCWeaponShot](../callbacks/OnNPCWeaponShot): Called when NPC fires weapon diff --git a/frontend/docs/scripting/functions/NPC_GetWeaponState.md b/frontend/docs/scripting/functions/NPC_GetWeaponState.md new file mode 100644 index 00000000000..478aa0fefc4 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_GetWeaponState.md @@ -0,0 +1,69 @@ +--- +title: NPC_GetWeaponState +sidebar_label: NPC_GetWeaponState +description: Gets the weapon state of an NPC. +tags: ["npc", "weapon"] +--- + + + +## Description + +Gets the weapon state of an NPC. + +| Name | Description | +| ----- | ----------------- | +| npcid | The ID of the NPC | + +## Returns + +Returns the weapon state ID. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkweaponstate", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new WEAPONSTATE:state = WEAPONSTATE:NPC_GetWeaponState(npcid); + + static weaponStates[5][64] = + { + "Unknown", + "No ammo remaining", + "Single bullet left", + "More than one bullet left", + "Reloading" + }; + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d weapon state: %s (%d)", npcid, weaponStates[state], _:state); + return 1; + } + return 0; +} +``` + +## Notes + +- Weapon states include reloading, shooting, out of ammo, etc. +- Use this to check the current status of the NPC's weapon +- State values correspond to PlayerWeaponState constants + +## Related Functions + +- [NPC_GetWeapon](NPC_GetWeapon): Get NPC's current weapon +- [NPC_IsReloading](NPC_IsReloading): Check if NPC is reloading +- [NPC_IsShooting](NPC_IsShooting): Check if NPC is shooting +- [NPC_GetAmmoInClip](NPC_GetAmmoInClip): Get ammo in clip + +## Related Callbacks + +- [OnNPCWeaponStateChange](../callbacks/OnNPCWeaponStateChange): Called when weapon state changes diff --git a/frontend/docs/scripting/functions/NPC_HasPathPointInRange.md b/frontend/docs/scripting/functions/NPC_HasPathPointInRange.md new file mode 100644 index 00000000000..bb99eaa3ce4 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_HasPathPointInRange.md @@ -0,0 +1,68 @@ +--- +title: NPC_HasPathPointInRange +sidebar_label: NPC_HasPathPointInRange +description: Checks if a path has any point within the specified range from given coordinates. +tags: ["npc", "path"] +--- + + + +## Description + +Checks if a path has any point within the specified range from given coordinates. + +| Name | Description | +| ------ | ------------------------------------------ | +| pathId | The ID of the path to check | +| x | The X coordinate of the center position | +| y | The Y coordinate of the center position | +| z | The Z coordinate of the center position | +| radius | The radius to check for path points within | + +## Returns + +Returns `true` if the path has at least one point within the specified range, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkpathpointinrange ", true, 23)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new pathid = strval(cmdtext[23]); + + new Float:x, Float:y, Float:z; + GetPlayerPos(playerid, x, y, z); + new bool:hasPoint = NPC_HasPathPointInRange(pathid, x, y, z, 50.0); + + SendClientMessage(playerid, 0x00FF00FF, "Path %d has point near your position (%.2f, %.2f, %.2f): %s", pathid, x, y, z, hasPoint ? "Yes" : "No"); + return 1; + } + return 0; +} +``` + +## Notes + +- This function is useful for checking if an NPC path intersects with a specific area or location before starting path movement +- The function checks the 3D distance between the given position and each path point +- Only valid paths with at least one point can return `true` + +## Related Functions + +- [NPC_CreatePath](NPC_CreatePath): Creates a new path for NPC movement +- [NPC_AddPointToPath](NPC_AddPointToPath): Adds a point to a path +- [NPC_GetPathPoint](NPC_GetPathPoint): Gets information about a specific point in a path +- [NPC_MoveByPath](NPC_MoveByPath): Makes an NPC follow a predefined path + +## Related Callbacks + +_No specific callbacks are triggered by this function._ diff --git a/frontend/docs/scripting/functions/NPC_IsAiming.md b/frontend/docs/scripting/functions/NPC_IsAiming.md new file mode 100644 index 00000000000..12bb5f8bb59 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_IsAiming.md @@ -0,0 +1,61 @@ +--- +title: NPC_IsAiming +sidebar_label: NPC_IsAiming +description: Checks if an NPC is currently aiming. +tags: ["npc", "weapon", "aiming"] +--- + + + +## Description + +Checks if an NPC is currently aiming. + +| Name | Description | +| ----- | ----------------- | +| npcid | The ID of the NPC | + +## Returns + +Returns `true` if the NPC is aiming, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkaiming", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new bool:isAiming = NPC_IsAiming(npcid); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d is aiming: %s", npcid, isAiming ? "Yes" : "No"); + return 1; + } + return 0; +} +``` + +## Notes + +- Returns true when the NPC is actively aiming at a target +- Use this to check if an NPC is in combat mode +- Aiming can be started with NPC_AimAt or NPC_AimAtPlayer +- NPCs continue aiming until stopped with NPC_StopAim + +## Related Functions + +- [NPC_AimAt](NPC_AimAt): Make NPC aim at position +- [NPC_AimAtPlayer](NPC_AimAtPlayer): Make NPC aim at player +- [NPC_StopAim](NPC_StopAim): Stop NPC from aiming +- [NPC_IsAimingAtPlayer](NPC_IsAimingAtPlayer): Check if aiming at specific player + +## Related Callbacks + +- [OnNPCWeaponShot](../callbacks/OnNPCWeaponShot): Called when NPC fires weapon diff --git a/frontend/docs/scripting/functions/NPC_IsAimingAtPlayer.md b/frontend/docs/scripting/functions/NPC_IsAimingAtPlayer.md new file mode 100644 index 00000000000..c166e283732 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_IsAimingAtPlayer.md @@ -0,0 +1,62 @@ +--- +title: NPC_IsAimingAtPlayer +sidebar_label: NPC_IsAimingAtPlayer +description: Checks if an NPC is aiming at a specific player. +tags: ["npc", "weapon", "aiming"] +--- + + + +## Description + +Checks if an NPC is aiming at a specific player. + +| Name | Description | +| -------- | ----------------------------- | +| npcid | The ID of the NPC | +| playerid | The ID of the player to check | + +## Returns + +Returns `true` if the NPC is aiming at the specified player, `false` otherwise. + +## Examples + +```c + +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkaimingat", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new bool:isAimingAtPlayer = NPC_IsAimingAtPlayer(npcid, playerid); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d is aiming at you: %s", npcid, isAimingAtPlayer ? "Yes" : "No"); + return 1; + } + return 0; +} +``` + +## Notes + +- Returns true only when the NPC is specifically targeting the given player +- Use this to check if a player is being targeted by an NPC +- The NPC must be using NPC_AimAtPlayer for this to return true + +## Related Functions + +- [NPC_AimAtPlayer](NPC_AimAtPlayer): Make NPC aim at player +- [NPC_IsAiming](NPC_IsAiming): Check if NPC is aiming +- [NPC_StopAim](NPC_StopAim): Stop NPC from aiming +- [NPC_AimAt](NPC_AimAt): Make NPC aim at position + +## Related Callbacks + +- [OnNPCWeaponShot](../callbacks/OnNPCWeaponShot): Called when NPC fires weapon diff --git a/frontend/docs/scripting/functions/NPC_IsAnyStreamedIn.md b/frontend/docs/scripting/functions/NPC_IsAnyStreamedIn.md new file mode 100644 index 00000000000..9339fea51f6 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_IsAnyStreamedIn.md @@ -0,0 +1,51 @@ +--- +title: NPC_IsAnyStreamedIn +sidebar_label: NPC_IsAnyStreamedIn +description: Checks if an NPC is streamed in for any player. +tags: ["npc", "streaming"] +--- + + + +## Description + +Checks if an NPC is streamed in for any player on the server. + +| Name | Description | +| ----- | ----------------- | +| npcid | The ID of the NPC | + +## Returns + +Returns `true` if the NPC is streamed in for at least one player, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkanystreamedin", true)) + { + new bool:anyStreamed = NPC_IsAnyStreamedIn(playerid); + + SendClientMessage(playerid, 0x00FF00FF, "Any NPCs streamed in for you: %s", anyStreamed ? "Yes" : "No"); + return 1; + } + return 0; +} +``` + +## Notes + +- An NPC is streamed in when it's within a player's streaming range + +## Related Functions + +- [NPC_IsStreamedIn](NPC_IsStreamedIn): Check if streamed in for specific player +- [NPC_SetPos](NPC_SetPos): Set NPC position +- [NPC_SetVirtualWorld](NPC_SetVirtualWorld): Set NPC virtual world +- [NPC_SetInterior](NPC_SetInterior): Set NPC interior + +## Related Callbacks + +- [OnNPCSpawn](../callbacks/OnNPCSpawn): Called when NPC spawns diff --git a/frontend/docs/scripting/functions/NPC_IsDead.md b/frontend/docs/scripting/functions/NPC_IsDead.md new file mode 100644 index 00000000000..dd93b2e6e0f --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_IsDead.md @@ -0,0 +1,63 @@ +--- +title: NPC_IsDead +sidebar_label: NPC_IsDead +description: Checks if an NPC is dead. +tags: ["npc"] +--- + + + +## Description + +Checks if an NPC is dead. + +| Name | Description | +| ----- | --------------------------- | +| npcid | The ID of the NPC to check. | + +## Returns + +Returns `true` if the NPC is dead, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkdead", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new bool:isDead = NPC_IsDead(npcid); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d is dead: %s", npcid, isDead ? "Yes" : "No"); + return 1; + } + return 0; +} +``` + +## Notes + +:::warning + +- An NPC is considered dead when its health reaches 0.0 or below. +- Dead NPCs can be respawned using [NPC_Respawn](NPC_Respawn). + +::: + +## Related Functions + +- [NPC_GetHealth](NPC_GetHealth): Gets the health of an NPC +- [NPC_SetHealth](NPC_SetHealth): Sets the health of an NPC +- [NPC_Respawn](NPC_Respawn): Respawns an NPC + +## Related Callbacks + +- [OnNPCDeath](../callbacks/OnNPCDeath): Called when an NPC dies +- [OnNPCTakeDamage](../callbacks/OnNPCTakeDamage): Called when an NPC takes damage diff --git a/frontend/docs/scripting/functions/NPC_IsEnteringVehicle.md b/frontend/docs/scripting/functions/NPC_IsEnteringVehicle.md new file mode 100644 index 00000000000..97b8da84aca --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_IsEnteringVehicle.md @@ -0,0 +1,60 @@ +--- +title: NPC_IsEnteringVehicle +sidebar_label: NPC_IsEnteringVehicle +description: Checks if an NPC is currently entering a vehicle. +tags: ["npc", "vehicle"] +--- + + + +## Description + +Checks if an NPC is currently in the process of entering a vehicle. + +| Name | Description | +| ----- | ----------------- | +| npcid | The ID of the NPC | + +## Returns + +Returns `true` if the NPC is entering a vehicle, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkenteringvehicle", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new bool:isEntering = NPC_IsEnteringVehicle(npcid); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d is entering vehicle: %s", npcid, isEntering ? "Yes" : "No"); + return 1; + } + return 0; +} +``` + +## Notes + +- Returns true only during the entering animation/process +- Once the NPC is fully inside, this returns false +- The NPC must have been instructed to enter with NPC_EnterVehicle + +## Related Functions + +- [NPC_EnterVehicle](NPC_EnterVehicle): Make NPC enter vehicle +- [NPC_GetEnteringVehicleID](NPC_GetEnteringVehicleID): Get entering vehicle ID +- [NPC_GetEnteringVehicleSeat](NPC_GetEnteringVehicleSeat): Get entering seat +- [NPC_GetVehicle](NPC_GetVehicle): Get current vehicle + +## Related Callbacks + +_No specific callbacks are triggered by this function._ diff --git a/frontend/docs/scripting/functions/NPC_IsInfiniteAmmoEnabled.md b/frontend/docs/scripting/functions/NPC_IsInfiniteAmmoEnabled.md new file mode 100644 index 00000000000..9fa5ce280d0 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_IsInfiniteAmmoEnabled.md @@ -0,0 +1,60 @@ +--- +title: NPC_IsInfiniteAmmoEnabled +sidebar_label: NPC_IsInfiniteAmmoEnabled +description: Checks if infinite ammo is enabled for an NPC. +tags: ["npc", "weapon", "ammo"] +--- + + + +## Description + +Checks if infinite ammo is enabled for an NPC. + +| Name | Description | +| ----- | ----------------- | +| npcid | The ID of the NPC | + +## Returns + +Returns `true` if infinite ammo is enabled, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkinfiniteammo", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new bool:infiniteAmmo = NPC_IsInfiniteAmmoEnabled(npcid); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d infinite ammo enabled: %s", npcid, infiniteAmmo ? "Yes" : "No"); + return 1; + } + return 0; +} +``` + +## Notes + +- Infinite ammo prevents the NPC from running out of ammunition +- The ammo count may still display as decreasing but weapon functionality remains +- Can be toggled with NPC_EnableInfiniteAmmo + +## Related Functions + +- [NPC_EnableInfiniteAmmo](NPC_EnableInfiniteAmmo): Enable/disable infinite ammo +- [NPC_GetAmmo](NPC_GetAmmo): Get NPC ammunition +- [NPC_SetAmmo](NPC_SetAmmo): Set NPC ammunition +- [NPC_GetWeapon](NPC_GetWeapon): Get NPC weapon + +## Related Callbacks + +- [OnNPCWeaponShot](../callbacks/OnNPCWeaponShot): Called when NPC fires a weapon diff --git a/frontend/docs/scripting/functions/NPC_IsInvulnerable.md b/frontend/docs/scripting/functions/NPC_IsInvulnerable.md new file mode 100644 index 00000000000..e528f9e6635 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_IsInvulnerable.md @@ -0,0 +1,60 @@ +--- +title: NPC_IsInvulnerable +sidebar_label: NPC_IsInvulnerable +description: Checks if an NPC is invulnerable to damage. +tags: ["npc", "invulnerable", "damage", "protection"] +--- + + + +## Description + +Checks if an NPC is invulnerable to damage. + +| Name | Description | +| ----- | ----------------- | +| npcid | The ID of the NPC | + +## Returns + +Returns true if the NPC is invulnerable, false otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkinvulnerable", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new bool:isInvulnerable = NPC_IsInvulnerable(npcid); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d is invulnerable: %s", npcid, isInvulnerable ? "Yes" : "No"); + return 1; + } + return 0; +} +``` + +## Notes + +- Returns the invulnerability status set by `NPC_SetInvulnerable` +- NPCs are vulnerable by default when created + +## Related Functions + +- [NPC_SetInvulnerable](NPC_SetInvulnerable): Set NPC invulnerability +- [NPC_IsValid](NPC_IsValid): Check if NPC ID is valid +- [NPC_IsDead](NPC_IsDead): Check if NPC is dead +- [NPC_GetHealth](NPC_GetHealth): Get NPC health + +## Related Callbacks + +- [OnNPCTakeDamage](../callbacks/OnNPCTakeDamage): Called when NPC takes damage (not called for invulnerable NPCs) +- [OnNPCDeath](../callbacks/OnNPCDeath): Called when NPC dies (invulnerable NPCs cannot die) diff --git a/frontend/docs/scripting/functions/NPC_IsMeleeAttacking.md b/frontend/docs/scripting/functions/NPC_IsMeleeAttacking.md new file mode 100644 index 00000000000..fcdd46be6e7 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_IsMeleeAttacking.md @@ -0,0 +1,59 @@ +--- +title: NPC_IsMeleeAttacking +sidebar_label: NPC_IsMeleeAttacking +description: Checks if an NPC is performing a melee attack. +tags: ["npc", "melee", "fighting"] +--- + + + +## Description + +Checks if an NPC is performing a melee attack. + +| Name | Description | +| ----- | ----------------- | +| npcid | The ID of the NPC | + +## Returns + +Returns `true` if the NPC is performing a melee attack, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkmeleeattacking", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new bool:isMeleeAttacking = NPC_IsMeleeAttacking(npcid); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d is melee attacking: %s", npcid, isMeleeAttacking ? "Yes" : "No"); + return 1; + } + return 0; +} +``` + +## Notes + +- Returns true during the melee attack animation +- Melee attacks are started with NPC_MeleeAttack + +## Related Functions + +- [NPC_MeleeAttack](NPC_MeleeAttack): Start melee attack +- [NPC_StopMeleeAttack](NPC_StopMeleeAttack): Stop melee attack +- [NPC_SetFightingStyle](NPC_SetFightingStyle): Set fighting style +- [NPC_GetFightingStyle](NPC_GetFightingStyle): Get fighting style + +## Related Callbacks + +- [OnNPCGiveDamage](../callbacks/OnNPCGiveDamage): Called when NPC damages someone diff --git a/frontend/docs/scripting/functions/NPC_IsMoving.md b/frontend/docs/scripting/functions/NPC_IsMoving.md new file mode 100644 index 00000000000..1a1fbf83ea7 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_IsMoving.md @@ -0,0 +1,59 @@ +--- +title: NPC_IsMoving +sidebar_label: NPC_IsMoving +description: Checks if an NPC is currently moving. +tags: ["npc", "movement"] +--- + + + +## Description + +Checks if an NPC is currently moving. + +| Name | Description | +| ----- | ----------------- | +| npcid | The ID of the NPC | + +## Returns + +Returns `true` if the NPC is moving, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkmoving", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new bool:isMoving = NPC_IsMoving(npcid); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d is moving: %s", npcid, isMoving ? "Yes" : "No"); + return 1; + } + return 0; +} +``` + +## Notes + +- Returns true when the NPC is walking, running, or driving to a destination +- Returns false when the NPC reaches its destination or is stopped + +## Related Functions + +- [NPC_Move](NPC_Move): Make NPC move to position +- [NPC_StopMove](NPC_StopMove): Stop NPC movement +- [NPC_MoveToPlayer](NPC_MoveToPlayer): Make NPC follow player +- [NPC_MoveByPath](NPC_MoveByPath): Make NPC follow path + +## Related Callbacks + +- [OnNPCFinishMove](../callbacks/OnNPCFinishMove): Called when NPC finishes movement diff --git a/frontend/docs/scripting/functions/NPC_IsMovingToPlayer.md b/frontend/docs/scripting/functions/NPC_IsMovingToPlayer.md new file mode 100644 index 00000000000..f65a9acdd68 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_IsMovingToPlayer.md @@ -0,0 +1,60 @@ +--- +title: NPC_IsMovingToPlayer +sidebar_label: NPC_IsMovingToPlayer +description: Checks if an NPC is moving toward a specific player. +tags: ["npc", "player", "movement"] +--- + + + +## Description + +Checks if an NPC is moving toward a specific player. + +| Name | Description | +| -------- | ------------------------------ | +| npcid | The ID of the NPC | +| playerid | The ID of the player to check | + +## Returns + +Returns `true` if the NPC is moving toward the specified player, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkmovingtowardme", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new bool:isMovingToPlayer = NPC_IsMovingToPlayer(npcid, playerid); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d is moving toward you: %s", npcid, isMovingToPlayer ? "Yes" : "No"); + return 1; + } + return 0; +} +``` + +## Notes + +- This function checks if the NPC was commanded to move toward a specific player using [NPC_MoveToPlayer](NPC_MoveToPlayer) +- Returns false if the NPC is not moving or is moving toward a different target + +## Related Functions + +- [NPC_MoveToPlayer](NPC_MoveToPlayer): Make NPC move toward a player +- [NPC_IsMoving](NPC_IsMoving): Check if NPC is moving +- [NPC_StopMove](NPC_StopMove): Stop NPC movement +- [NPC_GetPlayerMovingTo](NPC_GetPlayerMovingTo): Get the player ID the NPC is moving toward + +## Related Callbacks + +- [OnNPCFinishMove](../callbacks/OnNPCFinishMove): Called when NPC finishes movement diff --git a/frontend/docs/scripting/functions/NPC_IsNodeOpen.md b/frontend/docs/scripting/functions/NPC_IsNodeOpen.md new file mode 100644 index 00000000000..a90670b997c --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_IsNodeOpen.md @@ -0,0 +1,55 @@ +--- +title: NPC_IsNodeOpen +sidebar_label: NPC_IsNodeOpen +description: Checks if an NPC node is open. +tags: ["npc", "node", "navigation"] +--- + + + +## Description + +Checks if an NPC node is open and available for use. + +| Name | Description | +| ------ | ------------------ | +| nodeid | The ID of the node | + +## Returns + +Returns `true` if the node is open, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checknodeopen ", true, 15)) + { + new nodeid = strval(cmdtext[15]); + + new bool:isNodeOpen = NPC_IsNodeOpen(nodeid); + + SendClientMessage(playerid, 0x00FF00FF, "Node %d is open: %s", nodeid, isNodeOpen ? "Yes" : "No"); + return 1; + } + return 0; +} +``` + +## Notes + +- Nodes must be opened with NPC_OpenNode before use +- Only open nodes can be played by NPCs +- Use this to check node availability before assigning to NPCs + +## Related Functions + +- [NPC_OpenNode](NPC_OpenNode): Open a node for use +- [NPC_CloseNode](NPC_CloseNode): Close a node +- [NPC_PlayNode](NPC_PlayNode): Make NPC play a node +- [NPC_GetNodeType](NPC_GetNodeType): Get node type + +## Related Callbacks + +_No specific callbacks are triggered by this function._ diff --git a/frontend/docs/scripting/functions/NPC_IsPlaybackPaused.md b/frontend/docs/scripting/functions/NPC_IsPlaybackPaused.md new file mode 100644 index 00000000000..c9047cd5269 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_IsPlaybackPaused.md @@ -0,0 +1,60 @@ +--- +title: NPC_IsPlaybackPaused +sidebar_label: NPC_IsPlaybackPaused +description: Checks if an NPC's playback is paused. +tags: ["npc", "recording", "playback"] +--- + + + +## Description + +Checks if an NPC's playback is currently paused. + +| Name | Description | +| ----- | ----------------- | +| npcid | The ID of the NPC | + +## Returns + +Returns `true` if the playback is paused, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkplaybackpaused", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new bool:isPlaybackPaused = NPC_IsPlaybackPaused(npcid); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d playback paused: %s", npcid, isPlaybackPaused ? "Yes" : "No"); + return 1; + } + return 0; +} +``` + +## Notes + +- Only returns true if the NPC is playing a recording and it's paused +- NPCs not playing recordings will always return false + +## Related Functions + +- [NPC_PausePlayback](NPC_PausePlayback): Pause/unpause playback +- [NPC_IsPlayingPlayback](NPC_IsPlayingPlayback): Check if playing +- [NPC_StartPlayback](NPC_StartPlayback): Start playback +- [NPC_StopPlayback](NPC_StopPlayback): Stop playback + +## Related Callbacks + +- [OnNPCPlaybackStart](../callbacks/OnNPCPlaybackStart): Called when playback starts +- [OnNPCPlaybackEnd](../callbacks/OnNPCPlaybackEnd): Called when playback ends diff --git a/frontend/docs/scripting/functions/NPC_IsPlayingNode.md b/frontend/docs/scripting/functions/NPC_IsPlayingNode.md new file mode 100644 index 00000000000..81a175d197d --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_IsPlayingNode.md @@ -0,0 +1,58 @@ +--- +title: NPC_IsPlayingNode +sidebar_label: NPC_IsPlayingNode +description: Checks if an NPC is currently playing a node. +tags: ["npc", "node"] +--- + + + +## Description + +Checks if an NPC is currently playing a node. + +| Name | Description | +| ----- | ----------------- | +| npcid | The ID of the NPC | + +## Returns + +Returns `true` if the NPC is playing a node, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkplayingnode", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new bool:isPlayingNode = NPC_IsPlayingNode(npcid); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d is playing node: %s", npcid, isPlayingNode ? "Yes" : "No"); + return 1; + } + return 0; +} +``` + +## Notes + +- Returns `false` if the NPC is not valid + +## Related Functions + +- [NPC_PlayNode](NPC_PlayNode): Make NPC play a node +- [NPC_StopPlayingNode](NPC_StopPlayingNode): Stop playing node +- [NPC_IsPlayingNodePaused](NPC_IsPlayingNodePaused): Check if paused +- [NPC_PausePlayingNode](NPC_PausePlayingNode): Pause node playing + +## Related Callbacks + +- [OnNPCFinishNode](../callbacks/OnNPCFinishNode): Called when an NPC finishes a node diff --git a/frontend/docs/scripting/functions/NPC_IsPlayingNodePaused.md b/frontend/docs/scripting/functions/NPC_IsPlayingNodePaused.md new file mode 100644 index 00000000000..bdc2eceb521 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_IsPlayingNodePaused.md @@ -0,0 +1,58 @@ +--- +title: NPC_IsPlayingNodePaused +sidebar_label: NPC_IsPlayingNodePaused +description: Checks if an NPC's node playing is currently paused. +tags: ["npc", "node"] +--- + + + +## Description + +Checks if an NPC's node playing is currently paused. + +| Name | Description | +| ----- | ----------------- | +| npcid | The ID of the NPC | + +## Returns + +Returns `true` if the NPC's node playing is paused, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checknodepaused", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new bool:isNodePaused = NPC_IsPlayingNodePaused(npcid); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d node paused: %s", npcid, isNodePaused ? "Yes" : "No"); + return 1; + } + return 0; +} +``` + +## Notes + +- Returns `false` if the NPC is not playing a node + +## Related Functions + +- [NPC_IsPlayingNode](NPC_IsPlayingNode): Check if playing node +- [NPC_PausePlayingNode](NPC_PausePlayingNode): Pause node playing +- [NPC_ResumePlayingNode](NPC_ResumePlayingNode): Resume node playing +- [NPC_StopPlayingNode](NPC_StopPlayingNode): Stop playing node + +## Related Callbacks + +- [OnNPCFinishNode](../callbacks/OnNPCFinishNode): Called when an NPC finishes a node diff --git a/frontend/docs/scripting/functions/NPC_IsPlayingPlayback.md b/frontend/docs/scripting/functions/NPC_IsPlayingPlayback.md new file mode 100644 index 00000000000..19384d33d18 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_IsPlayingPlayback.md @@ -0,0 +1,59 @@ +--- +title: NPC_IsPlayingPlayback +sidebar_label: NPC_IsPlayingPlayback +description: Checks if an NPC is playing a recording playback. +tags: ["npc", "recording", "playback"] +--- + + + +## Description + +Checks if an NPC is currently playing a recording playback. + +| Name | Description | +| ----- | ----------------- | +| npcid | The ID of the NPC | + +## Returns + +Returns `true` if the NPC is playing a playback, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkplayingplayback", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new bool:isPlayingPlayback = NPC_IsPlayingPlayback(npcid); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d is playing playback: %s", npcid, isPlayingPlayback ? "Yes" : "No"); + return 1; + } + return 0; +} +``` + +## Notes + +- Returns true when the NPC is actively playing a recording + +## Related Functions + +- [NPC_StartPlayback](NPC_StartPlayback): Start playing recording +- [NPC_StopPlayback](NPC_StopPlayback): Stop playback +- [NPC_PausePlayback](NPC_PausePlayback): Pause/unpause playback +- [NPC_IsPlaybackPaused](NPC_IsPlaybackPaused): Check if paused + +## Related Callbacks + +- [OnNPCPlaybackStart](../callbacks/OnNPCPlaybackStart): Called when playback starts +- [OnNPCPlaybackEnd](../callbacks/OnNPCPlaybackEnd): Called when playback ends diff --git a/frontend/docs/scripting/functions/NPC_IsReloadEnabled.md b/frontend/docs/scripting/functions/NPC_IsReloadEnabled.md new file mode 100644 index 00000000000..2a7b5a99d71 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_IsReloadEnabled.md @@ -0,0 +1,61 @@ +--- +title: NPC_IsReloadEnabled +sidebar_label: NPC_IsReloadEnabled +description: Checks if automatic reloading is enabled for an NPC. +tags: ["npc", "weapon", "ammo"] +--- + + + +## Description + +Checks if automatic reloading is enabled for an NPC. + +| Name | Description | +| ----- | ----------------- | +| npcid | The ID of the NPC | + +## Returns + +Returns `true` if auto-reload is enabled, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkreloadenabled", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new bool:isReloadEnabled = NPC_IsReloadEnabled(npcid); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d reload enabled: %s", npcid, isReloadEnabled ? "Yes" : "No"); + return 1; + } + return 0; +} +``` + +## Notes + +- Auto-reload makes NPCs automatically reload when their clip is empty +- NPCs without auto-reload will stop shooting when their clip runs out +- This only affects clip ammunition, not total ammunition +- Use `NPC_EnableReloading` to change the reload setting + +## Related Functions + +- [NPC_EnableReloading](NPC_EnableReloading): Enable/disable auto-reload +- [NPC_IsReloading](NPC_IsReloading): Check if currently reloading +- [NPC_GetAmmoInClip](NPC_GetAmmoInClip): Get clip ammunition +- [NPC_SetAmmoInClip](NPC_SetAmmoInClip): Set clip ammunition + +## Related Callbacks + +- [OnNPCWeaponShot](../callbacks/OnNPCWeaponShot): Called when NPC fires diff --git a/frontend/docs/scripting/functions/NPC_IsReloading.md b/frontend/docs/scripting/functions/NPC_IsReloading.md new file mode 100644 index 00000000000..2d0912a4887 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_IsReloading.md @@ -0,0 +1,60 @@ +--- +title: NPC_IsReloading +sidebar_label: NPC_IsReloading +description: Checks if an NPC is currently reloading their weapon. +tags: ["npc", "weapon", "reloading"] +--- + + + +## Description + +Checks if an NPC is currently reloading their weapon. + +| Name | Description | +| ----- | ----------------- | +| npcid | The ID of the NPC | + +## Returns + +Returns `true` if the NPC is reloading, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkreloading", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new bool:isReloading = NPC_IsReloading(npcid); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d is reloading: %s", npcid, isReloading ? "Yes" : "No"); + return 1; + } + return 0; +} +``` + +## Notes + +- Returns true only during the actual reload animation +- Reloading is automatic when ammo in clip runs out +- Use NPC_EnableReloading to control reload behavior + +## Related Functions + +- [NPC_EnableReloading](NPC_EnableReloading): Enable/disable reloading +- [NPC_Reload](NPC_Reload): Force NPC to reload +- [NPC_GetAmmoInClip](NPC_GetAmmoInClip): Get ammo in clip +- [NPC_GetWeaponReloadTime](NPC_GetWeaponReloadTime): Get reload time + +## Related Callbacks + +- [OnNPCWeaponShot](../callbacks/OnNPCWeaponShot): Called when NPC shoots diff --git a/frontend/docs/scripting/functions/NPC_IsShooting.md b/frontend/docs/scripting/functions/NPC_IsShooting.md new file mode 100644 index 00000000000..29b17bad361 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_IsShooting.md @@ -0,0 +1,60 @@ +--- +title: NPC_IsShooting +sidebar_label: NPC_IsShooting +description: Checks if an NPC is currently shooting. +tags: ["npc", "weapon", "shooting"] +--- + + + +## Description + +Checks if an NPC is currently shooting their weapon. + +| Name | Description | +| ----- | ----------------- | +| npcid | The ID of the NPC | + +## Returns + +Returns `true` if the NPC is shooting, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkshooting", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new bool:isShooting = NPC_IsShooting(npcid); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d is shooting: %s", npcid, isShooting ? "Yes" : "No"); + return 1; + } + return 0; +} +``` + +## Notes + +- Returns true only during the actual shooting action +- NPCs must have a weapon and ammo to shoot + +## Related Functions + +- [NPC_Shoot](NPC_Shoot): Make NPC shoot +- [NPC_AimAt](NPC_AimAt): Make NPC aim and shoot +- [NPC_StopShoot](NPC_StopShoot): Stop NPC shooting +- [NPC_IsAiming](NPC_IsAiming): Check if aiming + +## Related Callbacks + +- [OnNPCWeaponShot](../callbacks/OnNPCWeaponShot): Called when NPC shoots +- [OnNPCGiveDamage](../callbacks/OnNPCGiveDamage): Called when NPC damages player diff --git a/frontend/docs/scripting/functions/NPC_IsSpawned.md b/frontend/docs/scripting/functions/NPC_IsSpawned.md new file mode 100644 index 00000000000..872a12a84e5 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_IsSpawned.md @@ -0,0 +1,59 @@ +--- +title: NPC_IsSpawned +sidebar_label: NPC_IsSpawned +description: Checks if an NPC is spawned in the game world. +tags: ["npc", "spawn"] +--- + + + +## Description + +Checks if an NPC is spawned in the game world. + +| Name | Description | +| ----- | ----------------- | +| npcid | The ID of the NPC | + +## Returns + +Returns `true` if the NPC is spawned, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkspawned", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new bool:isSpawned = NPC_IsSpawned(npcid); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d is spawned: %s", npcid, isSpawned ? "Yes" : "No"); + return 1; + } + return 0; +} +``` + +## Notes + +- This is different from [NPC_IsValid](NPC_IsValid), which checks if the NPC exists + +## Related Functions + +- [NPC_Spawn](NPC_Spawn): Spawn an NPC +- [NPC_Respawn](NPC_Respawn): Respawn an NPC +- [NPC_IsValid](NPC_IsValid): Check if NPC is valid +- [NPC_IsDead](NPC_IsDead): Check if NPC is dead + +## Related Callbacks + +- [OnNPCSpawn](../callbacks/OnNPCSpawn): Called when NPC spawns +- [OnNPCRespawn](../callbacks/OnNPCRespawn): Called when NPC respawns diff --git a/frontend/docs/scripting/functions/NPC_IsStreamedIn.md b/frontend/docs/scripting/functions/NPC_IsStreamedIn.md new file mode 100644 index 00000000000..607ab13f17e --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_IsStreamedIn.md @@ -0,0 +1,58 @@ +--- +title: NPC_IsStreamedIn +sidebar_label: NPC_IsStreamedIn +description: Checks if an NPC is streamed in for a specific player. +tags: ["npc", "streaming"] +--- + + + +## Description + +Checks if an NPC is streamed in for a specific player. + +| Name | Description | +| -------- | ----------------------------- | +| npcid | The ID of the NPC | +| playerid | The ID of the player to check | + +## Returns + +Returns `true` if the NPC is streamed in for the player, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkstreamedin", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new bool:isStreamedIn = NPC_IsStreamedIn(npcid, playerid); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d is streamed in for you: %s", npcid, isStreamedIn ? "Yes" : "No"); + return 1; + } + return 0; +} +``` + +## Notes + +- NPCs are only streamed in when within the player's streaming distance +- Streaming depends on distance and interior/virtual world matching + +## Related Functions + +- [NPC_IsAnyStreamedIn](NPC_IsAnyStreamedIn): Check if any player can see NPC +- [NPC_SetPos](NPC_SetPos): Set NPC position + +## Related Callbacks + +_No specific callbacks are triggered by this function._ diff --git a/frontend/docs/scripting/functions/NPC_IsValid.md b/frontend/docs/scripting/functions/NPC_IsValid.md new file mode 100644 index 00000000000..f2da67423a0 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_IsValid.md @@ -0,0 +1,58 @@ +--- +title: NPC_IsValid +sidebar_label: NPC_IsValid +description: Checks if an NPC ID is valid. +tags: ["npc"] +--- + + + +## Description + +Checks if an NPC ID is valid and the NPC exists. + +| Name | Description | +| ----- | -------------------- | +| npcid | The NPC ID to check. | + +## Returns + +Returns `true` if the NPC is valid, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkvalid", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + new bool:isValid = NPC_IsValid(npcid); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d is valid: %s", npcid, isValid ? "Yes" : "No"); + return 1; + } + return 0; +} +``` + +## Notes + +:::warning + +- Always check if an NPC is valid before performing operations on it. +- An NPC becomes invalid when it is destroyed. +- This prevents runtime errors and crashes. +- Use this in loops when iterating through potential NPC IDs. + +::: + +## Related Functions + +- [NPC_Create](NPC_Create): Create a new NPC. +- [NPC_Destroy](NPC_Destroy): Destroy an NPC. +- [NPC_GetAll](NPC_GetAll): Get all valid NPC IDs. +- [NPC_IsDead](NPC_IsDead): Check if NPC is dead. diff --git a/frontend/docs/scripting/functions/NPC_IsValidPath.md b/frontend/docs/scripting/functions/NPC_IsValidPath.md new file mode 100644 index 00000000000..d39b09ff548 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_IsValidPath.md @@ -0,0 +1,56 @@ +--- +title: NPC_IsValidPath +sidebar_label: NPC_IsValidPath +description: Checks if a path ID is valid and exists. +tags: ["npc", "path", "validation"] +--- + + + +## Description + +Checks if a path ID is valid and exists. + +| Name | Description | +| ------ | ------------------ | +| pathid | The ID of the path | + +## Returns + +Returns `true` if the path is valid, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkvalidpath ", true, 16)) + { + new pathid = strval(cmdtext[16]); + + new bool:isValidPath = NPC_IsValidPath(pathid); + + SendClientMessage(playerid, 0x00FF00FF, "Path %d is valid: %s", pathid, isValidPath ? "Yes" : "No"); + return 1; + } + return 0; +} +``` + +## Notes + +- Always check if a path is valid before using it with NPCs +- Invalid paths may have been destroyed or never created properly +- Use this before adding points or assigning paths to NPCs +- Path IDs are reused when paths are destroyed + +## Related Functions + +- [NPC_CreatePath](NPC_CreatePath): Create a new path +- [NPC_DestroyPath](NPC_DestroyPath): Destroy a path +- [NPC_GetPathCount](NPC_GetPathCount): Get total path count +- [NPC_AddPointToPath](NPC_AddPointToPath): Add point to path + +## Related Callbacks + +_No specific callbacks are triggered by this function._ diff --git a/frontend/docs/scripting/functions/NPC_IsValidRecord.md b/frontend/docs/scripting/functions/NPC_IsValidRecord.md new file mode 100644 index 00000000000..abb5f64e005 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_IsValidRecord.md @@ -0,0 +1,54 @@ +--- +title: NPC_IsValidRecord +sidebar_label: NPC_IsValidRecord +description: Checks if a recording file is valid and loaded. +tags: ["npc", "recording", "validation"] +--- + + + +## Description + +Checks if a recording ID is valid and loaded. + +| Name | Description | +| -------- | ----------------------- | +| recordId | The ID of the recording | + +## Returns + +Returns `true` if the recording is valid and loaded, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checkvalidrecord ", true, 18)) + { + new recordid = strval(cmdtext[18]); + + new bool:isValidRecord = NPC_IsValidRecord(recordid); + + SendClientMessage(playerid, 0x00FF00FF, "Record %d is valid: %s", recordid, isValidRecord ? "Yes" : "No"); + return 1; + } + return 0; +} +``` + +## Notes + +- Recording must be loaded with NPC_LoadRecord before it becomes valid +- Invalid recordings cannot be used for playback + +## Related Functions + +- [NPC_LoadRecord](NPC_LoadRecord): Load a recording file +- [NPC_UnloadRecord](NPC_UnloadRecord): Unload a recording +- [NPC_StartPlayback](NPC_StartPlayback): Start playing recording +- [NPC_GetRecordCount](NPC_GetRecordCount): Get loaded record count + +## Related Callbacks + +_No specific callbacks are triggered by this function._ diff --git a/frontend/docs/scripting/functions/NPC_IsVehicleSirenUsed.md b/frontend/docs/scripting/functions/NPC_IsVehicleSirenUsed.md new file mode 100644 index 00000000000..bf8055002ab --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_IsVehicleSirenUsed.md @@ -0,0 +1,64 @@ +--- +title: NPC_IsVehicleSirenUsed +sidebar_label: NPC_IsVehicleSirenUsed +description: Checks if an NPC is using the vehicle siren. +tags: ["npc", "vehicle", "siren"] +--- + + + +## Description + +Checks if an NPC is using the vehicle siren. + +| Name | Description | +| ----- | ----------------- | +| npcid | The ID of the NPC | + +## Returns + +Returns `true` if the NPC is using the vehicle siren, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/checksirenused", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new veh = NPC_GetVehicle(npcid); + if (veh == INVALID_VEHICLE_ID) + return SendClientMessage(playerid, 0xFFFF00FF, "NPC %d is not in any vehicle.", npcid); + + new bool:sirenUsed = NPC_IsVehicleSirenUsed(npcid); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d vehicle siren used: %s", npcid, sirenUsed ? "Yes" : "No"); + return 1; + } + return 0; +} +``` + +## Notes + +- Returns `false` if the NPC is not in a vehicle +- Only works for vehicles that have sirens (police cars, ambulances, fire trucks) +- Visual and audio siren effects are visible to all players + +## Related Functions + +- [NPC_UseVehicleSiren](NPC_UseVehicleSiren): Toggle vehicle siren +- [NPC_GetVehicleID](NPC_GetVehicleID): Get NPC's vehicle +- [NPC_PutInVehicle](NPC_PutInVehicle): Put NPC in vehicle +- [NPC_RemoveFromVehicle](NPC_RemoveFromVehicle): Remove NPC from vehicle + +## Related Callbacks + +_No specific callbacks are triggered by this function._ diff --git a/frontend/docs/scripting/functions/NPC_Kill.md b/frontend/docs/scripting/functions/NPC_Kill.md new file mode 100644 index 00000000000..5cd163cb1ce --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_Kill.md @@ -0,0 +1,63 @@ +--- +title: NPC_Kill +sidebar_label: NPC_Kill +description: Kills an NPC with a specific weapon/reason. +tags: ["npc", "death", "kill"] +--- + + + +## Description + +Kills an NPC with a specific weapon/reason. + +| Name | Description | +| -------- | ---------------------------------------------------------------------------- | +| npcid | The ID of the NPC to kill | +| killerid | The ID of the player who killed the NPC (optional, use INVALID_PLAYER_ID for no killer) | +| reason | The weapon ID or reason for death (default: 255 for suicide) | + +## Returns + +Returns `true` on success, `false` on failure. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/npckill", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + NPC_Kill(npcid); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d has been killed.", npcid); + return 1; + } + return 0; +} +``` + +## Notes + +- Use `INVALID_PLAYER_ID` for killerid if there is no killer +- The reason parameter uses weapon IDs (WEAPON enum) +- This triggers the [OnNPCDeath](../callbacks/OnNPCDeath) callback + +## Related Functions + +- [NPC_SetHealth](NPC_SetHealth): Set NPC health +- [NPC_GetHealth](NPC_GetHealth): Get NPC health +- [NPC_IsDead](NPC_IsDead): Check if NPC is dead +- [NPC_Respawn](NPC_Respawn): Respawn an NPC + +## Related Callbacks + +- [OnNPCDeath](../callbacks/OnNPCDeath): Called when NPC dies +- [OnNPCTakeDamage](../callbacks/OnNPCTakeDamage): Called when NPC takes damage diff --git a/frontend/docs/scripting/functions/NPC_LoadRecord.md b/frontend/docs/scripting/functions/NPC_LoadRecord.md new file mode 100644 index 00000000000..b6714e9ab1d --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_LoadRecord.md @@ -0,0 +1,63 @@ +--- +title: NPC_LoadRecord +sidebar_label: NPC_LoadRecord +description: Loads an NPC recording file for playback. +tags: ["npc", "recording", "playback"] +--- + + + +## Description + +Loads an NPC recording file for playback use. + +| Name | Description | +| -------------- | ------------------------------ | +| const filePath | The path to the recording file | + +## Returns + +Returns the ID of the loaded recording, or `INVALID_RECORD_ID` on failure. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/npcloadrecord ", true, 15)) + { + new filepath[128]; + new len = strlen(cmdtext); + if (len <= 15) + return SendClientMessage(playerid, 0xFF0000FF, "Usage: /npcloadrecord [filepath]"); + + strmid(filepath, cmdtext, 15, len); + + new recordid = NPC_LoadRecord(filepath); + + if (recordid == -1) + SendClientMessage(playerid, 0xFF0000FF, "Failed to load record from: %s", filepath); + else + SendClientMessage(playerid, 0x00FF00FF, "Record loaded from %s with ID: %d", filepath, recordid); + return 1; + } + return 0; +} +``` + +## Notes + +- Files should have .rec extension but don't include it in filename +- Load recordings before using them with NPC_StartPlayback + +## Related Functions + +- [NPC_UnloadRecord](NPC_UnloadRecord): Unload a recording +- [NPC_UnloadAllRecords](NPC_UnloadAllRecords): Unload all recordings +- [NPC_StartPlayback](NPC_StartPlayback): Start playing recording +- [NPC_GetRecordCount](NPC_GetRecordCount): Get loaded record count + +## Related Callbacks + +- [OnNPCPlaybackStart](../callbacks/OnNPCPlaybackStart): Called when playback starts +- [OnNPCPlaybackEnd](../callbacks/OnNPCPlaybackEnd): Called when playback ends diff --git a/frontend/docs/scripting/functions/NPC_MeleeAttack.md b/frontend/docs/scripting/functions/NPC_MeleeAttack.md new file mode 100644 index 00000000000..42e55c7fe76 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_MeleeAttack.md @@ -0,0 +1,81 @@ +--- +title: NPC_MeleeAttack +sidebar_label: NPC_MeleeAttack +description: Makes an NPC perform a melee attack. +tags: ["npc", "combat", "melee"] +--- + + + +## Description + +Makes an NPC perform a melee attack for a specified duration. + +| Name | Description | +| --------------- | ------------------------------------------------ | +| npcid | The ID of the NPC | +| time | The duration of the attack | +| secondaryAttack | Whether to use secondary attack (default: false) | + +## Returns + +Returns `true` if the operation was successful, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/npcmeleeattack", true, 15)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new time = 1000; + if (strlen(cmdtext) > 16) + time = strval(cmdtext[16]); + + new bool:success = NPC_MeleeAttack(npcid, time, false); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d melee attack for %dms: %s", npcid, time, success ? "Success" : "Failed"); + return 1; + } + return 0; +} + +forward ComboStep2(playerid); +public ComboStep2(playerid) +{ + NPC_MeleeAttack(0, 700, true); // Secondary attack + SendClientMessage(playerid, 0xFF8000FF, "Combo: Step 2!"); +} + +forward ComboStep3(playerid); +public ComboStep3(playerid) +{ + NPC_MeleeAttack(0, 900, false); // Finishing move + SendClientMessage(playerid, 0xFF4000FF, "Combo: Finishing move!"); +} +``` + +## Notes + +- The NPC must have a melee weapon or use fists for the attack +- Duration affects how long the attack animation plays +- Secondary attacks often have different animations and effects +- Use fighting styles to change attack animations and effectiveness + +## Related Functions + +- [NPC_StopMeleeAttack](NPC_StopMeleeAttack): Stop melee attacking +- [NPC_IsMeleeAttacking](NPC_IsMeleeAttacking): Check if attacking +- [NPC_SetFightingStyle](NPC_SetFightingStyle): Set fighting style +- [NPC_GetFightingStyle](NPC_GetFightingStyle): Get fighting style + +## Related Callbacks + +- [OnNPCGiveDamage](../callbacks/OnNPCGiveDamage): Called when NPC damages player diff --git a/frontend/docs/scripting/functions/NPC_Move.md b/frontend/docs/scripting/functions/NPC_Move.md new file mode 100644 index 00000000000..18c52fdef9c --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_Move.md @@ -0,0 +1,74 @@ +--- +title: NPC_Move +sidebar_label: NPC_Move +description: Makes an NPC move to a specific position. +tags: ["npc", "movement"] +--- + + + +## Description + +Makes an NPC move to a specific position. + +| Name | Description | +| ---------------------- | -------------------------------------------------- | +| npcid | The ID of the NPC. | +| Float:x | The X coordinate to move to. | +| Float:y | The Y coordinate to move to. | +| Float:z | The Z coordinate to move to. | +| NPC_MOVE_TYPE:moveType | The movement type (default: `NPC_MOVE_TYPE_JOG`). | +| Float:moveSpeed | Movement speed (default: `NPC_MOVE_SPEED_AUTO`). | +| Float:stopRange | Distance to target before stopping (default: 0.2). | + +## Returns + +Returns `true` if the movement was started successfully, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/npcmove", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new Float:x, Float:y, Float:z; + GetPlayerPos(playerid, x, y, z); + + NPC_Move(npcid, x, y, z, NPC_MOVE_TYPE_JOG, NPC_MOVE_SPEED_AUTO, 0.2); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d moving to your position (%.2f, %.2f, %.2f)", npcid, x, y, z); + return 1; + } + return 0; +} +``` + +## Notes + +:::warning + +- The NPC will pathfind to the target position. +- Movement types affect animation and speed. +- Stop range determines how close the NPC gets before stopping. +- Use [NPC_IsMoving](NPC_IsMoving) to check if the NPC is currently moving + +::: + +## Related Functions + +- [NPC_MoveToPlayer](NPC_MoveToPlayer): Move NPC to follow a player. +- [NPC_StopMove](NPC_StopMove): Stop NPC movement. +- [NPC_IsMoving](NPC_IsMoving): Check if NPC is moving. +- [NPC_MoveByPath](NPC_MoveByPath): Move NPC along a predefined path. + +## Related Callbacks + +- [OnNPCFinishMove](../callbacks/OnNPCFinishMove): Called when NPC finishes movement. diff --git a/frontend/docs/scripting/functions/NPC_MoveByPath.md b/frontend/docs/scripting/functions/NPC_MoveByPath.md new file mode 100644 index 00000000000..d4a0415f35f --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_MoveByPath.md @@ -0,0 +1,76 @@ +--- +title: NPC_MoveByPath +sidebar_label: NPC_MoveByPath +description: Makes an NPC follow a predefined path. +tags: ["npc", "movement", "path"] +--- + + + +## Description + +Makes an NPC follow a predefined path with various movement options. + +| Name | Description | +| --------- | -------------------------------------------------- | +| npcid | The ID of the NPC | +| pathid | The ID of the path to follow | +| moveType | The movement type (default: NPC_MOVE_TYPE_JOG) | +| moveSpeed | Movement speed (default: NPC_MOVE_SPEED_AUTO) | +| reversed | Whether to follow path in reverse (default: false) | + +## Returns + +Returns `true` if the NPC started following the path, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/startpatrol", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + new count = NPC_GetPathPointCount(PlayerPatrolPath[playerid]); + + if (NPC_IsValidPath(PlayerPatrolPath[playerid])) + { + NPC_MoveByPath(npcid, PlayerPatrolPath[playerid], NPC_MOVE_TYPE_WALK); + SendClientMessage(playerid, 0x00FF00FF, "NPC %d started patrol route with %d points", npcid, count); + + StopPlayerPatrolTimer(playerid); + PlayerPatrolTimer[playerid] = SetTimerEx("CheckPathProgress", 2000, true, "i", playerid); + } + else + { + SendClientMessage(playerid, 0xFF0000FF, "Failed to start patrol route"); + } + return 1; + } + return 0; +} +``` + +## Notes + +- Path must be created with `NPC_CreatePath` and contain at least one point before calling this function +- Use `NPC_AddPointToPath` to build the route and `NPC_ClearPath` if you need to reset it +- Set `reversed = true` to have the NPC traverse the path in the opposite order +- Returns `false` if the NPC is invalid, already performing an incompatible action, or the path cannot be followed + +## Related Functions + +- [NPC_CreatePath](NPC_CreatePath): Create a new path +- [NPC_AddPointToPath](NPC_AddPointToPath): Add point to path +- [NPC_ClearPath](NPC_ClearPath): Remove all points from a path +- [NPC_StopMove](NPC_StopMove): Stop path movement +- [NPC_GetCurrentPathPointIndex](NPC_GetCurrentPathPointIndex): Get current point + +## Related Callbacks + +- [OnNPCFinishMovePath](../callbacks/OnNPCFinishMovePath): Called when NPC finishes moving along a path +- [OnNPCFinishMovePathPoint](../callbacks/OnNPCFinishMovePathPoint): Called when NPC reaches each waypoint +- [OnNPCFinishMove](../callbacks/OnNPCFinishMove): Called when NPC finishes any movement diff --git a/frontend/docs/scripting/functions/NPC_MoveToPlayer.md b/frontend/docs/scripting/functions/NPC_MoveToPlayer.md new file mode 100644 index 00000000000..72e3c5737bc --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_MoveToPlayer.md @@ -0,0 +1,72 @@ +--- +title: NPC_MoveToPlayer +sidebar_label: NPC_MoveToPlayer +description: Makes an NPC move toward and follow a player. +tags: ["npc", "movement", "player", "follow"] +--- + + + +## Description + +Makes an NPC move toward and follow a player. + +| Name | Description | +| ---------------------- | ------------------------------------------------------------ | +| npcid | The ID of the NPC. | +| playerid | The ID of the player to move toward. | +| NPC_MOVE_TYPE:moveType | Movement type (default: `NPC_MOVE_TYPE_JOG`). | +| Float:moveSpeed | Movement speed (default: `NPC_MOVE_SPEED_AUTO`). | +| Float:stopRange | Distance to stop from player (default: 0.2) | +| updateDelayMS | Position check update delay in milliseconds (default: 500). | +| bool:autoRestart | Whether to automatically restart following (default: false). | + +## Returns + +Returns `true` on success, `false` on failure. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/npcmovetoplayer", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + NPC_MoveToPlayer(npcid, playerid, NPC_MOVE_TYPE_JOG, NPC_MOVE_SPEED_AUTO, 0.2, 500, false); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d now following you", npcid); + return 1; + } + return 0; +} +``` + +## Notes + +:::warning + +- NPCs will continuously follow the target player until stopped. +- The `updateDelayMS` parameter controls how often the NPC updates its target position. +- Lower `updateDelayMS` values provide smoother following but use more resources. +- The `autoRestart` parameter determines if following resumes after interruptions. +- Following stops when the target player disconnects. + +::: + +## Related Functions + +- [NPC_Move](NPC_Move): Move NPC to a specific position. +- [NPC_StopMove](NPC_StopMove): Stop NPC movement. +- [NPC_IsMoving](NPC_IsMoving): Check if NPC is moving. +- [NPC_MoveByPath](NPC_MoveByPath): Move NPC along a predefined path. + +## Related Callbacks + +- [OnNPCFinishMove](../callbacks/OnNPCFinishMove): Called when NPC reaches target (not called for continuous following). diff --git a/frontend/docs/scripting/functions/NPC_OpenNode.md b/frontend/docs/scripting/functions/NPC_OpenNode.md new file mode 100644 index 00000000000..176a606867d --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_OpenNode.md @@ -0,0 +1,59 @@ +--- +title: NPC_OpenNode +sidebar_label: NPC_OpenNode +description: Opens an NPC node for use. +tags: ["npc", "node", "navigation"] +--- + + + +## Description + +Opens an NPC node for use, making it available for NPCs to navigate through. + +| Name | Description | +| ------ | ------------------ | +| nodeid | The ID of the node | + +## Returns + +Returns `true` if the node was opened successfully, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/npcopennode ", true, 13)) + { + new nodeid = strval(cmdtext[13]); + + if (nodeid < 0 || nodeid > 63) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid node ID. Must be between 0 and 63."); + + new bool:success = NPC_OpenNode(nodeid); + + SendClientMessage(playerid, 0x00FF00FF, "Open node %d: %s", nodeid, success ? "Success" : "Failed"); + return 1; + } + return 0; +} +``` + +## Notes + +- Node IDs range from 0 to 63 +- Nodes must be opened before NPCs can use them for navigation +- Opening a node loads its data and makes it accessible +- Use NPC_IsNodeOpen to check if a node is already open + +## Related Functions + +- [NPC_CloseNode](NPC_CloseNode): Close a node +- [NPC_IsNodeOpen](NPC_IsNodeOpen): Check if node is open +- [NPC_PlayNode](NPC_PlayNode): Make NPC play a node +- [NPC_GetNodeInfo](NPC_GetNodeInfo): Get node information + +## Related Callbacks + +_No specific callbacks are triggered by this function._ diff --git a/frontend/docs/scripting/functions/NPC_PausePlayback.md b/frontend/docs/scripting/functions/NPC_PausePlayback.md new file mode 100644 index 00000000000..7966548e7ae --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_PausePlayback.md @@ -0,0 +1,62 @@ +--- +title: NPC_PausePlayback +sidebar_label: NPC_PausePlayback +description: Pauses or unpauses an NPC's recording playback. +tags: ["npc", "recording", "playback"] +--- + + + +## Description + +Pauses or unpauses an NPC's recording playback. + +| Name | Description | +| ----- | ------------------------------------------ | +| npcid | The ID of the NPC | +| pause | Whether to pause (true) or unpause (false) | + +## Returns + +Returns `true` if the operation was successful, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/pauseplayback ", true, 15)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new bool:pause = strval(cmdtext[15]) ? true : false; + + NPC_PausePlayback(npcid, pause); + SendClientMessage(playerid, 0x00FF00FF, "NPC %d playback %s.", npcid, pause ? "paused" : "resumed"); + return 1; + } + return 0; +} +``` + +## Notes + +- Only works when NPC is actively playing a recording +- Paused playback can be resumed by calling with pause = false +- Use NPC_IsPlaybackPaused to check current pause state + +## Related Functions + +- [NPC_IsPlaybackPaused](NPC_IsPlaybackPaused): Check if paused +- [NPC_StartPlayback](NPC_StartPlayback): Start playback +- [NPC_StopPlayback](NPC_StopPlayback): Stop playback +- [NPC_IsPlayingPlayback](NPC_IsPlayingPlayback): Check if playing + +## Related Callbacks + +_No specific callbacks are triggered by this function._ diff --git a/frontend/docs/scripting/functions/NPC_PausePlayingNode.md b/frontend/docs/scripting/functions/NPC_PausePlayingNode.md new file mode 100644 index 00000000000..87569b152ba --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_PausePlayingNode.md @@ -0,0 +1,60 @@ +--- +title: NPC_PausePlayingNode +sidebar_label: NPC_PausePlayingNode +description: Pauses an NPC's node navigation. +tags: ["npc", "node", "navigation"] +--- + + + +## Description + +Pauses an NPC's node navigation, temporarily stopping their movement through the node. + +| Name | Description | +| ----- | ----------------- | +| npcid | The ID of the NPC | + +## Returns + +Returns `true` if the operation was successful, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/npcpausenode", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new bool:success = NPC_PausePlayingNode(npcid); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d pause node: %s", npcid, success ? "Success" : "Failed"); + return 1; + } + return 0; +} +``` + +## Notes + +- Only works when NPC is actively playing a node +- Paused node navigation can be resumed with NPC_ResumePlayingNode +- Use NPC_IsPlayingNodePaused to check pause state + +## Related Functions + +- [NPC_ResumePlayingNode](NPC_ResumePlayingNode): Resume node playing +- [NPC_IsPlayingNodePaused](NPC_IsPlayingNodePaused): Check if paused +- [NPC_PlayNode](NPC_PlayNode): Start playing node +- [NPC_StopPlayingNode](NPC_StopPlayingNode): Stop playing node + +## Related Callbacks + +_No specific callbacks are triggered by this function._ diff --git a/frontend/docs/scripting/functions/NPC_PlayNode.md b/frontend/docs/scripting/functions/NPC_PlayNode.md new file mode 100644 index 00000000000..45018d86fdd --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_PlayNode.md @@ -0,0 +1,77 @@ +--- +title: NPC_PlayNode +sidebar_label: NPC_PlayNode +description: Makes an NPC navigate through predefined navigation nodes. +tags: ["npc", "node", "navigation"] +--- + + + +## Description + +Makes an NPC navigate through predefined navigation nodes using the game's built-in navigation system. + +| Name | Description | +| ------------- | ---------------------------------------------------------------------- | +| npcid | The ID of the NPC | +| nodeId | The ID of the node to navigate | +| moveType | Movement type (default: NPC_MOVE_TYPE_JOG) | +| Float:speed | Movement speed (default: NPC_MOVE_SPEED_AUTO) | +| Float:radius | Radius around nodes to consider as reached (default: 0.0) | +| bool:setangle | Whether to update NPC's facing angle during navigation (default: true) | + +## Returns + +Returns `true` if the NPC started playing the node, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/npcplaynode ", true, 13)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new nodeid = strval(cmdtext[13]); + + if (nodeid < 0 || nodeid > 63) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid node ID. Must be between 0 and 63."); + + new bool:success = NPC_PlayNode(npcid, nodeid, NPC_MOVE_TYPE_JOG, NPC_MOVE_SPEED_AUTO, 0.0, true); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d play node %d: %s", npcid, nodeid, success ? "Success" : "Failed"); + return 1; + } + return 0; +} +``` + +## Notes + +- Nodes are predefined navigation points from the game's node files (IDs 0-63) +- The node must be opened with `NPC_OpenNode` before it can be used +- The NPC will automatically navigate between points within the specified node +- Use `setAngle` parameter to control whether the NPC rotates to face movement direction +- The `radius` parameter determines how close the NPC needs to get to each point +- Node navigation can be paused, resumed, or stopped using related functions + +## Related Functions + +- [NPC_StopPlayingNode](NPC_StopPlayingNode): Stop NPC node navigation +- [NPC_PausePlayingNode](NPC_PausePlayingNode): Pause NPC node navigation +- [NPC_ResumePlayingNode](NPC_ResumePlayingNode): Resume paused node navigation +- [NPC_IsPlayingNode](NPC_IsPlayingNode): Check if NPC is navigating a node +- [NPC_ChangeNode](NPC_ChangeNode): Change to a different node during navigation +- [NPC_OpenNode](NPC_OpenNode): Open a node for use + +## Related Callbacks + +- [OnNPCFinishNode](../callbacks/OnNPCFinishNode): Called when NPC finishes navigating a node +- [OnNPCFinishNodePoint](../callbacks/OnNPCFinishNodePoint): Called when NPC reaches a point within a node +- [OnNPCChangeNode](../callbacks/OnNPCChangeNode): Called when NPC changes from one node to another diff --git a/frontend/docs/scripting/functions/NPC_PutInVehicle.md b/frontend/docs/scripting/functions/NPC_PutInVehicle.md new file mode 100644 index 00000000000..69738cf7f0a --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_PutInVehicle.md @@ -0,0 +1,77 @@ +--- +title: NPC_PutInVehicle +sidebar_label: NPC_PutInVehicle +description: Puts an NPC into a vehicle at a specific seat. +tags: ["npc", "vehicle"] +--- + + + +## Description + +Puts an NPC into a vehicle at a specific seat. + +| Name | Description | +| --------- | ----------------------------- | +| npcid | The ID of the NPC | +| vehicleid | The ID of the vehicle | +| seatid | The seat ID to put the NPC in | + +## Returns + +Returns `true` if the NPC was put in the vehicle successfully, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/npcputinvehicle", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new vehicleid = GetPlayerVehicleID(playerid); + if (vehicleid == 0) + return SendClientMessage(playerid, 0xFF0000FF, "You are not in a vehicle."); + + new bool:success = NPC_PutInVehicle(npcid, vehicleid, 1); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d put in vehicle %d (seat 1): %s", npcid, vehicleid, success ? "Success" : "Failed"); + return 1; + } + return 0; +} +``` + +## Seat IDs + +| ID | Seat | +| --- | ---------------------------- | +| 0 | Driver | +| 1 | Front passenger | +| 2 | Back-left passenger | +| 3 | Back-right passenger | +| 4+ | Passenger seats (coach etc.) | + +## Notes + +- NPC will instantly appear in the vehicle without enter animation +- Use NPC_GetVehicleID to check which vehicle an NPC is in +- Seat 0 is always the driver seat +- Maximum seat ID depends on the vehicle model + +## Related Functions + +- [NPC_RemoveFromVehicle](NPC_RemoveFromVehicle): Remove NPC from vehicle +- [NPC_GetVehicleID](NPC_GetVehicleID): Get NPC's vehicle +- [NPC_GetVehicleSeat](NPC_GetVehicleSeat): Get NPC's seat +- [NPC_EnterVehicle](NPC_EnterVehicle): Make NPC enter with animation + +## Related Callbacks + +_No specific callbacks are triggered by this function._ diff --git a/frontend/docs/scripting/functions/NPC_RemoveFromVehicle.md b/frontend/docs/scripting/functions/NPC_RemoveFromVehicle.md new file mode 100644 index 00000000000..b466dcf54b6 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_RemoveFromVehicle.md @@ -0,0 +1,61 @@ +--- +title: NPC_RemoveFromVehicle +sidebar_label: NPC_RemoveFromVehicle +description: Removes an NPC from their current vehicle. +tags: ["npc", "vehicle"] +--- + + + +## Description + +Removes an NPC from their current vehicle. + +| Name | Description | +| ----- | ----------------- | +| npcid | The ID of the NPC | + +## Returns + +Returns `true` if the NPC was removed from the vehicle, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/npcremovefromvehicle", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new bool:success = NPC_RemoveFromVehicle(npcid); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d removed from vehicle: %s", npcid, success ? "Success" : "Failed"); + return 1; + } + return 0; +} +``` + +## Notes + +- NPC will instantly appear outside the vehicle without exit animation +- Use NPC_ExitVehicle for animated exit +- Returns false if NPC is not in a vehicle +- NPC position will be set near the vehicle + +## Related Functions + +- [NPC_PutInVehicle](NPC_PutInVehicle): Put NPC in vehicle +- [NPC_ExitVehicle](NPC_ExitVehicle): Make NPC exit with animation +- [NPC_GetVehicleID](NPC_GetVehicleID): Get NPC's vehicle +- [NPC_GetVehicleSeat](NPC_GetVehicleSeat): Get NPC's seat + +## Related Callbacks + +_No specific callbacks are triggered by this function._ diff --git a/frontend/docs/scripting/functions/NPC_RemovePointFromPath.md b/frontend/docs/scripting/functions/NPC_RemovePointFromPath.md new file mode 100644 index 00000000000..0af092c542d --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_RemovePointFromPath.md @@ -0,0 +1,76 @@ +--- +title: NPC_RemovePointFromPath +sidebar_label: NPC_RemovePointFromPath +description: Removes a waypoint from an NPC path. +tags: ["npc", "path"] +--- + + + +## Description + +Removes a waypoint from an NPC path. + +| Name | Description | +| ----------- | -------------------------------- | +| pathid | The ID of the path | +| point_index | The index of the point to remove | + +## Returns + +Returns `true` on success, `false` on failure. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strncmp(cmdtext, "/removepatrolpoint ", 19, true)) + { + if (!NPC_IsValidPath(PlayerPatrolPath[playerid])) + { + SendClientMessage(playerid, 0xFF0000FF, "No valid patrol path. Use /createpatrol first."); + return 1; + } + + new pointIndex = strval(cmdtext[19]); + new totalPoints = NPC_GetPathPointCount(PlayerPatrolPath[playerid]); + + if (pointIndex < 0 || pointIndex >= totalPoints) + { + SendClientMessage(playerid, 0xFF0000FF, "Invalid point index. Valid range: 0-%d", totalPoints - 1); + return 1; + } + + if (NPC_RemovePointFromPath(PlayerPatrolPath[playerid], pointIndex)) + { + SendClientMessage(playerid, 0x00FF00FF, "Removed point %d from path %d (now has %d points)", pointIndex, PlayerPatrolPath[playerid], totalPoints - 1); + } + else + { + SendClientMessage(playerid, 0xFF0000FF, "Failed to remove point %d from path", pointIndex); + } + return 1; + } + return 0; +} +``` + +## Notes + +- Point indices start at 0 +- Removing a point will shift all subsequent points down by one index +- If the specified index is out of bounds, the function will return `false` +- You cannot remove points from an invalid path + +## Related Functions + +- [NPC_AddPointToPath](NPC_AddPointToPath): Add a point to a path +- [NPC_ClearPath](NPC_ClearPath): Clear all points from a path +- [NPC_GetPathPointCount](NPC_GetPathPointCount): Get number of points in a path +- [NPC_GetPathPoint](NPC_GetPathPoint): Get information about a path point + +## Related Callbacks + +- [OnNPCFinishMovePath](../callbacks/OnNPCFinishMovePath): Called when NPC finishes moving along a path +- [OnNPCFinishMove](../callbacks/OnNPCFinishMove): Called when NPC finishes any movement diff --git a/frontend/docs/scripting/functions/NPC_ResetAnimation.md b/frontend/docs/scripting/functions/NPC_ResetAnimation.md new file mode 100644 index 00000000000..af348a014cd --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_ResetAnimation.md @@ -0,0 +1,56 @@ +--- +title: NPC_ResetAnimation +sidebar_label: NPC_ResetAnimation +description: Resets an NPC's current animation to default. +tags: ["npc", "animation"] +--- + + + +## Description + +Resets an NPC's current animation to the default state. + +| Name | Description | +| ----- | ----------------- | +| npcid | The ID of the NPC | + +## Returns + +Returns `true` if the operation was successful, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/resetanim", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + NPC_ResetAnimation(npcid); + SendClientMessage(playerid, 0x00FF00FF, "NPC %d animation has been reset.", npcid); + + return 1; + } + return 0; +} +``` + +## Notes + +- Stops all current animations and returns NPC to idle state +- Equivalent to calling NPC_ClearAnimations + +## Related Functions + +- [NPC_ApplyAnimation](NPC_ApplyAnimation): Apply animation to NPC +- [NPC_ClearAnimations](NPC_ClearAnimations): Clear all animations +- [NPC_SetAnimation](NPC_SetAnimation): Set specific animation +- [NPC_GetAnimation](NPC_GetAnimation): Get current animation + +## Related Callbacks + +_No specific callbacks are triggered by this function._ diff --git a/frontend/docs/scripting/functions/NPC_ResetSurfingData.md b/frontend/docs/scripting/functions/NPC_ResetSurfingData.md new file mode 100644 index 00000000000..229a0c2f1b1 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_ResetSurfingData.md @@ -0,0 +1,61 @@ +--- +title: NPC_ResetSurfingData +sidebar_label: NPC_ResetSurfingData +description: Resets all surfing data for an NPC. +tags: ["npc", "surfing"] +--- + + + +## Description + +Resets all surfing data for an NPC. + +| Name | Description | +| ----- | ----------------- | +| npcid | The ID of the NPC | + +## Returns + +Returns `true` if the operation was successful, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/resetsurfing", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + NPC_ResetSurfingData(npcid); + SendClientMessage(playerid, 0x00FF00FF, "NPC %d surfing data has been reset.", npcid); + return 1; + } + return 0; +} +``` + +## Notes + +- This function clears all surfing-related data for an NPC, including the surfing object/vehicle and offset +- The NPC will no longer be attached to any surface after calling this function +- The NPC's position is not changed, only its surfing state is reset + +## Related Functions + +- [NPC_SetSurfingObject](NPC_SetSurfingObject): Sets the object an NPC is surfing on +- [NPC_SetSurfingVehicle](NPC_SetSurfingVehicle): Sets the vehicle an NPC is surfing on +- [NPC_SetSurfingPlayerObject](NPC_SetSurfingPlayerObject): Sets the player object an NPC is surfing on +- [NPC_SetSurfingOffset](NPC_SetSurfingOffset): Sets the surfing offset for an NPC +- [NPC_GetSurfingObject](NPC_GetSurfingObject): Gets the object an NPC is surfing on +- [NPC_GetSurfingVehicle](NPC_GetSurfingVehicle): Gets the vehicle an NPC is surfing on + +## Related Callbacks + +_No specific callbacks are triggered by this function._ diff --git a/frontend/docs/scripting/functions/NPC_Respawn.md b/frontend/docs/scripting/functions/NPC_Respawn.md new file mode 100644 index 00000000000..944bd6ac372 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_Respawn.md @@ -0,0 +1,72 @@ +--- +title: NPC_Respawn +sidebar_label: NPC_Respawn +description: Respawns an NPC to their spawn position, resetting their state. +tags: ["npc", "spawn", "respawn"] +--- + + + +## Description + +Respawns an NPC to their spawn position, resetting their state. + +| Name | Description | +| ----- | ------------------ | +| npcid | The ID of the NPC. | + +## Returns + +Returns `true` if the operation was successful, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/respawnnpc", true)) + { + new npcid = PlayerNPC[playerid]; + + if (!NPC_IsValid(npcid)) + { + SendClientMessage(playerid, 0xFF0000FF, "You don't have a valid NPC to respawn."); + return 1; + } + + if (NPC_Respawn(npcid)) + { + SendClientMessage(playerid, 0x00FF00FF, "Your NPC (ID %d) has been respawned.", npcid); + } + else + { + SendClientMessage(playerid, 0xFF0000FF, "Failed to respawn your NPC (ID %d).", npcid); + } + + return 1; + } + return 0; +} +``` + +## Notes + +:::warning + +- Resets NPC health, position, and state. +- NPC returns to their original spawn coordinates. +- All current activities (movement, combat) are stopped. + +::: + +## Related Functions + +- [NPC_Spawn](NPC_Spawn): Initial spawn of NPC. +- [NPC_SetPos](NPC_SetPos): Set NPC position. +- [NPC_GetHealth](NPC_GetHealth): Get NPC health. +- [NPC_IsDead](NPC_IsDead): Check if NPC is dead. + +## Related Callbacks + +- [OnNPCSpawn](../callbacks/OnNPCSpawn): Called when NPC spawns. +- [OnNPCRespawn](../callbacks/OnNPCRespawn): Called when NPC respawns. diff --git a/frontend/docs/scripting/functions/NPC_ResumePlayingNode.md b/frontend/docs/scripting/functions/NPC_ResumePlayingNode.md new file mode 100644 index 00000000000..4747f3cd77f --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_ResumePlayingNode.md @@ -0,0 +1,59 @@ +--- +title: NPC_ResumePlayingNode +sidebar_label: NPC_ResumePlayingNode +description: Resumes paused node navigation for an NPC. +tags: ["npc", "node"] +--- + + + +## Description + +Resumes paused node navigation for an NPC. + +| Name | Description | +| ----- | ----------------- | +| npcid | The ID of the NPC | + +## Returns + +Returns `true` if the operation was successful, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/npcresumenode", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new bool:success = NPC_ResumePlayingNode(npcid); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d resume node: %s", npcid, success ? "Success" : "Failed"); + return 1; + } + return 0; +} +``` + +## Notes + +- Only works if the NPC's node navigation was previously paused +- The NPC will continue from where it was paused + +## Related Functions + +- [NPC_PausePlayingNode](NPC_PausePlayingNode): Pause node navigation +- [NPC_PlayNode](NPC_PlayNode): Start playing a node +- [NPC_IsPlayingNodePaused](NPC_IsPlayingNodePaused): Check if paused +- [NPC_IsPlayingNode](NPC_IsPlayingNode): Check if playing node + +## Related Callbacks + +- [OnNPCFinishNode](../callbacks/OnNPCFinishNode): Called when NPC finishes a node diff --git a/frontend/docs/scripting/functions/NPC_SetAmmo.md b/frontend/docs/scripting/functions/NPC_SetAmmo.md new file mode 100644 index 00000000000..4c397a89c71 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_SetAmmo.md @@ -0,0 +1,65 @@ +--- +title: NPC_SetAmmo +sidebar_label: NPC_SetAmmo +description: Sets the ammunition count for an NPC's current weapon. +tags: ["npc", "weapon", "ammo", "ammunition"] +--- + + + +## Description + +Sets the ammunition count for an NPC's current weapon. + +| Name | Description | +| ----- | ------------------------------- | +| npcid | The ID of the NPC | +| ammo | The amount of ammunition to set | + +## Returns + +Returns `true` if the ammo was set successfully, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/setammo ", true, 9)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new ammo = strval(cmdtext[9]); + if (ammo < 0) + return SendClientMessage(playerid, 0xFF0000FF, "Ammo must be positive."); + + NPC_SetAmmo(npcid, ammo); + SendClientMessage(playerid, 0x00FF00FF, "NPC %d ammo set to %d", npcid, ammo); + + return 1; + } + return 0; +} +``` + +## Notes + +- Setting ammo to 0 makes the weapon unusable +- Different weapons have different maximum ammo capacities +- This sets total ammunition, not just the current clip + +## Related Functions + +- [NPC_GetAmmo](NPC_GetAmmo): Get NPC ammunition +- [NPC_SetAmmoInClip](NPC_SetAmmoInClip): Set ammunition in current clip +- [NPC_GetAmmoInClip](NPC_GetAmmoInClip): Get ammunition in current clip +- [NPC_EnableInfiniteAmmo](NPC_EnableInfiniteAmmo): Enable infinite ammunition + +## Related Callbacks + +_No specific callbacks are triggered by this function._ diff --git a/frontend/docs/scripting/functions/NPC_SetAmmoInClip.md b/frontend/docs/scripting/functions/NPC_SetAmmoInClip.md new file mode 100644 index 00000000000..94668d2abc0 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_SetAmmoInClip.md @@ -0,0 +1,66 @@ +--- +title: NPC_SetAmmoInClip +sidebar_label: NPC_SetAmmoInClip +description: Sets the amount of ammo in an NPC's weapon clip. +tags: ["npc", "weapon", "ammo"] +--- + + + +## Description + +Sets the amount of ammo in an NPC's weapon clip. + +| Name | Description | +| ----- | ------------------------- | +| npcid | The ID of the NPC | +| ammo | The amount of ammo to set | + +## Returns + +Returns `true` if the operation was successful, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/setammoclip ", true, 13)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new ammo = strval(cmdtext[13]); + if (ammo < 0) + return SendClientMessage(playerid, 0xFF0000FF, "Ammo must be positive."); + + NPC_SetAmmoInClip(npcid, ammo); + SendClientMessage(playerid, 0x00FF00FF, "NPC %d clip ammo set to %d", npcid, ammo); + + return 1; + } + return 0; +} +``` + +## Notes + +- Amount cannot exceed the weapon's maximum clip size +- Setting to 0 will require the NPC to reload before shooting +- Use NPC_GetAmmoInClip to check current clip amount +- Affects only the current weapon's clip, not total ammo + +## Related Functions + +- [NPC_GetAmmoInClip](NPC_GetAmmoInClip): Get ammo in clip +- [NPC_GetWeaponClipSize](NPC_GetWeaponClipSize): Get max clip size +- [NPC_GiveWeapon](NPC_GiveWeapon): Give weapon to NPC +- [NPC_GetAmmo](NPC_GetAmmo): Get total ammo + +## Related Callbacks + +- [OnNPCWeaponShot](../callbacks/OnNPCWeaponShot): Called when NPC shoots diff --git a/frontend/docs/scripting/functions/NPC_SetAngleToPlayer.md b/frontend/docs/scripting/functions/NPC_SetAngleToPlayer.md new file mode 100644 index 00000000000..e9fe0d35c1c --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_SetAngleToPlayer.md @@ -0,0 +1,63 @@ +--- +title: NPC_SetAngleToPlayer +sidebar_label: NPC_SetAngleToPlayer +description: Rotates an NPC to face a specific player. +tags: ["npc", "angle", "player"] +--- + + + +## Description + +Rotates an NPC to face a specific player by using the player's current position. + +| Name | Description | +| -------- | ----------- | +| npcid | The ID of the NPC. | +| playerid | The ID of the player that the NPC should face. | + +## Returns + +Returns `true` if the NPC was rotated successfully, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/lookatme", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + if (!IsPlayerConnected(playerid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid player."); + + NPC_SetAngleToPlayer(npcid, playerid); + SendClientMessage(playerid, 0x00FF00FF, "NPC %d is now facing you.", npcid); + return 1; + } + return 0; +} +``` + +## Notes + +:::warning + +- This function performs a single rotation; call it again to keep the NPC facing a moving player. +- The player must be connected, otherwise the NPC will not rotate. +- Internally uses [NPC_SetAngleToPos](NPC_SetAngleToPos) with the player's current position. + +::: + +## Related Functions + +- [NPC_SetAngleToPos](NPC_SetAngleToPos): Face a specific position. +- [NPC_SetFacingAngle](NPC_SetFacingAngle): Set a numeric angle. +- [NPC_GetFacingAngle](NPC_GetFacingAngle): Get the NPC's facing angle. +- [NPC_MoveToPlayer](NPC_MoveToPlayer): Move the NPC toward a player. diff --git a/frontend/docs/scripting/functions/NPC_SetAngleToPos.md b/frontend/docs/scripting/functions/NPC_SetAngleToPos.md new file mode 100644 index 00000000000..a6b94421442 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_SetAngleToPos.md @@ -0,0 +1,64 @@ +--- +title: NPC_SetAngleToPos +sidebar_label: NPC_SetAngleToPos +description: Rotates an NPC so it faces a specific world position. +tags: ["npc", "angle", "position"] +--- + + + +## Description + +Rotates an NPC so it faces a specific world position. + +| Name | Description | +| ------ | ----------- | +| npcid | The ID of the NPC. | +| Float:x | X coordinate of the target position. | +| Float:y | Y coordinate of the target position. | +| Float:z | Z coordinate of the target position. | + +## Returns + +Returns `true` if the NPC was rotated successfully, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/lookatpos", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new Float:x, Float:y, Float:z; + GetPlayerPos(playerid, x, y, z); + + NPC_SetAngleToPos(npcid, x + 3.0, y, z); + SendClientMessage(playerid, 0x00FF00FF, "NPC %d now faces %.2f, %.2f, %.2f", npcid, x + 3.0, y, z); + return 1; + } + return 0; +} +``` + +## Notes + +:::warning + +- Only the horizontal plane (X/Y) is considered when calculating the facing angle. +- The NPC will not move; it only rotates to face the position. + +::: + +## Related Functions + +- [NPC_SetFacingAngle](NPC_SetFacingAngle): Set an exact angle value. +- [NPC_SetAngleToPlayer](NPC_SetAngleToPlayer): Face a player automatically. +- [NPC_GetFacingAngle](NPC_GetFacingAngle): Get the NPC's current facing. +- [NPC_Move](NPC_Move): Move the NPC toward a position. diff --git a/frontend/docs/scripting/functions/NPC_SetAnimation.md b/frontend/docs/scripting/functions/NPC_SetAnimation.md new file mode 100644 index 00000000000..5cfa5bf32ed --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_SetAnimation.md @@ -0,0 +1,72 @@ +--- +title: NPC_SetAnimation +sidebar_label: NPC_SetAnimation +description: Sets an animation for an NPC by animation ID. +tags: ["npc", "animation"] +--- + + + +## Description + +Sets an animation for an NPC using animation ID. + +| Name | Description | +| ----------- | ------------------------------------------------- | +| npcid | The ID of the NPC | +| animationid | The animation ID to set | +| delta | Animation speed (typically 4.1) | +| loop | Whether the animation should loop | +| lockX | Lock movement on X axis during animation | +| lockY | Lock movement on Y axis during animation | +| freeze | Freeze the NPC after animation | +| time | Animation duration in milliseconds (0 = infinite) | + +## Returns + +Returns `true` if the operation was successful, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/setdance", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + NPC_SetAnimation(npcid, 405, 4.1, true, false, false, false, 0); + SendClientMessage(playerid, 0x00FF00FF, "NPC %d has been set to animate.", npcid); + + SetTimerEx("ClearNPCAnimations", 25000, false, "ii", playerid, npcid); + + return 1; + } + return 0; +} + +forward ClearNPCAnimations(playerid, npcid); +public ClearNPCAnimations(playerid, npcid) +{ + + NPC_ClearAnimations(npcid); + SendClientMessage(playerid, 0x00FF00FF, "NPC %d animations were cleared.", npcid); +} +``` + +## Notes + +- Animation IDs correspond to GTA San Andreas animation indices +- Use `NPC_ApplyAnimation` for animations by library and name + +## Related Functions + +- [NPC_ApplyAnimation](NPC_ApplyAnimation): Apply animation by name +- [NPC_ClearAnimations](NPC_ClearAnimations): Clear all animations +- [NPC_ResetAnimation](NPC_ResetAnimation): Reset to default stance + +## Related Callbacks + +- [OnNPCSpawn](../callbacks/OnNPCSpawn): Called when NPC spawns diff --git a/frontend/docs/scripting/functions/NPC_SetArmour.md b/frontend/docs/scripting/functions/NPC_SetArmour.md new file mode 100644 index 00000000000..177cececd7f --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_SetArmour.md @@ -0,0 +1,66 @@ +--- +title: NPC_SetArmour +sidebar_label: NPC_SetArmour +description: Sets an NPC's armour level. +tags: ["npc", "armour", "health"] +--- + + + +## Description + +Sets an NPC's armour level. + +| Name | Description | +| ------ | ----------------------------- | +| npcid | The ID of the NPC | +| armour | The armour amount (0.0-100.0) | + +## Returns + +Returns `true` if the armour was set successfully, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/setarmour ", true, 11)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new Float:armour = floatstr(cmdtext[11]); + if (armour < 0.0 || armour > 100.0) + return SendClientMessage(playerid, 0xFF0000FF, "Armour must be between 0.0 and 100.0."); + + NPC_SetArmour(npcid, armour); + SendClientMessage(playerid, 0x00FF00FF, "NPC %d armour set to %.1f", npcid, armour); + + return 1; + } + return 0; +} +``` + +## Notes + +- Armour value ranges from 0.0 (no armour) to 100.0 (full armour) +- Armour absorbs damage before health is affected +- Use NPC_GetArmour to check current armour level + +## Related Functions + +- [NPC_GetArmour](NPC_GetArmour): Get NPC's armour level +- [NPC_SetHealth](NPC_SetHealth): Set NPC's health +- [NPC_GetHealth](NPC_GetHealth): Get NPC's health +- [NPC_IsDead](NPC_IsDead): Check if NPC is dead + +## Related Callbacks + +- [OnNPCTakeDamage](../callbacks/OnNPCTakeDamage): Called when NPC takes damage +- [OnNPCDeath](../callbacks/OnNPCDeath): Called when NPC dies diff --git a/frontend/docs/scripting/functions/NPC_SetFacingAngle.md b/frontend/docs/scripting/functions/NPC_SetFacingAngle.md new file mode 100644 index 00000000000..21924dda6dc --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_SetFacingAngle.md @@ -0,0 +1,65 @@ +--- +title: NPC_SetFacingAngle +sidebar_label: NPC_SetFacingAngle +description: Sets an NPC's facing angle. +tags: ["npc", "angle", "rotation"] +--- + + + +## Description + +Sets an NPC's facing angle. + +| Name | Description | +| ----------- | ------------------------------------ | +| npcid | The ID of the NPC. | +| Float:angle | The facing angle in degrees (0-360). | + +## Returns + +Returns `true` if the facing angle was set successfully, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/setfacingangle ", true, 16)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new Float:angle = floatstr(cmdtext[16]); + if (angle < 0.0 || angle > 360.0) + return SendClientMessage(playerid, 0xFF0000FF, "Angle must be between 0.0 and 360.0."); + + NPC_SetFacingAngle(npcid, angle); + SendClientMessage(playerid, 0x00FF00FF, "NPC %d facing angle set to %.1f", npcid, angle); + + return 1; + } + return 0; +} +``` + +## Notes + +:::warning + +- Angle is measured in degrees (0-360). +- Use [NPC_GetFacingAngle](NPC_GetFacingAngle) to get current facing angle. +- Instantly rotates NPC without animation. + +::: + +## Related Functions + +- [NPC_GetFacingAngle](NPC_GetFacingAngle): Get NPC's facing angle. +- [NPC_SetRot](NPC_SetRot): Set NPC rotation (X, Y, Z). +- [NPC_GetRot](NPC_GetRot): Get NPC rotation. +- [NPC_SetPos](NPC_SetPos): Set NPC position. diff --git a/frontend/docs/scripting/functions/NPC_SetFightingStyle.md b/frontend/docs/scripting/functions/NPC_SetFightingStyle.md new file mode 100644 index 00000000000..fc2496a6c62 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_SetFightingStyle.md @@ -0,0 +1,70 @@ +--- +title: NPC_SetFightingStyle +sidebar_label: NPC_SetFightingStyle +description: Sets an NPC's fighting style for melee combat. +tags: ["npc", "combat", "fighting", "melee"] +--- + + + +## Description + +Sets an NPC's fighting style for melee combat. + +| Name | Description | +| ----- | --------------------- | +| npcid | The ID of the NPC | +| style | The fighting style ID | + +## Returns + +Returns `true` if the operation was successful, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/setfightingstyle ", true, 18)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new styleid = strval(cmdtext[18]); + // Valid fighting styles: 4, 5, 6, 7, 15, 16 + if (styleid != 4 && styleid != 5 && styleid != 6 && styleid != 7 && styleid != 15 && styleid != 16) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid style. Valid: 4(Normal), 5(Boxing), 6(KungFu), 7(KneeHead), 15(GrabKick), 16(Elbow)"); + + NPC_SetFightingStyle(npcid, FIGHT_STYLE:styleid); + SendClientMessage(playerid, 0x00FF00FF, "NPC %d fighting style set to %d", npcid, styleid); + + return 1; + } + return 0; +} +``` + +## Notes + +- Fighting styles affect melee attack animations and damage +- Use NPC_GetFightingStyle to check current style +- Style affects both attack animations and combat effectiveness + +## Related Functions + +- [NPC_GetFightingStyle](NPC_GetFightingStyle): Get fighting style +- [NPC_MeleeAttack](NPC_MeleeAttack): Make NPC attack +- [NPC_IsMeleeAttacking](NPC_IsMeleeAttacking): Check if attacking +- [NPC_StopMeleeAttack](NPC_StopMeleeAttack): Stop attacking + +## Related Resources + +- [Fighting Styles](../resources/fightingstyles) + +## Related Callbacks + +- [OnNPCGiveDamage](../callbacks/OnNPCGiveDamage): Called when NPC damages someone diff --git a/frontend/docs/scripting/functions/NPC_SetHealth.md b/frontend/docs/scripting/functions/NPC_SetHealth.md new file mode 100644 index 00000000000..65f434a239e --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_SetHealth.md @@ -0,0 +1,67 @@ +--- +title: NPC_SetHealth +sidebar_label: NPC_SetHealth +description: Sets the health value of an NPC. +tags: ["npc", "health"] +--- + + + +## Description + +Sets the health value of an NPC. + +| Name | Description | +| ------ | ----------------------- | +| npcid | The ID of the NPC | +| health | The health value to set | + +## Returns + +Returns `true` if the health was set successfully, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/sethealth ", true, 11)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new Float:health = floatstr(cmdtext[11]); + if (health < 0.0 || health > 100.0) + return SendClientMessage(playerid, 0xFF0000FF, "Health must be between 0.0 and 100.0."); + + NPC_SetHealth(npcid, health); + SendClientMessage(playerid, 0x00FF00FF, "NPC %d health set to %.1f", npcid, health); + + return 1; + } + return 0; +} +``` + +## Notes + +- Health values typically range from 0.0 to 100.0, but can be set higher +- Setting health to 0.0 will kill the NPC +- NPCs spawn with 100.0 health by default + +## Related Functions + +- [NPC_GetHealth](NPC_GetHealth): Get NPC health +- [NPC_SetArmour](NPC_SetArmour): Set NPC armour +- [NPC_GetArmour](NPC_GetArmour): Get NPC armour +- [NPC_IsDead](NPC_IsDead): Check if NPC is dead +- [NPC_SetInvulnerable](NPC_SetInvulnerable): Make NPC invulnerable + +## Related Callbacks + +- [OnNPCTakeDamage](../callbacks/OnNPCTakeDamage): Called when NPC takes damage +- [OnNPCDeath](../callbacks/OnNPCDeath): Called when NPC dies diff --git a/frontend/docs/scripting/functions/NPC_SetInterior.md b/frontend/docs/scripting/functions/NPC_SetInterior.md new file mode 100644 index 00000000000..1326a28a1b1 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_SetInterior.md @@ -0,0 +1,64 @@ +--- +title: NPC_SetInterior +sidebar_label: NPC_SetInterior +description: Sets the interior of an NPC. +tags: ["npc", "interior"] +--- + + + +## Description + +Sets the interior of an NPC. + +| Name | Description | +| ---------- | ---------------------- | +| npcid | The ID of the NPC | +| interiorid | The interior ID to set | + +## Returns + +Returns `true` if the operation was successful, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/setinterior ", true, 13)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new interiorid = strval(cmdtext[13]); + if (interiorid < 0 || interiorid > 255) + return SendClientMessage(playerid, 0xFF0000FF, "Interior ID must be between 0 and 255."); + + NPC_SetInterior(npcid, interiorid); + SendClientMessage(playerid, 0x00FF00FF, "NPC %d interior set to %d", npcid, interiorid); + + return 1; + } + return 0; +} +``` + +## Notes + +- Interior 0 is the main world (outside) +- Make sure to set appropriate coordinates for each interior + +## Related Functions + +- [NPC_GetInterior](NPC_GetInterior): Get NPC interior +- [NPC_SetVirtualWorld](NPC_SetVirtualWorld): Set NPC virtual world +- [NPC_GetVirtualWorld](NPC_GetVirtualWorld): Get NPC virtual world +- [NPC_SetPos](NPC_SetPos): Set NPC position + +## Related Callbacks + +- [OnNPCSpawn](../callbacks/OnNPCSpawn): Called when NPC spawns diff --git a/frontend/docs/scripting/functions/NPC_SetInvulnerable.md b/frontend/docs/scripting/functions/NPC_SetInvulnerable.md new file mode 100644 index 00000000000..e540a0146a0 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_SetInvulnerable.md @@ -0,0 +1,64 @@ +--- +title: NPC_SetInvulnerable +sidebar_label: NPC_SetInvulnerable +description: Sets whether an NPC is invulnerable to damage. +tags: ["npc", "invulnerable", "damage", "protection"] +--- + + + +## Description + +Sets whether an NPC is invulnerable to damage. + +| Name | Description | +| ------ | --------------------------------------------------- | +| npcid | The ID of the NPC | +| toggle | true to make invulnerable, false to make vulnerable | + +## Returns + +Returns `true` if the invulnerability was set successfully, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/toggleinvulnerable", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new bool:invulnerable = NPC_IsInvulnerable(npcid); + NPC_SetInvulnerable(npcid, !invulnerable); + SendClientMessage(playerid, 0x00FF00FF, "NPC %d invulnerable: %s", npcid, !invulnerable ? "Enabled" : "Disabled"); + + return 1; + } + return 0; +} + +``` + +## Notes + +- Invulnerable NPCs will not take any damage from weapons, explosions, or other damage sources +- This setting persists until changed or the NPC is destroyed +- Invulnerable NPCs can still be moved, teleported, or have their animations changed + +## Related Functions + +- [NPC_IsInvulnerable](NPC_IsInvulnerable): Check if an NPC is invulnerable +- [NPC_SetHealth](NPC_SetHealth): Set NPC health +- [NPC_GetHealth](NPC_GetHealth): Get NPC health +- [NPC_SetArmour](NPC_SetArmour): Set NPC armour + +## Related Callbacks + +- [OnNPCTakeDamage](../callbacks/OnNPCTakeDamage): Called when NPC takes damage (not called for invulnerable NPCs) +- [OnNPCDeath](../callbacks/OnNPCDeath): Called when NPC dies (invulnerable NPCs cannot die) diff --git a/frontend/docs/scripting/functions/NPC_SetKeys.md b/frontend/docs/scripting/functions/NPC_SetKeys.md new file mode 100644 index 00000000000..49bf554cda5 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_SetKeys.md @@ -0,0 +1,94 @@ +--- +title: NPC_SetKeys +sidebar_label: NPC_SetKeys +description: Sets the key states for an NPC. +tags: ["npc", "keys", "input"] +--- + + + +## Description + +Sets the key states for an NPC, simulating key presses. + +| Name | Description | +| ------------ | -------------------------- | +| npcid | The ID of the NPC | +| upAndDown | Up/down key state | +| leftAndRight | Left/right key state | +| keys | The key combination to set | + +## Returns + +Returns `true` if the operation was successful, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/setkeys ", true, 9)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new idx = 9; + new keys = 0, updown = 0, leftright = 0; + + // Parse keys + while (cmdtext[idx] == ' ') idx++; + if (cmdtext[idx] == '\0') + return SendClientMessage(playerid, 0xFF0000FF, "Usage: /setkeys [keys] [updown] [leftright]"); + keys = strval(cmdtext[idx]); + + // Skip to next parameter + while (cmdtext[idx] != ' ' && cmdtext[idx] != '\0') idx++; + while (cmdtext[idx] == ' ') idx++; + + // Parse updown if exists + if (cmdtext[idx] != '\0') + { + updown = strval(cmdtext[idx]); + while (cmdtext[idx] != ' ' && cmdtext[idx] != '\0') idx++; + while (cmdtext[idx] == ' ') idx++; + + // Parse leftright if exists + if (cmdtext[idx] != '\0') + { + leftright = strval(cmdtext[idx]); + } + } + + NPC_SetKeys(npcid, keys, updown, leftright); + SendClientMessage(playerid, 0x00FF00FF, "NPC %d keys: keys=%d, ud=%d, lr=%d", npcid, keys, updown, leftright); + + return 1; + } + return 0; +} +``` + +## Notes + +- Keys affect NPC behavior in vehicles and on foot +- Use NPC_GetKeys to check current key states +- Key states persist until changed or NPC state resets + +## Related Functions + +- [NPC_GetKeys](NPC_GetKeys): Get NPC's key states +- [NPC_PutInVehicle](NPC_PutInVehicle): Put NPC in vehicle +- [NPC_Move](NPC_Move): Make NPC move to position +- [NPC_StopMove](NPC_StopMove): Stop NPC movement + +## Related Resources + +- [Keys](../resources/keys) + +## Related Callbacks + +_No specific callbacks are triggered by this function._ diff --git a/frontend/docs/scripting/functions/NPC_SetNodePoint.md b/frontend/docs/scripting/functions/NPC_SetNodePoint.md new file mode 100644 index 00000000000..4032a73753a --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_SetNodePoint.md @@ -0,0 +1,68 @@ +--- +title: NPC_SetNodePoint +sidebar_label: NPC_SetNodePoint +description: Sets a point in an NPC node. +tags: ["npc", "node", "navigation"] +--- + + + +## Description + +Sets the current point index for an NPC node. + +| Name | Description | +| ------- | --------------------------- | +| nodeid | The ID of the node | +| pointid | The point index in the node | + +## Returns + +Returns `true` if the point was set successfully, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/npcsetnodepoint ", true, 17)) + { + new nodeid = strval(cmdtext[17]); + + if (nodeid < 0 || nodeid > 63) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid node ID. Must be between 0 and 63."); + + new idx = 17; + while (cmdtext[idx] != ' ' && cmdtext[idx] != '\0') idx++; + while (cmdtext[idx] == ' ') idx++; + + if (cmdtext[idx] == '\0') + return SendClientMessage(playerid, 0xFF0000FF, "Usage: /npcsetnodepoint [nodeid] [pointid]"); + + new pointid = strval(cmdtext[idx]); + + new bool:success = NPC_SetNodePoint(nodeid, pointid); + + SendClientMessage(playerid, 0x00FF00FF, "Set node %d to point %d: %s", nodeid, pointid, success ? "Success" : "Failed"); + return 1; + } + return 0; +} +``` + +## Notes + +- Node must be opened before setting points +- Point indices typically start from 0 +- Use NPC_GetNodePointPosition to retrieve point coordinates + +## Related Functions + +- [NPC_OpenNode](NPC_OpenNode): Open node for editing +- [NPC_GetNodePointPosition](NPC_GetNodePointPosition): Get point coordinates +- [NPC_GetNodePointCount](NPC_GetNodePointCount): Get point count +- [NPC_UpdateNodePoint](NPC_UpdateNodePoint): Update existing point + +## Related Callbacks + +_No specific callbacks are triggered by this function._ diff --git a/frontend/docs/scripting/functions/NPC_SetPos.md b/frontend/docs/scripting/functions/NPC_SetPos.md new file mode 100644 index 00000000000..d82ec312a1a --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_SetPos.md @@ -0,0 +1,70 @@ +--- +title: NPC_SetPos +sidebar_label: NPC_SetPos +description: Sets the position of an NPC. +tags: ["npc", "position"] +--- + + + +## Description + +Sets the position of an NPC instantly without movement animation. + +| Name | Description | +| ------- | ------------------ | +| npcid | The ID of the NPC. | +| Float:x | The X coordinate. | +| Float:y | The Y coordinate. | +| Float:z | The Z coordinate. | + +## Returns + +Returns `true` on success, `false` on failure. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/setposhere", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new Float:x, Float:y, Float:z; + GetPlayerPos(playerid, x, y, z); + + NPC_SetPos(npcid, x + 2.0, y, z); + SendClientMessage(playerid, 0x00FF00FF, "NPC %d teleported to your position", npcid); + + return 1; + } + return 0; +} +``` + +## Notes + +:::warning + +- This function teleports the NPC instantly without animation +- Any current movement is stopped when setting position +- Use `NPC_Move` if you want the NPC to walk to a position + +::: + +## Related Functions + +- [NPC_GetPos](NPC_GetPos): Get NPC position. +- [NPC_Move](NPC_Move): Move NPC to position with animation. +- [NPC_SetRot](NPC_SetRot): Set NPC rotation. +- [NPC_SetFacingAngle](NPC_SetFacingAngle): Set NPC facing direction. + +## Related Callbacks + +- [OnNPCSpawn](../callbacks/OnNPCSpawn): Called when NPC spawns. diff --git a/frontend/docs/scripting/functions/NPC_SetRot.md b/frontend/docs/scripting/functions/NPC_SetRot.md new file mode 100644 index 00000000000..f95ee0dfc02 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_SetRot.md @@ -0,0 +1,68 @@ +--- +title: NPC_SetRot +sidebar_label: NPC_SetRot +description: Sets an NPC's rotation on all axes. +tags: ["npc", "rotation", "angle"] +--- + + + +## Description + +Sets an NPC's rotation on all three axes (X, Y, Z). + +| Name | Description | +| ------- | --------------------------- | +| npcid | The ID of the NPC. | +| Float:x | X-axis rotation in degrees. | +| Float:y | Y-axis rotation in degrees. | +| Float:z | Z-axis rotation in degrees. | + +## Returns + +Returns `true` if the operation was successful, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/setrandomrot", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new Float:x = float(random(360)); + new Float:y = float(random(360)); + new Float:z = float(random(360)); + + NPC_SetRot(npcid, x, y, z); + SendClientMessage(playerid, 0x00FF00FF, "NPC %d rotation randomized", npcid); + + return 1; + } + return 0; +} +``` + +## Notes + +:::warning + +- Rotation values are in degrees (0-360). +- Z-axis rotation affects facing direction (same as [NPC_SetFacingAngle](NPC_SetFacingAngle)). +- X and Y rotations can create tilted or upside-down NPCs. +- Use [NPC_GetRot](NPC_GetRot) to retrieve current rotation values. + +::: + +## Related Functions + +- [NPC_GetRot](NPC_GetRot): Get NPC rotation. +- [NPC_SetFacingAngle](NPC_SetFacingAngle): Set facing angle only. +- [NPC_GetFacingAngle](NPC_GetFacingAngle): Get facing angle. +- [NPC_SetPos](NPC_SetPos): Set NPC position. diff --git a/frontend/docs/scripting/functions/NPC_SetSkin.md b/frontend/docs/scripting/functions/NPC_SetSkin.md new file mode 100644 index 00000000000..f69cbdddc63 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_SetSkin.md @@ -0,0 +1,62 @@ +--- +title: NPC_SetSkin +sidebar_label: NPC_SetSkin +description: Sets an NPC's skin model. +tags: ["npc", "skin", "model"] +--- + + + +## Description + +Sets an NPC's skin model to change their appearance. + +| Name | Description | +| ----- | ------------------------ | +| npcid | The ID of the NPC | +| model | The skin model ID to set | + +## Returns + +Returns `true` if the skin was set successfully, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/setskin ", true, 9)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new skinid = strval(cmdtext[9]); + if (skinid < 0 || skinid > 311) + return SendClientMessage(playerid, 0xFF0000FF, "Skin ID must be between 0 and 311."); + + NPC_SetSkin(npcid, skinid); + SendClientMessage(playerid, 0x00FF00FF, "NPC %d skin set to %d", npcid, skinid); + + return 1; + } + return 0; +} +``` + +## Notes + +- Invalid skin IDs may cause visual glitches + +## Related Functions + +- [NPC_GetSkin](NPC_GetSkin): Get NPC's current skin +- [NPC_Spawn](NPC_Spawn): Spawn NPC with default skin +- [NPC_Create](NPC_Create): Create NPC + +## Related Callbacks + +- [OnNPCSpawn](../callbacks/OnNPCSpawn): Called when NPC spawns diff --git a/frontend/docs/scripting/functions/NPC_SetSpecialAction.md b/frontend/docs/scripting/functions/NPC_SetSpecialAction.md new file mode 100644 index 00000000000..b562e9d8516 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_SetSpecialAction.md @@ -0,0 +1,66 @@ +--- +title: NPC_SetSpecialAction +sidebar_label: NPC_SetSpecialAction +description: Sets an NPC's special action state. +tags: ["npc", "action", "special"] +--- + + + +## Description + +Sets an NPC's special action state, such as sitting, smoking, drinking, etc. + +| Name | Description | +| ------ | ---------------------------- | +| npcid | The ID of the NPC | +| action | The special action ID to set | + +## Returns + +Returns `true` if the operation was successful, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/setspecialaction ", true, 18)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new actionid = strval(cmdtext[18]); + + NPC_SetSpecialAction(npcid, SPECIAL_ACTION:actionid); + SendClientMessage(playerid, 0x00FF00FF, "NPC %d special action set to %d", npcid, actionid); + + return 1; + } + return 0; +} +``` + +## Notes + +- Use SPECIAL_ACTION_NONE to clear the current action +- Some actions may conflict with movement or other activities + +## Related Functions + +- [NPC_GetSpecialAction](NPC_GetSpecialAction): Get current special action +- [NPC_ApplyAnimation](NPC_ApplyAnimation): Apply custom animations +- [NPC_ClearAnimations](NPC_ClearAnimations): Clear animations +- [NPC_ResetAnimation](NPC_ResetAnimation): Reset to default + +## Related Resources + +- [Special Actions](../resources/specialactions) + +## Related Callbacks + +_No specific callbacks are triggered by this function._ diff --git a/frontend/docs/scripting/functions/NPC_SetSurfingObject.md b/frontend/docs/scripting/functions/NPC_SetSurfingObject.md new file mode 100644 index 00000000000..d9bf2732a59 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_SetSurfingObject.md @@ -0,0 +1,63 @@ +--- +title: NPC_SetSurfingObject +sidebar_label: NPC_SetSurfingObject +description: Sets the object an NPC is surfing on. +tags: ["npc", "surfing"] +--- + + + +## Description + +Sets the object an NPC is surfing on. + +| Name | Description | +| -------- | ----------------- | +| npcid | The ID of the NPC | +| objectid | The object ID | + +## Returns + +Returns `true` if the operation was successful, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/setsurfingobject ", true, 18)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new objectid = strval(cmdtext[18]); + + NPC_SetSurfingObject(npcid, objectid); + SendClientMessage(playerid, 0x00FF00FF, "NPC %d surfing object set to %d", npcid, objectid); + + return 1; + } + return 0; +} +``` + +## Notes + +- The NPC will move along with the object if it moves +- The object must exist for surfing to work properly + +## Related Functions + +- [NPC_GetSurfingObject](NPC_GetSurfingObject): Gets the object an NPC is surfing on +- [NPC_SetSurfingVehicle](NPC_SetSurfingVehicle): Sets the vehicle an NPC is surfing on +- [NPC_SetSurfingPlayerObject](NPC_SetSurfingPlayerObject): Sets the player object an NPC is surfing on +- [NPC_SetSurfingOffset](NPC_SetSurfingOffset): Sets the surfing offset for an NPC +- [NPC_ResetSurfingData](NPC_ResetSurfingData): Resets all surfing data for an NPC + +## Related Callbacks + +_No specific callbacks are triggered by this function._ diff --git a/frontend/docs/scripting/functions/NPC_SetSurfingOffsets.md b/frontend/docs/scripting/functions/NPC_SetSurfingOffsets.md new file mode 100644 index 00000000000..a5e3e6b040a --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_SetSurfingOffsets.md @@ -0,0 +1,90 @@ +--- +title: NPC_SetSurfingOffset +sidebar_label: NPC_SetSurfingOffset +description: Sets the surfing offset for an NPC. +tags: ["npc", "surfing"] +--- + + + +## Description + +Sets the surfing offset for an NPC. + +| Name | Description | +| ----- | ----------------- | +| npcid | The ID of the NPC | +| x | The X offset | +| y | The Y offset | +| z | The Z offset | + +## Returns + +Returns `true` if the operation was successful, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/setsurfingoffset ", true, 18)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new Float:x, Float:y, Float:z; + new idx = 18; + + // Parse x + while (cmdtext[idx] == ' ') idx++; + new startIdx = idx; + while (cmdtext[idx] != ' ' && cmdtext[idx] != '\0') idx++; + new xStr[32]; + strmid(xStr, cmdtext, startIdx, idx); + x = floatstr(xStr); + + // Parse y + while (cmdtext[idx] == ' ') idx++; + startIdx = idx; + while (cmdtext[idx] != ' ' && cmdtext[idx] != '\0') idx++; + new yStr[32]; + strmid(yStr, cmdtext, startIdx, idx); + y = floatstr(yStr); + + // Parse z + while (cmdtext[idx] == ' ') idx++; + z = floatstr(cmdtext[idx]); + + NPC_SetSurfingOffsets(npcid, x, y, z); + SendClientMessage(playerid, 0x00FF00FF, "NPC %d surfing offset set to %.2f, %.2f, %.2f", npcid, x, y, z); + + return 1; + } + return 0; +} +``` + +## Notes + +- The surfing offset determines the relative position of the NPC compared to the object/vehicle it's surfing on +- Positive Z values move the NPC upward, negative values downward +- Positive Y values typically move the NPC forward relative to the vehicle's direction +- Positive X values move the NPC to the right relative to the vehicle's direction +- This is useful for fine-tuning the NPC's position when surfing +- Great for creating vehicle escorts or passengers + +## Related Functions + +- [NPC_GetSurfingOffset](NPC_GetSurfingOffsets): Gets the surfing offset for an NPC +- [NPC_SetSurfingObject](NPC_SetSurfingObject): Sets the object an NPC is surfing on +- [NPC_SetSurfingVehicle](NPC_SetSurfingVehicle): Sets the vehicle an NPC is surfing on +- [NPC_SetSurfingPlayerObject](NPC_SetSurfingPlayerObject): Sets the player object an NPC is surfing on +- [NPC_ResetSurfingData](NPC_ResetSurfingData): Resets all surfing data for an NPC + +## Related Callbacks + +_No specific callbacks are triggered by this function._ diff --git a/frontend/docs/scripting/functions/NPC_SetSurfingPlayerObject.md b/frontend/docs/scripting/functions/NPC_SetSurfingPlayerObject.md new file mode 100644 index 00000000000..7687c6282c1 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_SetSurfingPlayerObject.md @@ -0,0 +1,64 @@ +--- +title: NPC_SetSurfingPlayerObject +sidebar_label: NPC_SetSurfingPlayerObject +description: Sets the player object an NPC is surfing on. +tags: ["npc", "surfing"] +--- + + + +## Description + +Sets the player object an NPC is surfing on. + +| Name | Description | +| -------- | -------------------- | +| npcid | The ID of the NPC | +| objectid | The player object ID | + +## Returns + +Returns `true` if the operation was successful, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/setsurfingplayerobject ", true, 24)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new objectid = strval(cmdtext[24]); + + NPC_SetSurfingPlayerObject(npcid, objectid); + SendClientMessage(playerid, 0x00FF00FF, "NPC %d surfing player object set to %d", npcid, objectid); + + return 1; + } + return 0; +} +``` + +## Notes + +- The NPC will move along with the player object if it moves +- Player objects are client-side objects created specifically for individual players +- The player object must exist for surfing to work properly + +## Related Functions + +- [NPC_GetSurfingPlayerObject](NPC_GetSurfingPlayerObject): Gets the player object an NPC is surfing on +- [NPC_SetSurfingObject](NPC_SetSurfingObject): Sets the object an NPC is surfing on +- [NPC_SetSurfingVehicle](NPC_SetSurfingVehicle): Sets the vehicle an NPC is surfing on +- [NPC_SetSurfingOffset](NPC_SetSurfingOffset): Sets the surfing offset for an NPC +- [NPC_ResetSurfingData](NPC_ResetSurfingData): Resets all surfing data for an NPC + +## Related Callbacks + +_No specific callbacks are triggered by this function._ diff --git a/frontend/docs/scripting/functions/NPC_SetSurfingVehicle.md b/frontend/docs/scripting/functions/NPC_SetSurfingVehicle.md new file mode 100644 index 00000000000..77299c1792c --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_SetSurfingVehicle.md @@ -0,0 +1,65 @@ +--- +title: NPC_SetSurfingVehicle +sidebar_label: NPC_SetSurfingVehicle +description: Sets the vehicle an NPC is surfing on. +tags: ["npc", "surfing", "vehicle"] +--- + + + +## Description + +Sets the vehicle an NPC is surfing on. + +| Name | Description | +| --------- | ----------------- | +| npcid | The ID of the NPC | +| vehicleid | The vehicle ID | + +## Returns + +Returns `true` if the operation was successful, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/setsurfingvehicle ", true, 19)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new vehicleid = strval(cmdtext[19]); + + NPC_SetSurfingVehicle(npcid, vehicleid); + SendClientMessage(playerid, 0x00FF00FF, "NPC %d surfing vehicle set to %d", npcid, vehicleid); + + return 1; + } + return 0; +} +``` + +## Notes + +- This function allows NPCs to "surf" on vehicles, meaning they will move along with the vehicle while maintaining their position relative to it +- The NPC will follow the vehicle's movement, rotation, and position changes +- Use `NPC_SetSurfingOffset` to position the NPC at specific locations on the vehicle (roof, hood, etc.) +- The vehicle must exist for surfing to work properly + +## Related Functions + +- [NPC_GetSurfingVehicle](NPC_GetSurfingVehicle): Gets the vehicle an NPC is surfing on +- [NPC_SetSurfingObject](NPC_SetSurfingObject): Sets the object an NPC is surfing on +- [NPC_SetSurfingPlayerObject](NPC_SetSurfingPlayerObject): Sets the player object an NPC is surfing on +- [NPC_SetSurfingOffset](NPC_SetSurfingOffset): Sets the surfing offset for an NPC +- [NPC_ResetSurfingData](NPC_ResetSurfingData): Resets all surfing data for an NPC + +## Related Callbacks + +_No specific callbacks are triggered by this function._ diff --git a/frontend/docs/scripting/functions/NPC_SetVehicleGearState.md b/frontend/docs/scripting/functions/NPC_SetVehicleGearState.md new file mode 100644 index 00000000000..9d8b111aa28 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_SetVehicleGearState.md @@ -0,0 +1,67 @@ +--- +title: NPC_SetVehicleGearState +sidebar_label: NPC_SetVehicleGearState +description: Sets an NPC's aircraft landing gear state. +tags: ["npc", "vehicle", "aircraft", "landing gear"] +--- + + + +## Description + +Sets an NPC's aircraft landing gear state when piloting an aircraft. + +| Name | Description | +| --------- | -------------------------------------------------------------------------------- | +| npcid | The ID of the NPC | +| gearstate | The landing gear state to set (LANDING_GEAR_STATE_DOWN or LANDING_GEAR_STATE_UP) | + +## Returns + +This function does not return any specific value. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/setvehiclegearstate ", true, 21)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new gearState = strval(cmdtext[21]); + + NPC_SetVehicleGearState(npcid, gearState); + SendClientMessage(playerid, 0x00FF00FF, "NPC %d vehicle gear state set to %d", npcid, gearState); + + return 1; + } + return 0; +} +``` + +## Notes + +- Only works when NPC is piloting an aircraft +- Uses the same constants as [Vehicle Landing Gear States](../resources/landinggearstate): LANDING_GEAR_STATE_DOWN and LANDING_GEAR_STATE_UP +- Check current landing gear state with NPC_GetVehicleGearState + +## Related Functions + +- [NPC_GetVehicleGearState](NPC_GetVehicleGearState): Get current landing gear state +- [GetPlayerLandingGearState](GetPlayerLandingGearState): Get player's landing gear state +- [GetVehicleLandingGearState](GetVehicleLandingGearState): Get vehicle's landing gear state +- [NPC_PutInVehicle](NPC_PutInVehicle): Put NPC in vehicle + +## Related Resources + +- [Vehicle Landing Gear States](../resources/landinggearstate) + +## Related Callbacks + +_No specific callbacks are triggered by this function._ diff --git a/frontend/docs/scripting/functions/NPC_SetVehicleHealth.md b/frontend/docs/scripting/functions/NPC_SetVehicleHealth.md new file mode 100644 index 00000000000..f4edcf77012 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_SetVehicleHealth.md @@ -0,0 +1,63 @@ +--- +title: NPC_SetVehicleHealth +sidebar_label: NPC_SetVehicleHealth +description: Sets the health of an NPC's vehicle. +tags: ["npc", "vehicle", "health"] +--- + + + +## Description + +Sets the health of an NPC's vehicle. + +| Name | Description | +| ------ | ----------------------------- | +| npcid | The ID of the NPC | +| health | The health value (0.0-1000.0) | + +## Returns + +Returns `true` if the operation was successful, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/setvehiclehealth ", true, 18)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new Float:health = floatstr(cmdtext[18]); + + NPC_SetVehicleHealth(npcid, health); + SendClientMessage(playerid, 0x00FF00FF, "NPC %d vehicle health set to %.2f", npcid, health); + + return 1; + } + return 0; +} +``` + +## Notes + +- Only works when NPC is in a vehicle +- Health ranges from 0.0 (destroyed) to 1000.0 (perfect condition) +- Vehicles explode when health drops below 250 + +## Related Functions + +- [NPC_GetVehicleHealth](NPC_GetVehicleHealth): Get vehicle health +- [NPC_GetVehicleID](NPC_GetVehicleID): Get NPC's vehicle +- [NPC_PutInVehicle](NPC_PutInVehicle): Put NPC in vehicle +- [SetVehicleHealth](SetVehicleHealth): Set vehicle health directly + +## Related Callbacks + +_No specific callbacks are triggered by this function._ diff --git a/frontend/docs/scripting/functions/NPC_SetVehicleHydraThrusters.md b/frontend/docs/scripting/functions/NPC_SetVehicleHydraThrusters.md new file mode 100644 index 00000000000..febd4a669b0 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_SetVehicleHydraThrusters.md @@ -0,0 +1,64 @@ +--- +title: NPC_SetVehicleHydraThrusters +sidebar_label: NPC_SetVehicleHydraThrusters +description: Sets the Hydra thruster direction for an NPC's vehicle. +tags: ["npc", "vehicle", "hydra", "aircraft"] +--- + + + +## Description + +Sets the Hydra thruster direction for an NPC's vehicle when piloting a Hydra aircraft. + +| Name | Description | +| --------- | ---------------------------------------------- | +| npcid | The ID of the NPC | +| direction | The thruster direction (0=forward, 1=backward) | + +## Returns + +Returns `true` if the operation was successful, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/sethydrathrusters ", true, 19)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new direction = strval(cmdtext[19]); + + NPC_SetVehicleHydraThrusters(npcid, direction); + SendClientMessage(playerid, 0x00FF00FF, "NPC %d hydra thrusters set to %d", npcid, direction); + + return 1; + } + return 0; +} +``` + +## Notes + +- Only works with Hydra aircraft (vehicle ID 520) +- Direction 0 = forward thrusters (jet mode) +- Direction 1 = downward thrusters (VTOL mode) +- Use NPC_GetVehicleHydraThrusters to check current direction + +## Related Functions + +- [NPC_GetVehicleHydraThrusters](NPC_GetVehicleHydraThrusters): Get thruster direction +- [NPC_GetVehicleID](NPC_GetVehicleID): Get NPC's vehicle +- [NPC_PutInVehicle](NPC_PutInVehicle): Put NPC in vehicle +- [GetVehicleModel](GetVehicleModel): Get vehicle model + +## Related Callbacks + +_No specific callbacks are triggered by this function._ diff --git a/frontend/docs/scripting/functions/NPC_SetVehicleTrainSpeed.md b/frontend/docs/scripting/functions/NPC_SetVehicleTrainSpeed.md new file mode 100644 index 00000000000..717f4e18b83 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_SetVehicleTrainSpeed.md @@ -0,0 +1,63 @@ +--- +title: NPC_SetVehicleTrainSpeed +sidebar_label: NPC_SetVehicleTrainSpeed +description: Sets the speed of an NPC's train vehicle. +tags: ["npc", "vehicle", "train", "speed"] +--- + + + +## Description + +Sets the speed of an NPC's train vehicle. + +| Name | Description | +| ----- | ---------------------- | +| npcid | The ID of the NPC | +| speed | The train speed to set | + +## Returns + +Returns `true` if the operation was successful, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/settrainspeed ", true, 15)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new Float:speed = floatstr(cmdtext[15]); + + NPC_SetVehicleTrainSpeed(npcid, speed); + SendClientMessage(playerid, 0x00FF00FF, "NPC %d train speed set to %.2f", npcid, speed); + + return 1; + } + return 0; +} +``` + +## Notes + +- Only works with train vehicles (models 537, 538) +- Use NPC_GetVehicleTrainSpeed to check current speed +- Setting speed to 0 stops the train + +## Related Functions + +- [NPC_GetVehicleTrainSpeed](NPC_GetVehicleTrainSpeed): Get train speed +- [NPC_GetVehicleID](NPC_GetVehicleID): Get NPC's vehicle +- [NPC_PutInVehicle](NPC_PutInVehicle): Put NPC in vehicle +- [GetVehicleModel](GetVehicleModel): Get vehicle model + +## Related Callbacks + +_No specific callbacks are triggered by this function._ diff --git a/frontend/docs/scripting/functions/NPC_SetVelocity.md b/frontend/docs/scripting/functions/NPC_SetVelocity.md new file mode 100644 index 00000000000..039a809d3c8 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_SetVelocity.md @@ -0,0 +1,85 @@ +--- +title: NPC_SetVelocity +sidebar_label: NPC_SetVelocity +description: Sets the velocity of an NPC. +tags: ["npc", "velocity", "movement"] +--- + + + +## Description + +Sets the velocity of an NPC. + +| Name | Description | +| ------- | -------------------------- | +| npcid | The ID of the NPC | +| Float:x | The X velocity component | +| Float:y | The Y velocity component | +| Float:z | The Z velocity component | + +## Returns + +Returns `true` on success, `false` on failure. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/setvelocity ", true, 13)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new Float:x, Float:y, Float:z; + new idx = 13; + + // Parse x + while (cmdtext[idx] == ' ') idx++; + new startIdx = idx; + while (cmdtext[idx] != ' ' && cmdtext[idx] != '\0') idx++; + new xStr[32]; + strmid(xStr, cmdtext, startIdx, idx); + x = floatstr(xStr); + + // Parse y + while (cmdtext[idx] == ' ') idx++; + startIdx = idx; + while (cmdtext[idx] != ' ' && cmdtext[idx] != '\0') idx++; + new yStr[32]; + strmid(yStr, cmdtext, startIdx, idx); + y = floatstr(yStr); + + // Parse z + while (cmdtext[idx] == ' ') idx++; + z = floatstr(cmdtext[idx]); + + NPC_SetVelocity(npcid, x, y, z); + SendClientMessage(playerid, 0x00FF00FF, "NPC %d velocity set to %.2f, %.2f, %.2f", npcid, x, y, z); + + return 1; + } + return 0; +} +``` + +## Notes + +- Velocity values determine the speed and direction of movement +- Positive Z values move the NPC upward, negative values move downward +- This can be used to create custom movement behaviors + +## Related Functions + +- [NPC_GetVelocity](NPC_GetVelocity): Get NPC velocity +- [NPC_SetPos](NPC_SetPos): Set NPC position +- [NPC_Move](NPC_Move): Make NPC move to position + +## Related Callbacks + +- [OnNPCFinishMove](../callbacks/OnNPCFinishMove): Called when NPC finishes movement diff --git a/frontend/docs/scripting/functions/NPC_SetVirtualWorld.md b/frontend/docs/scripting/functions/NPC_SetVirtualWorld.md new file mode 100644 index 00000000000..2bb953ba266 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_SetVirtualWorld.md @@ -0,0 +1,66 @@ +--- +title: NPC_SetVirtualWorld +sidebar_label: NPC_SetVirtualWorld +description: Sets an NPC's virtual world. +tags: ["npc", "virtual world", "dimension"] +--- + + + +## Description + +Sets an NPC's virtual world, controlling which players can see and interact with them. + +| Name | Description | +| ----- | ---------------------------- | +| npcid | The ID of the NPC. | +| vw | The virtual world ID to set. | + +## Returns + +Returns `true` if the operation was successful, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/setvirtualworld ", true, 16)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new vw = strval(cmdtext[16]); + if (vw < 0) + return SendClientMessage(playerid, 0xFF0000FF, "Virtual world must be positive."); + + NPC_SetVirtualWorld(npcid, vw); + SendClientMessage(playerid, 0x00FF00FF, "NPC %d virtual world set to %d", npcid, vw); + + return 1; + } + return 0; +} +``` + +## Notes + +:::warning + +- Virtual world 0 is the default world where all players start. +- NPCs in different virtual worlds cannot see or interact with each other. +- Players must be in the same virtual world to see NPCs. +- Use [NPC_GetVirtualWorld](NPC_GetVirtualWorld) to check current virtual world. + +::: + +## Related Functions + +- [NPC_GetVirtualWorld](NPC_GetVirtualWorld): Get NPC's virtual world. +- [SetPlayerVirtualWorld](SetPlayerVirtualWorld): Set player's virtual world. +- [GetPlayerVirtualWorld](GetPlayerVirtualWorld): Get player's virtual world. +- [NPC_SetInterior](NPC_SetInterior): Set NPC's interior. diff --git a/frontend/docs/scripting/functions/NPC_SetWeapon.md b/frontend/docs/scripting/functions/NPC_SetWeapon.md new file mode 100644 index 00000000000..41219ab978e --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_SetWeapon.md @@ -0,0 +1,64 @@ +--- +title: NPC_SetWeapon +sidebar_label: NPC_SetWeapon +description: Sets an NPC's current weapon. +tags: ["npc", "weapon", "combat"] +--- + + + +## Description + +Sets an NPC's current weapon to a specific weapon ID. + +| Name | Description | +| ------ | -------------------- | +| npcid | The ID of the NPC | +| weapon | The weapon ID to set | + +## Returns + +Returns `true` if the weapon was set successfully, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/setweapon ", true, 11)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new weaponid = strval(cmdtext[11]); + if (weaponid < 0 || weaponid > 46) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid weapon ID. Must be between 0 and 46."); + + NPC_SetWeapon(npcid, WEAPON:weaponid); + SendClientMessage(playerid, 0x00FF00FF, "NPC %d weapon set to %d", npcid, weaponid); + + return 1; + } + return 0; +} +``` + +## Notes + +- Setting a weapon will equip the NPC with that weapon +- Use NPC_SetAmmo to provide ammunition for the weapon +- Use NPC_GetWeapon to check current weapon + +## Related Functions + +- [NPC_GetWeapon](NPC_GetWeapon): Get NPC's current weapon +- [NPC_SetAmmo](NPC_SetAmmo): Set ammunition for NPC's weapon +- [NPC_GetAmmo](NPC_GetAmmo): Get NPC's current ammo count + +## Related Callbacks + +- [OnNPCWeaponShot](../callbacks/OnNPCWeaponShot): Called when NPC shoots diff --git a/frontend/docs/scripting/functions/NPC_SetWeaponAccuracy.md b/frontend/docs/scripting/functions/NPC_SetWeaponAccuracy.md new file mode 100644 index 00000000000..8ace95c2c7a --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_SetWeaponAccuracy.md @@ -0,0 +1,63 @@ +--- +title: NPC_SetWeaponAccuracy +sidebar_label: NPC_SetWeaponAccuracy +description: Sets the accuracy of a specific weapon for an NPC. +tags: ["npc", "weapon", "accuracy"] +--- + + + +## Description + +Sets the accuracy of a specific weapon for an NPC. + +| Name | Description | +| -------- | --------------------------------- | +| npcid | The ID of the NPC | +| weaponid | The weapon ID to set accuracy for | +| accuracy | The accuracy value (0.0 to 1.0) | + +## Returns + +Returns `true` if the operation was successful, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/setweaponaccuracy ", true, 19)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new weapon = NPC_GetWeapon(npcid); + new Float:accuracy = floatstr(cmdtext[19]); + + NPC_SetWeaponAccuracy(npcid, WEAPON:weapon, accuracy); + SendClientMessage(playerid, 0x00FF00FF, "NPC %d weapon %d accuracy set to %.2f", npcid, weapon, accuracy); + return 1; + } + return 0; +} +``` + +## Notes + +- Accuracy value ranges from 0.0 (never hits) to 1.0 (always hits) +- Default accuracy varies by weapon type +- Accuracy affects bullet spread and hit probability + +## Related Functions + +- [NPC_GetWeaponAccuracy](NPC_GetWeaponAccuracy): Get weapon accuracy +- [NPC_SetWeapon](NPC_SetWeapon): Set NPC weapon +- [NPC_Shoot](NPC_Shoot): Make NPC shoot + +## Related Callbacks + +_No specific callbacks are triggered by this function._ diff --git a/frontend/docs/scripting/functions/NPC_SetWeaponClipSize.md b/frontend/docs/scripting/functions/NPC_SetWeaponClipSize.md new file mode 100644 index 00000000000..589b4d5c679 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_SetWeaponClipSize.md @@ -0,0 +1,64 @@ +--- +title: NPC_SetWeaponClipSize +sidebar_label: NPC_SetWeaponClipSize +description: Sets the clip size for an NPC's weapon. +tags: ["npc", "weapon", "ammo"] +--- + + + +## Description + +Sets the clip size for an NPC's current weapon. + +| Name | Description | +| ------ | -------------------- | +| npcid | The ID of the NPC | +| weapon | The weapon ID to set | +| size | The new clip size | + +## Returns + +Returns `true` if the operation was successful, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/setweaponclipsize ", true, 19)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new weapon = NPC_GetWeapon(npcid); + new clipsize = strval(cmdtext[19]); + + NPC_SetWeaponClipSize(npcid, WEAPON:weapon, clipsize); + SendClientMessage(playerid, 0x00FF00FF, "NPC %d weapon %d clip size set to %d", npcid, weapon, clipsize); + return 1; + } + return 0; +} +``` + +## Notes + +- The NPC must have a weapon for this function to work +- Clip size affects how much ammo the NPC can fire before needing to reload +- Different weapons have different default clip sizes + +## Related Functions + +- [NPC_GetWeaponClipSize](NPC_GetWeaponClipSize): Get weapon clip size +- [NPC_SetAmmoInClip](NPC_SetAmmoInClip): Set current clip ammunition +- [NPC_GetAmmoInClip](NPC_GetAmmoInClip): Get current clip ammunition +- [NPC_SetWeapon](NPC_SetWeapon): Set NPC weapon + +## Related Callbacks + +- [OnNPCWeaponShot](../callbacks/OnNPCWeaponShot): Called when NPC fires weapon diff --git a/frontend/docs/scripting/functions/NPC_SetWeaponReloadTime.md b/frontend/docs/scripting/functions/NPC_SetWeaponReloadTime.md new file mode 100644 index 00000000000..a03deb30f6f --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_SetWeaponReloadTime.md @@ -0,0 +1,63 @@ +--- +title: NPC_SetWeaponReloadTime +sidebar_label: NPC_SetWeaponReloadTime +description: Sets the reload time for an NPC's weapon. +tags: ["npc", "weapon", "reload", "time"] +--- + + + +## Description + +Sets the reload time for a specific weapon of an NPC. + +| Name | Description | +| -------- | ------------------------------------ | +| npcid | The ID of the NPC | +| weaponid | The weapon ID to set reload time for | +| time | The reload time in milliseconds | + +## Returns + +Returns `true` if the operation was successful, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/setweaponreloadtime ", true, 21)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new weapon = NPC_GetWeapon(npcid); + new reloadtime = strval(cmdtext[21]); + + NPC_SetWeaponReloadTime(npcid, WEAPON:weapon, reloadtime); + SendClientMessage(playerid, 0x00FF00FF, "NPC %d weapon %d reload time set to %d ms", npcid, weapon, reloadtime); + return 1; + } + return 0; +} +``` + +## Notes + +- Reload time is measured in milliseconds +- Use NPC_GetWeaponReloadTime to check current reload time + +## Related Functions + +- [NPC_GetWeaponReloadTime](NPC_GetWeaponReloadTime): Get reload time +- [NPC_GetWeaponActualReloadTime](NPC_GetWeaponActualReloadTime): Get actual reload time +- [NPC_IsReloading](NPC_IsReloading): Check if reloading +- [NPC_EnableReloading](NPC_EnableReloading): Enable/disable reloading + +## Related Callbacks + +- [OnNPCWeaponShot](../callbacks/OnNPCWeaponShot): Called when NPC shoots diff --git a/frontend/docs/scripting/functions/NPC_SetWeaponShootTime.md b/frontend/docs/scripting/functions/NPC_SetWeaponShootTime.md new file mode 100644 index 00000000000..8f64dec7d1d --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_SetWeaponShootTime.md @@ -0,0 +1,64 @@ +--- +title: NPC_SetWeaponShootTime +sidebar_label: NPC_SetWeaponShootTime +description: Sets the shooting interval for an NPC's weapon. +tags: ["npc", "weapon", "shooting", "time"] +--- + + + +## Description + +Sets the shooting interval for a specific weapon of an NPC. + +| Name | Description | +| -------- | ------------------------------------- | +| npcid | The ID of the NPC | +| weaponid | The weapon ID to set shoot time for | +| time | The shooting interval in milliseconds | + +## Returns + +Returns `true` if the operation was successful, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/setweaponshoottime ", true, 20)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new weapon = NPC_GetWeapon(npcid); + new shoottime = strval(cmdtext[20]); + + NPC_SetWeaponShootTime(npcid, WEAPON:weapon, shoottime); + SendClientMessage(playerid, 0x00FF00FF, "NPC %d weapon %d shoot time set to %d ms", npcid, weapon, shoottime); + return 1; + } + return 0; +} +``` + +## Notes + +- Shoot time is measured in milliseconds between shots +- Use NPC_GetWeaponShootTime to check current shoot time + +## Related Functions + +- [NPC_GetWeaponShootTime](NPC_GetWeaponShootTime): Get shoot time +- [NPC_IsShooting](NPC_IsShooting): Check if shooting +- [NPC_Shoot](NPC_Shoot): Make NPC shoot +- [NPC_GetWeapon](NPC_GetWeapon): Get current weapon + +## Related Callbacks + +- [OnNPCWeaponShot](../callbacks/OnNPCWeaponShot): Called when NPC shoots +- [OnNPCGiveDamage](../callbacks/OnNPCGiveDamage): Called when NPC damages someone diff --git a/frontend/docs/scripting/functions/NPC_SetWeaponSkillLevel.md b/frontend/docs/scripting/functions/NPC_SetWeaponSkillLevel.md new file mode 100644 index 00000000000..7e90795437f --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_SetWeaponSkillLevel.md @@ -0,0 +1,72 @@ +--- +title: NPC_SetWeaponSkillLevel +sidebar_label: NPC_SetWeaponSkillLevel +description: Sets the weapon skill level for an NPC. +tags: ["npc", "weapon", "skill"] +--- + + + +## Description + +Sets the weapon skill level for an NPC. + +| Name | Description | +| ----- | ---------------------------------------- | +| npcid | The ID of the NPC | +| skill | The weapon skill type (WEAPONSKILL) | +| level | The skill level to set (0-999) | + +## Returns + +Returns `true` on success, `false` on failure. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/setweaponskill ", true, 16)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new level = strval(cmdtext[16]); + + NPC_SetWeaponSkillLevel(npcid, WEAPONSKILL_PISTOL, level); + NPC_SetWeaponSkillLevel(npcid, WEAPONSKILL_PISTOL_SILENCED, level); + NPC_SetWeaponSkillLevel(npcid, WEAPONSKILL_DESERT_EAGLE, level); + NPC_SetWeaponSkillLevel(npcid, WEAPONSKILL_SHOTGUN, level); + NPC_SetWeaponSkillLevel(npcid, WEAPONSKILL_MICRO_UZI, level); + NPC_SetWeaponSkillLevel(npcid, WEAPONSKILL_MP5, level); + NPC_SetWeaponSkillLevel(npcid, WEAPONSKILL_AK47, level); + NPC_SetWeaponSkillLevel(npcid, WEAPONSKILL_M4, level); + NPC_SetWeaponSkillLevel(npcid, WEAPONSKILL_SNIPERRIFLE, level); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d all weapon skills set to %d", npcid, level); + return 1; + } + return 0; +} +``` + +## Notes + +- Weapon skill affects accuracy and shooting behavior +- Skill level ranges from 0 (poor) to 999 (hitman) +- Different weapon types have different skill categories + +## Related Functions + +- [NPC_GetWeaponSkillLevel](NPC_GetWeaponSkillLevel): Get NPC weapon skill level +- [NPC_SetWeaponAccuracy](NPC_SetWeaponAccuracy): Set weapon accuracy +- [NPC_GetWeaponAccuracy](NPC_GetWeaponAccuracy): Get weapon accuracy +- [NPC_SetWeapon](NPC_SetWeapon): Set NPC weapon + +## Related Callbacks + +- [OnNPCWeaponShot](../callbacks/OnNPCWeaponShot): Called when NPC fires weapon diff --git a/frontend/docs/scripting/functions/NPC_SetWeaponState.md b/frontend/docs/scripting/functions/NPC_SetWeaponState.md new file mode 100644 index 00000000000..baa3c6ab84e --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_SetWeaponState.md @@ -0,0 +1,76 @@ +--- +title: NPC_SetWeaponState +sidebar_label: NPC_SetWeaponState +description: Sets the weapon state of an NPC. +tags: ["npc", "weapon", "state"] +--- + + + +## Description + +Sets the weapon state of an NPC. + +| Name | Description | +| ----------- | ------------------------- | +| npcid | The ID of the NPC | +| weaponState | The weapon state to set | + +## Returns + +Returns `true` on success, `false` on failure. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/setweaponstate ", true, 16)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new weaponstate = strval(cmdtext[16]); + + static weaponStates[5][64] = + { + "Unknown", + "No ammo remaining", + "Single bullet left", + "More than one bullet left", + "Reloading" + }; + + NPC_SetWeaponState(npcid, WEAPONSTATE:weaponstate); + SendClientMessage(playerid, 0x00FF00FF, "NPC %d weapon state set to: %s (%d)", npcid, weaponStates[weaponstate], weaponstate); + return 1; + } + return 0; +} +``` + +## Notes + +- Weapon state controls the current action of the NPC's weapon +- Use [NPC_GetWeaponState](NPC_GetWeaponState) to retrieve the current state +- Changing weapon state affects NPC shooting behavior + +## Related Functions + +- [NPC_GetWeaponState](NPC_GetWeaponState): Get NPC weapon state +- [NPC_SetWeapon](NPC_SetWeapon): Set NPC weapon +- [NPC_GetWeapon](NPC_GetWeapon): Get NPC weapon +- [NPC_IsReloading](NPC_IsReloading): Check if NPC is reloading + +## Related Resources + +- [Weapon States](../resources/weaponstates) + +## Related Callbacks + +- [OnNPCWeaponStateChange](../callbacks/OnNPCWeaponStateChange): Called when NPC weapon state changes +- [OnNPCWeaponShot](../callbacks/OnNPCWeaponShot): Called when NPC fires weapon diff --git a/frontend/docs/scripting/functions/NPC_Shoot.md b/frontend/docs/scripting/functions/NPC_Shoot.md new file mode 100644 index 00000000000..c76f23f81eb --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_Shoot.md @@ -0,0 +1,76 @@ +--- +title: NPC_Shoot +sidebar_label: NPC_Shoot +description: Makes an NPC fire a weapon shot. +tags: ["npc", "weapon", "shoot", "combat"] +--- + + + +## Description + +Makes an NPC fire a weapon shot. + +| Name | Description | +| ------------------- | --------------------------------------------------------- | +| npcid | The ID of the NPC | +| weapon | The weapon ID to use for shooting | +| hitId | The ID of the target entity being shot | +| hitType | The type of entity being hit (player, NPC, vehicle, etc.) | +| endPointX | X coordinate of the bullet end point | +| endPointY | Y coordinate of the bullet end point | +| endPointZ | Z coordinate of the bullet end point | +| offsetX | X offset from the hit point | +| offsetY | Y offset from the hit point | +| offsetZ | Z offset from the hit point | +| isHit | Whether the shot actually hits the target | +| checkInBetweenFlags | Entity check flags (default: NPC_ENTITY_CHECK_ALL) | + +## Returns + +Returns `true` if the operation was successful, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/npcshoot", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new Float:x, Float:y, Float:z; + GetPlayerPos(playerid, x, y, z); + + new weapon = NPC_GetWeapon(npcid); + NPC_Shoot(npcid, WEAPON:weapon, playerid, 1, x, y, z, 0.0, 0.0, 0.0, true, NPC_ENTITY_CHECK_ALL); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d fired a shot at you.", npcid); + return 1; + } + return 0; +} +``` + +## Notes + +- The NPC must have a weapon set with `NPC_SetWeapon` before shooting +- Use `isHit = false` for warning shots or suppression fire +- The `checkInBetweenFlags` parameter determines what entities block the shot + +## Related Functions + +- [NPC_SetWeapon](NPC_SetWeapon): Set NPC weapon +- [NPC_GetWeapon](NPC_GetWeapon): Get NPC current weapon +- [NPC_IsShooting](NPC_IsShooting): Check if NPC is currently shooting +- [NPC_AimAt](NPC_AimAt): Make NPC aim at position + +## Related Callbacks + +- [OnNPCWeaponShot](../callbacks/OnNPCWeaponShot): Called when NPC fires weapon +- [OnNPCGiveDamage](../callbacks/OnNPCGiveDamage): Called when NPC damages another entity diff --git a/frontend/docs/scripting/functions/NPC_Spawn.md b/frontend/docs/scripting/functions/NPC_Spawn.md new file mode 100644 index 00000000000..90141266916 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_Spawn.md @@ -0,0 +1,74 @@ +--- +title: NPC_Spawn +sidebar_label: NPC_Spawn +description: Spawns an NPC into the game world. +tags: ["npc"] +--- + + + +## Description + +Spawns an NPC into the game world, making it visible and active. + +| Name | Description | +| ----- | ------------------ | +| npcid | The ID of the NPC. | + +## Returns + +Returns `true` if the NPC was spawned successfully, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/createnpc", true)) + { + new name[24]; + format(name, sizeof name, "Bot_%d", g_NPCCount++); + + new npcid = NPC_Create(name); + if (NPC_IsValid(npcid)) + { + new Float:x, Float:y, Float:z; + GetPlayerPos(playerid, x, y, z); + + NPC_Spawn(npcid); + NPC_SetPos(npcid, x + 3.0, y, z); + NPC_SetWeapon(npcid, WEAPON_M4); + NPC_SetAmmo(npcid, 500); + + PlayerNPC[playerid] = npcid; + SendClientMessage(playerid, 0x00FF00FF, "NPC %s (ID %d) spawned near you!", name, npcid); + } + else + { + SendClientMessage(playerid, 0xFF0000FF, "Failed to create NPC!"); + } + return 1; + } + return 0; +} +``` + +## Notes + +:::warning + +- The NPC must be created with [NPC_Create](NPC_Create) before spawning. + +::: + +## Related Functions + +- [NPC_Create](NPC_Create): Create a new NPC. +- [NPC_IsValid](NPC_IsValid): Check if NPC ID is valid. +- [NPC_SetPos](NPC_SetPos): Set NPC position. +- [NPC_Destroy](NPC_Destroy): Destroy an NPC. + +## Related Callbacks + +- [OnNPCSpawn](../callbacks/OnNPCSpawn): Called when NPC spawns. +- [OnNPCCreate](../callbacks/OnNPCCreate): Called when NPC is created. diff --git a/frontend/docs/scripting/functions/NPC_StartPlayback.md b/frontend/docs/scripting/functions/NPC_StartPlayback.md new file mode 100644 index 00000000000..7da6885ee46 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_StartPlayback.md @@ -0,0 +1,83 @@ +--- +title: NPC_StartPlayback +sidebar_label: NPC_StartPlayback +description: Starts playing a recording file for an NPC. +tags: ["npc", "recording", "playback"] +--- + + + +## Description + +Starts playing a recording file for an NPC by filename. + +| Name | Description | +| ------------ | --------------------------------------------- | +| npcid | The ID of the NPC | +| recordName[] | The filename of the recording to play | +| autoUnload | Whether to unload the recording when finished | +| startX | Starting X coordinate | +| startY | Starting Y coordinate | +| startZ | Starting Z coordinate | +| rotX | Starting X rotation | +| rotY | Starting Y rotation | +| rotZ | Starting Z rotation | + +## Returns + +Returns `true` if the playback was started successfully, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/startplayback ", true, 15)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new recordName[64]; + new len = strlen(cmdtext); + if (len <= 15) + return SendClientMessage(playerid, 0xFF0000FF, "Usage: /startplayback [recordname]"); + + strmid(recordName, cmdtext, 15, len); + + new Float:x, Float:y, Float:z; + NPC_GetPos(npcid, x, y, z); + + new bool:success = NPC_StartPlayback(npcid, recordName, true, x, y, z, 0.0, 0.0, 0.0); + + if (success) + SendClientMessage(playerid, 0x00FF00FF, "NPC %d started playback: %s", npcid, recordName); + else + SendClientMessage(playerid, 0xFF0000FF, "Failed to start playback for NPC %d", npcid); + + return 1; + } + return 0; +} +``` + +## Notes + +- The recording file must exist in the `npcmodes\recordings` directory +- If autoUnload is true, the recording is unloaded when playback ends +- Use NPC_StartPlaybackEx for better control with pre-loaded recordings + +## Related Functions + +- [NPC_StartPlaybackEx](NPC_StartPlaybackEx): Start playback with recording ID +- [NPC_StopPlayback](NPC_StopPlayback): Stop playback +- [NPC_PausePlayback](NPC_PausePlayback): Pause/unpause playback +- [NPC_LoadRecord](NPC_LoadRecord): Pre-load a recording file + +## Related Callbacks + +- [OnNPCPlaybackStart](../callbacks/OnNPCPlaybackStart): Called when playback starts +- [OnNPCPlaybackEnd](../callbacks/OnNPCPlaybackEnd): Called when playback ends diff --git a/frontend/docs/scripting/functions/NPC_StartPlaybackEx.md b/frontend/docs/scripting/functions/NPC_StartPlaybackEx.md new file mode 100644 index 00000000000..dffae5558fc --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_StartPlaybackEx.md @@ -0,0 +1,76 @@ +--- +title: NPC_StartPlaybackEx +sidebar_label: NPC_StartPlaybackEx +description: Starts playback for an NPC using a pre-loaded recording ID with extended options. +tags: ["npc", "playback", "recording"] +--- + + + +## Description + +Starts playback for an NPC using a pre-loaded recording ID with extended options. + +| Name | Description | +| ---------- | ---------------------------------------------- | +| npcid | The ID of the NPC | +| recordId | The pre-loaded recording ID | +| autoUnload | Whether to automatically unload after playback | +| startX | X offset from recording position | +| startY | Y offset from recording position | +| startZ | Z offset from recording position | +| rotX | X rotation offset | +| rotY | Y rotation offset | +| rotZ | Z rotation offset | + +## Returns + +Returns `true` if the operation was successful, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/startplaybackex ", true, 17)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new recordId = strval(cmdtext[17]); + + new Float:x, Float:y, Float:z; + NPC_GetPos(npcid, x, y, z); + + new bool:success = NPC_StartPlaybackEx(npcid, recordId, true, x, y, z, 0.0, 0.0, 0.0); + + if (success) + SendClientMessage(playerid, 0x00FF00FF, "NPC %d started playback with record ID: %d", npcid, recordId); + else + SendClientMessage(playerid, 0xFF0000FF, "Failed to start playback for NPC %d with record ID %d", npcid, recordId); + + return 1; + } + return 0; +} +``` + +## Notes + +- Recording must be pre-loaded with `NPC_LoadRecord` +- Auto-unload saves memory when playback completes + +## Related Functions + +- [NPC_LoadRecord](NPC_LoadRecord): Load a recording file +- [NPC_StartPlayback](NPC_StartPlayback): Start playback by filename +- [NPC_StopPlayback](NPC_StopPlayback): Stop playback +- [NPC_IsValidRecord](NPC_IsValidRecord): Check if record is valid + +## Related Callbacks + +- [OnNPCPlaybackEnd](../callbacks/OnNPCPlaybackEnd): Called when playback ends diff --git a/frontend/docs/scripting/functions/NPC_StopAim.md b/frontend/docs/scripting/functions/NPC_StopAim.md new file mode 100644 index 00000000000..4356b9669b8 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_StopAim.md @@ -0,0 +1,56 @@ +--- +title: NPC_StopAim +sidebar_label: NPC_StopAim +description: Stops an NPC from aiming. +tags: ["npc", "weapon", "aiming"] +--- + + + +## Description + +Stops an NPC from aiming at any target. + +| Name | Description | +| ----- | ----------------- | +| npcid | The ID of the NPC | + +## Returns + +Returns `true` if the operation was successful, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/friendly", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + NPC_StopAim(npcid); + SendClientMessage(playerid, 0x00FF00FF, "NPC %d stopped aiming.", npcid); + return 1; + } + return 0; +} +``` + +## Notes + +- This stops both aiming and shooting if the NPC was doing both +- The NPC will return to its normal stance after stopping aim +- Has no effect if the NPC is not currently aiming + +## Related Functions + +- [NPC_AimAt](NPC_AimAt): Make NPC aim at position +- [NPC_AimAtPlayer](NPC_AimAtPlayer): Make NPC aim at player +- [NPC_IsAiming](NPC_IsAiming): Check if NPC is aiming +- [NPC_Shoot](NPC_Shoot): Make NPC shoot + +## Related Callbacks + +- [OnNPCWeaponShot](../callbacks/OnNPCWeaponShot): Called when NPC fires weapon diff --git a/frontend/docs/scripting/functions/NPC_StopMeleeAttack.md b/frontend/docs/scripting/functions/NPC_StopMeleeAttack.md new file mode 100644 index 00000000000..6b4201798bb --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_StopMeleeAttack.md @@ -0,0 +1,61 @@ +--- +title: NPC_StopMeleeAttack +sidebar_label: NPC_StopMeleeAttack +description: Stops an NPC from performing melee attacks. +tags: ["npc", "melee", "fighting"] +--- + + + +## Description + +Stops an NPC from performing melee attacks. + +| Name | Description | +| ----- | ----------------- | +| npcid | The ID of the NPC | + +## Returns + +Returns `true` if the operation was successful, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/npcstopmelee", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new bool:success = NPC_StopMeleeAttack(npcid); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d stop melee attack: %s", npcid, success ? "Success" : "Failed"); + return 1; + } + return 0; +} + +``` + +## Notes + +- This immediately stops any ongoing melee attack animation +- The NPC will return to its normal stance +- Has no effect if the NPC is not currently attacking + +## Related Functions + +- [NPC_MeleeAttack](NPC_MeleeAttack): Start melee attack +- [NPC_IsMeleeAttacking](NPC_IsMeleeAttacking): Check if NPC is attacking +- [NPC_SetFightingStyle](NPC_SetFightingStyle): Set fighting style +- [NPC_GetFightingStyle](NPC_GetFightingStyle): Get fighting style + +## Related Callbacks + +- [OnNPCGiveDamage](../callbacks/OnNPCGiveDamage): Called when NPC damages someone diff --git a/frontend/docs/scripting/functions/NPC_StopMove.md b/frontend/docs/scripting/functions/NPC_StopMove.md new file mode 100644 index 00000000000..c3a28bd231d --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_StopMove.md @@ -0,0 +1,61 @@ +--- +title: NPC_StopMove +sidebar_label: NPC_StopMove +description: Stops an NPC from moving. +tags: ["npc", "movement"] +--- + + + +## Description + +Stops an NPC from moving to their current destination. + +| Name | Description | +| ----- | ------------------ | +| npcid | The ID of the NPC. | + +## Returns + +Returns `true` if the operation was successful, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/npcstopmove", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new bool:success = NPC_StopMove(npcid); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d stop moving: %s", npcid, success ? "Success" : "Failed"); + return 1; + } + return 0; +} +``` + +## Notes + +- This stops the NPC at their current position. +- If the NPC is not moving, this function has no effect. +- The NPC will remain at the stopped position until given a new movement command. +- Use [NPC_IsMoving](NPC_IsMoving) to check if an NPC is currently moving. + +## Related Functions + +- [NPC_Move](NPC_Move): Make NPC move to a position. +- [NPC_IsMoving](NPC_IsMoving): Check if NPC is moving. +- [NPC_MoveByPath](NPC_MoveByPath): Make NPC follow a path. +- [NPC_SetPos](NPC_SetPos): Set NPC position instantly. + +## Related Callbacks + +- [OnNPCFinishMove](../callbacks/OnNPCFinishMove): Called when NPC finishes movement. diff --git a/frontend/docs/scripting/functions/NPC_StopPlayback.md b/frontend/docs/scripting/functions/NPC_StopPlayback.md new file mode 100644 index 00000000000..4622733eb4c --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_StopPlayback.md @@ -0,0 +1,60 @@ +--- +title: NPC_StopPlayback +sidebar_label: NPC_StopPlayback +description: Stops an NPC from playing a recording. +tags: ["npc", "playback", "recording"] +--- + + + +## Description + +Stops an NPC from playing their current recording playback. + +| Name | Description | +| ----- | ----------------- | +| npcid | The ID of the NPC | + +## Returns + +Returns `true` if the operation was successful, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/stopplayback", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new bool:success = NPC_StopPlayback(npcid); + SendClientMessage(playerid, 0x00FF00FF, "NPC %d playback stopped: %s", npcid, success ? "Success" : "Failed"); + return 1; + } + return 0; +} +``` + +## Notes + +- The NPC will stop at their current position when playback ends +- If the NPC is not playing a recording, this function has no effect +- Use `NPC_IsPlayingPlayback` to check if an NPC is playing a recording +- The recording file remains loaded and can be used again + +## Related Functions + +- [NPC_StartPlayback](NPC_StartPlayback): Start playback for NPC +- [NPC_IsPlayingPlayback](NPC_IsPlayingPlayback): Check if playing playback +- [NPC_LoadRecord](NPC_LoadRecord): Load a recording file +- [NPC_UnloadRecord](NPC_UnloadRecord): Unload a recording + +## Related Callbacks + +- [OnNPCPlaybackEnd](../callbacks/OnNPCPlaybackEnd): Called when playback ends diff --git a/frontend/docs/scripting/functions/NPC_StopPlayingNode.md b/frontend/docs/scripting/functions/NPC_StopPlayingNode.md new file mode 100644 index 00000000000..6d27d08dd91 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_StopPlayingNode.md @@ -0,0 +1,61 @@ +--- +title: NPC_StopPlayingNode +sidebar_label: NPC_StopPlayingNode +description: Stops an NPC from playing a node. +tags: ["npc", "node"] +--- + + + +## Description + +Stops an NPC from playing their current node. + +| Name | Description | +| ----- | ----------------- | +| npcid | The ID of the NPC | + +## Returns + +Returns `true` if the NPC was stopped successfully, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/npcstopnode", true)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new bool:success = NPC_StopPlayingNode(npcid); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d stop node: %s", npcid, success ? "Success" : "Failed"); + return 1; + } + return 0; +} +``` + +## Notes + +- The NPC will stop at their current position in the node +- If the NPC is not playing a node, this function returns `false` +- The node remains open and can be used by other NPCs +- Use `NPC_IsPlayingNode` to check if an NPC is playing a node + +## Related Functions + +- [NPC_PlayNode](NPC_PlayNode): Make NPC play a node +- [NPC_IsPlayingNode](NPC_IsPlayingNode): Check if NPC is playing node +- [NPC_PausePlayingNode](NPC_PausePlayingNode): Pause node playing +- [NPC_ResumePlayingNode](NPC_ResumePlayingNode): Resume node playing + +## Related Callbacks + +- [OnNPCFinishNode](../callbacks/OnNPCFinishNode): Called when NPC finishes a node diff --git a/frontend/docs/scripting/functions/NPC_UnloadAllRecords.md b/frontend/docs/scripting/functions/NPC_UnloadAllRecords.md new file mode 100644 index 00000000000..94416de43ea --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_UnloadAllRecords.md @@ -0,0 +1,52 @@ +--- +title: NPC_UnloadAllRecords +sidebar_label: NPC_UnloadAllRecords +description: Unloads all NPC recording files from memory. +tags: ["npc", "recording"] +--- + + + +## Description + +Unloads all NPC recording files from memory to free up resources. + +## Returns + +Returns `true` if all records were unloaded successfully, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/npcunloadallrecords", true)) + { + new bool:success = NPC_UnloadAllRecords(); + + if (success) + SendClientMessage(playerid, 0x00FF00FF, "All records unloaded successfully"); + else + SendClientMessage(playerid, 0xFF0000FF, "Failed to unload all records"); + return 1; + } + return 0; +} +``` + +## Notes + +- This frees up memory used by loaded recordings +- All record IDs become invalid after this function +- Any NPCs using these recordings will stop playback + +## Related Functions + +- [NPC_LoadRecord](NPC_LoadRecord): Load a recording file +- [NPC_UnloadRecord](NPC_UnloadRecord): Unload specific recording +- [NPC_GetRecordCount](NPC_GetRecordCount): Get number of loaded records +- [NPC_IsValidRecord](NPC_IsValidRecord): Check if record is valid + +## Related Callbacks + +- [OnNPCPlaybackEnd](../callbacks/OnNPCPlaybackEnd): Called when playback ends diff --git a/frontend/docs/scripting/functions/NPC_UnloadRecord.md b/frontend/docs/scripting/functions/NPC_UnloadRecord.md new file mode 100644 index 00000000000..50274e2386c --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_UnloadRecord.md @@ -0,0 +1,59 @@ +--- +title: NPC_UnloadRecord +sidebar_label: NPC_UnloadRecord +description: Unloads a specific NPC recording from memory. +tags: ["npc", "recording"] +--- + + + +## Description + +Unloads a specific NPC recording from memory to free up resources. + +| Name | Description | +| -------- | ------------------------------ | +| recordId | The ID of the record to unload | + +## Returns + +Returns `true` if the record was unloaded successfully, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/npcunloadrecord ", true, 17)) + { + new recordid = strval(cmdtext[17]); + + new bool:success = NPC_UnloadRecord(recordid); + + if (success) + SendClientMessage(playerid, 0x00FF00FF, "Record %d unloaded successfully", recordid); + else + SendClientMessage(playerid, 0xFF0000FF, "Failed to unload record %d", recordid); + return 1; + } + return 0; +} +``` + +## Notes + +- Frees memory used by the specific recording +- The record ID becomes invalid after unloading +- Any NPCs using this recording will stop playback +- Use `NPC_UnloadAllRecords` to unload all recordings at once + +## Related Functions + +- [NPC_LoadRecord](NPC_LoadRecord): Load a recording file +- [NPC_UnloadAllRecords](NPC_UnloadAllRecords): Unload all recordings +- [NPC_IsValidRecord](NPC_IsValidRecord): Check if record is valid +- [NPC_GetRecordCount](NPC_GetRecordCount): Get number of loaded records + +## Related Callbacks + +- [OnNPCPlaybackEnd](../callbacks/OnNPCPlaybackEnd): Called when playback ends diff --git a/frontend/docs/scripting/functions/NPC_UpdateNodePoint.md b/frontend/docs/scripting/functions/NPC_UpdateNodePoint.md new file mode 100644 index 00000000000..d09ef8dbb81 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_UpdateNodePoint.md @@ -0,0 +1,64 @@ +--- +title: NPC_UpdateNodePoint +sidebar_label: NPC_UpdateNodePoint +description: Updates an NPC to a specific point in the currently playing node. +tags: ["npc", "node"] +--- + + + +## Description + +Updates an NPC to a specific point in the currently playing node. + +| Name | Description | +| ------- | ------------------------------------- | +| npcid | The ID of the NPC | +| pointid | The point ID in the node to update to | + +## Returns + +Returns `true` if the update was successful, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/npcupdatenodepoint ", true, 20)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new pointid = strval(cmdtext[20]); + + new bool:success = NPC_UpdateNodePoint(npcid, pointid); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d update node point %d: %s", npcid, pointid, success ? "Success" : "Failed"); + return 1; + } + return 0; +} +``` + +## Notes + +- The NPC must be currently playing a node +- Point ID must exist in the current node +- Use this to skip to specific waypoints in navigation +- Useful for teleporting NPCs within their current path + +## Related Functions + +- [NPC_PlayNode](NPC_PlayNode): Start playing a node +- [NPC_SetNodePoint](NPC_SetNodePoint): Set node point coordinates +- [NPC_GetNodePointPosition](NPC_GetNodePointPosition): Get point position +- [NPC_IsPlayingNode](NPC_IsPlayingNode): Check if playing node + +## Related Callbacks + +- [OnNPCFinishNode](../callbacks/OnNPCFinishNode): Called when NPC finishes a node diff --git a/frontend/docs/scripting/functions/NPC_UseVehicleSiren.md b/frontend/docs/scripting/functions/NPC_UseVehicleSiren.md new file mode 100644 index 00000000000..c3e207a1ee4 --- /dev/null +++ b/frontend/docs/scripting/functions/NPC_UseVehicleSiren.md @@ -0,0 +1,67 @@ +--- +title: NPC_UseVehicleSiren +sidebar_label: NPC_UseVehicleSiren +description: Makes an NPC use or stop using a vehicle siren. +tags: ["npc", "vehicle", "siren"] +--- + + + +## Description + +Makes an NPC use or stop using a vehicle siren. + +| Name | Description | +| ----- | ---------------------------------------------------- | +| npcid | The ID of the NPC | +| use | `true` to use siren, `false` to stop (default: true) | + +## Returns + +Returns `true` if the operation was successful, `false` otherwise. + +## Examples + +```c +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if (!strcmp(cmdtext, "/npcusesiren ", true, 13)) + { + new npcid = PlayerNPC[playerid]; + if (npcid == INVALID_NPC_ID) + return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC."); + + if (!NPC_IsValid(npcid)) + return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC."); + + new veh = NPC_GetVehicle(npcid); + if (veh == INVALID_VEHICLE_ID) + return SendClientMessage(playerid, 0xFFFF00FF, "NPC %d is not in any vehicle.", npcid); + + new bool:use = strval(cmdtext[13]) ? true : false; + + new bool:success = NPC_UseVehicleSiren(npcid, use); + + SendClientMessage(playerid, 0x00FF00FF, "NPC %d vehicle siren %s: %s", npcid, use ? "enabled" : "disabled", success ? "Success" : "Failed"); + return 1; + } + return 0; +} +``` + +## Notes + +- Only works when the NPC is in a vehicle as driver +- The vehicle must support sirens (emergency vehicles) +- Siren state persists until changed or NPC exits vehicle + +## Related Functions + +- [NPC_IsVehicleSirenUsed](NPC_IsVehicleSirenUsed): Check if siren is being used +- [NPC_GetVehicle](NPC_GetVehicle): Get NPC's current vehicle +- [NPC_PutInVehicle](NPC_PutInVehicle): Put NPC in vehicle +- [NPC_Move](NPC_Move): Make NPC drive to location + +## Related Callbacks + +_No specific callbacks are triggered by this function._ diff --git a/frontend/docs/scripting/functions/NetStats_ConnectionStatus.md b/frontend/docs/scripting/functions/NetStats_ConnectionStatus.md index 9ad996dad5f..640e2a05a28 100644 --- a/frontend/docs/scripting/functions/NetStats_ConnectionStatus.md +++ b/frontend/docs/scripting/functions/NetStats_ConnectionStatus.md @@ -24,7 +24,7 @@ public OnPlayerCommandText(playerid, cmdtext[]) { if (!strcmp(cmdtext, "/connectionstatus")) { - static ConnectionStatuses[9][48] = + static ConnectionStatuses[9][48] = { "No Action", "Disconnect ASAP", diff --git a/frontend/docs/scripting/functions/PauseRecordingPlayback.md b/frontend/docs/scripting/functions/PauseRecordingPlayback.md index dd6d5475656..4aaa1c35414 100644 --- a/frontend/docs/scripting/functions/PauseRecordingPlayback.md +++ b/frontend/docs/scripting/functions/PauseRecordingPlayback.md @@ -9,7 +9,6 @@ tags: [] This will pause playing back the recording. - ## Related Functions - [ResumeRecordingPlayback](ResumeRecordingPlayback): Resumes the recording if its paused. diff --git a/frontend/docs/scripting/functions/PlayerGangZoneDestroy.md b/frontend/docs/scripting/functions/PlayerGangZoneDestroy.md index cd32ce4e7cf..e237b968be2 100644 --- a/frontend/docs/scripting/functions/PlayerGangZoneDestroy.md +++ b/frontend/docs/scripting/functions/PlayerGangZoneDestroy.md @@ -11,10 +11,10 @@ tags: ["player", "gangzone", "playergangzone"] Destroy player gangzone. -| Name | Description | -| ----------- | ------------------------------------------------------------------- | -| playerid | The ID of the player to whom the player gangzone will be destroyed. | -| zoneid | The ID of the player gangzone for destroy. | +| Name | Description | +| -------- | ------------------------------------------------------------------- | +| playerid | The ID of the player to whom the player gangzone will be destroyed. | +| zoneid | The ID of the player gangzone for destroy. | ## Returns @@ -61,4 +61,4 @@ public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) - [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. \ No newline at end of file +- [UsePlayerGangZoneCheck](UsePlayerGangZoneCheck): Enables the callback when a player enters/leaves this zone. diff --git a/frontend/docs/scripting/functions/PlayerGangZoneFlash.md b/frontend/docs/scripting/functions/PlayerGangZoneFlash.md index 807726e2d84..6015bbe171f 100644 --- a/frontend/docs/scripting/functions/PlayerGangZoneFlash.md +++ b/frontend/docs/scripting/functions/PlayerGangZoneFlash.md @@ -11,11 +11,11 @@ tags: ["player", "gangzone", "playergangzone"] Start player gangzone flash. -| Name | Description | -| ----------- | ---------------------------------------------------------------- | -| playerid | The ID of the player to whom player gangzone is bound. | -| zoneid | The ID of the player gangzone for in start flashing. | -| flashColour | The colour by which the player gangzone will be flashing. | +| Name | Description | +| ----------- | --------------------------------------------------------- | +| playerid | The ID of the player to whom player gangzone is bound. | +| zoneid | The ID of the player gangzone for in start flashing. | +| flashColour | The colour by which the player gangzone will be flashing. | ## Returns @@ -38,7 +38,7 @@ public OnPlayerConnect(playerid) // Show the gangzone player PlayerGangZoneShow(playerid, gGangZoneID[playerid]); - // Start player gangzone flash + // Start player gangzone flash PlayerGangZoneFlash(playerid, gGangZoneID[playerid], 0xFF00FFFF); } ``` @@ -57,4 +57,4 @@ public OnPlayerConnect(playerid) - [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. \ No newline at end of file +- [UsePlayerGangZoneCheck](UsePlayerGangZoneCheck): Enables the callback when a player enters/leaves this zone. diff --git a/frontend/docs/scripting/functions/PlayerGangZoneGetColour.md b/frontend/docs/scripting/functions/PlayerGangZoneGetColour.md index ba7087a402f..a5d60dcd15a 100644 --- a/frontend/docs/scripting/functions/PlayerGangZoneGetColour.md +++ b/frontend/docs/scripting/functions/PlayerGangZoneGetColour.md @@ -11,10 +11,10 @@ tags: ["player", "gangzone", "playergangzone"] Get the colour of a player gangzone. -| Name | Description | -| ----------- | ---------------------------------------------------------------- | -| playerid | The ID of the player to whom player gangzone is bound. | -| zoneid | The ID of the player gangzone. | +| Name | Description | +| -------- | ------------------------------------------------------ | +| playerid | The ID of the player to whom player gangzone is bound. | +| zoneid | The ID of the player gangzone. | ## Returns @@ -55,4 +55,4 @@ public OnPlayerConnect(playerid) - [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. \ No newline at end of file +- [UsePlayerGangZoneCheck](UsePlayerGangZoneCheck): Enables the callback when a player enters/leaves this zone. diff --git a/frontend/docs/scripting/functions/PlayerGangZoneGetFlashColour.md b/frontend/docs/scripting/functions/PlayerGangZoneGetFlashColour.md index 68db45e6ec3..8655aa8cf24 100644 --- a/frontend/docs/scripting/functions/PlayerGangZoneGetFlashColour.md +++ b/frontend/docs/scripting/functions/PlayerGangZoneGetFlashColour.md @@ -11,10 +11,10 @@ tags: ["player", "gangzone", "playergangzone"] Get the flashing colour of a player gangzone. -| Name | Description | -| ----------- | ---------------------------------------------------------------- | -| playerid | The ID of the player to whom player gangzone is bound. | -| zoneid | The ID of the player gangzone. | +| Name | Description | +| -------- | ------------------------------------------------------ | +| playerid | The ID of the player to whom player gangzone is bound. | +| zoneid | The ID of the player gangzone. | ## Returns @@ -35,7 +35,7 @@ public OnPlayerConnect(playerid) // Show the gangzone to player PlayerGangZoneShow(playerid, gGangZoneID[playerid], 0xFF0000FF); - // Start player gangzone flash + // Start player gangzone flash PlayerGangZoneFlash(playerid, gGangZoneID[playerid], 0x45D1ABFF); new flashColour = PlayerGangZoneGetFlashColour(playerid, gGangZoneID[playerid]); @@ -58,4 +58,4 @@ public OnPlayerConnect(playerid) - [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. \ No newline at end of file +- [UsePlayerGangZoneCheck](UsePlayerGangZoneCheck): Enables the callback when a player enters/leaves this zone. diff --git a/frontend/docs/scripting/functions/PlayerGangZoneGetPos.md b/frontend/docs/scripting/functions/PlayerGangZoneGetPos.md index a29eee10b8e..6710b132ba0 100644 --- a/frontend/docs/scripting/functions/PlayerGangZoneGetPos.md +++ b/frontend/docs/scripting/functions/PlayerGangZoneGetPos.md @@ -34,12 +34,12 @@ public OnPlayerConnect(playerid) // Create the gangzone gGangZoneID[playerid] = CreatePlayerGangZone(playerid, 2236.1475, 2424.7266, 2319.1636, 2502.4348); - new + new Float:minX, Float:minY, Float:maxX, Float:maxY; - + PlayerGangZoneGetPos(playerid, gGangZoneID[playerid], minX, minY, maxX, maxY); return 1; } @@ -59,4 +59,4 @@ public OnPlayerConnect(playerid) - [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. \ No newline at end of file +- [UsePlayerGangZoneCheck](UsePlayerGangZoneCheck): Enables the callback when a player enters/leaves this zone. diff --git a/frontend/docs/scripting/functions/PlayerGangZoneHide.md b/frontend/docs/scripting/functions/PlayerGangZoneHide.md index 43b2574c251..2e0b3d958ff 100644 --- a/frontend/docs/scripting/functions/PlayerGangZoneHide.md +++ b/frontend/docs/scripting/functions/PlayerGangZoneHide.md @@ -11,10 +11,10 @@ tags: ["player", "gangzone", "playergangzone"] 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. | +| Name | Description | +| -------- | ------------------------------------------------------ | +| playerid | The ID of the player to whom player gangzone is bound. | +| zoneid | The ID of the player gangzone for hide. | ## Returns @@ -58,4 +58,4 @@ public OnPlayerDeath(playerid, killerid, WEAPON:reason) - [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. \ No newline at end of file +- [UsePlayerGangZoneCheck](UsePlayerGangZoneCheck): Enables the callback when a player enters/leaves this zone. diff --git a/frontend/docs/scripting/functions/PlayerGangZoneShow.md b/frontend/docs/scripting/functions/PlayerGangZoneShow.md index d2a5263e7bd..55bba3f5510 100644 --- a/frontend/docs/scripting/functions/PlayerGangZoneShow.md +++ b/frontend/docs/scripting/functions/PlayerGangZoneShow.md @@ -11,11 +11,11 @@ tags: ["player", "gangzone", "playergangzone"] Show player gangzone in a color. -| Name | Description | -| ----------- | ---------------------------------------------------------------- | -| playerid | The ID of the player to whom player gangzone is bound. | -| zoneid | The ID of the player gangzone for shown. | -| colour | The colour by which the player gangzone will be shown. | +| Name | Description | +| -------- | ------------------------------------------------------ | +| playerid | The ID of the player to whom player gangzone is bound. | +| zoneid | The ID of the player gangzone for shown. | +| colour | The colour by which the player gangzone will be shown. | ## Returns @@ -54,4 +54,4 @@ public OnPlayerConnect(playerid) - [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. \ No newline at end of file +- [UsePlayerGangZoneCheck](UsePlayerGangZoneCheck): Enables the callback when a player enters/leaves this zone. diff --git a/frontend/docs/scripting/functions/PlayerGangZoneStopFlash.md b/frontend/docs/scripting/functions/PlayerGangZoneStopFlash.md index 2f58afef179..6b123b6b121 100644 --- a/frontend/docs/scripting/functions/PlayerGangZoneStopFlash.md +++ b/frontend/docs/scripting/functions/PlayerGangZoneStopFlash.md @@ -11,10 +11,10 @@ tags: ["player", "gangzone", "playergangzone"] Stop player gangzone flash. -| Name | Description | -| ----------- | ---------------------------------------------------------------- | -| playerid | The ID of the player to whom player gangzone is bound. | -| zoneid | The ID of the player gangzone for in stop flashing. | +| Name | Description | +| -------- | ------------------------------------------------------ | +| playerid | The ID of the player to whom player gangzone is bound. | +| zoneid | The ID of the player gangzone for in stop flashing. | ## Returns @@ -37,7 +37,7 @@ public OnPlayerConnect(playerid) // Show the gangzone player PlayerGangZoneShow(playerid, gGangZoneID[playerid]); - // Start player gangzone flash + // Start player gangzone flash PlayerGangZoneFlash(playerid, gGangZoneID[playerid], 0xFF00FFFF); } @@ -66,4 +66,4 @@ public OnPlayerDeath(playerid, killerid, WEAPON:reason) - [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. \ No newline at end of file +- [UsePlayerGangZoneCheck](UsePlayerGangZoneCheck): Enables the callback when a player enters/leaves this zone. diff --git a/frontend/docs/scripting/functions/PlayerSpectatePlayer.md b/frontend/docs/scripting/functions/PlayerSpectatePlayer.md index 75d62242d00..21cdb8c2d62 100644 --- a/frontend/docs/scripting/functions/PlayerSpectatePlayer.md +++ b/frontend/docs/scripting/functions/PlayerSpectatePlayer.md @@ -9,11 +9,11 @@ tags: ["player"] Makes a player spectate (watch) another player. -| Name | Description | -| -------------- | -------------------------------------------------------------------------------------------- | -| playerid | The ID of the player that will spectate. | -| targetplayerid | The ID of the player that should be spectated. | -| SPECTATE_MODE:mode | The [mode](../resources/spectatemodes) to spectate with (optional; defaults to 'normal'). | +| Name | Description | +| ------------------ | ----------------------------------------------------------------------------------------- | +| playerid | The ID of the player that will spectate. | +| targetplayerid | The ID of the player that should be spectated. | +| SPECTATE_MODE:mode | The [mode](../resources/spectatemodes) to spectate with (optional; defaults to 'normal'). | ## Returns diff --git a/frontend/docs/scripting/functions/PlayerTextDrawFont.md b/frontend/docs/scripting/functions/PlayerTextDrawFont.md index 54f143e479e..760a3481d0b 100644 --- a/frontend/docs/scripting/functions/PlayerTextDrawFont.md +++ b/frontend/docs/scripting/functions/PlayerTextDrawFont.md @@ -43,10 +43,10 @@ public OnPlayerConnect(playerid) { // First, create the textdraw welcomeText[playerid] = CreatePlayerTextDraw(playerid, 320.0, 240.0, "Welcome to my server!"); - + // Set the font of player-textdraw 'welcomeText[playerid]' to 2. PlayerTextDrawFont(playerid, welcomeText[playerid], TEXT_DRAW_FONT_2); - + // Show 'welcomeText[playerid]' to player PlayerTextDrawShow(playerid, welcomeText[playerid]); diff --git a/frontend/docs/scripting/functions/PlayerTextDrawGetAlignment.md b/frontend/docs/scripting/functions/PlayerTextDrawGetAlignment.md index c5125298930..7f6b81a9dc8 100644 --- a/frontend/docs/scripting/functions/PlayerTextDrawGetAlignment.md +++ b/frontend/docs/scripting/functions/PlayerTextDrawGetAlignment.md @@ -29,7 +29,7 @@ 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; diff --git a/frontend/docs/scripting/functions/PlayerTextDrawGetPreviewModel.md b/frontend/docs/scripting/functions/PlayerTextDrawGetPreviewModel.md index 40d0d0d444f..c95f86bdc24 100644 --- a/frontend/docs/scripting/functions/PlayerTextDrawGetPreviewModel.md +++ b/frontend/docs/scripting/functions/PlayerTextDrawGetPreviewModel.md @@ -12,7 +12,7 @@ tags: ["player", "textdraw", "playertextdraw"] Gets the preview model of a 3D preview player-textdraw. | Name | Description | -|-------------------|------------------------------------------------------------| +| ----------------- | ---------------------------------------------------------- | | playerid | The ID of the player. | | PlayerText:textid | The ID of the player-textdraw to get the preview model of. | diff --git a/frontend/docs/scripting/functions/PlayerTextDrawGetString.md b/frontend/docs/scripting/functions/PlayerTextDrawGetString.md index 53478392989..85f5e4be649 100644 --- a/frontend/docs/scripting/functions/PlayerTextDrawGetString.md +++ b/frontend/docs/scripting/functions/PlayerTextDrawGetString.md @@ -31,7 +31,7 @@ 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!" diff --git a/frontend/docs/scripting/functions/PlayerTextDrawLetterSize.md b/frontend/docs/scripting/functions/PlayerTextDrawLetterSize.md index c9824e8e79c..a06c84df98a 100644 --- a/frontend/docs/scripting/functions/PlayerTextDrawLetterSize.md +++ b/frontend/docs/scripting/functions/PlayerTextDrawLetterSize.md @@ -29,7 +29,7 @@ public OnPlayerConnect(playerid) { welcomeText[playerid] = CreatePlayerTextDraw(playerid, 320.0, 240.0, "Welcome to my OPEN.MP server"); PlayerTextDrawLetterSize(playerid, welcomeText[playerid], 3.2, 5.1); - + PlayerTextDrawShow(playerid, welcomeText[playerid]); return 1; } diff --git a/frontend/docs/scripting/functions/PlayerTextDrawSetPreviewModel.md b/frontend/docs/scripting/functions/PlayerTextDrawSetPreviewModel.md index af5cd476e59..03acf6285ee 100644 --- a/frontend/docs/scripting/functions/PlayerTextDrawSetPreviewModel.md +++ b/frontend/docs/scripting/functions/PlayerTextDrawSetPreviewModel.md @@ -33,7 +33,7 @@ public OnPlayerConnect(playerid) PlayerTextDrawUseBox(playerid, gTextDraw[playerid], true); PlayerTextDrawBoxColor(playerid, gTextDraw[playerid], 0x000000FF); PlayerTextDrawTextSize(playerid, gTextDraw[playerid], 40.0, 40.0); - + PlayerTextDrawSetPreviewModel(playerid, gTextDraw[playerid], 411); // Show an Infernus (model 411) //PlayerTextDrawSetPreviewModel(playerid, gTextDraw[playerid], 0); // Display model 0 (CJ Skin) //PlayerTextDrawSetPreviewModel(playerid, gTextDraw[playerid], 18646); // Display model 18646 (police light object) diff --git a/frontend/docs/scripting/functions/PlayerTextDrawSetPreviewVehCol.md b/frontend/docs/scripting/functions/PlayerTextDrawSetPreviewVehCol.md index c7f5f1e64e5..61b9400e17c 100644 --- a/frontend/docs/scripting/functions/PlayerTextDrawSetPreviewVehCol.md +++ b/frontend/docs/scripting/functions/PlayerTextDrawSetPreviewVehCol.md @@ -32,7 +32,7 @@ public OnPlayerConnect(playerid) PlayerTextDrawUseBox(playerid, gTextDraw[playerid], true); PlayerTextDrawBoxColor(playerid, gTextDraw[playerid], 0x000000FF); PlayerTextDrawTextSize(playerid, gTextDraw[playerid], 40.0, 40.0); - + PlayerTextDrawSetPreviewModel(playerid, gTextDraw[playerid], 411); PlayerTextDrawSetPreviewVehCol(playerid, gTextDraw[playerid], 3, 6); diff --git a/frontend/docs/scripting/functions/PlayerTextDrawSetPreviewVehicleColours.md b/frontend/docs/scripting/functions/PlayerTextDrawSetPreviewVehicleColours.md index c9feab76771..1fe01a9abf9 100644 --- a/frontend/docs/scripting/functions/PlayerTextDrawSetPreviewVehicleColours.md +++ b/frontend/docs/scripting/functions/PlayerTextDrawSetPreviewVehicleColours.md @@ -15,8 +15,8 @@ Set the colour of a vehicle in a player-textdraw model preview (if a vehicle is | ----------------- | ----------------------------------------------------- | | playerid | The ID of the player whose player-textdraw to change. | | PlayerText:textid | The ID of the player's player-textdraw to change. | -| colour1 | The colour to set the vehicle's primary colour to. | -| colour2 | The colour to set the vehicle's secondary colour to. | +| colour1 | The colour to set the vehicle's primary colour to. | +| colour2 | The colour to set the vehicle's secondary colour to. | ## Returns @@ -34,7 +34,7 @@ public OnPlayerConnect(playerid) PlayerTextDrawUseBox(playerid, gTextDraw[playerid], true); PlayerTextDrawBoxColour(playerid, gTextDraw[playerid], 0x000000FF); PlayerTextDrawTextSize(playerid, gTextDraw[playerid], 40.0, 40.0); - + PlayerTextDrawSetPreviewModel(playerid, gTextDraw[playerid], 411); PlayerTextDrawSetPreviewVehicleColours(playerid, gTextDraw[playerid], 3, 6); diff --git a/frontend/docs/scripting/functions/PlayerTextDrawSetSelectable.md b/frontend/docs/scripting/functions/PlayerTextDrawSetSelectable.md index 337ea1ec4f2..aba444fb0e5 100644 --- a/frontend/docs/scripting/functions/PlayerTextDrawSetSelectable.md +++ b/frontend/docs/scripting/functions/PlayerTextDrawSetSelectable.md @@ -28,7 +28,7 @@ public OnPlayerConnect(playerid) { welcomeText[playerid] = CreatePlayerTextDraw(playerid, 320.0, 240.0, "Welcome to my server"); PlayerTextDrawTextSize(playerid, welcomeText[playerid], 30.0, 10.0); - + // Set 'welcomeText[playerid]' selectable PlayerTextDrawSetSelectable(playerid, welcomeText[playerid], true); diff --git a/frontend/docs/scripting/functions/PlayerTextDrawSetString.md b/frontend/docs/scripting/functions/PlayerTextDrawSetString.md index dfe5e6bcbac..704c59abfff 100644 --- a/frontend/docs/scripting/functions/PlayerTextDrawSetString.md +++ b/frontend/docs/scripting/functions/PlayerTextDrawSetString.md @@ -47,7 +47,7 @@ public OnPlayerStateChange(playerid, PLAYER_STATE:newstate, PLAYER_STATE:oldstat forward UpdateVehicleHealthTextDraw(playerid); public UpdateVehicleHealthTextDraw(playerid) { - new + new string[32], vehicleid = GetPlayerVehicleID(playerid), Float:health; diff --git a/frontend/docs/scripting/functions/PlayerTextDrawTextSize.md b/frontend/docs/scripting/functions/PlayerTextDrawTextSize.md index 09535be0b4b..962997d139e 100644 --- a/frontend/docs/scripting/functions/PlayerTextDrawTextSize.md +++ b/frontend/docs/scripting/functions/PlayerTextDrawTextSize.md @@ -40,9 +40,9 @@ public OnPlayerConnect(playerid) :::tip - The x and y have different meanings with different [PlayerTextDrawAlignment](PlayerTextDrawAlignment) 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 + - 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 [PlayerTextDrawSetSelectable](PlayerTextDrawSetSelectable), whether a box is shown or not. diff --git a/frontend/docs/scripting/functions/PutPlayerInVehicle.md b/frontend/docs/scripting/functions/PutPlayerInVehicle.md index dca596bbb15..735e199e663 100644 --- a/frontend/docs/scripting/functions/PutPlayerInVehicle.md +++ b/frontend/docs/scripting/functions/PutPlayerInVehicle.md @@ -81,9 +81,9 @@ You can use [GetPlayerVehicleSeat](GetPlayerVehicleSeat) in a loop to check if a :::warning -* If the seat is invalid or already taken, the client will crash when they EXIT the vehicle. -* Putting a player into a vehicle that is not streamed in can be unreliable. This is due to a potential client-side issue where the vehicle may not have fully loaded into memory yet. -* This also applies when attempting to put a player into a vehicle that was just created. +- If the seat is invalid or already taken, the client will crash when they EXIT the vehicle. +- Putting a player into a vehicle that is not streamed in can be unreliable. This is due to a potential client-side issue where the vehicle may not have fully loaded into memory yet. +- This also applies when attempting to put a player into a vehicle that was just created. ::: diff --git a/frontend/docs/scripting/functions/RemovePlayerWeapon.md b/frontend/docs/scripting/functions/RemovePlayerWeapon.md index bd07a74c598..40d64aae6df 100644 --- a/frontend/docs/scripting/functions/RemovePlayerWeapon.md +++ b/frontend/docs/scripting/functions/RemovePlayerWeapon.md @@ -12,7 +12,7 @@ tags: ["player"] Remove a specified weapon from a player. | Name | Description | -|-----------------|-----------------------------------------------------------| +| --------------- | --------------------------------------------------------- | | playerid | The ID of the player whose weapon to remove. | | WEAPON:weaponid | The [ID of the weapon](../resources/weaponids) to remove. | diff --git a/frontend/docs/scripting/functions/RemoveServerRule.md b/frontend/docs/scripting/functions/RemoveServerRule.md index 0833438b63c..ed56f55a232 100644 --- a/frontend/docs/scripting/functions/RemoveServerRule.md +++ b/frontend/docs/scripting/functions/RemoveServerRule.md @@ -11,9 +11,9 @@ tags: ["rule"] Remove the server rule. -| Name | Description | -| ----------------- | ----------------------------------------------------------- | -| const rule[] | The server rule name to remove. | +| Name | Description | +| ------------ | ------------------------------- | +| const rule[] | The server rule name to remove. | ## Returns diff --git a/frontend/docs/scripting/functions/RemoveVehicleComponent.md b/frontend/docs/scripting/functions/RemoveVehicleComponent.md index 299a84688c1..a715903ad75 100644 --- a/frontend/docs/scripting/functions/RemoveVehicleComponent.md +++ b/frontend/docs/scripting/functions/RemoveVehicleComponent.md @@ -9,10 +9,10 @@ tags: ["vehicle"] Remove a component from a vehicle. -| Name | Description | -|--------------------------------------------|--------------------------------| -| vehicleid | ID of the vehicle. | -| [component](../resources/carcomponentid) | ID of the component to remove. | +| Name | Description | +| ---------------------------------------- | ------------------------------ | +| vehicleid | ID of the vehicle. | +| [component](../resources/carcomponentid) | ID of the component to remove. | ## Returns diff --git a/frontend/docs/scripting/functions/ResumeRecordingPlayback.md b/frontend/docs/scripting/functions/ResumeRecordingPlayback.md index 35c33616c9d..302d0a1d15d 100644 --- a/frontend/docs/scripting/functions/ResumeRecordingPlayback.md +++ b/frontend/docs/scripting/functions/ResumeRecordingPlayback.md @@ -9,7 +9,6 @@ tags: [] This will resume the paused recording. - ## Related Functions - [PauseRecordingPlayback](PauseRecordingPlayback): Resumes the recording if its paused. diff --git a/frontend/docs/scripting/functions/SendChat.md b/frontend/docs/scripting/functions/SendChat.md index 5b51d23ca0e..b29a816f349 100644 --- a/frontend/docs/scripting/functions/SendChat.md +++ b/frontend/docs/scripting/functions/SendChat.md @@ -9,9 +9,9 @@ tags: [] This will send a player text by the bot, just like using [SendPlayerMessageToAll](SendPlayerMessageToAll), but this function is to be used inside the NPC scripts. -| Name | Description | -| ------------ | -------------------------------------------------- | -| msg[] | The text to be sent by the NPC. | +| Name | Description | +| ----- | ------------------------------- | +| msg[] | The text to be sent by the NPC. | ## Examples diff --git a/frontend/docs/scripting/functions/SendClientCheck.md b/frontend/docs/scripting/functions/SendClientCheck.md index 915a89e2ff1..d7176207e51 100644 --- a/frontend/docs/scripting/functions/SendClientCheck.md +++ b/frontend/docs/scripting/functions/SendClientCheck.md @@ -9,15 +9,13 @@ tags: [] Perform a memory check on the client. - -| Name | Description | -| --------------- | ------------------------------------ | -| playerid | The ID of the player to check. | -| type | The type of check to perform. [See here](../resources/opcodes)| -| memAddr | The base address to check. | -| memOffset | The offset from the base address. | -| byteCount | The number of bytes to check. | - +| Name | Description | +| --------- | -------------------------------------------------------------- | +| playerid | The ID of the player to check. | +| type | The type of check to perform. [See here](../resources/opcodes) | +| memAddr | The base address to check. | +| memOffset | The offset from the base address. | +| byteCount | The number of bytes to check. | ## Returns @@ -58,7 +56,7 @@ public OnClientCheckResponse(playerid, actionid, memaddr, retndata) **SA:MP Server**: This function only works when it is in a filterscript. -**Open Multiplayer Server**: This functions normally inside a gamemode / filterscript. +**Open Multiplayer Server**: This functions normally inside a gamemode / filterscript. ::: diff --git a/frontend/docs/scripting/functions/SendClientMessage.md b/frontend/docs/scripting/functions/SendClientMessage.md index 303b06311cf..e95ee627fc3 100644 --- a/frontend/docs/scripting/functions/SendClientMessage.md +++ b/frontend/docs/scripting/functions/SendClientMessage.md @@ -10,7 +10,7 @@ tags: [] This function sends a message to a specific player with a chosen color in the chat. The whole line in the chatbox will be in the set color unless color embedding is used. | Name | Description | -|------------------|-------------------------------------------------------| +| ---------------- | ----------------------------------------------------- | | playerid | The ID of the player to display the message to. | | color | The color of the message (0xRRGGBBAA Hex format). | | const format[] | The text that will be displayed (max 144 characters). | diff --git a/frontend/docs/scripting/functions/SendClientMessageToAllf.md b/frontend/docs/scripting/functions/SendClientMessageToAllf.md index ef2379f9cb3..5de3c5cd7e0 100644 --- a/frontend/docs/scripting/functions/SendClientMessageToAllf.md +++ b/frontend/docs/scripting/functions/SendClientMessageToAllf.md @@ -19,11 +19,11 @@ This function was deprecated. Displays a formatted message in chat to all players. This is a multi-player equivalent of SendClientMessage. -| Name | Description | -| --------------- | ------------------------------------------------- | -| color | The color of the message (0xRRGGBBAA Hex format). | -| const message[] | The message to show (max 144 characters). | -| \{Float, _\}:... | Indefinite number of arguments of any tag | +| Name | Description | +| ----------------- | ------------------------------------------------- | +| color | The color of the message (0xRRGGBBAA Hex format). | +| const message[] | The message to show (max 144 characters). | +| \{Float, \_\}:... | Indefinite number of arguments of any tag | ## Returns diff --git a/frontend/docs/scripting/functions/SendClientMessagef.md b/frontend/docs/scripting/functions/SendClientMessagef.md index df26ba17915..8c79ad161b7 100644 --- a/frontend/docs/scripting/functions/SendClientMessagef.md +++ b/frontend/docs/scripting/functions/SendClientMessagef.md @@ -19,12 +19,12 @@ This function was deprecated. This function sends a formatted message to a specific player with a chosen color in the chat. The whole line in the chatbox will be in the set color unless color embedding is used. -| Name | Description | -| --------------- | ----------------------------------------------------- | -| playerid | The ID of the player to display the message to. | -| color | The color of the message (0xRRGGBBAA Hex format). | -| const message[] | The text that will be displayed (max 144 characters). | -| \{Float, _\}:... | Indefinite number of arguments of any tag | +| Name | Description | +| ----------------- | ----------------------------------------------------- | +| playerid | The ID of the player to display the message to. | +| color | The color of the message (0xRRGGBBAA Hex format). | +| const message[] | The text that will be displayed (max 144 characters). | +| \{Float, \_\}:... | Indefinite number of arguments of any tag | ## Returns diff --git a/frontend/docs/scripting/functions/SendCommand.md b/frontend/docs/scripting/functions/SendCommand.md index 1aaa32666d9..3afd275cf9a 100644 --- a/frontend/docs/scripting/functions/SendCommand.md +++ b/frontend/docs/scripting/functions/SendCommand.md @@ -9,9 +9,9 @@ tags: [] This will force the NPC to write a desired command, and this way, getting the effects it would produce. -| Name | Description | -| -------------------- | -------------------------------------------------- | -| commandtext[] | The command text to be sent by the NPC. | +| Name | Description | +| ------------- | --------------------------------------- | +| commandtext[] | The command text to be sent by the NPC. | ## Examples diff --git a/frontend/docs/scripting/functions/SetActorHealth.md b/frontend/docs/scripting/functions/SetActorHealth.md index 62b8887a508..8a448672bce 100644 --- a/frontend/docs/scripting/functions/SetActorHealth.md +++ b/frontend/docs/scripting/functions/SetActorHealth.md @@ -30,7 +30,7 @@ new gMyActor; public OnGameModeInit() { gMyActor = CreateActor(179, 316.1, -134.0, 999.6, 90.0); // Actor as salesperson in Ammunation - + SetActorHealth(gMyActor, 100.0); return 1; } diff --git a/frontend/docs/scripting/functions/SetActorSkin.md b/frontend/docs/scripting/functions/SetActorSkin.md index 092d9a40377..f0ccbd9a2f7 100644 --- a/frontend/docs/scripting/functions/SetActorSkin.md +++ b/frontend/docs/scripting/functions/SetActorSkin.md @@ -12,7 +12,7 @@ tags: ["actor"] Set the skin of the actor. | Name | Description | -|---------|---------------------------------| +| ------- | ------------------------------- | | actorid | The ID of the actor to set. | | skin | The ID of the skin to give them | diff --git a/frontend/docs/scripting/functions/SetModeRestartTime.md b/frontend/docs/scripting/functions/SetModeRestartTime.md index 6d7dc56cade..f9a3307a91e 100644 --- a/frontend/docs/scripting/functions/SetModeRestartTime.md +++ b/frontend/docs/scripting/functions/SetModeRestartTime.md @@ -14,7 +14,7 @@ Sets the delay between loading main scripts, in seconds. ## Parameters | Name | Description | -|---------------|---------------------| +| ------------- | ------------------- | | Float:seconds | Seconds to restart. | ## Return Values diff --git a/frontend/docs/scripting/functions/SetMyFacingAngle.md b/frontend/docs/scripting/functions/SetMyFacingAngle.md index 0094ac87741..b6815f9ec2c 100644 --- a/frontend/docs/scripting/functions/SetMyFacingAngle.md +++ b/frontend/docs/scripting/functions/SetMyFacingAngle.md @@ -5,13 +5,19 @@ description: Set the NPC's facing angle. tags: [] --- +:::warning + +This function is deprecated. Please see [NPC_SetFacingAngle](NPC_SetFacingAngle). + +::: + ## Description Set the NPC's facing angle. -| Name | Description | -| -------------------- | ----------------------------- | -| Float:ang | The new NPC's facing angle. | +| Name | Description | +| --------- | --------------------------- | +| Float:ang | The new NPC's facing angle. | ## Examples diff --git a/frontend/docs/scripting/functions/SetMyPos.md b/frontend/docs/scripting/functions/SetMyPos.md index c795b0e4182..4b556c85575 100644 --- a/frontend/docs/scripting/functions/SetMyPos.md +++ b/frontend/docs/scripting/functions/SetMyPos.md @@ -5,19 +5,25 @@ description: Set position of the NPC tags: ["npc"] --- +:::warning + +This function is deprecated. Please see [NPC_SetPos](NPC_SetPos). + +::: + ## 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. | +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. +This function does not return any specific values. ## Example diff --git a/frontend/docs/scripting/functions/SetObjectMoveSpeed.md b/frontend/docs/scripting/functions/SetObjectMoveSpeed.md index c7a2d66118a..2724be45d55 100644 --- a/frontend/docs/scripting/functions/SetObjectMoveSpeed.md +++ b/frontend/docs/scripting/functions/SetObjectMoveSpeed.md @@ -12,7 +12,7 @@ tags: ["object"] Set the move speed of an object. | Name | Description | -|-------------|-----------------------------------------------------------| +| ----------- | --------------------------------------------------------- | | objectid | The ID of the object to set the move speed of. | | Float:speed | The speed at which to move the object (units per second). | diff --git a/frontend/docs/scripting/functions/SetObjectsDefaultCameraCollision.md b/frontend/docs/scripting/functions/SetObjectsDefaultCameraCollision.md index 7342eb305fe..918f7666c68 100644 --- a/frontend/docs/scripting/functions/SetObjectsDefaultCameraCollision.md +++ b/frontend/docs/scripting/functions/SetObjectsDefaultCameraCollision.md @@ -12,7 +12,7 @@ tags: ["object", "camera"] Allows camera collisions with newly created objects to be disabled by default. | Name | Description | -|--------------|----------------------------------------------------------------------------------------------------------------| +| ------------ | -------------------------------------------------------------------------------------------------------------- | | bool:disable | `true` to disable camera collisions for newly created objects and `false` to enable them (enabled by default). | ## Returns diff --git a/frontend/docs/scripting/functions/SetPVarString.md b/frontend/docs/scripting/functions/SetPVarString.md index fc97b8c7e1b..55d245217f7 100644 --- a/frontend/docs/scripting/functions/SetPVarString.md +++ b/frontend/docs/scripting/functions/SetPVarString.md @@ -25,10 +25,10 @@ This function does not return any specific values. ```c public OnPlayerConnect(playerid) { - new - hours, - minutes, - seconds, + new + hours, + minutes, + seconds, string[46]; gettime(hours, minutes, seconds); // get the time diff --git a/frontend/docs/scripting/functions/SetPickupForPlayer.md b/frontend/docs/scripting/functions/SetPickupForPlayer.md index edf0402a96a..df73a589b37 100644 --- a/frontend/docs/scripting/functions/SetPickupForPlayer.md +++ b/frontend/docs/scripting/functions/SetPickupForPlayer.md @@ -18,7 +18,7 @@ This function has not yet been implemented. Adjusts the pickup model, type, and position for a specific player. | Name | Description | -|----------|-----------------------------------------------------| +| -------- | --------------------------------------------------- | | playerid | The ID of the player. | | pickupid | The ID of the pickup. | | model | The [model](../resources/pickupids) to set. | diff --git a/frontend/docs/scripting/functions/SetPickupModel.md b/frontend/docs/scripting/functions/SetPickupModel.md index 7d504e1aea4..8f9b7f7cfea 100644 --- a/frontend/docs/scripting/functions/SetPickupModel.md +++ b/frontend/docs/scripting/functions/SetPickupModel.md @@ -12,7 +12,7 @@ tags: ["pickup"] Sets the model of a pickup. | Name | Description | -|--------------------|---------------------------------------------| +| ------------------ | ------------------------------------------- | | pickupid | The ID of the pickup. | | model | The [model](../resources/pickupids) to set. | | bool:update = true | Update pickup for everyone. (true/false) | diff --git a/frontend/docs/scripting/functions/SetPickupPos.md b/frontend/docs/scripting/functions/SetPickupPos.md index 4b966078788..4e12f1f3f28 100644 --- a/frontend/docs/scripting/functions/SetPickupPos.md +++ b/frontend/docs/scripting/functions/SetPickupPos.md @@ -12,7 +12,7 @@ tags: ["pickup"] 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. | diff --git a/frontend/docs/scripting/functions/SetPickupType.md b/frontend/docs/scripting/functions/SetPickupType.md index 69d08cea790..884b452e0f6 100644 --- a/frontend/docs/scripting/functions/SetPickupType.md +++ b/frontend/docs/scripting/functions/SetPickupType.md @@ -12,7 +12,7 @@ tags: ["pickup"] Sets the type of a pickup. | Name | Description | -|--------------------|-----------------------------------------------------| +| ------------------ | --------------------------------------------------- | | pickupid | The ID of the pickup. | | type | The [pickup type](../resources/pickuptypes) to set. | | bool:update = true | Update pickup for everyone. (true/false) | diff --git a/frontend/docs/scripting/functions/SetPickupVirtualWorld.md b/frontend/docs/scripting/functions/SetPickupVirtualWorld.md index e894caf18a9..ffe95148c43 100644 --- a/frontend/docs/scripting/functions/SetPickupVirtualWorld.md +++ b/frontend/docs/scripting/functions/SetPickupVirtualWorld.md @@ -12,7 +12,7 @@ tags: ["pickup"] Sets the virtual world ID of a pickup. | Name | Description | -|--------------|------------------------------| +| ------------ | ---------------------------- | | pickupid | The ID of the pickup. | | virtualWorld | The virtual world ID to set. | diff --git a/frontend/docs/scripting/functions/SetPlayerAdmin.md b/frontend/docs/scripting/functions/SetPlayerAdmin.md index eea9050b320..928eeee0bb8 100644 --- a/frontend/docs/scripting/functions/SetPlayerAdmin.md +++ b/frontend/docs/scripting/functions/SetPlayerAdmin.md @@ -12,7 +12,7 @@ tags: ["player", "rcon", "administration"] Sets the player as an RCON admin. | Name | Description | -|------------|--------------------------------------------------------------------------| +| ---------- | ------------------------------------------------------------------------ | | playerid | The ID of the player. | | bool:admin | **true** for set as an RCON admin, **false** for remove from RCON admin. | @@ -41,4 +41,4 @@ public OnPlayerCommandText(playerid, cmdtext[]) ## Related Callbacks -- [OnRconLoginAttempt](OnRconLoginAttempt): Called when an attempt to login to RCON is made. \ No newline at end of file +- [OnRconLoginAttempt](OnRconLoginAttempt): Called when an attempt to login to RCON is made. diff --git a/frontend/docs/scripting/functions/SetPlayerHoldingObject.md b/frontend/docs/scripting/functions/SetPlayerHoldingObject.md index bcc2cdcfd53..cdef562b594 100644 --- a/frontend/docs/scripting/functions/SetPlayerHoldingObject.md +++ b/frontend/docs/scripting/functions/SetPlayerHoldingObject.md @@ -9,17 +9,17 @@ tags: ["player"] Attaches an object to a bone. -| Name | Description | -| -------- | -------------------------------------------------------------------- | -| playerid | ID of the player you want to attach the object to. | -| modelid | The model you want to use. | +| Name | Description | +| -------- | ----------------------------------------------------------------- | +| playerid | ID of the player you want to attach the object to. | +| modelid | The model you want to use. | | bone | The [bone](../resources/boneid) you want to attach the object to. | -| fOffsetX | (optional) X axis offset for the object position. | -| fOffsetY | (optional) Y axis offset for the object position. | -| fOffsetZ | (optional) Z axis offset for the object position. | -| fRotX | (optional) X axis rotation of the object. | -| fRotY | (optional) Y axis rotation of the object. | -| fRotZ | (optional) Z axis rotation of the object. | +| fOffsetX | (optional) X axis offset for the object position. | +| fOffsetY | (optional) Y axis offset for the object position. | +| fOffsetZ | (optional) Z axis offset for the object position. | +| fRotX | (optional) X axis rotation of the object. | +| fRotY | (optional) Y axis rotation of the object. | +| fRotZ | (optional) Z axis rotation of the object. | ## Returns diff --git a/frontend/docs/scripting/functions/SetPlayerInterior.md b/frontend/docs/scripting/functions/SetPlayerInterior.md index fcf4910b28b..37beea9a0f1 100644 --- a/frontend/docs/scripting/functions/SetPlayerInterior.md +++ b/frontend/docs/scripting/functions/SetPlayerInterior.md @@ -9,9 +9,9 @@ tags: ["player"] Set a player's interior. A list of currently known interiors and their positions can be found here. -| Name | Description | -| ---------- | -------------------------------------------------------------------- | -| playerid | The ID of the player to set the interior of. | +| Name | Description | +| ---------- | ----------------------------------------------------------------- | +| playerid | The ID of the player to set the interior of. | | interiorid | The [interior ID](../resources/interiorids) to set the player in. | ## Returns diff --git a/frontend/docs/scripting/functions/SetPlayerObjectMoveSpeed.md b/frontend/docs/scripting/functions/SetPlayerObjectMoveSpeed.md index fd3e51a88e6..63309a926be 100644 --- a/frontend/docs/scripting/functions/SetPlayerObjectMoveSpeed.md +++ b/frontend/docs/scripting/functions/SetPlayerObjectMoveSpeed.md @@ -12,7 +12,7 @@ tags: ["player", "object", "playerobject"] Set the move speed of a player-object. | Name | Description | -|-------------|-----------------------------------------------------------| +| ----------- | --------------------------------------------------------- | | playerid | The ID of the player. | | objectid | The ID of the player-object to set the move speed of. | | Float:speed | The speed at which to move the object (units per second). | diff --git a/frontend/docs/scripting/functions/SetPlayerPickupModel.md b/frontend/docs/scripting/functions/SetPlayerPickupModel.md index 2f4961115f7..e1f05f21a7e 100644 --- a/frontend/docs/scripting/functions/SetPlayerPickupModel.md +++ b/frontend/docs/scripting/functions/SetPlayerPickupModel.md @@ -12,7 +12,7 @@ tags: ["player", "pickup", "playerpickup"] Sets the model of a player-pickup. | Name | Description | -|--------------------|---------------------------------------------| +| ------------------ | ------------------------------------------- | | playerid | The ID of the player. | | pickupid | The ID of the player-pickup. | | model | The [model](../resources/pickupids) to set. | @@ -30,7 +30,7 @@ new PlayerPickup[MAX_PLAYERS]; public OnPlayerConnect(playerid) { PlayerPickup[playerid] = CreatePlayerPickup(playerid, 1242, 2, 2010.0979, 1222.0642, 10.8206, -1); - + SetPlayerPickupModel(playerid, PlayerPickup[playerid], 1210); return 1; } diff --git a/frontend/docs/scripting/functions/SetPlayerPickupPos.md b/frontend/docs/scripting/functions/SetPlayerPickupPos.md index 9982057b612..90ec1a89f44 100644 --- a/frontend/docs/scripting/functions/SetPlayerPickupPos.md +++ b/frontend/docs/scripting/functions/SetPlayerPickupPos.md @@ -12,7 +12,7 @@ tags: ["player", "pickup", "playerpickup"] 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. | @@ -32,7 +32,7 @@ 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; } diff --git a/frontend/docs/scripting/functions/SetPlayerPickupType.md b/frontend/docs/scripting/functions/SetPlayerPickupType.md index df85d1fa9c3..46a2f18e34b 100644 --- a/frontend/docs/scripting/functions/SetPlayerPickupType.md +++ b/frontend/docs/scripting/functions/SetPlayerPickupType.md @@ -12,7 +12,7 @@ tags: ["player", "pickup", "playerpickup"] Sets the type of a player-pickup. | Name | Description | -|--------------------|-----------------------------------------------------| +| ------------------ | --------------------------------------------------- | | playerid | The ID of the player. | | pickupid | The ID of the player-pickup. | | type | The [pickup type](../resources/pickuptypes) to set. | @@ -30,7 +30,7 @@ new PlayerPickup[MAX_PLAYERS]; public OnPlayerConnect(playerid) { PlayerPickup[playerid] = CreatePlayerPickup(playerid, 1242, 1, 2010.0979, 1222.0642, 10.8206, -1); - + SetPlayerPickupType(playerid, PlayerPickup[playerid], 2); return 1; } diff --git a/frontend/docs/scripting/functions/SetPlayerPickupVirtualWorld.md b/frontend/docs/scripting/functions/SetPlayerPickupVirtualWorld.md index 21e297e38cd..298868208a8 100644 --- a/frontend/docs/scripting/functions/SetPlayerPickupVirtualWorld.md +++ b/frontend/docs/scripting/functions/SetPlayerPickupVirtualWorld.md @@ -12,7 +12,7 @@ tags: ["player", "pickup", "playerpickup"] Sets the virtual world ID of a player-pickup. | Name | Description | -|--------------|------------------------------| +| ------------ | ---------------------------- | | playerid | The ID of the player. | | pickupid | The ID of the player-pickup. | | virtualWorld | The virtual world ID to set. | @@ -29,7 +29,7 @@ new PlayerPickup[MAX_PLAYERS]; public OnPlayerConnect(playerid) { PlayerPickup[playerid] = CreatePlayerPickup(playerid, 1242, 1, 2010.0979, 1222.0642, 10.8206, 20); - + SetPlayerPickupVirtualWorld(playerid, PlayerPickup[playerid], 10); return 1; } diff --git a/frontend/docs/scripting/functions/SetPlayerRaceCheckpoint.md b/frontend/docs/scripting/functions/SetPlayerRaceCheckpoint.md index c0c31f003b3..feb19734811 100644 --- a/frontend/docs/scripting/functions/SetPlayerRaceCheckpoint.md +++ b/frontend/docs/scripting/functions/SetPlayerRaceCheckpoint.md @@ -10,7 +10,7 @@ tags: ["player", "checkpoint", "racecheckpoint"] Creates a race checkpoint. When the player enters it, the OnPlayerEnterRaceCheckpoint callback is called. | Name | Description | -|---------------|----------------------------------------------------------------| +| ------------- | -------------------------------------------------------------- | | playerid | The ID of the player to set the checkpoint for | | CP_TYPE:type | [Type of race checkpoint](../resources/race-checkpoint-types) | | Float:centreX | X-Coordinate | diff --git a/frontend/docs/scripting/functions/SetPlayerSkin.md b/frontend/docs/scripting/functions/SetPlayerSkin.md index 189bec7236e..df23264ec84 100644 --- a/frontend/docs/scripting/functions/SetPlayerSkin.md +++ b/frontend/docs/scripting/functions/SetPlayerSkin.md @@ -92,7 +92,7 @@ Known Bug(s): - If a player's skin is set when they are crouching, in a vehicle, or performing certain animations, they will become frozen or otherwise glitched. This can be fixed by using [TogglePlayerControllable](TogglePlayerControllable). - Players can be detected as being crouched through [GetPlayerSpecialAction](GetPlayerSpecialAction) (SPECIAL_ACTION_DUCK). -- Other players around the player may crash if he is in a vehicle or if he is entering/leaving a vehicle. +- Other players around the player may crash if he is in a vehicle or if he is entering/leaving a vehicle. - Setting a player's skin when he is dead may crash players around him. - Breaks sitting on bikes. diff --git a/frontend/docs/scripting/functions/SetPlayerWeather.md b/frontend/docs/scripting/functions/SetPlayerWeather.md index c6215ddde2e..14a907566a0 100644 --- a/frontend/docs/scripting/functions/SetPlayerWeather.md +++ b/frontend/docs/scripting/functions/SetPlayerWeather.md @@ -9,10 +9,10 @@ tags: ["player"] Set a player's weather. -| Name | Description | -| -------- | ---------------------------------------------- | -| playerid | The ID of the player whose weather to set. | -| weather | The [weather](../resources/weatherid) to set. | +| Name | Description | +| -------- | --------------------------------------------- | +| playerid | The ID of the player whose weather to set. | +| weather | The [weather](../resources/weatherid) to set. | ## Returns diff --git a/frontend/docs/scripting/functions/SetServerRule.md b/frontend/docs/scripting/functions/SetServerRule.md index b1f105c99a2..fc7daf0361b 100644 --- a/frontend/docs/scripting/functions/SetServerRule.md +++ b/frontend/docs/scripting/functions/SetServerRule.md @@ -13,11 +13,11 @@ Add a server rule. ## Parameters -| Name | Description | -| ----------------- | ----------------------------------------------------------- | -| const rule[] | The server rule name to add. | -| const format[] | The server rule value. | -| OPEN_MP_TAGS:... | Indefinite number of arguments of any tag. | +| Name | Description | +| ---------------- | ------------------------------------------ | +| const rule[] | The server rule name to add. | +| const format[] | The server rule value. | +| OPEN_MP_TAGS:... | Indefinite number of arguments of any tag. | ## Returns diff --git a/frontend/docs/scripting/functions/SetServerRuleFlags.md b/frontend/docs/scripting/functions/SetServerRuleFlags.md index 3e4050e5eb1..ee50d014a8b 100644 --- a/frontend/docs/scripting/functions/SetServerRuleFlags.md +++ b/frontend/docs/scripting/functions/SetServerRuleFlags.md @@ -20,7 +20,7 @@ Sets the flags of a server rule. ## Parameters | Name | Description | -|---------------------------|-----------------------| +| ------------------------- | --------------------- | | const rule[] | The server rule name. | | E_SERVER_RULE_FLAGS:flags | The flags to set. | diff --git a/frontend/docs/scripting/functions/SetTimer.md b/frontend/docs/scripting/functions/SetTimer.md index 63d5a9a1501..427a3aa27f2 100644 --- a/frontend/docs/scripting/functions/SetTimer.md +++ b/frontend/docs/scripting/functions/SetTimer.md @@ -64,7 +64,7 @@ You can use [KillTimer](KillTimer) on a timer ID and it won't matter if it's run ## Definitions | Definition | Value | -|---------------|-------| +| ------------- | ----- | | INVALID_TIMER | 0 | ## Related Functions diff --git a/frontend/docs/scripting/functions/SetTimerEx.md b/frontend/docs/scripting/functions/SetTimerEx.md index fd0c4a33f23..ed7126fcb51 100644 --- a/frontend/docs/scripting/functions/SetTimerEx.md +++ b/frontend/docs/scripting/functions/SetTimerEx.md @@ -76,7 +76,7 @@ But it is fixed in open.mp :::tip -Timer ID variables should be reset to 0 when they can to minimise the chance of accidentally killing new timers by mistake. `-1` is commonly mistaken to be the invalid ID - it isn't. +Timer ID variables should be reset to 0 when they can to minimise the chance of accidentally killing new timers by mistake. `-1` is commonly mistaken to be the invalid ID - it isn't. The function to be called must be public. That means it has to be forwarded. @@ -85,7 +85,7 @@ The function to be called must be public. That means it has to be forwarded. ## Definitions | Definition | Value | -|---------------|-------| +| ------------- | ----- | | INVALID_TIMER | 0 | ## Related Functions diff --git a/frontend/docs/scripting/functions/SetVehicleAngularVelocity.md b/frontend/docs/scripting/functions/SetVehicleAngularVelocity.md index aca29dcc6a1..f01acc0d062 100644 --- a/frontend/docs/scripting/functions/SetVehicleAngularVelocity.md +++ b/frontend/docs/scripting/functions/SetVehicleAngularVelocity.md @@ -15,12 +15,12 @@ This function is in _world_ space not _local_ space. If you want to make local s Sets the angular X, Y and Z velocity of a vehicle -| Name | Description | -| --------- | --------------------------------------------------- | -| vehicleid | The ID of the vehicle to set the velocity of. | -| Float:x | The amount of velocity in the angular X direction. | -| Float:y | The amount of velocity in the angular Y direction. | -| Float:z | The amount of velocity in the angular Z direction. | +| Name | Description | +| --------- | -------------------------------------------------- | +| vehicleid | The ID of the vehicle to set the velocity of. | +| Float:x | The amount of velocity in the angular X direction. | +| Float:y | The amount of velocity in the angular Y direction. | +| Float:z | The amount of velocity in the angular Z direction. | ## Returns diff --git a/frontend/docs/scripting/functions/SetVehicleBeenOccupied.md b/frontend/docs/scripting/functions/SetVehicleBeenOccupied.md index 429112e7e83..860eef07982 100644 --- a/frontend/docs/scripting/functions/SetVehicleBeenOccupied.md +++ b/frontend/docs/scripting/functions/SetVehicleBeenOccupied.md @@ -19,9 +19,9 @@ Sets the vehicle's occupancy. ## Parameters -| Name | Description | -|---------------|--------------------------------------| -| vehicleid | The ID of the vehicle. | +| Name | Description | +| ------------- | -------------------------------------------- | +| vehicleid | The ID of the vehicle. | | bool:occupied | **true**: occupied - **false**: not occupied | ## Examples diff --git a/frontend/docs/scripting/functions/SetVehicleDead.md b/frontend/docs/scripting/functions/SetVehicleDead.md index 5461da15059..aac1383a2c1 100644 --- a/frontend/docs/scripting/functions/SetVehicleDead.md +++ b/frontend/docs/scripting/functions/SetVehicleDead.md @@ -20,7 +20,7 @@ Sets the vehicle to dead. ## Parameters | Name | Description | -|-----------|--------------------------------------| +| --------- | ------------------------------------ | | vehicleid | The ID of the vehicle. | | bool:dead | **true**: dead - **false**: not dead | diff --git a/frontend/docs/scripting/functions/SetVehicleNumberPlate.md b/frontend/docs/scripting/functions/SetVehicleNumberPlate.md index 628ef59f505..7becd9041ee 100644 --- a/frontend/docs/scripting/functions/SetVehicleNumberPlate.md +++ b/frontend/docs/scripting/functions/SetVehicleNumberPlate.md @@ -37,7 +37,7 @@ SetVehicleNumberPlate(vehicleid, "ABCD 123"); - The vehicle must be re-spawned or re-streamed for the changes to take effect. - There's a limit of 32 characters on each number plate (including embedded colors). - The text length that can be seen on the number plate is around 9 to 10 characters, more characters will cause the text to split. -- Some vehicle models has a backward number plate, e.g. Boxville (498) (as an alternative to this vehicle you can use vehicle model ID 609, which is a duplicated Boxville (aka Boxburg), but with a regular number plate). +- Some vehicle models has a backward number plate, e.g. Boxville (498) (as an alternative to this vehicle you can use vehicle model ID 609, which is a duplicated Boxville (aka Boxburg), but with a regular number plate). ::: diff --git a/frontend/docs/scripting/functions/SetVehicleOccupiedTick.md b/frontend/docs/scripting/functions/SetVehicleOccupiedTick.md index 991010eb4fc..3c94d16a48b 100644 --- a/frontend/docs/scripting/functions/SetVehicleOccupiedTick.md +++ b/frontend/docs/scripting/functions/SetVehicleOccupiedTick.md @@ -20,7 +20,7 @@ Set the occupied tick of a vehicle. ## Parameters | Name | Description | -|-----------|------------------------| +| --------- | ---------------------- | | vehicleid | The ID of the vehicle. | | ticks | The ticks to set. | diff --git a/frontend/docs/scripting/functions/SetVehicleParamsSirenState.md b/frontend/docs/scripting/functions/SetVehicleParamsSirenState.md index 063181687a4..be84047fa30 100644 --- a/frontend/docs/scripting/functions/SetVehicleParamsSirenState.md +++ b/frontend/docs/scripting/functions/SetVehicleParamsSirenState.md @@ -14,7 +14,7 @@ Turn the siren for a vehicle on or off. ## Parameters | Name | Description | -|--------------|-------------------------------| +| ------------ | ----------------------------- | | vehicleid | The ID of the vehicle. | | bool:enabled | **true**: On - **false**: Off | diff --git a/frontend/docs/scripting/functions/SetVehicleRespawnDelay.md b/frontend/docs/scripting/functions/SetVehicleRespawnDelay.md index 0e592365e32..9a33c2f5e3a 100644 --- a/frontend/docs/scripting/functions/SetVehicleRespawnDelay.md +++ b/frontend/docs/scripting/functions/SetVehicleRespawnDelay.md @@ -14,7 +14,7 @@ Set the respawn delay of a vehicle. ## Parameters | Name | Description | -|--------------|----------------------------------------| +| ------------ | -------------------------------------- | | vehicleid | The ID of the vehicle. | | respawnDelay | The respawn delay (in seconds) to set. | diff --git a/frontend/docs/scripting/functions/SetVehicleRespawnTick.md b/frontend/docs/scripting/functions/SetVehicleRespawnTick.md index 55995ba6071..ccee85cef05 100644 --- a/frontend/docs/scripting/functions/SetVehicleRespawnTick.md +++ b/frontend/docs/scripting/functions/SetVehicleRespawnTick.md @@ -20,7 +20,7 @@ Set the respawn tick of a vehicle. ## Parameters | Name | Description | -|-----------|------------------------| +| --------- | ---------------------- | | vehicleid | The ID of the vehicle. | | ticks | The ticks to set. | diff --git a/frontend/docs/scripting/functions/SetVehicleSpawnInfo.md b/frontend/docs/scripting/functions/SetVehicleSpawnInfo.md index 917579bfaea..2111260cc3a 100644 --- a/frontend/docs/scripting/functions/SetVehicleSpawnInfo.md +++ b/frontend/docs/scripting/functions/SetVehicleSpawnInfo.md @@ -14,7 +14,7 @@ Adjusts vehicle model, spawn location, colours, respawn delay and interior. ## Parameters | Name | Description | -|-------------------|-------------------------------------------------------------| +| ----------------- | ----------------------------------------------------------- | | vehicleid | The ID of the vehicle. | | modelid | [Vehicle model](../resources/vehicleid) id to set. | | Float:spawnX | The X coordinate to set. | diff --git a/frontend/docs/scripting/functions/SetVehicleZAngle.md b/frontend/docs/scripting/functions/SetVehicleZAngle.md index 47a6ce06ae2..33dda61368a 100644 --- a/frontend/docs/scripting/functions/SetVehicleZAngle.md +++ b/frontend/docs/scripting/functions/SetVehicleZAngle.md @@ -30,11 +30,11 @@ public OnPlayerCommandText(playerid, cmdtext[]) new vehicleid, Float:angle; - + vehicleid = GetPlayerVehicleID(playerid); GetVehicleZAngle(vehicleid, angle); SetVehicleZAngle(vehicleid, angle); - + SendClientMessage(playerid, 0xFFFFFFFF, "Your vehicle has been flipped."); return 1; } diff --git a/frontend/docs/scripting/functions/ShowObjectForPlayer.md b/frontend/docs/scripting/functions/ShowObjectForPlayer.md index 1088f56acf8..2c131595ebc 100644 --- a/frontend/docs/scripting/functions/ShowObjectForPlayer.md +++ b/frontend/docs/scripting/functions/ShowObjectForPlayer.md @@ -14,7 +14,7 @@ Show an object for a player that is hidden with [HideObjectForPlayer](HideObject ## Parameters | Name | Description | -|----------|------------------------------------------| +| -------- | ---------------------------------------- | | playerid | The ID of the player. | | objectid | The ID of the object to show for player. | diff --git a/frontend/docs/scripting/functions/ShowPickupForPlayer.md b/frontend/docs/scripting/functions/ShowPickupForPlayer.md index d6e2c3ae6f9..f5df9e76d82 100644 --- a/frontend/docs/scripting/functions/ShowPickupForPlayer.md +++ b/frontend/docs/scripting/functions/ShowPickupForPlayer.md @@ -12,7 +12,7 @@ tags: ["player", "pickup"] Shows a pickup for a specific player. | Name | Description | -|----------|-------------------------------------------------| +| -------- | ----------------------------------------------- | | playerid | The ID of the player. | | pickupid | The ID of the pickup to display for the player. | diff --git a/frontend/docs/scripting/functions/ShowVehicle.md b/frontend/docs/scripting/functions/ShowVehicle.md index a975cdd94d0..060e0e0c6a7 100644 --- a/frontend/docs/scripting/functions/ShowVehicle.md +++ b/frontend/docs/scripting/functions/ShowVehicle.md @@ -20,7 +20,7 @@ Shows the hidden vehicle. ## Parametes | Name | Description | -|-----------|--------------------------------| +| --------- | ------------------------------ | | vehicleid | The ID of the vehicle to show. | ## Examples diff --git a/frontend/docs/scripting/functions/StartRecordingPlayback.md b/frontend/docs/scripting/functions/StartRecordingPlayback.md index cfb64f65cc9..3b6c1362ed9 100644 --- a/frontend/docs/scripting/functions/StartRecordingPlayback.md +++ b/frontend/docs/scripting/functions/StartRecordingPlayback.md @@ -5,6 +5,12 @@ description: This will run a .rec file which has to be saved in the npcmodes/rec tags: [] --- +:::warning + +This function is deprecated. Please see [NPC_StartPlayback](NPC_StartPlayback). + +::: + ## Description This will run a .rec file which has to be saved in the npcmodes/recordings folder. These files allow the NPC to follow certain actions. Their actions can be recorded manually. For more information, check the related functions. diff --git a/frontend/docs/scripting/functions/StopRecordingPlayback.md b/frontend/docs/scripting/functions/StopRecordingPlayback.md index d78b8b25155..9ef66b06cb0 100644 --- a/frontend/docs/scripting/functions/StopRecordingPlayback.md +++ b/frontend/docs/scripting/functions/StopRecordingPlayback.md @@ -5,11 +5,16 @@ description: This will stop the current .rec file which is being ran by the NPC, tags: [] --- +:::warning + +This function is deprecated. Please see [NPC_StopPlayback](NPC_StopPlayback). + +::: + ## Description This will stop the current .rec file which is being ran by the NPC, making it stay idle until some other order is given. - ## Examples ```c diff --git a/frontend/docs/scripting/functions/TextDrawCreate.md b/frontend/docs/scripting/functions/TextDrawCreate.md index fb3ffb08360..d3b4d2bd275 100644 --- a/frontend/docs/scripting/functions/TextDrawCreate.md +++ b/frontend/docs/scripting/functions/TextDrawCreate.md @@ -10,7 +10,7 @@ tags: ["textdraw"] Creates a textdraw. Textdraws are, as the name implies, text (mainly - there can be boxes, sprites and model previews (skins/vehicles/weapons/objects too) that is drawn on a player's screens. See this page for extensive information about textdraws. | Name | Description | -|------------------|----------------------------------------------------------| +| ---------------- | -------------------------------------------------------- | | Float:x | The X (left/right) coordinate to create the textdraw at. | | Float:y | The Y (up/down) coordinate to create the textdraw at. | | const format[] | The text that will appear in the textdraw. | diff --git a/frontend/docs/scripting/functions/TextDrawGetPos.md b/frontend/docs/scripting/functions/TextDrawGetPos.md index 0cc3bca84b8..0b3cac46904 100644 --- a/frontend/docs/scripting/functions/TextDrawGetPos.md +++ b/frontend/docs/scripting/functions/TextDrawGetPos.md @@ -25,7 +25,7 @@ new Text:gMyTextdraw; public OnGameModeInit() { gMyTextdraw = TextDrawCreate(100.0, 33.0, "Example TextDraw"); - + new Float:x, Float:y; TextDrawGetPos(gMyTextdraw, x, y); // The `x` will be '100.0' and `y` will be '33.0' diff --git a/frontend/docs/scripting/functions/TextDrawGetPreviewModel.md b/frontend/docs/scripting/functions/TextDrawGetPreviewModel.md index ca5e6751dcc..9508b2a9206 100644 --- a/frontend/docs/scripting/functions/TextDrawGetPreviewModel.md +++ b/frontend/docs/scripting/functions/TextDrawGetPreviewModel.md @@ -12,7 +12,7 @@ tags: ["textdraw"] Gets the preview model of a 3D preview textdraw. | Name | Description | -|-------------|-----------------------------------------------------| +| ----------- | --------------------------------------------------- | | Text:textid | The ID of the textdraw to get the preview model of. | ## Returns diff --git a/frontend/docs/scripting/functions/TextDrawGetPreviewRot.md b/frontend/docs/scripting/functions/TextDrawGetPreviewRot.md index 91266275e8f..47dfa62da46 100644 --- a/frontend/docs/scripting/functions/TextDrawGetPreviewRot.md +++ b/frontend/docs/scripting/functions/TextDrawGetPreviewRot.md @@ -33,7 +33,7 @@ public OnGameModeInit() TextDrawTextSize(gMyTextdraw, 40.0, 40.0); TextDrawSetPreviewModel(gMyTextdraw, 411); TextDrawSetPreviewRot(gMyTextdraw, -10.0, 0.0, -20.0, 1.0); - + new Float:rotationX, Float:rotationY, Float:rotationZ, Float:zoom; TextDrawGetPreviewRot(gMyTextdraw, rotationX, rotationY, rotationZ, zoom); // rotationX = -10.0 diff --git a/frontend/docs/scripting/functions/TextDrawIsBox.md b/frontend/docs/scripting/functions/TextDrawIsBox.md index 30ec16f6878..8b5608f4a87 100644 --- a/frontend/docs/scripting/functions/TextDrawIsBox.md +++ b/frontend/docs/scripting/functions/TextDrawIsBox.md @@ -30,7 +30,7 @@ public OnGameModeInit() { gMyTextdraw = TextDrawCreate(100.0, 33.0, "Example TextDraw"); TextDrawUseBox(gMyTextdraw, true); // Toggle box ON - + if (TextDrawIsBox(gMyTextdraw)) { // Textdraw is box diff --git a/frontend/docs/scripting/functions/TextDrawIsProportional.md b/frontend/docs/scripting/functions/TextDrawIsProportional.md index 429886c89a9..25ce9cc6cb6 100644 --- a/frontend/docs/scripting/functions/TextDrawIsProportional.md +++ b/frontend/docs/scripting/functions/TextDrawIsProportional.md @@ -30,7 +30,7 @@ public OnGameModeInit() { gMyTextdraw = TextDrawCreate(100.0, 33.0, "Example TextDraw"); TextDrawSetProportional(gMyTextdraw, true); - + if (TextDrawIsProportional(gMyTextdraw)) { // Textdraw is proportional diff --git a/frontend/docs/scripting/functions/TextDrawSetPos.md b/frontend/docs/scripting/functions/TextDrawSetPos.md index 66509f9fa35..f5cb28c2628 100644 --- a/frontend/docs/scripting/functions/TextDrawSetPos.md +++ b/frontend/docs/scripting/functions/TextDrawSetPos.md @@ -25,7 +25,7 @@ new Text:gMyTextdraw; public OnGameModeInit() { gMyTextdraw = TextDrawCreate(100.0, 33.0, "Example TextDraw"); - + TextDrawSetPos(gMyTextdraw, 200.0, 50.0); return 1; } diff --git a/frontend/docs/scripting/functions/TextDrawSetPreviewRot.md b/frontend/docs/scripting/functions/TextDrawSetPreviewRot.md index 20bf8838136..b5c8a947d28 100644 --- a/frontend/docs/scripting/functions/TextDrawSetPreviewRot.md +++ b/frontend/docs/scripting/functions/TextDrawSetPreviewRot.md @@ -35,7 +35,7 @@ public OnGameModeInit() TextDrawTextSize(gMyTextdraw, 40.0, 40.0); TextDrawSetPreviewModel(gMyTextdraw, 411); TextDrawSetPreviewRot(gMyTextdraw, -10.0, 0.0, -20.0, 1.0); - + // You still have to use TextDrawShowForAll/TextDrawShowForPlayer to make the textdraw visible. return 1; } diff --git a/frontend/docs/scripting/functions/ToggleChatTextReplacement.md b/frontend/docs/scripting/functions/ToggleChatTextReplacement.md index e6492841b79..e6c3cc645fc 100644 --- a/frontend/docs/scripting/functions/ToggleChatTextReplacement.md +++ b/frontend/docs/scripting/functions/ToggleChatTextReplacement.md @@ -13,9 +13,9 @@ Toggles the chat input filter. Disable it to use of chars like % in the chat. -| Name | Description | -| ----------- | --------------------------------------------------------------------- | -| bool:enable | 'true' to enable or 'false' to disable the chat input filter. | +| Name | Description | +| ----------- | ------------------------------------------------------------- | +| bool:enable | 'true' to enable or 'false' to disable the chat input filter. | ## Returns @@ -24,7 +24,7 @@ This function does not return any specific value. ## Examples ```c -public OnGameModeInit() +public OnGameModeInit() { ToggleChatTextReplacement(false); return 1; diff --git a/frontend/docs/scripting/functions/TogglePlayerSpectating.md b/frontend/docs/scripting/functions/TogglePlayerSpectating.md index 8df494dc159..9306c2edf93 100644 --- a/frontend/docs/scripting/functions/TogglePlayerSpectating.md +++ b/frontend/docs/scripting/functions/TogglePlayerSpectating.md @@ -11,9 +11,9 @@ Toggle whether a player is in spectator mode or not. While in spectator mode a p ## Parameters -| Name | Description | -| ----------- | ------------------------------------------------- | -| playerid | The ID of the player who should spectate. | +| Name | Description | +| ----------- | ------------------------------------------------------- | +| playerid | The ID of the player who should spectate. | | bool:toggle | **true** to enable spectating and **false** to disable. | ## Returns diff --git a/frontend/docs/scripting/functions/TogglePlayerWidescreen.md b/frontend/docs/scripting/functions/TogglePlayerWidescreen.md index cb641d91a3e..ec542e0052c 100644 --- a/frontend/docs/scripting/functions/TogglePlayerWidescreen.md +++ b/frontend/docs/scripting/functions/TogglePlayerWidescreen.md @@ -12,7 +12,7 @@ tags: ["player"] Toggle player's widescreen. | Name | Description | -|-----------|--------------------------------------------------| +| --------- | ------------------------------------------------ | | playerid | The ID of the player to toggle the widescreen. | | bool:wide | **true** for turn on and **false** for turn off. | diff --git a/frontend/docs/scripting/functions/ToggleVehicleSirenEnabled.md b/frontend/docs/scripting/functions/ToggleVehicleSirenEnabled.md index 6380fd38abd..acfee07bdec 100644 --- a/frontend/docs/scripting/functions/ToggleVehicleSirenEnabled.md +++ b/frontend/docs/scripting/functions/ToggleVehicleSirenEnabled.md @@ -14,7 +14,7 @@ Turn the siren for a vehicle on or off. ## Parameters | Name | Description | -|--------------|-------------------------------| +| ------------ | ----------------------------- | | vehicleid | The ID of the vehicle. | | bool:enabled | **true**: On - **false**: Off | diff --git a/frontend/docs/scripting/functions/UpdateVehicleDamageStatus.md b/frontend/docs/scripting/functions/UpdateVehicleDamageStatus.md index 735df866b7c..b556a4b277d 100644 --- a/frontend/docs/scripting/functions/UpdateVehicleDamageStatus.md +++ b/frontend/docs/scripting/functions/UpdateVehicleDamageStatus.md @@ -30,7 +30,7 @@ This function does not return any specific values. ## Examples ```c -new +new VEHICLE_PANEL_STATUS:panels, VEHICLE_DOOR_STATUS:doors, VEHICLE_LIGHT_STATUS:lights, diff --git a/frontend/docs/scripting/functions/UseGangZoneCheck.md b/frontend/docs/scripting/functions/UseGangZoneCheck.md index a49fed97143..83e22f760a5 100644 --- a/frontend/docs/scripting/functions/UseGangZoneCheck.md +++ b/frontend/docs/scripting/functions/UseGangZoneCheck.md @@ -60,14 +60,14 @@ public OnPlayerLeaveGangZone(playerid, zoneid) ## Related Callbacks -The following callbacks might be useful, as they're related to this function in one way or another. +The following callbacks might be useful, as they're related to this function in one way or another. - [OnPlayerEnterGangZone](../callbacks/OnPlayerEnterGangZone): This callback is called when a player enters a gangzone. - [OnPlayerLeaveGangZone](../callbacks/OnPlayerLeaveGangZone): This callback is called when a player exited a gangzone. ## Related Functions -The following functions might be useful, as they're related to this function in one way or another. +The following functions might be useful, as they're related to this function in one way or another. - [GangZoneCreate](GangZoneCreate): Create a gangzone. - [GangZoneDestroy](GangZoneDestroy): Destroy a gangzone. @@ -81,4 +81,4 @@ The following functions might be useful, as they're related to this function in - [GangZoneStopFlashForAll](GangZoneStopFlashForAll): Stop a gangzone flashing for all players. - [IsValidGangZone](IsValidGangZone): Check if the gangzone valid. - [IsPlayerInGangZone](IsPlayerInGangZone): Check if the player in gangzone. -- [IsGangZoneVisibleForPlayer](IsGangZoneVisibleForPlayer): Check if the gangzone is visible for player. \ No newline at end of file +- [IsGangZoneVisibleForPlayer](IsGangZoneVisibleForPlayer): Check if the gangzone is visible for player. diff --git a/frontend/docs/scripting/functions/UsePlayerGangZoneCheck.md b/frontend/docs/scripting/functions/UsePlayerGangZoneCheck.md index 43c3cbad07c..a726d0447da 100644 --- a/frontend/docs/scripting/functions/UsePlayerGangZoneCheck.md +++ b/frontend/docs/scripting/functions/UsePlayerGangZoneCheck.md @@ -64,14 +64,14 @@ public OnPlayerLeavePlayerGangZone(playerid, zoneid) ## Related Callbacks -The following callbacks might be useful, as they're related to this function in one way or another. +The following callbacks might be useful, as they're related to this function in one way or another. - [OnPlayerEnterPlayerGangZone](../callbacks/OnPlayerEnterPlayerGangZone): This callback is called when a player enters a player gangzone. - [OnPlayerLeavePlayerGangZone](../callbacks/OnPlayerLeavePlayerGangZone): This callback is called when a player exited a player gangzone. ## Related Functions -The following functions might be useful, as they're related to this function in one way or another. +The following functions might be useful, as they're related to this function in one way or another. - [CreatePlayerGangZone](CreatePlayerGangZone): Create player gangzone. - [PlayerGangZoneDestroy](PlayerGangZoneDestroy): Destroy player gangzone. diff --git a/frontend/docs/scripting/functions/VehicleCanHaveComponent.md b/frontend/docs/scripting/functions/VehicleCanHaveComponent.md index b520346f041..8b61abfc91e 100644 --- a/frontend/docs/scripting/functions/VehicleCanHaveComponent.md +++ b/frontend/docs/scripting/functions/VehicleCanHaveComponent.md @@ -13,7 +13,7 @@ Is the component legal on the vehicle model? | Name | Description | | ---------------------------------------- | ----------------------------- | -| [modelid](../resources/vehicleid) | Vehicle Model ID | +| [modelid](../resources/vehicleid) | Vehicle Model ID | | [component](../resources/carcomponentid) | ID of the component to check. | ## Returns diff --git a/frontend/docs/scripting/functions/VehicleColourIndexToColour.md b/frontend/docs/scripting/functions/VehicleColourIndexToColour.md index 1ad76362db6..a9b28f855e9 100644 --- a/frontend/docs/scripting/functions/VehicleColourIndexToColour.md +++ b/frontend/docs/scripting/functions/VehicleColourIndexToColour.md @@ -14,7 +14,7 @@ Convert a car colour index to a HEX colour (RGBA). ## Parameters | Name | Description | -|--------------|------------------------------------------------| +| ------------ | ---------------------------------------------- | | index | [Vehicle colour](../resources/vehiclecolorid). | | alpha = 0xFF | Alpha channel. | diff --git a/frontend/docs/scripting/functions/diskfree.md b/frontend/docs/scripting/functions/diskfree.md index a1eaeb5d020..0908a8d2256 100644 --- a/frontend/docs/scripting/functions/diskfree.md +++ b/frontend/docs/scripting/functions/diskfree.md @@ -19,9 +19,9 @@ This function has not yet been implemented. 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. | +| 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 diff --git a/frontend/docs/scripting/functions/existproperty.md b/frontend/docs/scripting/functions/existproperty.md index 3739ed3bb85..6dae494bf35 100644 --- a/frontend/docs/scripting/functions/existproperty.md +++ b/frontend/docs/scripting/functions/existproperty.md @@ -13,9 +13,9 @@ Check if a property exist. | Name | Description | | ------ | --------------------------------------------------------------------------------------------------- | -| id | The virtual machine to use, you should keep this zero. *(optional=0)* | +| id | The virtual machine to use, you should keep this zero. _(optional=0)_ | | name[] | The property's name, you should keep this "". | -| value | The property's unique ID. Use the hash-function to calculate it from a string. *(optional=cellmin)* | +| value | The property's unique ID. Use the hash-function to calculate it from a string. _(optional=cellmin)_ | ## Returns diff --git a/frontend/docs/scripting/functions/fattrib.md b/frontend/docs/scripting/functions/fattrib.md index c7643f1f6b0..f62a99f4fc6 100644 --- a/frontend/docs/scripting/functions/fattrib.md +++ b/frontend/docs/scripting/functions/fattrib.md @@ -17,7 +17,7 @@ Set the file attributes. | ---------------- | ------------------------------------------------------------------------------------------------------------------------- | | const filename[] | The name of the file. | | timestamp = 0 | Time of the last modification of the file. When this parameter is set to zero, the time stamp of the file is not changed. | -| attrib = 0x0F | A bit mask with the new attributes of the file. When set to 0x0F, the attributes of the file are not changed. | +| attrib = 0x0F | A bit mask with the new attributes of the file. When set to 0x0F, the attributes of the file are not changed. | ## Returns diff --git a/frontend/docs/scripting/functions/fblockread.md b/frontend/docs/scripting/functions/fblockread.md index 2c3edbc3978..570b110fa4f 100644 --- a/frontend/docs/scripting/functions/fblockread.md +++ b/frontend/docs/scripting/functions/fblockread.md @@ -84,6 +84,7 @@ Using an invalid handle will crash your server! Get a valid handle by using [fop ::: ## Related Functions + - [fopen](fopen): Open a file. - [fclose](fclose): Close a file. - [ftemp](ftemp): Create a temporary file stream. diff --git a/frontend/docs/scripting/functions/floatround.md b/frontend/docs/scripting/functions/floatround.md index 53af7f27a7c..683d778a754 100644 --- a/frontend/docs/scripting/functions/floatround.md +++ b/frontend/docs/scripting/functions/floatround.md @@ -12,7 +12,7 @@ tags: ["math", "floating-point"] Round a floating point number to an integer value. | Name | Description | -|--------------------------|-------------------------------------------------------------------------------------------------| +| ------------------------ | ----------------------------------------------------------------------------------------------- | | Float:value | The value to round. | | floatround_method:method | The [floatround mode](../resources/floatroundmodes) to use.
By default: `floatround_round` | diff --git a/frontend/docs/scripting/functions/floatsub.md b/frontend/docs/scripting/functions/floatsub.md index a3c50c8c901..ab554572710 100644 --- a/frontend/docs/scripting/functions/floatsub.md +++ b/frontend/docs/scripting/functions/floatsub.md @@ -11,10 +11,10 @@ tags: ["math", "floating-point"] Subtracts one float from another one. Note that this function has no real use, as one can simply use the standard operator (-) instead. -| Name | Description | -| ----------- | ---------------------------------------------------- | -| Float:oper1 | First Float. | -| Float:oper2 | Second Float (gets subtracted from the first float) | +| Name | Description | +| ----------- | --------------------------------------------------- | +| Float:oper1 | First Float. | +| Float:oper2 | Second Float (gets subtracted from the first float) | ## Returns diff --git a/frontend/docs/scripting/functions/format.md b/frontend/docs/scripting/functions/format.md index b3fb6b200c5..f45144a882b 100644 --- a/frontend/docs/scripting/functions/format.md +++ b/frontend/docs/scripting/functions/format.md @@ -11,12 +11,12 @@ tags: ["string"] 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 | +| 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 diff --git a/frontend/docs/scripting/functions/fstat.md b/frontend/docs/scripting/functions/fstat.md index 0dced0e0b8a..130f37ad3b8 100644 --- a/frontend/docs/scripting/functions/fstat.md +++ b/frontend/docs/scripting/functions/fstat.md @@ -13,13 +13,13 @@ tags: ["file management"] Return the size and the timestamp of a file. -| Name | Description | -| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| const filename[] | The name of the file. | -| &size | If the function is successful, this param-eter holds the size of the file on return. | -| ×tamp | If the function is successful, this parameter holds the time of the last modification of the file on return. | -| &attrib | If the function is successful, this parameter holds the file attributes. | -| &inode | If the function is successful, this parameter holds inode number of the file. An inode number is a number that uniquely identifies a file, and it usually indicates the physical position of (the start of) the file on the disk or memory card. | +| Name | Description | +| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| const filename[] | The name of the file. | +| &size | If the function is successful, this param-eter holds the size of the file on return. | +| ×tamp | If the function is successful, this parameter holds the time of the last modification of the file on return. | +| &attrib | If the function is successful, this parameter holds the file attributes. | +| &inode | If the function is successful, this parameter holds inode number of the file. An inode number is a number that uniquely identifies a file, and it usually indicates the physical position of (the start of) the file on the disk or memory card. | ## Returns @@ -30,7 +30,7 @@ Return the size and the timestamp of a file. ## Examples ```c -new +new size, timestamp, attrib, diff --git a/frontend/docs/scripting/functions/getarg.md b/frontend/docs/scripting/functions/getarg.md index 224acf2c55c..7620f40e5e3 100644 --- a/frontend/docs/scripting/functions/getarg.md +++ b/frontend/docs/scripting/functions/getarg.md @@ -14,7 +14,7 @@ Get an argument that was passed to a function. | Name | Description | | ----- | ----------------------------------------------------------- | | arg | The argument sequence number. Use 0 for first argument. | -| index | The index (in case the argument is an array) *(optional=0)* | +| index | The index (in case the argument is an array) _(optional=0)_ | ## Returns diff --git a/frontend/docs/scripting/functions/getproperty.md b/frontend/docs/scripting/functions/getproperty.md index d655307cdd1..4acd0f9b8b8 100644 --- a/frontend/docs/scripting/functions/getproperty.md +++ b/frontend/docs/scripting/functions/getproperty.md @@ -13,9 +13,9 @@ Get a specific property from the memory, the string is returned as a packed stri | Name | Description | | -------- | --------------------------------------------------------------------------------------------------- | -| id | The virtual machine to use, you should keep this zero. *(optional=0)* | +| id | The virtual machine to use, you should keep this zero. _(optional=0)_ | | name[] | The property's name, you should keep this "". | -| value | The property's unique ID, Use the hash-function to calculate it from a string. *(optional=cellmin)* | +| value | The property's unique ID, Use the hash-function to calculate it from a string. _(optional=cellmin)_ | | string[] | The variable to store the result in, passed by reference. | ## Returns diff --git a/frontend/docs/scripting/functions/listenport.md b/frontend/docs/scripting/functions/listenport.md index 0a2083f905f..1fa7feedfd2 100644 --- a/frontend/docs/scripting/functions/listenport.md +++ b/frontend/docs/scripting/functions/listenport.md @@ -17,9 +17,9 @@ This function is deprecated, Use [HTTP](HTTP) or [pawn-requests](https://github. Sets up the port number to listen at. -| Name | Description | -| ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | -| port | The number of the port to listen at. This must be a value between 1 and 65535, but you should probably avoid to use any of the reserved port numbers. | +| Name | Description | +| ---- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | +| port | The number of the port to listen at. This must be a value between 1 and 65535, but you should probably avoid to use any of the reserved port numbers. | ## Return Values diff --git a/frontend/docs/scripting/functions/max.md b/frontend/docs/scripting/functions/max.md index 07b360a0d51..c049d179f78 100644 --- a/frontend/docs/scripting/functions/max.md +++ b/frontend/docs/scripting/functions/max.md @@ -35,7 +35,7 @@ public OnGameModeInit() printf("max(%d, %d) = %d", a, b, result); // Since b is bigger than a so result will be 10. - + return 1; } ``` diff --git a/frontend/docs/scripting/functions/min.md b/frontend/docs/scripting/functions/min.md index 490e409ad19..2a7a647ee6a 100644 --- a/frontend/docs/scripting/functions/min.md +++ b/frontend/docs/scripting/functions/min.md @@ -36,7 +36,7 @@ public OnGameModeInit() printf("min(%d, %d) = %d", a, b, result); // Since a is smaller than b so result will be 5. - + return 1; } ``` diff --git a/frontend/docs/scripting/functions/print.md b/frontend/docs/scripting/functions/print.md index 82a2eb978c6..8432bdb733a 100644 --- a/frontend/docs/scripting/functions/print.md +++ b/frontend/docs/scripting/functions/print.md @@ -12,10 +12,10 @@ tags: ["console"] Prints a string to the server console (not in-game chat) and logs (log.txt). | Name | Description | -| --------------------- | ----------------------------- | +| --------------------- | ----------------------------- | ----------------------------- | | const string[] | The string to print. | - +| | ## Returns diff --git a/frontend/docs/scripting/functions/printf.md b/frontend/docs/scripting/functions/printf.md index 45fea513718..86342da9da7 100644 --- a/frontend/docs/scripting/functions/printf.md +++ b/frontend/docs/scripting/functions/printf.md @@ -11,10 +11,10 @@ tags: ["console"] Outputs a formatted string on the console (the server window, not the in-game chat). -| Name | Description | -| -------------- | ----------------------------------------- | -| const format[] | The format string | -| \{Float, _\}:... | Indefinite number of arguments of any tag | +| Name | Description | +| ----------------- | ----------------------------------------- | +| const format[] | The format string | +| \{Float, \_\}:... | Indefinite number of arguments of any tag | ## Returns diff --git a/frontend/docs/scripting/functions/sendpacket.md b/frontend/docs/scripting/functions/sendpacket.md index 4f686701018..cccf40ef7f1 100644 --- a/frontend/docs/scripting/functions/sendpacket.md +++ b/frontend/docs/scripting/functions/sendpacket.md @@ -21,7 +21,7 @@ Sends a packet. | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | const packet[] | The buffer that contains the packet to send. | | size | Buffer size. | -| const destination[] = "" | The IP address and port number to which the packet must be sent. If absent or an empty string, this function will broadcast the packet and use the default port number 9930 *(optional="")* | +| const destination[] = "" | The IP address and port number to which the packet must be sent. If absent or an empty string, this function will broadcast the packet and use the default port number 9930 _(optional="")_ | ## Return Values diff --git a/frontend/docs/scripting/functions/sendstring.md b/frontend/docs/scripting/functions/sendstring.md index a753a1c3d19..8c52c3346b4 100644 --- a/frontend/docs/scripting/functions/sendstring.md +++ b/frontend/docs/scripting/functions/sendstring.md @@ -17,10 +17,10 @@ This function is deprecated, Use [HTTP](HTTP) or [pawn-requests](https://github. Sends a packet containing a string. -| Name | Description | -| ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| const message[] | The buffer that contains the string to send. If this is an unpacked string, it will be UTF-8 encoded before being transferred. | -| const destination[] = "" | The IP address and port number to which the packet must be sent. If absent or an empty string, this function will broadcast the packet and use the default port number 9930 *(optional="")* | +| Name | Description | +| ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| const message[] | The buffer that contains the string to send. If this is an unpacked string, it will be UTF-8 encoded before being transferred. | +| const destination[] = "" | The IP address and port number to which the packet must be sent. If absent or an empty string, this function will broadcast the packet and use the default port number 9930 _(optional="")_ | ## Return Values diff --git a/frontend/docs/scripting/functions/setarg.md b/frontend/docs/scripting/functions/setarg.md index d5aeb969e81..22479301a30 100644 --- a/frontend/docs/scripting/functions/setarg.md +++ b/frontend/docs/scripting/functions/setarg.md @@ -14,7 +14,7 @@ Set an argument that was passed to a function. | Name | Description | | ----- | ----------------------------------------------------------- | | arg | The argument sequence number. Use 0 for the first argument. | -| index | The index (if the argument is an array) *(optional=0)* | +| index | The index (if the argument is an array) _(optional=0)_ | | value | The value to set the argument to. | ## Returns diff --git a/frontend/docs/scripting/functions/setproperty.md b/frontend/docs/scripting/functions/setproperty.md index 2505ea7e611..4ac3f985c09 100644 --- a/frontend/docs/scripting/functions/setproperty.md +++ b/frontend/docs/scripting/functions/setproperty.md @@ -13,9 +13,9 @@ Add a new property or change an existing property. | Name | Description | | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | -| id | The virtual machine to use, you should keep this zero. *(optional=0)* | +| id | The virtual machine to use, you should keep this zero. _(optional=0)_ | | name[] | Used in combination with value when storing integers; don't use this if you want to store a string. | -| value | The integer value to store or the property's unique ID if storing a string. Use the hash-function to calculate it from a string. *(optional=cellmin)* | +| value | The integer value to store or the property's unique ID if storing a string. Use the hash-function to calculate it from a string. _(optional=cellmin)_ | | string[] | The value of the property, as a string. Don't use this if you want to store an integer. | ## Returns diff --git a/frontend/docs/scripting/functions/strcmp.md b/frontend/docs/scripting/functions/strcmp.md index 5537dd494ca..b37c061c947 100644 --- a/frontend/docs/scripting/functions/strcmp.md +++ b/frontend/docs/scripting/functions/strcmp.md @@ -15,8 +15,8 @@ Compares two strings to see if they are the same. | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | | const string1[] | The first string to compare. | | const string2[] | The second string to compare. | -| bool:ignorecase *(optional)* | When set to **true**, the case doesn't matter - HeLLo is the same as Hello. When **false**, they're not the same. | -| length *(optional)* | When this length is set, the first x chars will be compared - doing "Hello" and "Hell No" with a length of 4 will say it's the same string. | +| bool:ignorecase _(optional)_ | When set to **true**, the case doesn't matter - HeLLo is the same as Hello. When **false**, they're not the same. | +| length _(optional)_ | When this length is set, the first x chars will be compared - doing "Hello" and "Hell No" with a length of 4 will say it's the same string. | ## Returns diff --git a/frontend/docs/scripting/functions/strcopy.md b/frontend/docs/scripting/functions/strcopy.md index 3de1810db76..f47f60156e7 100644 --- a/frontend/docs/scripting/functions/strcopy.md +++ b/frontend/docs/scripting/functions/strcopy.md @@ -17,7 +17,7 @@ Copies a string into the destination string. | ------------------------- | --------------------------------------------------- | | dest[] | The string to copy the source string into. | | const source[] | The source string. | -| maxlength = sizeof (dest) | The maximum length of the destination. *(optional)* | +| maxlength = sizeof (dest) | The maximum length of the destination. _(optional)_ | ## Returns diff --git a/frontend/docs/scripting/functions/strequal.md b/frontend/docs/scripting/functions/strequal.md index 67ca522300c..4bd77c6a629 100644 --- a/frontend/docs/scripting/functions/strequal.md +++ b/frontend/docs/scripting/functions/strequal.md @@ -17,8 +17,8 @@ Compares two strings to see if they are the same. | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | | const string1[] | The first string to compare. | | const string2[] | The second string to compare. | -| bool:ignorecase *(optional)* | When set to **true**, the case doesn't matter - HeLLo is the same as Hello. When **false**, they're not the same. | -| length *(optional)* | When this length is set, the first x chars will be compared - doing "Hello" and "Hell No" with a length of 4 will say it's the same string. | +| bool:ignorecase _(optional)_ | When set to **true**, the case doesn't matter - HeLLo is the same as Hello. When **false**, they're not the same. | +| length _(optional)_ | When this length is set, the first x chars will be compared - doing "Hello" and "Hell No" with a length of 4 will say it's the same string. | ## Returns diff --git a/frontend/docs/scripting/functions/strfind.md b/frontend/docs/scripting/functions/strfind.md index a8133c4550f..c61d435bfbd 100644 --- a/frontend/docs/scripting/functions/strfind.md +++ b/frontend/docs/scripting/functions/strfind.md @@ -15,8 +15,8 @@ Search for a sub string in a string. | ---------------------------- | --------------------------------------------------------------------------------------------------------- | | const string[] | The string you want to search in (haystack). | | const sub[] | The string you want to search for (needle). | -| bool:ignorecase *(optional)* | When set to true, the case doesn't matter - HeLLo is the same as Hello. When false, they're not the same. | -| Position *(optional)* | The offset to start searching from. | +| bool:ignorecase _(optional)_ | When set to true, the case doesn't matter - HeLLo is the same as Hello. When false, they're not the same. | +| Position _(optional)_ | The offset to start searching from. | ## Returns diff --git a/frontend/docs/scripting/functions/valstr.md b/frontend/docs/scripting/functions/valstr.md index 3a006d03acd..c3ef947f666 100644 --- a/frontend/docs/scripting/functions/valstr.md +++ b/frontend/docs/scripting/functions/valstr.md @@ -15,7 +15,7 @@ Convert an integer into a string. | ----------------- | ------------------------------------------------- | | dest | The destination of the string. | | value | The value to convert to a string. | -| pack *(optional)* | Whether to pack the destination (off by default). | +| pack _(optional)_ | Whether to pack the destination (off by default). | ## Returns diff --git a/frontend/docs/scripting/language/reference/02-A-tutorial-introduction.md b/frontend/docs/scripting/language/reference/02-A-tutorial-introduction.md index ac5daa46cfa..3294a666499 100644 --- a/frontend/docs/scripting/language/reference/02-A-tutorial-introduction.md +++ b/frontend/docs/scripting/language/reference/02-A-tutorial-introduction.md @@ -2786,7 +2786,7 @@ processors usually do. The pawn toolkit comes with an example XSLT file | name | info | | ----------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | -| ` ` | Preformatted source code in a monospaced font; although the “&”, “\<” and “>” must be typed as “&”, “<” and “&rt;” respectively. | +| ` ` | Preformatted source code in a monospaced font; although the “&”, “\<” and “>” must be typed as “&”, “<” and “&rt;” respectively. | | ` ` | Text set under the sub-header “Example”. | | ` ` | A parameter description, with the parameter name appearing inside the opening tag (the “name=” option) and the parameter description following it. | | `` | A reference to a parameter, with the parameter name appearing inside the opening tag (the “name=” option). | diff --git a/frontend/docs/scripting/language/reference/04-Functions.md b/frontend/docs/scripting/language/reference/04-Functions.md index f3e35daafd8..a06a445fbbb 100644 --- a/frontend/docs/scripting/language/reference/04-Functions.md +++ b/frontend/docs/scripting/language/reference/04-Functions.md @@ -1259,9 +1259,13 @@ parser will attempt to use the user-defined operator rather than the default `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 @@ -1278,14 +1282,18 @@ main(){ 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; @@ -1300,19 +1308,28 @@ main(){ 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: + +##### 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 @@ -1330,7 +1347,9 @@ main() { 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 @@ -1346,11 +1365,15 @@ factorial(3) \\ factorial initiate 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 + \\ 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(){ @@ -1361,7 +1384,9 @@ grow_stacK(n){ // recursive function grow_stacK(n+1); } ``` + #### Output + ``` N: 1 N: 2 @@ -1369,6 +1394,7 @@ N: 3 .. . Stack/heap collision (insufficient stack size) ``` + ![Stack](https://i.imgur.com/ZaIVUkJ.png) [Go Back to Contents](00-Contents) diff --git a/frontend/docs/scripting/language/reference/07-Operators-and-expressions.md b/frontend/docs/scripting/language/reference/07-Operators-and-expressions.md index efdc6229dd9..7c68e70d84d 100644 --- a/frontend/docs/scripting/language/reference/07-Operators-and-expressions.md +++ b/frontend/docs/scripting/language/reference/07-Operators-and-expressions.md @@ -149,9 +149,9 @@ A logical “false” is represented by an integer value of 0; a logical “true | Sign | Description | | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [] | a\[e\] | +| [] | a\[e\] | | | array index: results to cell e from array a. | -| \{\} | a\{e\} | +| \{\} | a\{e\} | | | array index: results to character e from “packed” array a. | | () | f(e1,e2,...eN) | | | results to the value returned by the function f. The function is called with the arguments e1, e2, . . . eN. The order of evaluation of the arguments is undefined (an implementation may choose to evaluate function arguments in reversed order). | diff --git a/frontend/docs/scripting/language/reference/12-Assorted-tips.md b/frontend/docs/scripting/language/reference/12-Assorted-tips.md index c311ab304e9..9cdb9d1e92f 100644 --- a/frontend/docs/scripting/language/reference/12-Assorted-tips.md +++ b/frontend/docs/scripting/language/reference/12-Assorted-tips.md @@ -41,7 +41,7 @@ In other words, the char operators divides its left operand by the number of bytes that fit in a cell and rounds upwards. Again, in a typical implementation, this means dividing by four and rounding upwards. -You can design routines that work on strings in both packed and unpacked formats. +You can design routines that work on strings in both packed and unpacked formats. To find out whether a string is packed or unpacked, look at the first cell of a string. If its value is either negative or higher than the maximum possible value of an unpacked character, the string is a packed string. Otherwise it @@ -147,12 +147,12 @@ characters in strings and character constants. The PAWN language requires that all keywords and symbols (names of functions, variables, tags and other elements) be encoded in the ascii character set. -For languages whose required character set is relatively small, a common solution +For languages whose required character set is relatively small, a common solution is to use an 8-bit extended ascii character set (the ascii character set is -7-bit, holding 128 characters). The upper 128 codes of the extended set contain +7-bit, holding 128 characters). The upper 128 codes of the extended set contain glyphs specific for the language. For Western European languages, a well known character set is “Latin-1”, which is standardized as ISO 8859-1 —the -same set also goes by the name “codepage 1252”, at least for Microsoft Windows.∗ +same set also goes by the name “codepage 1252”, at least for Microsoft Windows.∗ Codepages have been defined for many languages; for example, ISO 8859-2 (“Latin-2”) has glyphs used in Central and Eastern Europe, and ISO 8859-7 contains the Greek alphabet in the upper half of the extended ascii set. @@ -182,7 +182,7 @@ the 7-bit ascii set) can still be indicated by a single byte. The Codepages become problematic when interchanging documents or data with people in regions that use a different codepage, or when using different -languages in the same document. Codepages that use “shift” characters complicate +languages in the same document. Codepages that use “shift” characters complicate the matter further, because text processing must now take into account that a character may take either one or two bytes. Scanning through a string from right to left may even become impossible, as a byte may either indicate a @@ -190,7 +190,7 @@ glyph from the base set (“unshifted”) or it may be a glyph from a shifted se -in the latter case the preceding byte indicates the shift set, but the meaning of the preceding character depends on the character before that. -The ISO/IEC 10646 “Universal Character Set” (UCS) standard has the ambitious +The ISO/IEC 10646 “Universal Character Set” (UCS) standard has the ambitious goal to eventually include all characters used in all the written languages in the world, using a 31-bit character set. This solves both of the problems related to codepages and “shifted” character sets. However, the ISO/IEC body @@ -224,7 +224,7 @@ emerged in two different ways: either the internal representation of characters is multi-byte (typically 16-bit, or 2-byte), or the application stores strings internally in UTF-8 format, and these strings are converted to the proper glyphs only when displaying or printing them. Recent versions of Microsoft Windows -use Unicode internally; The Plan-9 operating system pioneered the UTF-8 encoding +use Unicode internally; The Plan-9 operating system pioneered the UTF-8 encoding approach, which is now widely used in Unix/Linux. The advantage of UTF-8 encoding as an internal representation is that it is physically an 8- bit encoding, and therefore compatible with nearly all existing databases, file @@ -329,9 +329,9 @@ x = valencia /* ok */ ``` -The first assignment causes a “tag mismatch” diagnostic as it assigns an “orange” +The first assignment causes a “tag mismatch” diagnostic as it assigns an “orange” tagged variable to a variable with an “apple” tag. The second assignment -puts the untagged value of x into a tagged variable, which causes again a diagnostic. +puts the untagged value of x into a tagged variable, which causes again a diagnostic. When the untagged variable is on the left hand of the assignment operator, as in the third assignment, there is no warning or error message. As variable x is untagged, it can accept a value of any weak tag. @@ -355,13 +355,13 @@ if (apple:valencia < elstar) ``` The test expression of the if statement (between parentheses) compares the -variable valencia to the variable elstar. To avoid a “tag mismatch” diagnostic, +variable valencia to the variable elstar. To avoid a “tag mismatch” diagnostic, it puts a tag override apple: on valencia —after that, the expressions on the left and the right hands of the > operator have the same tag name: “apple:”. The second line, the assignment of elstar to valencia, overrides the tag name of elstar or orange: before the assignment. In an assignment, you cannot override the tag name of the destination; i.e., the left hand of -the = operator. It is an error to write “apple:valencia = elstar”. In the assignment, +the = operator. It is an error to write “apple:valencia = elstar”. In the assignment, valencia is an “lvalue” and you cannot override the tag name of an lvalue. @@ -436,7 +436,7 @@ in the above snippet (which uses the original definition of printf), I needed to put an empty tag override, “\_:”, before the variables value and limit in the first printf call. -There is an alternative to untagging expressions with strong tag names in general +There is an alternative to untagging expressions with strong tag names in general purpose functions: adjust the definition of the function to accept both all weak tags and a selective set of strong tag names. The PAWN language supports multiple tag names for every function arguments. The original definition of printf (from the file console.inc) is: @@ -462,7 +462,7 @@ native printf(const format[], {Float, _}: ...); ``` -Plural tags allow you to write a single function that accepts cells with a precisely +Plural tags allow you to write a single function that accepts cells with a precisely specified subset of tags (strong and/or weak). While a function argument may accept being passed actual arguments with diverse tags, a variable can only have a single tag —and a formal function argument is a local variable in @@ -516,11 +516,11 @@ print("Hello \ ### • A program that generates its own source code -An odd, slightly academic, criterion to quantify the “expressiveness” of a programming +An odd, slightly academic, criterion to quantify the “expressiveness” of a programming language is size of the smallest program that, upon execution, re- generates its own source code. The rationale behind this criterion is that the shorter the self-generating program, the more flexible and expressive the -language must be. Programs of this kind have been created for many programming +language must be. Programs of this kind have been created for many programming languages —sometimes surprisingly small, as for languages that have a built-in reflective capabilities. diff --git a/frontend/docs/scripting/language/reference/13-Appendices.md b/frontend/docs/scripting/language/reference/13-Appendices.md index 9c4c592cdcf..dd90852756b 100644 --- a/frontend/docs/scripting/language/reference/13-Appendices.md +++ b/frontend/docs/scripting/language/reference/13-Appendices.md @@ -156,7 +156,7 @@ Errors are separated into three classes: | 050 | **invalid range** | | | A numeric range with the syntax “n1 .. n2”, where n1 and n2 are numeric constants, is invalid. Either one of the values in not a valid number, or n1 is not smaller than n2. | | 051 | **invalid subscript, use “[ ]” operators on major dimensions** | -| | You can use the “array character index” operator (braces: “\{ \}” only for the last dimension. For other dimensions, you must use the cell index operator (square brackets: “[ ]”). | +| | You can use the “array character index” operator (braces: “\{ \}” only for the last dimension. For other dimensions, you must use the cell index operator (square brackets: “[ ]”). | | 052 | **multi-dimensional arrays must be fully initialized** | | | If an array with more than one dimension is initialized at its declaration, then there must be equally many literal vectors/subarrays at the right of the equal sign (“=”) as specified for the major dimension(s) of the array. | | 053 | **exceeding maximum number of dimensions** | diff --git a/frontend/docs/scripting/resources/npc-constants.md b/frontend/docs/scripting/resources/npc-constants.md new file mode 100644 index 00000000000..0d6b88f7082 --- /dev/null +++ b/frontend/docs/scripting/resources/npc-constants.md @@ -0,0 +1,196 @@ +--- +title: NPC Constants +sidebar_label: NPC Constants +description: Constants used in NPC functions and callbacks. +tags: ["npc", "constants"] +--- + +This page lists all constants specific to NPC functions in open.mp. + +## Limits + +| Value | Constant | Description | +| ----- | ------------- | ----------------------- | +| 1000 | MAX_NPCS | Maximum number of NPCs | +| 64 | NPC_MAX_NODES | Maximum number of nodes | + +## Invalid Constants + +| Value | Constant | Description | +| ----- | ----------------- | -------------------- | +| -1 | INVALID_NPC_ID | Invalid NPC ID | +| -1 | INVALID_PATH_ID | Invalid path ID | +| -1 | INVALID_NODE_ID | Invalid node ID | +| -1 | INVALID_RECORD_ID | Invalid recording ID | + +## Movement Types + +Used by functions like [NPC_Move](../functions/NPC_Move), [NPC_MoveByPath](../functions/NPC_MoveByPath), [NPC_EnterVehicle](../functions/NPC_EnterVehicle), and [NPC_PlayNode](../functions/NPC_PlayNode). + +| Value | Constant | Description | +| ----- | --------------------- | ---------------------------------------------------- | +| -1 | UNKNOWN_NPC_MOVE_TYPE | Unknown movement type | +| 0 | NPC_MOVE_TYPE_NONE | No movement | +| 1 | NPC_MOVE_TYPE_WALK | NPC walks to destination | +| 2 | NPC_MOVE_TYPE_JOG | NPC jogs to destination (default for most functions) | +| 3 | NPC_MOVE_TYPE_SPRINT | NPC sprints to destination | +| 4 | NPC_MOVE_TYPE_DRIVE | NPC drives to destination (vehicle movement) | +| 5 | NPC_MOVE_TYPE_AUTO | Automatic movement type | + +## Movement Speed + +Used by movement functions to control NPC speed. + +| Value | Constant | Description | +| --------- | --------------------- | -------------------------------------- | +| -1.0 | NPC_MOVE_SPEED_AUTO | Automatic speed based on movement type | +| 0.1552086 | NPC_MOVE_SPEED_WALK | Walking speed | +| 0.56444 | NPC_MOVE_SPEED_JOG | Jogging speed | +| 0.926784 | NPC_MOVE_SPEED_SPRINT | Sprinting speed | + +## Entity Check Flags + +Used by [NPC_AimAt](../functions/NPC_AimAt), [NPC_AimAtPlayer](../functions/NPC_AimAtPlayer), and [NPC_Shoot](../functions/NPC_Shoot) for collision detection. + +| Value | Constant | Description | +| ----- | ----------------------------- | ----------------------------------------------- | +| 0 | NPC_ENTITY_CHECK_NONE | No collision checking | +| 1 | NPC_ENTITY_CHECK_PLAYER | Check collisions with players | +| 2 | NPC_ENTITY_CHECK_NPC | Check collisions with NPCs | +| 4 | NPC_ENTITY_CHECK_ACTOR | Check collisions with actors | +| 8 | NPC_ENTITY_CHECK_VEHICLE | Check collisions with vehicles | +| 16 | NPC_ENTITY_CHECK_OBJECT | Check collisions with objects | +| 32 | NPC_ENTITY_CHECK_POBJECT_ORIG | Check collisions with player objects (original) | +| 64 | NPC_ENTITY_CHECK_POBJECT_TARG | Check collisions with player objects (target) | +| 128 | NPC_ENTITY_CHECK_MAP | Check collisions with map | +| 255 | NPC_ENTITY_CHECK_ALL | Check collisions with all entities | + +## Bullet Hit Types + +Used by [NPC_Shoot](../functions/NPC_Shoot) to specify what type of target is being hit. + +| Constant | Description | +| ---------------------- | ------------------ | +| BULLET_HIT_TYPE_NONE | No specific target | +| BULLET_HIT_TYPE_PLAYER | Player target | + +## Examples + +### Movement Types + +```c +// Make NPC walk slowly +NPC_Move(npcid, x, y, z, NPC_MOVE_TYPE_WALK); + +// Make NPC jog (default speed) +NPC_Move(npcid, x, y, z, NPC_MOVE_TYPE_JOG); + +// Make NPC sprint quickly +NPC_Move(npcid, x, y, z, NPC_MOVE_TYPE_SPRINT); + +// Make NPC drive to location +NPC_Move(npcid, x, y, z, NPC_MOVE_TYPE_DRIVE); + +// Use automatic movement type +NPC_Move(npcid, x, y, z, NPC_MOVE_TYPE_AUTO); +``` + +### Movement Speed + +```c +// Use automatic speed +NPC_Move(npcid, x, y, z, NPC_MOVE_TYPE_WALK, NPC_MOVE_SPEED_AUTO); + +// Use specific walking speed +NPC_Move(npcid, x, y, z, NPC_MOVE_TYPE_WALK, NPC_MOVE_SPEED_WALK); + +// Use specific jogging speed +NPC_Move(npcid, x, y, z, NPC_MOVE_TYPE_JOG, NPC_MOVE_SPEED_JOG); + +// Use specific sprinting speed +NPC_Move(npcid, x, y, z, NPC_MOVE_TYPE_SPRINT, NPC_MOVE_SPEED_SPRINT); +``` + +### Entity Check Flags + +```c +// Aim with no collision checking +NPC_AimAt(npcid, x, y, z, true, 1000, true, 0.0, 0.0, 0.6, NPC_ENTITY_CHECK_NONE); + +// Aim with full collision checking +NPC_AimAt(npcid, x, y, z, true, 1000, true, 0.0, 0.0, 0.6, NPC_ENTITY_CHECK_ALL); + +// Only check collisions with players +NPC_AimAt(npcid, x, y, z, true, 1000, true, 0.0, 0.0, 0.6, NPC_ENTITY_CHECK_PLAYER); + +// Check collisions with players and vehicles +NPC_AimAt(npcid, x, y, z, true, 1000, true, 0.0, 0.0, 0.6, + NPC_ENTITY_CHECK_PLAYER | NPC_ENTITY_CHECK_VEHICLE); + +// Check collisions with objects only +NPC_AimAt(npcid, x, y, z, true, 1000, true, 0.0, 0.0, 0.6, NPC_ENTITY_CHECK_OBJECT); +``` + +### Bullet Hit Types + +```c +// Shoot at a specific location (no target) +NPC_Shoot(npcid, INVALID_PLAYER_ID, BULLET_HIT_TYPE_NONE, WEAPON_SNIPER, + x, y, z, 0.0, 0.0, 0.0, false); + +// Shoot at a player +NPC_Shoot(npcid, playerid, BULLET_HIT_TYPE_PLAYER, WEAPON_M4, + x, y, z, 0.0, 0.0, 0.0, true); +``` + +### Invalid Constants + +```c +// Check if NPC ID is valid +new npcid = NPC_Create("Bot"); +if (npcid != INVALID_NPC_ID) +{ + // NPC was created successfully + NPC_Spawn(npcid); +} + +// Check if path ID is valid +new pathid = NPC_CreatePath(); +if (pathid != INVALID_PATH_ID) +{ + // Path was created successfully + NPC_AddPointToPath(pathid, 0.0, 0.0, 3.0, 0.2); +} + +// Check for invalid player in NPC_Kill +NPC_Kill(npcid, INVALID_PLAYER_ID, REASON_SUICIDE); +``` + +### Limits + +```c +// Loop through all possible NPCs +for (new i = 0; i < MAX_NPCS; i++) +{ + if (NPC_IsValid(i)) + { + // Process valid NPC + } +} + +// Example using NPC_MAX_NODES +for (new i = 0; i < NPC_MAX_NODES; i++) +{ + if (NPC_IsNodeOpen(i)) + { + // Process open node + NPC_CloseNode(i); + } +} +``` + +## Related Pages + +- [Weapon Constants](constants#weapon-constants) - For weapon IDs used with NPCs +- [Player States](playerstates) - For player state constants that may apply to NPCs +- [Vehicle IDs](vehicleid) - For vehicle model IDs used in NPC vehicle functions diff --git a/frontend/docs/scripting/resources/path-nodes.md b/frontend/docs/scripting/resources/path-nodes.md new file mode 100644 index 00000000000..70060c5ce94 --- /dev/null +++ b/frontend/docs/scripting/resources/path-nodes.md @@ -0,0 +1,282 @@ +--- +title: Path Nodes +sidebar_label: Path Nodes +description: GTA SA path node system documentation +tags: [nodes, paths, ai, navigation, vehicles, pedestrians] +--- + +:::warning Source Attribution +This documentation was originally sourced from [GTAMods Wiki - Paths (GTA SA)]() and has been preserved here for archival purposes. The content remains unchanged, with only formatting improvements to enhance readability in the open.mp documentation. +::: + + + +## Overview + +The 64 `nodes*.dat` files in `gta3.img` (or any other archive) contain the vehicle and ped paths and related information for GTA SA. There's a file for every 750×750 unit square, starting at the south-west corner (-3000, -3000) in row-major order. + +Paths for planes and trains are not stored in the node files. Trains use the four `tracks*.dat` files. There are also paths for several missions and concrete cars in `carrec.img`. + +Nodes can be influenced through scripts using the opcodes 01EB and 03DE. + +Usually, cars and pedestrians use nodes if they are not linked to a script or `carrec.img` path in any way. + +There is a [modified version](https://gtamods.com/wiki/Fastman92_Path_Format) of the path format that may be used with fastman92's Limit Adjuster, which removes or extends some of the limits that the native format imposes. + +## Purpose + +It is believed that the node files were generated by some sort of path compiler during development of the game, and represent the processing-friendly binary data structures otherwise generated at runtime by previous versions of the game from files like `paths.ipl` and related. Such files are still present in SA, but are unused. + +Since the built-in path compiler has apparently been removed from the game code or at least made non-functional, custom tools and techniques are required to generate new paths for SA. + +Node files are streamed by the game — only the active area and those surrounding it are loaded at a time. Thus corrupt files only lead to a game crash when the player enters the specific area. + +The separate `nodes*.dat` files in the `data/paths/` directory are ignored by the game. + +## File Format + +Each file starts with a header, followed by 7 distinct sections. + +Paths are stored as double-linked (thus undirected) graphs in adjacency list representation. There can be connections between separate areas. + +### Data Types + +The following data types and structures are used within this article: + +| Type | Description | Size | +| ---------------- | -------------------------------------- | ------- | +| **INT8/UINT8** | signed/unsigned 8 bit integer | 1 byte | +| **INT16/UINT16** | signed/unsigned 16 bit integer | 2 bytes | +| **INT32/UINT32** | signed/unsigned 32 bit integer | 4 bytes | +| **FLOAT** | single precision floating point number | 4 bytes | + +### Key Concepts + +There are several main concepts that are important for understanding the way path files work: + +- A **"node"** is an individual point in space which is used as an anchor for a path +- **Paths** are routes between nodes. These are traced in-game by peds and vehicles, but are typically shown in editors as graphical lines +- Two nodes are connected by one referencing a **"link"** which points to the other +- Most nodes link to two other nodes, one for each direction along a path, but it is possible for there to be more (such as at a junction) + +### Header + +The header contains information about the content of the various sections in the file. It has a size of **20 bytes**. + +| Size | Type | Description | +| ---- | ------ | ------------------------------------ | +| 4b | UINT32 | number of nodes (section 1) | +| 4b | UINT32 | number of vehicle nodes (section 1a) | +| 4b | UINT32 | number of ped nodes (section 1b) | +| 4b | UINT32 | number of navi nodes (section 2) | +| 4b | UINT32 | number of links (section 3/5/6) | + +:::note +Sections related to links (3/5/6) have the same number of entries. These entries belong together and can be treated as one record by editors. +::: + +### Section 1 - Path Nodes + +The first section contains the node data for the paths. They are grouped by type: the list of vehicle nodes (cars, boats, race tracks) is followed by the ped nodes. Each node entry has a size of **28 bytes**. + +| Size | Type | Description | +| ---- | -------- | -------------------------------------------------------------------- | +| 4b | UINT32 | Mem Address, _unused_ | +| 4b | UINT32 | always zero, _unused_ | +| 6b | INT16[3] | Position (XYZ), see below | +| 2b | INT16 | heuristic cost, always `0x7FFE`, used internally to calculate routes | +| 2b | UINT16 | Link ID | +| 2b | UINT16 | Area ID (same as in filename) | +| 2b | UINT16 | Node ID (increments by 1) | +| 1b | UINT8 | Path Width | +| 1b | UINT8 | Flood Fill, used in route calculations | +| 4b | UINT32 | Flags | + +#### Field Descriptions + +- **Mem Address**: These might have been pointers to path segment structures inside R\*'s path compiler. Apparently they are ignored by the game and can be set to zero. +- **Position**: This is the position of the node in world coordinates. To convert the signed words to floating point values divide them by 8. +- **Link ID**: The ID of the first node this node links to. The range of linked nodes is _link ID ≤ x < (link ID + link count)_, where the link count is given by the first four bits of the flags. +- **Area ID and Node ID**: Informational data, used to connect nodes via Links. Area ID is always the same as the number in the filename, and Node ID is used to identify the node. +- **Path Width**: This is used to modify the width of a path. The default value is 0 (zero). To convert the signed word to a floating point value divide it by 8. +- **Flood Fill**: Flood IDs for route calculation for NPCs. For normal NPC vehicle traffic a value of 1 is used, 2 is for boats and higher values are allocated to disconnected path area segment, e.g for race tracks and other mission applications. +- **Flags**: The first 4 bits define the number of links to adjacent nodes. The other bits are used to characterize node behavior, for more information see the table below. + +#### Path Node Flags + +_Node flag bits, from low to high:_ + +| Bits | Description | +| ---- | ------------ | +| 0-3 | Link Count | +| 4-5 | TrafficLevel | + +The LinkCount defines the number of entries incrementing from the LinkID. The TrafficLevel uses 4 steps: + +- 0 = full +- 1 = high +- 2 = medium +- 3 = low + +| Flag | Bit | Description | +| ----- | ----- | --------------------------------------------------------------- | +| A | 06 | Road-Blocks | +| B | 07 | Boats | +| C | 08 | Emergency Vehicles only | +| D | 09 | zero/unused | +| E | 10 | unknown, grove house entrance paths ? | +| F | 11 | zero/unused | +| G | 12 | Is not Highway | +| H | 13 | Is Highway (ignored for PED-Nodes and never 11 or 00 for Cars!) | +| I | 14 | zero | +| J | 15 | zero | +| K-M | 16-19 | spawn probability (`0x00` to `0x0F`) | +| O | 20 | RoadBlock? | +| P | 21 | Parking | +| Q | 22 | zero | +| R | 23 | RoadBlock? | +| 24-31 | | zero (unused) | + +The following _statistics on flag usage_, grouped by path type, might be useful for further research: + +| Flag | Peds | Cars | Total | +| --------- | --------------- | --------------- | ------ | +| **Total** | 37,650 | 30,587 | 68,237 | +| A | 0 | 391 (1.28%) | 391 | +| B | 0 | 1,596 (5.22%) | 1,596 | +| C | 6,019 (15.99%) | 7,669 (25.08%) | 13,688 | +| D | 0 | 0 | 0 | +| E | 17 (0.05%) | 0 | 17 | +| F | 0 | 0 | 0 | +| G | 0 | 27,936 (91.33%) | 27,936 | +| H | 0 | 2,539 (8.3%) | 2,539 | +| I | 0 | 0 | 0 | +| J | 0 | 0 | 0 | +| K | 37,646 (99.98%) | 30,582 (99.98%) | 68,228 | +| L | 36,676 (97.41%) | 30,141 (98.54%) | 66,817 | +| M | 36,676 (97.41%) | 30,136 (98.52%) | 66,812 | +| N | 36,607 (97.22%) | 30,046 (98.23%) | 66,653 | +| O | 0 | 8 (0.03%) | 8 | +| P | 0 | 215 (0.7%) | 215 | +| Q | 0 | 0 | 0 | +| R | 0 | 16 (0.05%) | 16 | + +### Section 2 - Navi Nodes + +The second section contains additional nodes. These nodes are _navigational nodes_ (but are referred to in this article as "navi nodes" for brevity). Each record has a size of **14 bytes**. + +Navi nodes are used to define additional information for vehicle path segments; they are not used by ped paths. They are usually positioned between two adjacent vehicle nodes on an interpolated curve. + +There may be bugs if you don't connect navi nodes correctly. Links always go from a node with a higher area/node ID to one with a lower ID, so the target is always the lower node. + +| Size | Type | Description | +| ---- | -------- | ------------------------- | +| 4b | INT16[2] | Position (XY), see below | +| 2b | UINT16 | Area ID | +| 2b | UINT16 | Node ID | +| 2b | INT8[2] | Direction (XY), see below | +| 4b | UINT32 | Flags | + +#### Navi Node Field Descriptions + +- **Position**: This is the position of the navi node in world coordinates. To convert the signed words to floating point values divide them by 8. +- **Area ID and Node ID**: These identify the target node a navi node is attached to. +- **Direction**: This is a normalized vector pointing towards above mentioned target node, thus defining the general direction of the path segment. The vector components are represented by signed bytes with values within the interval [-100, 100], which corresponds to the range of floating point values [-1.0, 1.0]. + +#### Navi Node Flags + +These are used to characterize path segment behavior, for more information see the table below. + +| Bits | Description | +| ----- | ---------------------------------------------------------------------- | +| 0-7 | path node width, usually a copy of the linked node's path width (byte) | +| 8-10 | number of left lanes | +| 11-13 | number of right lanes | +| 14 | traffic light direction behavior | +| 15 | zero/unused | +| 16,17 | traffic light behavior | +| 18 | train crossing | +| 19-31 | zero/unused | + +#### Important Notes + +- Right (forward) and left (backward) lanes are relative to the direction vector. +- Experience has shown that navi nodes with attachments across area borders don't work too well. A possible solution is to attach them to the last instead of the next node, reverse the direction and exchange the lane numbers (if different) and other direction dependent flags. However, this will never work if previous, navi and next node are located in different areas each. **(\*)** +- _Traffic light behavior_ can be a value from 0 to 2, where 0 means traffic lights is disabled, 1 and 2 are used for the traffic lights and are North-South and West-East cycles for traffic light synchronization respectively. +- The _traffic light direction behavior_ is 1 if the navi node has the same direction as the traffic light and 0 if the navi node points somewhere else. + +:::note +(\*) Got clear after knowing how Navis are linked exactly. So you may use this but it is not obligation. +::: + +### Section 3 - Links + +These are links to adjacent nodes, **4 bytes** per entry. + +| Size | Type | Description | +| ---- | ------ | ----------- | +| 2b | UINT16 | Area ID | +| 2b | UINT16 | Node ID | + +### Section 4 - Filler + +This section holds data of constant size and content; its purpose is unknown. These **768 bytes** are filled with 192 repetitions of the pattern `0xFF 0xFF 0x00 0x00`, but this can be filled with zeros as well. + +### Section 5 - Navi Links + +These are links to adjacent navi nodes, one for each link (in section 3), **2 bytes** per entry. For indices from ped nodes (in section 1b) these are zero (unused). + +| Size | Type | Description | +| ---- | ------ | ------------------------------------------------------------------------ | +| 2b | UINT16 | lower 10 bit are the Navi Node ID, upper 6 bit the corresponding Area ID | + +:::warning Important Limitations +**Navi Node Limits:** + +- Maximum **1024** Navi Nodes per area file +- Maximum **64** files/areas total + +**Navi Node ID Note:** + +- The Navi Node ID is not the Linked Node ID from Section 2, but rather the sequential order in which the Navi Node appears in the file. + ::: + +### Section 6 - Link Lengths + +These are the distances between linked nodes in full units, **1 byte** per entry. They are essential for path finding algorithms. + +| Size | Type | Description | +| ---- | ----- | ----------- | +| 1b | UINT8 | Length | + +### Section 7 - Path Intersection Flags + +This section consists of intersection flag values for each node address (i.e. node link). + +```cpp +class CPathIntersectionInfo +{ +public: + unsigned char m_bRoadCross : 1; + unsigned char m_bPedTrafficLight : 1; +}; +``` + +The size of section is equal to count of node addresses. +The section is followed by 192 bytes of unknown data. + +## Tools & Scripts + +- [Fastman92 Path Format](https://gtamods.com/wiki/Fastman92_Path_Format) +- [SA Path Editor (WIP)](https://gtagmodding.com/1093) by JGuntherS@NL - Only useful for editing existing path data +- [Path Compiler (WIP)](https://gtaforums.com/topic/214901-compiled-path-nodes/?do=findComment&comment=3841297) by ocram88 - Allows to create linear ped paths by generating waypoints from inside the game +- [Path Tool (WIP)](https://gtaforums.com/topic/214901-compiled-path-nodes/?do=findComment&comment=3936074) by steve-m - Comes bundled with a MaxScript to export ped and vehicle paths from Max (by using spline shapes) +- [APE v1.1](https://gtaforums.com/topic/295628-ape-v11/) by Aschratt - Based on a memhack and including a decompiler it is possible to add path to the existing or to create completely new from ingame! +- [Path Script](https://gtaforums.com/topic/283684-path-script/) - a script by Deniska for 3DSMax that creates path files directly +- [PathViewer](https://gtaforums.com/topic/392955-pathviewer/) - a tool by Aschratt which allows to view paths and highlight nodes with special flags in 3D +- [fastman92 limit adjuster](https://gtaforums.com/topic/733982-fastman92-limit-adjuster/) - Limit adjuster by fastman92 which allows to increase the path limits + +## See Also + +- [Compiled Path Nodes](https://gtaforums.com/topic/214901-compiled-path-nodes/) - original discussion thread +- [Paths Documentation for SA, VC and GTA3](https://gtaforums.com/topic/93990-paths-documentation-for-sa-vc-and-gta3/?do=findComment&comment=3813170) diff --git a/frontend/docs/scripting/resources/skins.md b/frontend/docs/scripting/resources/skins.md index 193c908d39b..d1225e1caaa 100644 --- a/frontend/docs/scripting/resources/skins.md +++ b/frontend/docs/scripting/resources/skins.md @@ -8,8 +8,8 @@ description: This page has the all the available skins in SA-MP. This page contains every available skin used by [SetPlayerSkin](../functions/SetPlayerSkin) and [GetPlayerSkin](../functions/GetPlayerSkin) functions. -| Skin ID | Preview | Skin Model Name | Skin Name/Type | Singleplayer Location | Gender | -| ------- | ------------------------------------- | --------------- | ---------------------------------------- | -------------------------------------------------- | ------ | +| Skin ID | Preview | Skin Model Name | Skin Name/Type | Singleplayer Location | Gender | +| ------- | ------------------------------------------------------------------ | --------------- | ---------------------------------------- | -------------------------------------------------- | ------ | | 0 | ![Skin ID 0](https://assets.open.mp/assets/images/skins/0.png) | cj | Carl "CJ" Johnson (Main Character) | Anywhere | Male | | 1 | ![Skin ID 1](https://assets.open.mp/assets/images/skins/1.png) | truth | The Truth | San Fierro and Las Venturas | Male | | 2 | ![Skin ID 2](https://assets.open.mp/assets/images/skins/2.png) | maccer | Maccer | Las Venturas and Los Santos | Male | @@ -318,8 +318,8 @@ These skins (300 to 311) were added in SA-MP 0.3.7 RC3 and will not work in earl ::: -| Skin ID | Preview | Skin Model Name | Skin Name/Type | Singleplayer Location | Gender | -| ------- | ------------------------------------- | --------------- | --------------------------------------------------- | --------------------- | ------ | +| Skin ID | Preview | Skin Model Name | Skin Name/Type | Singleplayer Location | Gender | +| ------- | ------------------------------------------------------------------ | --------------- | --------------------------------------------------- | --------------------- | ------ | | 300 | ![Skin ID 300](https://assets.open.mp/assets/images/skins/300.png) | lapdna | Los Santos Police Officer (Without gun holster) | - | Male | | 301 | ![Skin ID 301](https://assets.open.mp/assets/images/skins/301.png) | sfpdna | San Fierro Police Officer (Without gun holster) | - | Male | | 302 | ![Skin ID 302](https://assets.open.mp/assets/images/skins/302.png) | lvpdna | Las Venturas Police Officer (Without gun holster) | - | Male | diff --git a/frontend/docs/server/Installation.md b/frontend/docs/server/Installation.md index ce61a0cca4b..4b8c3cf0eb5 100644 --- a/frontend/docs/server/Installation.md +++ b/frontend/docs/server/Installation.md @@ -1,8 +1,14 @@ +--- +title: Installation +sidebar_label: Installation +description: Guide for transferring your gamemode from SA:MP server to open.mp server. +--- + **This tutorial is for those who want to transfer their gamemode from SA:MP server to open.mp server.** -:::note +:::tip -If you are using the FCNPC plugin, please stop for now because this plugin does not work for open.mp currently. +**Good news for FCNPC users!** The legacy FCNPC plugin has been replaced with the official **open.mp NPC component**, which provides the same functionality with better performance and native integration. Simply convert your code to the built-in NPC component instead. ::: diff --git a/frontend/docs/server/LinuxServerInstallation.md b/frontend/docs/server/LinuxServerInstallation.md index 24219cf24df..8120d979742 100644 --- a/frontend/docs/server/LinuxServerInstallation.md +++ b/frontend/docs/server/LinuxServerInstallation.md @@ -1,3 +1,9 @@ +--- +title: Linux Server Installation +sidebar_label: Linux Server Installation +description: Comprehensive guide on installing an open.mp server on Ubuntu or another Debian based Linux. +--- + **This guide contains a comprehensive guide on installing an open.mp server on Ubuntu or another Debian based Linux. Whether you're a beginner or just looking to refresh your knowledge, this guide may have something useful for you!** @@ -7,9 +13,9 @@ If you are using the SA:MP server and didn't convert to open.mp yet, **[please s ::: -:::note +:::tip -If you are using the FCNPC plugin, please stop for now because this plugin does not work for open.mp currently. +**Good news for FCNPC users!** The legacy FCNPC plugin has been replaced with the official **open.mp NPC component**, which provides the same functionality with better performance and native integration. Simply convert your code to the built-in NPC component instead. ::: @@ -40,7 +46,6 @@ Seek online guides or your hosting provider's documentation if you're unsure how ::: 2. Updating your Linux Instance: - - Before proceeding, let's ensure your system is up to date by running: ``` @@ -52,43 +57,60 @@ Seek online guides or your hosting provider's documentation if you're unsure how ``` 3. Creating a secure service account: - - For security reasons, we should create a dedicated service account without a home directory: ``` sudo useradd -M svc-omp-server ``` -4. Locking the service sccount: - +4. Locking the service account: - Let's prevent the service account from being used for login: ``` sudo usermod -L svc-omp-server ``` -5. Creating a directory for the server files: +5. Adding your user to the service group: + - Add your current user to the svc-omp-server group so you can manage files: + + ``` + sudo usermod -aG svc-omp-server $USER + ``` + :::warning + + You need to log out and log back in for group changes to take effect! + + ::: + +6. Creating a directory for the server files: - We will use the /opt directory, this is the standard location for third-party applications: ``` sudo mkdir /opt/omp-server ``` -6. Setting permissions for the directory: - +7. Setting permissions for the directory: - Changing the group of the directory to match the service account: ``` sudo chgrp svc-omp-server /opt/omp-server ``` - - Setting the g+s flag so new files inherit the correct group and remove access for others: + - Give the group read, write, and execute permissions: + + ``` + sudo chmod g+rwx /opt/omp-server + ``` + + - Setting the g+s flag so new files inherit the correct group: ``` sudo chmod g+s /opt/omp-server ``` + - Remove access for others: + ``` sudo chmod o-rwx /opt/omp-server ``` @@ -97,16 +119,14 @@ Seek online guides or your hosting provider's documentation if you're unsure how ## Phase 2: Installing open.mp Server Files -7. Let's navigate to the server directory: - +8. Let's navigate to the server directory: - We need to move to the /opt/omp-server directory where the server will be stored: ``` cd /opt/omp-server ``` -8. Downloading the open.mp server files: - +9. Downloading the open.mp server files: - Download the latest release of the open.mp server: ``` @@ -120,8 +140,7 @@ Seek online guides or your hosting provider's documentation if you're unsure how ::: -9. Extracting the server files: - +10. Extracting the server files: - Once downloaded, extract the files: ``` @@ -132,9 +151,8 @@ Seek online guides or your hosting provider's documentation if you're unsure how ## Phase 3: Configuring and Starting the Server -10. Installing the required x86 libraries: - - - Since the server runs as a 32-bit application, you need to enable 32-bit architecture support: +11. Installing the required packages: + - Since the server runs as a 32-bit application, you need to enable 32-bit architecture support and install screen: ``` sudo dpkg --add-architecture i386 @@ -145,11 +163,10 @@ Seek online guides or your hosting provider's documentation if you're unsure how ``` ``` - sudo apt install libc6:i386 + sudo apt install libc6:i386 screen ``` -11. Making the server executable: - +12. Making the server executable: - Change the permissions so the server can be executed (only required once!): ``` @@ -160,43 +177,52 @@ Seek online guides or your hosting provider's documentation if you're unsure how sudo chmod +x omp-server ``` -12. Starting the server: - - - Use the following command to start the server in the background: +13. Starting the server: + - Use screen to start the server in a detachable session as the service account: ``` - nohup ./omp-server & + sudo -u svc-omp-server screen -dmS omp-server ./omp-server ``` - - The terminal will output a process ID (PID). Write this number down for future reference. + :::tip + + This creates a detached screen session named "omp-server" running as the service account. You can attach to it anytime to see the console! + + :::
## Phase 4: Managing the Server -13. Stopping the server: - - - To stop the server, use the PID from step 12 and run: +14. Viewing the server console: + - To attach to the running server and see the console output: ``` - sudo kill + sudo -u svc-omp-server screen -r omp-server ``` -14. Finding the Process ID (if forgotten): + - To detach from the screen session (leave it running), press: `Ctrl+A` then `D` - - If you forget the process ID, run: +15. Stopping the server: + - Attach to the screen session (step 14), then stop the server gracefully by typing `/exit` in the console or pressing `Ctrl+C` + - Alternatively, you can kill the screen session: ``` - top + sudo -u svc-omp-server screen -X -S omp-server quit ``` - - Look for the omp-server process in the list, note the PID, press 'Q' to quit, and then kill the process as shown in step 13. +16. Checking if the server is running: + - To see all screen sessions: + + ``` + sudo -u svc-omp-server screen -ls + ```
## Phase 5: Uploading Your Gamemode and Files -15. Upload your custom gamemodes and scripts: +17. Upload your custom gamemodes and scripts: - Use WinSCP or Filezilla to transfer your gamemodes and scripts to the /opt/omp-server directory. Important: Make sure to use .so files for Linux plugins, as .dll files are only supported on Windows.