Dvcar file

when i do /dv this do’nt work
car not deleted

If you wrote the script yourself, show the code

If it’s a script from the forums or github ask there

AddEventHandler(‘chatMessage’, function(source, name, msg)
if msg == “/dv” then
local user_id = vRP.getUserId({source})
local player = vRP.getUserSource({user_id})
if vRP.hasGroup({user_id,“cop”}) then
CancelEvent();
TriggerClientEvent(‘wk:deleteVehicle’, source);
elseif vRP.hasGroup({user_id,“Chief of Police”}) then
CancelEvent();
TriggerClientEvent(‘wk:deleteVehicle’, source);
elseif vRP.hasGroup({user_id,“ems”}) then
CancelEvent();
TriggerClientEvent(‘wk:deleteVehicle’, source);
end
end
end)

Hi,

So, if you want to create a command, why are you using ‘chatMessage’ event instead of RegisterCommand function?

About your problem, you’re using { when you call a function and you can’t do that in lua, call functions like this: local user_id = vRP.getUserId(source)

I made some change in your code:

RegisterCommand("dv", function(source, args, raw)
	local user_id = vRP.getUserId(source)
	if vRP.hasGroup(user_id,"cop") then
		TriggerClientEvent('wk:deleteVehicle', source);
	elseif vRP.hasGroup(user_id,"Chief of Police") then
		TriggerClientEvent('wk:deleteVehicle', source);
	elseif vRP.hasGroup(user_id,"ems") then
		TriggerClientEvent('wk:deleteVehicle', source);
	end
end)

I’m not 100% sure it’s workgin because I don’t use vRP, but should be better now :yum:

And the next time you send code on the forum, please use ‘preformatted text’ :wink:

1 Like

i have a question
do you know how can i remove boots?

boots? Like change shoes or make a player bare feet?

i mean the cars and peds

You mean the ped and vehicle density?

1 Like

yes i do’nt know how i remove it

wher add it ?