A few questions on making rp gamemode

I have a few questions for a future maybe developpement of a new rp gamemode.

How can I parse input from every key of Keyboard ?
How can I render texts in front of each doors in the map ?
How can I call a function at each game server ticks (update network parse, food and water bars) ?
I want to disable the light key of all clients, how to do it ?
How can I slow down player movement ?
How can I display a model in a DermaPanel ?
Is there any way to make an interactable fake ia entity ? Like RealLife job npc ?

I need protection for net streams ; I can use bits manipulation. Problem when I try &, <<, >>, |, ^ ; the game throws errors. Also, maybe the lua lang simply not have any bit support…
I already made a byte encoder/decoder in c++, however it seams that byte rotation is not supported in lua. If that’s the case, is there any way to call my own c++ dll in lua ?

Thanks by advance,
Yuri

  1. input.IsKeyDown(key)

  2. cam.3d2d

  3. hook to think

  4. Player:SetRunSpeed( runSpeed ) & Player:SetWalkSpeed( walkSpeed )

  5. DModelPanel

  6. there’s like a million things like that on workshop, google is your friend

  7. i have no idea what all that is about but you can use Require() to call dll modules via lua

Thank you for your quick answer !

Here are what is clear for me now :

  • Ok, I suppose key is the key code used in OpenGL. (EDIT : viewed that on wiki, done)
  • Ok, if I understand I will need to set camera angle to display text. (EDIT: viewed how does cam work). However, you did not tell me how do I do to parse every map entities to know who is a door and who is not (I’m using evocity v33x) I already tried with ent_ commands but it says I need sv_cheats 1…
  • Ok for think hook, I understand what you mean.
  • Thanks for those functions, however are variables float or double. (EDIT : seen that on wiki, done)
  • Ok, I see…
  • Sorry, but only things I found are outdated, or payed (coder hire)

You’ve not answered about how to disable the light key…

See http://wiki.garrysmod.com/page/Player/AllowFlashlight for the flashlight.
You can use the bit library to do bit manipulation. See http://wiki.garrysmod.com/page/Category:bit

Don’t use console commands if you can use Lua. Use the ent library to get the doors, optimally with FindByClass. Then loop through the returned table and for each entity check if the classname is equal to the class name or class names of the door type(s) you want to modify. Most common is prop_door_rotating I think



for key,value in pairs(ents.GetByClass('prop_door_rotating')) do
    --start cam
end


So much thanks ! But i will use a moified version of DarkRP for my server. I already made HUD, F4Menu, Removed F1Menu, Added Time System by Atmos.

However, i got a problem with your functions… Nothing works player speed does not change and allow flash light not working, here is my code :



hook.Add( "PlayerSpawn", "YuriRPAddon-PlayerSpawnEvent", function (ply)
	ply:AllowFlashlight( false )
	local var = ply:GetRunSpeed()
	local var1 = ply:GetWalkSpeed()
	ply:SetRunSpeed( var / 10 )
	ply:SetWalkSpeed( var1 / 10 )
end)


EDIT : Player:SetWalkSpeed and Player:SetRunSpeed are both working now but no way to make allow flash light working…
EDIT 2 : Edited DarkRP Base GameMode and now working !!!