It’s a little script I made to replace basic marker by NPC (for more realism and immersive).
Very easy to use and config.
You will need this resource for my other scripts.

Dependency
-es_extended

-esx_policejob

EDIT: Script updated and re-uploaded.

2 Likes

Moved to Resource Development & Modding : Releases per OP request.

thx ^^

The NPC shows up, and it says the command but when i hit E it the text to hit the button dissapears but nothing happens? any ideas```
{ --Default Config

    name = "akina",									--name
    pos = vector3(-2667.46, 1301.1, 146.9),						--ped pos
    h = 353.0,											--ped heading
    color = 6, 											--marker color (uncom in client files if you want it)
    scale = 0.8, 										--marker size
    model = "cs_bankman", 								--ped model
    animation = "world_human_leaning", 					--ped animation
    resource = "esx_advancedgarage",							--name of the resource
    onEnter = "OpenMenuGarage",							--name of the function on enter/press
    onEnterText = "Press ~INPUT_CONTEXT~ to access garage", 	--text on enter
    onExit = 'closeMenu'								--name of the function on exit
	
},

Got the same problem as @Mifsopo
After pressing input button, or exiting the marker, console returns with “no such export…” script error.

cfg file:

Config.Peds = {
    { --Default Config
    
        name = "Dealership",                                  --name
        pos = vector3(-897.97, -235.67, 39.88),                       --ped pos
        h = 340.0,                                            --ped heading
        color = 6,                                          --marker color (uncom in client files if you want it)
        scale = 0.8,                                        --marker size
        model = "cs_bankman",                               --ped model
        animation = "world_human_leaning",                  --ped animation
        resource = "esx_vehicleshop",                          --name of the resource
        onEnter = "esx_vehicleshop:hasEnteredMarker",                           --name of the function on enter/press
        onEnterText = "Press ~INPUT_CONTEXT~ to buy a car",    --text on enter
        onExit = 'esx_vehicleshop:hasExitedMarker'                                --name of the function on exit
        
    },

“onEnter” and “onExit” should be the same function executed by the default resource marker right? (esx_vehicleshop in this example)

@Rapthor No need to put the name of the resource again.

...
        resource = "esx_vehicleshop",
        onEnter = "hasEnteredMarker",
        onEnterText = "Press ~INPUT_CONTEXT~ to buy a car",
        onExit = 'hasExitedMarker'
...

@Mifsopo

Your config file seems to be good, can I see how do you export in esx_advancedgarage ?

what do you mean how i do export?

i got the function from this command which i presume is right, i have tried other functions aswell as tried switching to the clothestore and nothing had worked all the same issue

-- Open Main Menu
function OpenMenuGarage(PointType)
	ESX.UI.Menu.CloseAll()

@Mifsopo Try something like this

exports(
    'OpenMenuGarage',
    function()
        You_code_here
    end
)

so your telling me to edit the esx_advancedgarage scriptt? what would i put there?
i know basics but im not fluent in lua

and where is the export area?

The way you call the function in esx_advancedgarage is not good, soo you have 2 option, create or edit.

1 - Create

esx_marker_npc/config.lua

    name = "akina",
    pos = vector3(-2667.46, 1301.1, 146.9),
    h = 353.0,
    color = 6,
    scale = 0.8,
    model = "cs_bankman",
    animation = "world_human_leaning",
    resource = "esx_advancedgarage",
    onEnter = "YourNewFunctionName",
    onEnterText = "Press ~INPUT_CONTEXT~ to access garage",
    onExit = 'closeMenu'

esx_advancedgarage/client.lua (add this line)

exports(
    'YourNewFunctionName',
    function()
        OpenMenuGarage(PointType)
    end
)

OR

2 - Edit

esx_marker_npc/config.lua

    name = "akina",
    pos = vector3(-2667.46, 1301.1, 146.9),
    h = 353.0,
    color = 6,
    scale = 0.8,
    model = "cs_bankman",
    animation = "world_human_leaning",
    resource = "esx_advancedgarage",
    onEnter = "OpenMenuGarage",
    onEnterText = "Press ~INPUT_CONTEXT~ to access garage",
    onExit = 'closeMenu'

in esx_advancedgarage/client.lua

REPLACE

function OpenMenuGarage(PointType)
	Your_code_you_need_to_copy_and_paste
end

WITH

exports(
    'OpenMenuGarage',
    function(PointType)
        Your_code_you_need_to_copy_and_paste
    end
)

its now working only issue is now its not showing the owned vehicles hmm

finally fixed it, took me a little, it wasnt the function i asssumed but did require your fix aswell, thank you very much, i asume i just add a new function to every client i use this with?

i stand corrected, it works as it shows the vehicles but it doesnt finish the esx_advancedgarage script by spawning in the car

the way esx_advancedgarage works is it says it iopens with ListOwnedCarsMenu

but then to spawn the car it used spawn_owned_car but do i have to tie both of these in with the marker

is it just going to be too complicated for it wo work with garage

@Mifsopo It’s a public resource? I need to see how it’s works to tell you how you can proceed to make it work with my script.

Edit : OpenMenuGarage seems to have a parameter…

I make a possible optimisation fix (CPU usage mainly), i cant test at this time, need feedback mate, update config file if you test it (i add more feature btw)

it doesn’t work for me I put esx_weashops to buy weapons from the npc but I don’t see any npc … is something wrong?

Config = {}

Config.Peds = {

[[{ --Default Config

    name = "Venta de Armas",									--name
    pos = vector3(1465.32, 6349.36, 22.86),						--ped pos
    h = 353.0,											--ped heading
    color = 6, 											--marker color (uncom in client files if you want it)
    scale = 0.8, 										--marker size
    model = "cs_bankman", 								--ped model
    animation = "world_human_leaning", 					--ped animation
    resource = "esx_weashops",							--name of the resource
    onEnter = "hasEnteredMarker",							--name of the function on enter/press
    onEnterText = "Press ~INPUT_CONTEXT~ to blabla", 	--text on enter
    onExit = 'hasExitedMarker'								--name of the function on exit
	
},]]

Remove the - - [[ and the ]], read previous post, someone make the same mistake earlier.

Now if I get the order … but I don’t get any message like buying or etc. … no menu … I am using this configuration of esx_weashops

	name = 'Mac à Dames',
	id = 279,
	pos = vector3(1465.32, 6349.36, 22.86),
	h = 8.4,
	color = 1,
	scale = 0.8,
	model = 's_f_y_hooker_01',
	animation = 'WORLD_HUMAN_SMOKING',
	resource = 'esx_weashops',
	onEnter = 'hasEnteredMarker',
	onEnterText = "Appuyez sur ~INPUT_CONTEXT~ pour ~g~parier~w~ ou pour ~y~combattre~w~.",
	isEnabled = 'hasExitedMarker'
},

Sorry bro, i make some edit on a cheaty laptop because im in vacation right now, i fix some mistakes just update the scripts and tell me if its good for you.

I come back in 3 days, be sure that i will make pretty good update on all my scripts, and share more of them.

I try to use yhis script to open Shop

I put this code in esx-marker-npc:


Config = {}
Config.OpenForCops = false -- Enable/Disable interaction for cops
Config.drawMarker = false -- Enable/Disable drawing marker on peds
Config.Peds = {
	{
		name = "Negão tem tudo",            				--name, change it
		pos = vector3(158.36567687988, -2204.2170410156, 4.6880249977112),			--ped pos
		h = 100.0,		      				--ped heading
		color = 6, 		      				--marker color
		scale = 0.8, 		      				--marker size
		model = "a_m_m_og_boss_01", 	      				--ped model
		animation = "world_human_hang_out_street", 			--ped animation
		resource = "esx_shops",				--resource name you want to export
		onEnter = "EnteredMarker",			--function name in your script when player is close the ped/press action key
		onEnterText = "Pressione ~INPUT_CONTEXT~ para falar com o macho", 	--text when player is close the ped, not required use only if you want a action key to activate the ped
		onExit = 'closeShopMenu'
	}
}

and in esx_shops i added:

exports(
    'EnteredMarker',
    function()
        OpenShopMenu(zone)
    end
)

in F8 show this error:

SCIPT ERROR: @esx_shops/client/main.lua:37: attempt do index a nil value (field ‘?’)

can help?