RSGCore:Client:OnPlayerLoaded

  • Handles the player loading in after character selection
This event can be used as an event handler to trigger code because it signifies the player has successfully loaded into the server!
RegisterNetEvent('RSGCore:Client:OnPlayerLoaded', function()
    print('Im a client and i just loaded into your server!')
end)

RSGCore:Client:OnPlayerUnload

  • Handles the player login out to character selection
This event can be used as an event handler to trigger code because it signifies the player has successfully unloaded or logged out of the server!
RegisterNetEvent('RSGCore:Client:OnPlayerUnload', function()
    print('Im a client and i just logged out of your server!')
end)

RSGCore:Client:PvpHasToggled

On player load this event checks is triggered after checking the rsg-core config to see if PVP should be enabled or disabled
RegisterNetEvent('RSGCore:Client:PvpHasToggled', function(pvp_state)
    print('PVP mode has been set to '..pvp_state..'!')
end)

RSGCore:Command:SpawnVehicle

ArgumentsTypeRequiredDefault
cart modelstringyesnone
Client example
-- /spawnveh cart

RegisterCommand('spawnveh', function(_, args)
    local vehicle = RSGCore.Shared.Trim(args[1])
    TriggerEvent('RSGCore:Command:SpawnVehicle', vehicle)
end)
Server example
-- /spawnveh wagon

RegisterCommand('spawnveh', function(source, args)
    local vehicle = RSGCore.Shared.Trim(args[1])
    TriggerClientEvent('RSGCore:Command:SpawnVehicle', source, vehicle)
end)

RSGCore:Command:DeleteVehicle

ArgumentsTypeRequiredDefault
nonenonenonone
Client example
RegisterCommand('deleteveh', function(_, args)
    TriggerEvent('RSGCore:Command:DeleteVehicle')
end)
Server example
RegisterCommand('deleteveh', function(source, args)
    TriggerClientEvent('RSGCore:Command:DeleteVehicle', source)
end)

RSGCore:Player:SetPlayerData

This event can be used as an event handler to trigger code because it indicates that the players data has changed!
RegisterNetEvent('RSGCore:Player:SetPlayerData', function(val)
    PlayerData = val
    print(RSGCore.Debug(PlayerData))
end)

RSGCore:Client:UseItem

ArgumentsTypeRequiredDefault
item namestringyesnone
Client example (must have the item in your inventory)
-- /useitem bread 1

RegisterCommand('useitem', function(_, args)
    local item = {
        name = args[1],
        amount = tonumber(args[2])
    }
    TriggerEvent('RSGCore:Client:UseItem', item)
end)
Server example (must have the item in your inventory)
-- /useitem bread 1

RegisterCommand('useitem', function(source, args)
    local item = {
        name = args[1],
        amount = tonumber(args[2])
    }
    TriggerClientEvent('RSGCore:Client:UseItem', source, item)
end)

RSGCore:Client:UpdateObject

This event must be used as a handler when using Shared Exports because it refreshes the core object in your resource
RegisterNetEvent('RGCore:Client:UpdateObject', function()
    RSGCore = exports['rsg-core']:GetCoreObject()
end)