Mechanic Advertise

Hey guys today it’s my first release. Im not good at coding I just made a version of TaxiAdvert. Im learing LUA atm. Anyone can help me to fix so only those with mecano job can use the command and not everybody?

Hope you like it

Install:
Put the folder into resources
add “start MecanoAdvert” in server.cfg
Restart server

command: /mekaniker <- standard (you can change in server.lua line 14)

download: http://www.mediafire.com/folder/0a7boyylo3r91/MecanoAdvert

Can you upload this to github?

Also looking how to make it mechanics only.

Made the following changes:

CLIENT:

local input = true -- Useless stuff

RegisterNetEvent("triggerMecanich")
AddEventHandler("triggerMecanich",function()
	DisplayOnscreenKeyboard(false, "FMMC_KEY_TIP8", "", "", "", "", "", 60)
	
	Citizen.CreateThread(function()
		while input do
			if input == true then
				--HideHudAndRadarThisFrame() -- NO FUNCTION IS CALLED CUZ IT DOESN'T EXIST
				
				if UpdateOnscreenKeyboard() == 1 then
					local inputText = GetOnscreenKeyboardResult()
					
					if string.len(inputText) > 0 then
						TriggerServerEvent('syncMechanic', inputText)
						--input = false
					else
						DisplayOnscreenKeyboard(false, "FMMC_KEY_TIP8", "", "", "", "", "", 60)
					end
				--elseif UpdateOnscreenKeyboard() == 2 then
					--input = false
				end
			end
			
			Citizen.Wait(0)
		end
	end)
end)

RegisterNetEvent('displayMecanich')
AddEventHandler('displayMecanich',function(inputText)
	SetNotificationTextEntry("STRING");
	AddTextComponentString(inputText);
	SetNotificationMessage("CHAR_LS_CUSTOMS", "CHAR_LS_CUSTOMS", true, 1, "~y~Mechanic Service:~s~", "");
	DrawNotification(false, true);
end)

SERVER:

RegisterServerEvent("syncMechanic")
AddEventHandler('syncMechanic', function(inputText)
	TriggerClientEvent('displayMecanich', -1, inputText)
end)


AddEventHandler('chatMessage', function(from, name, message)
	if message == "/mechanic" then
		CancelEvent()
		TriggerClientEvent("triggerMecanich", from)
	end
end)

Please explain to me why you got functions that don’t even exist, such as:

  • HideHudAndRadarThisFrame()

And also why did you even do:

if input == true then

When you already triggered:

while input do

Some stuff in this code doesn’t make sense to me.

Use those changes however you’d like to, best regards.

upload it to github please