NPC with a menu? Save items? More..

Ok well is there a way to make an npc so that if u click the button “E” when looking at it. A menu will come up to buy certain things. LIke a car dealer, or a clothes seller.

Also I would like to know if there is a way to have the server save a person’s car, or Guns he has. So that hwne he logs back on he can spawn it back, or go to a npc who can spawn it back for him.

For Dark RP Game Mode.

Also is there a mod that has an inventory that u can hold things in? If not, is it possible to make? If so think u can say somethin about it? xD

Also is there a way we can make new type of rank in dark rp? A respected rank, so that when making a new class u can have it so it shows to respected. We have ULX Mod on the server if that helps.

Im sorry for being so noob lol :stuck_out_tongue:

Thanks,

Fero

Yes to all of it. As for actual assistance, can’t really give you any. I just recommend looking through some DarkRP code (not highly recommended -.-) or ask some people who have made it. For example, I’m sure you could ask one of the guy’s in the chaos gamemode. But I’m pretty sure you have to do it on the map and not only in the gamemode (for npc’s).

You can make it if the player presses E it traces a line and then opens a derma menu if its a npc

Somthing like this : (untested)

[lua]
function KeyPressed (ply, key)

if key == IN_USE then
	
	trace = util.GetPlayerTrace( ply )
	traceRes=util.TraceLine(trace)
	if traceRes.Entity:IsNPC() then
		// Open a derma menu where you can buy stuff and add a if statement so it checks what vendor the npc is
	end
	
end

end

hook.Add( “KeyPress”, “KeyPressedHook”, KeyPressed )
[/lua]

Sorry I can’t help you more I have plenty other things to finish :frowning:

edit : I have to do this for my own gamemode later so maybe when its finished I can send you the code

The codes you are asking for is highly possible, but it would indeed require many months of LUA scripting to understand, and even more to make. I believe the people that are able to create these wonderful codes wouldn’t share it so easy. However, i’ve seen several posts been posted about NPC shops etc. longer back in the forum. I suggest taking a look.