API
Client Exports
IsInGame
Returns true if the player is playing in the Gun Range, otherwise false.
local retval = exports["rcore_gunrange"]:isInGame()
print(retval) -- trueServer Exports
IsPlayerInGame
Returns true if the player is playing in the Gun Range, otherwise false.
local retval = exports["rcore_gunrange"]:IsPlayerInGame(playerSource)
print(retval) -- trueClient Events
rcore_gunrange:client:api:onMenuOpen
rcore_gunrange:client:api:onMenuOpenTriggered whenever the player opens the gun range menu.
rcore_gunrange:client:api:onMenuClose
rcore_gunrange:client:api:onMenuCloseTriggered when the player closes the gun range menu or when it is closed automatically (e.g., when a game starts).
rcore_gunrange:client:api:onGameStart
rcore_gunrange:client:api:onGameStartTriggered when a game begins. Comes with four parameters.
AddEventHandler('rcore_gunrange:client:api:onGameStart', function(gameMode, timeLimit, isRentingWeapons, weapon)
print(gameMode) -- EXAM, PRACTISE, SESSION
print(timeLimit) -- Time in seconds
print(isRentingWeapons) -- true | false
print(weapon) -- nil when player is not renting a weapon
end)rcore_gunrange:client:api:onGameEnd
rcore_gunrange:client:api:onGameEndTriggered when a game ends or is stopped by the player. Comes with two parameters, which tells you what game mode player has completed playing and what score the playe got. The first parameter can also be UNKNOWN and second 0, indicating that the player stopped the game using a command.
AddEventHandler('rcore_gunrange:client:api:onGameEnd', function(gameMode, playerScore)
print(gameMode) -- EXAM, PRACTISE, SESSION, UNKNOWN
print(playerScore) -- Number
end)Last updated
Was this helpful?