Skip to content

Conversation

@Alphazinn
Copy link

@Alphazinn Alphazinn commented Apr 28, 2025

Client-side Changes:

  • Teleportation to Waypoint: Added the ND:teleportToMarker event, allowing players to teleport to their marked waypoint.
  • Weather and Time Changes: Added the ND:changeWeather and ND:changeTime events to allow dynamic updates to weather and time in the game world.

Server-side Changes:

  • New Admin Commands:
    • /tpm: Teleports the player to their marked waypoint.
    • /tp: Teleports the player to specified coordinates.
    • /weather: Changes the weather based on a weather type.
    • /time: Updates the in-game time with hours, minutes, and optional seconds.
    • /coords: Displays the player's current coordinates and heading in the chat.

Item Usability System:

  • Implemented functions in NDCore to register, check, and use usable items (registerUsableItem, isItemUsable, useItem)
  • Added integration with ox_inventory to hook into its usedItem event, ensuring compatibility with the new usable item system
  • Created a shared items.lua file to manage item callbacks and provide exports for registering and using items

Example Usage:

exports["ND_Core"]:RegisterUsableItem("bandage", function(source, item)
    local player = exports["ND_Core"]:getPlayer(source)
    if not player then return end

    TriggerClientEvent("some:healing:event", source)

    TriggerClientEvent("ox_lib:notify", source, {
        title = "Used Bandage",
        description = "You have used a bandage and feel better",
        type = "success"
    })

    return true
end)

@Alphazinn Alphazinn changed the title New Admin Commands New Admin Commands & Register Usable Item Feature May 1, 2025
@Andyyy7666
Copy link
Member

Thank you, I'll review and test this soon.

@Andyyy7666
Copy link
Member

I like the commands for teleportation but I think the weather and time should be separate for weather & time scripts. And the item thing is nice but seems to be a little unnecessary since ox_inventory already does all that. Let me know if there's a specific reason you want it.

@Alphazinn
Copy link
Author

I like the commands for teleportation but I think the weather and time should be separate for weather & time scripts. And the item thing is nice but seems to be a little unnecessary since ox_inventory already does all that. Let me know if there's a specific reason you want it.

While working on a script that's compatible with all frameworks, it becomes a bit of a limitation that nd_core doesn't provide a registerUsableItem export. When everything is centralized under one library, not having this means users have to manually configure items, which can be inconvenient. Other frameworks do provide this export, so having it in nd_core would improve consistency and usability. That’s why I wanted to include it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants