Hey guys!
I’m currently working in my selfhelp thread in the forums and seem to be stuck! Precurser - I’m NOT a guru with regards to lua programming.
I’m trying to make an on off switch using commands. For example.
Native starts in off state. Then you do: /command on and the native activates. To be more specific I’m trying to create a marker at the entering of a command!
So far I have:
function ShowNotification( text )
SetNotificationTextEntry("STRING")
AddTextComponentSubstringPlayerName(text)
DrawNotification(false, false)
end
RegisterCommand("borders", function(source, args, RawCommand)
local flag = 0
if args[1] == 'on' then flag = 'true' break
else if args[1] == 'off' then flag = 'false' break
else ShowNotification("~g~~b~Wrong usage! Try this: /borders [on/off]") break
end
end
end)
Citizen.CreateThread(function()
while flag == 1 do
Wait(0)
DrawMarker(43, -1064.04, 03156.26, 15.05, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1, 0, 0, 0, false, false, 2, false)
end
end)
But the command isn’t returning anything specific. what are some best practices that I’m missing. Are there any syntax errors that you lua greybeards can spot?
Please let me know! Thanks for your help!