[HELP] Drag command

Hi im trying to make a drag mod thats not using essentials mode.
But i cant figure out why it wont work and the std for getplayerid anyone who could help with this?

Here is my code

client.lua

RegisterNetEvent(“dr:drag”)

otherid = 0
drag = false

RegisterNetEvent(“dr:drag”)
AddEventHandler(‘dr:drag’, function(pl)
otherid = tonumber(pl)
drag = not drag
end)

Citizen.CreateThread(function()
while true do
if drag then
local ped = GetPlayerPed(GetPlayerFromServerId(otherid))
local myped = GetPlayerPed(-1)
AttachEntityToEntity(myped, ped, 11816, 0.54, 0.54, 0.0, 0.0, 0.0, 0.0, false, false, false, false, 2, true)
else
DetachEntity(GetPlayerPed(-1), true, false)
end
Citizen.Wait(0)
end
end)

server.lua

RegisterServerEvent(“chatCommandEntered”)
RegisterServerEvent(‘chatMessageEntered’)

AddEventHandler(“chatMessage”, function(p, color, msg)
if msg:sub(1, 1) == “/” then
fullcmd = stringSplit(msg, " ")
cmd = fullcmd[1]

    if cmd == "/drag" then
        TriggerClientEvent("dr:drag", p)
        CancelEvent()
    end
end

end)

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>")
			
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

This script now uses aSync and CouchDB

Has drag built in

I know that one. I dont need another police mod. And not one who is useing couchdb

MySQL and MySQL-async and CouchDB
Not only CouchDB

1 Like

Dont need a police mod. i need a drag mod :slight_smile:

That use essentialmode :slight_smile:

it’s a little modification to remove essentialmode, just do it by yourself

i tried. but i got idea what i should replace and what to put in instead… would you mind telling me