Hi, i have make a phone with a button "call the police’ after this the player in the job police receive a message with name of the player and a marker for join the caller but doesnt work
if action == "police" then
if LOADOUTS == "police" then
Citizen.CreateThread(function()
while true do
Wait(3)
DisplayCash(false);
SetNotificationTextEntry("STRING");
AddTextComponentString("^2"..GetPlayerName(source).. ", à besoin de Policier, un marqueur a été ajouter" ); -- Message sent to Police
BLIP.destination = AddBlipForCoord "..GetPlayerName(source).." -- generate a blip to the caller
SetBlipSprite(BLIP.destination, 1)
SetBlipColour(BLIP.destination, 2)
SetBlipRoute(BLIP.destination, true)
SetNotificationMessage("CHAR_CHAT_CALL", "CHAR_CHAT_CALL", true, 1, "Demande de Policier"); -- Title of the request sent to Police
DrawNotification(false, true);
Wait(10000000)
drawNotification("~g~A patrol was sent, do not move!")
I have updated my code… but it doesnt work anyone (its the complete file )
local police
RegisterNUICallback("telephone", function(data, cb)
local action = data.action
local newstate = data.newstate
if action == "police" and LOADOUTS == "police" then
Wait(3)
DisplayCash(false);
SetNotificationTextEntry("STRING");
AddTextComponentString("^2"..GetPlayerName(source).. ", à besoin de Policier, un marqueur a été ajouter" ); -- Message sent to Police
BLIP.destination = AddBlipForChar"..GetPlayerName(source).." -- generate a blip to the caller
SetBlipSprite(BLIP.destination, 1)
SetBlipColour(BLIP.destination, 2)
SetBlipRoute(BLIP.destination, true)
SetNotificationMessage("CHAR_CHAT_CALL", "CHAR_CHAT_CALL", true, 1, "Demande de Policier"); -- Title of the request sent to Police
DrawNotification(false, true);
Wait(10000000)
drawNotification("~g~A patrol was sent, do not move!")
end
cb("ok")
end)
if action == "police" then
Citizen.CreateThread(function()
while true do and LOADOUTS == "police" then
Wait(3)
DisplayCash(false);
SetNotificationTextEntry("STRING");
AddTextComponentString("^2"..GetPlayerName(source).. ", à besoin de Policier, un marqueur a été ajouter" ); -- Message sent to Police
SetNotificationMessage("CHAR_CHAT_CALL", "CHAR_CHAT_CALL", true, 1, "Demande de Policier"); -- Title of the request sent to Police
DrawNotification(false, true);
Wait(10000000)
BLIP.destination = AddBlipForChar " ..GetPlayerName(source).. " -- generate a blip to the caller
SetBlipSprite(BLIP.destination, 1)
SetBlipColour(BLIP.destination, 2)
SetBlipRoute(BLIP.destination, true)
end
drawNotification("~g~Une patrouille a été envoyé, ne bougez pas !") -- Notification sent to the caller
end)
That’s not valid syntax in LUA. If you want a while loop to continue when two things are true, you need to do while {experssion 1} and {experssion 2} do and not what you put, while {experssion 1} do and {experssion 2} then.
As I can’t see all of your code, I have to ask. Where are you setting “LOADOUTS” and are you sure it’s being set to “police”?
I… I don’t think that’s how that works… As far as I know, there’s only 4 Blip functions:
AddBlipForRadius(x, y, z, radius)
AddBlipForPickup(p0)
AddBlipForEntity(entity)
AddBlipForCoord(x, y, z)
Also, again as I can’t see all of the code. Are you initializing “BLIP” to a table? If not, I’m fairly certain this assignment won’t work.