MRS - Advanced Rank System

List of functions hooks and usefull information for developers

MRS Functions

Here you can find list of functions and Information about them.

 


MRS.SetPlayerRank

  Server MRS.SetPlayerRank( Player ply, string group, number id, boolean silent )

Description

Sets rank for a player in a given group by rankid. This function will automatically check for group and rank validation.

Arguments

  1. Player ply | A player to set the rank for
  2. string group | The group id, in which you want to set the rank
  3. number id | The rank id, which you want to set
  4. boolean silent | Suppress the notification. If set to true, player will not get notification about promotion/demotion

Example

Promote player by one rank in group "LAPD" (change + 1 to - 1 for demotion):

local rank = MRS.GetPlyRank(ply, "LAPD")
MRS.SetPlayerRank(ply, "LAPD", rank + 1)

 


MRS.GetNWdata

 Shared MRS.GetNWdata( Player ply, string key )

Description

Returns networked data related to the MRS. Can be a string or a number. Primarely uses to get player's current group and rank id.

Arguments

  1. Player ply | The player who is associated with the value
  2. string key | The key that is associated with the value

Returns

  1. string or a number | The value associated with the key

Example

Get players group and rank ids:

    local group = MRS.GetNWdata(ply, "Group")
    local rank = MRS.GetNWdata(ply, "Rank")

Returns active rank info for a player:

    local group = MRS.GetNWdata(ply, "Group")
    local rank = MRS.GetNWdata(ply, "Rank")

    if not MRS.Ranks[group] or not MRS.Ranks[group].ranks[rank] then return false end

    local rank_info = MRS.Ranks[group].ranks[rank]

MRS.GetPlyRank

 Shared MRS.GetPlyRank( Player ply, string group)

Description

Returns the rank id for a player in the mentioned group, even if he is not currently playing in that group.

Arguments

  1. Player ply | The player
  2. string group | The group id

Returns

  1.  number | Rank ID