What did I do wrong?

Hey, everyone! Been trying to make a /911 command that sends the location as a waypoint on the GPS/minimap. I am using essentials.

My problem is, that whenever the command is executed, no marker/waypoint is set on the map/GPS. I am using base code from SPJESTER as the basis for my 911 command. I tried not using essentials, however, the marker still wouldn’t set. If you have any suggestions or know the problem, let me know! Thank you!

Here are my Client.lua:

AddEventHandler('set_location', function()

function SetWaypoint()
	x, y, z = table.unpack(GetEntityCoords(GetPlayerPed(-1), true))
	Emergency = AddBlipForCord(x, y, z)
	SetBlipRoute(Emergency, true)
	SetBlipSprite(Emergency, 50)

Here is my server.lua:

local permission = {
	kick = 2,
	normal = 0,
	ban = 3
TriggerEvent('es:addAdminCommand', '911', permission.normal, function(source, args, user)
	table.remove(args, 1)
	TriggerClientEvent('set_location', source)
	TriggerClientEvent('chatMessage', -1, "^5[911]", {30, 144, 255}, " (^1 Caller ID: ^3" .. GetPlayerName(source) .." | "..source.."^0 ) " .. table.concat(args, " "))
end, function(source, args, user)
	TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Insufficienct permissions!")

Here is my __resource.lua:

resource_manifest_version '77731fab-63ca-442c-a67b-abc70f28dfa5'
client_script "client.lua"
server_script "server.lua"

Do you mean AddBlipForCoord not AddBlipForCord?

Emergency = AddBlipForCord(x, y, z)

should be AddBlipForCoord

if so spelling mistake ruined it lol

Thanks for spotting that, grammar is my downfall. I won’t be able to test this until I get home, but it seems like the Server.lua isn’t calling the client function when the command is run. Could this one little grammar mistake screw everything up? At one point I had it set to draw a notification but the notification never came.

I appreciate the help.

i unfortunately dont do anything with tables as i never really have needed to but even if that worked the blip would definitely not show a blip at all with that mistake. i could look into it though (probably with no luck, my 14 yr old brain limits me a bit XD)

wait, ignore that last message haha

you’re missing a ) at the end of setwaypoint too as you opened it with AddEventHandler( but never closed it

You want to place waypoint on caller’s head that only he can see when he call 911? Because it’s what you are trying to do, judging from your code.

I too was wondering that, wasnt too sure though haha.


function SetWaypoint(x,y,z)
	Emergency = AddBlipForCoord(x, y, z)
	SetBlipRoute(Emergency, true)
	SetBlipSprite(Emergency, 50)

AddEventHandler('set_location', function()
	local pos=GetEntityCoords(GetPlayerPed(-1), true)
	TriggerServerEvent('911_location', pos.x,pos.y,pos.z)

AddEventHandler('911_location', function(x,y,z)

Add this to server.lua

AddEventHandler('911_location', function(x,y,z)

Now everyone on server will see waypoint.

There should be alot more code to send waypoint only to emergency services, to remove waypoints when players are rescued, etc, but you didn’t tell what you want.

still has the spelling error i said

Emergency = AddBlipForCord(x, y, z) should be Emergency = AddBlipForCoord(x, y, z)

Thank you so much for the help. I was thinking of using permissions to send it only to emergency personnel, if you have any ideas on where I could start with that let me know. Thank you so much!

What permissions emergency personnel have? Can client check if he is emergency personnel on his side?

I actually figured out permissions already. I integrated this with another plugin called COPs. I decided the resources are already there to determine who is a cop and if they are on duty. It was a simple as adding an if statement before the “SetBlipRoute” to check if the cop was on duty.

Thank you so much for your help! I really do appreciate it.

Is there by any chance you can upload this so we can download it or something?
Or send me a message via Discord: Emil H#2689 or Mail: Holmstedt.emil@gmail.com

A cool new feature to add could be that the cops can choose to respond or not via a shortcut or a command.