Dvcar file

roleplay

#1

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


#2

If you wrote the script yourself, show the code

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


#3

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)


#4

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:


#5

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


#6

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


#7

i mean the cars and peds


#8

You mean the ped and vehicle density?


#9

yes i do’nt know how i remove it


#10