TriggerEvent(‘es:addGroupCommand’, ‘fix’, “mod”, function(source, args, user)
TriggerEvent(“SetVehicleFixed”, source)
end, function(source, args, user)
TriggerClientEvent(‘chatMessage’, source, “SYSTEM”, {255, 0, 0}, “Insufficienct permissions!”)
end)
can you help me i dont know what is wrong with this?
Yoan
May 16, 2017, 3:53am
2
You have this sv_admin.lua script ?
indeed i do have it in there
Should be TriggerClientEvent, I believe
I had it as that and didnt work so i changed
anyone else have an idea what it is?
so its registering the command but it just doesn’t fix the car
Havoc
May 16, 2017, 10:17pm
9
Could you provide more code rather than just a snippet?
It’s kinda hard to help you when we don’t have any context and a small snippet to work with.
I’m going to assume you’ve already done the following on the client
RegisterNetEvent("SetVehicleFixed")
AddEventHandler("SetVehicleFixed", function()
-- Some code here
end)
If so then you need to listen to what @Briglair said and use TriggerClientEvent
.
You can find more on TriggerClientEvent
here .
i posted the whole file [quote=“ExoticNx, post:4, topic:19995, full:true”]
https://hastebin.com/oruneniyep.lua thats how i have it
[/quote]
Havoc
May 16, 2017, 10:23pm
11
Right, so you haven’t written any client-side code?
There’s the problem. The event “SetVehicleFixed” doesn’t exist on the server (you haven’t got a handler for it) and it should probably be a client event (assuming you’re going to be calling natives).
So,
Create a client event called “SetVehicleFixed”
Add code to the event to fix the vehicle.
Make sure to call TriggerClientEvent("SetVehicleFixed", source)
RegisterNetEvent(“SetVehicleFixed”)
AddEventHandler(“SetVehicleFixed”, function()
SetVehicleFixed(GetVehiclePedIsUsing)
end)
put this in cl_admin