Okay, so I’ve found some wonderful scripts on this fine forum and they’ve helped me out a lot with my server development. My issue is some of these don’t check permissions and I would like to add that – or at least add a password or something to the commands. I’ve peered through some other scripts that have done it successfully, but I’m unable to get it working as intended on my server.
This is what I’ve tried for grabbing vRP permissions and checking them before allowing the use of the /drag command.
local Tunnel = module("vrp", "lib/Tunnel")
local Proxy = module("vrp", "lib/Proxy")
vRP = Proxy.getInterface("vRP")
vRPclient = Tunnel.getInterface("vRP","dragvrp")
TriggerEvent('es:addCommand', 'drag', function(source, args, user)
local argument = args[2] -- player id to check license
local savedsource = source
if argument == nil or type(tonumber(argument)) == nil then
TriggerClientEvent("chatMessage", source, "SYSTEM", { 0, 141, 155 }, "example: /drag <id>")
elseif (permissions={"police.handcuff"}) then <-- add your permissions here
-- TriggerClientEvent("chatMessage", source, "SYSTEM", { 0, 141, 155 }, "^3Civilians are not allowed to use /drag")
else
if(GetPlayerName(tonumber(argument)))then
TriggerEvent('es:getPlayerFromId', tonumber(argument), function(target)
if argument == savedsource then
TriggerClientEvent('chatMessage', source, "SYSTEM", { 0, 141, 155 }, "You cannot drag yourself.")
else
TriggerClientEvent("dr:drag", tonumber(argument), source)
end
end)
else
TriggerClientEvent('chatMessage', source, "SYSTEM", { 0, 141, 155 }, "Incorrect Player ID")
end
end
end)
This is from a drag command script that I’ve found on here that works quite well, the problem is I’d only want police to be able to use it. I thought that by adding the vRP tunnels and the permissions line that everything would work, but it does not. It doesn’t function at all in game. Can anyone point me in the right direction for fixing this? I’ve pored over the vRP documentation and I’m unable to figure out on my own what’s wrong.