# Installation

1. Download the purchased resource from [keymaster](https://keymaster.fivem.net/asset-grants) - the official site of fivem with purchased resources.
2. Unzip the  `g-redeem-code`
3. Create a Folder - In your resources directory, create a new folder and name it `[g-scripts]`if it has not already been created.
4. Drag `g-redeem-code` in to `[g-scripts]`

## Arrangement

Add this line in your <mark style="color:red;">server.cfg</mark> file

```
ensure [g-scripts]
```

#### Add this line into your <mark style="color:red;">server.cfg</mark>

This line determines who can access the main panel to manage, create, or send redeem codes.

```properties
add_ace group.admin createredeem.openmenu allow
```

## Database Sql

{% tabs %}
{% tab title="g\_redeem\_code" %}

```sql
CREATE TABLE `g_redeem_code` (
	`id` INT(11) NOT NULL AUTO_INCREMENT,
	`redeem_code` VARCHAR(255) NOT NULL COLLATE 'utf8mb4_general_ci',
	`createdBy` VARCHAR(255) NOT NULL COLLATE 'utf8mb4_general_ci',
	`createdAt` DATETIME NOT NULL DEFAULT current_timestamp(),
	`updatedAt` DATETIME NULL DEFAULT NULL ON UPDATE current_timestamp(),
	`expiryDate` DATETIME NULL DEFAULT NULL,
	`creatorIdentifier` VARCHAR(255) NOT NULL COLLATE 'utf8mb4_general_ci',
	`usage_limit` INT(11) NULL DEFAULT NULL,
	`remainingUses` INT(11) NULL DEFAULT '0',
	`expired` TINYINT(1) NULL DEFAULT '0',
	`enable` TINYINT(1) NULL DEFAULT '1',
	`claimed_redeem` TINYINT(1) NULL DEFAULT '0',
	`items` LONGTEXT NULL DEFAULT NULL COLLATE 'utf8mb4_bin',
	`type` VARCHAR(50) NULL DEFAULT 'redeem' COLLATE 'utf8mb4_general_ci',
	`receiver_identifier` VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci',
	`receiver_name` VARCHAR(50) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci',
	PRIMARY KEY (`id`) USING BTREE,
	UNIQUE INDEX `redeem_code` (`redeem_code`) USING BTREE,
	CONSTRAINT `items` CHECK (json_valid(`items`))
)
COLLATE='utf8mb4_general_ci'
ENGINE=InnoDB
AUTO_INCREMENT=1
;

```

{% endtab %}

{% tab title="g\_redeem\_log" %}

```sql
CREATE TABLE `g_redeem_log` (
	`id` INT(11) NOT NULL AUTO_INCREMENT,
	`identifier` VARCHAR(46) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci',
	`redeem_code` VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci',
	`name` CHAR(50) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci',
	PRIMARY KEY (`id`) USING BTREE
)
COLLATE='utf8mb4_general_ci'
ENGINE=InnoDB
AUTO_INCREMENT=1
;

```

{% endtab %}
{% endtabs %}
