CS_VISA
An easy to use visa script to disable certain actions for players that do not have the necessary playtime.
Installation
Configuration
Config.lua
In the VisumLevels table you can configure the different visum levels you want to have
Make sure to have an increment of 1 for each level. Like this: [0], [1], [2]
Webhook.lua
The script offers 3 different webhooks.
visumUpgraded
getvisumcommand
setvisumcommand
If you do not want one of these, just leave the string empty. Like this:
WebhookVisum = {
Colors = {
["Main"] = 43775,
},
visumUpgraded = "",
getvisumcommand = "https://discord.com/api/webhooks/1253971849193324595/FJS-Tml5AOKdPoXog7qc6VB27__7SzL8XSp5uD23KCFfo4uP6iyuExEkgWeSbCLl-7t_",
setvisumcommand = "https://discord.com/api/webhooks/1253971849193324595/FJS-Tml5AOKdPoXog7qc6VB27__7SzL8XSp5uD23KCFfo4uP6iyuExEkgWeSbCLl-7t_",
}
In this example, you would not be notified when a player visa level is upgraded.
Working with CS_VISA
Client
If you want to get the visa level of the client, use this export:
exports['cs_visum']:getVisum()
Server
If you want to print the visalevel of a certain playerid, use this export like this:
exports['cs_visum']:getVisumServer(playerid, function(visum)
print('Visa Level: ' .. visum)
end)
If you want to get the current playtime of a certain playerid, use this export like this:
exports['cs_visum']:getCurrentPlaytime(playerid, function(playtime)
print('Current Playtime: ' .. playtime)
end)
This export callbacks the playtime that is currently saved in the database and therefore does not give you the correct playtime of the player. So this is only useful in specific cases.
exports['cs_visum']:getPlaytime(playerid, function(playtime)
print('Playtime in DB: ' .. playtime)
end)
Unsupported exports
I also added two exports to save either the playtime or the visa level. But these are not to be used. So really make sure, you know what you are doing when using them!
You can find these exports at the bottom of -> script/server/openserver.lua and at the bottom of the fxmanifest.lua.
These exports would be used like this:
local xPlayer = ESX.GetPlayerFromId(playerid)
exports['cs_visum']:savePlaytime(xPlayer)
exports['cs_visum']:saveVisum(xPlayer, visumlevel)
If you have any further questions, open a ticket on our discord server: discord.gg/core-services
Last updated
Was this helpful?