I have recently made a new Server, and I wish to add Dark RP to it. However before I do I will need two Lua Codes.
Firstly I will need a lua script that will disable several tools that could be used to “Minge” within the server. My only barrier is that I know nothing of Lua coding at all. so would it be possible please if someone could provide me a lua code, Or explain how i might make a lua code, which I can use to disable any tool that I choose, for example dynamite, explosives and E2?
Secondly, because the theme of the server will be post apocalyptic, in which people will earn $100 every time they kill another player. How might I encorporate a Spawn Protection, in which a player will not be able to shoot or recieve damage until 10 seconds after spawning. If this is possible can someone explain how i might do it, or provide a Lua code that will do it please?
Finally, if a code is provided can you please leave comments in it which I can use to learn some Lua coding. Thank you in advance.
DarkRP has Falco’s Prop Protection built in, this comes with it’s own tool restriction that can restrict by job or by admin/superadmin. You can find it in Q > Utilities > Falco’s Prop Protection > Admin Settings > Tool Restriction.
For the spawn protection use rp_babygod 1 and rp_babygodtime 10 in your console.
Create a .lua file in DarkRP/gamemode/modules and put the following in it, I’ve commented it as you requested.
function RewardKiller( victim, inflictor, killer ) – the victim is the player who died
– the inflictor is the player who did the final bit of damage
– and the killer is the person who did the majority of the damage.
if killer:IsPlayer() then – if the killer is a player
killer:AddMoney( 100 ) – give the killer $100
Notify( killer, 1, 4, “You have recieved $100 for killing “…victim.DarkRPVars.rpname…”.” ) – Notifies the killer that they have recieved $100 for killing <the victims name>
hook.Add( “PlayerDeath”, “RewardKiller”, RewardKiller )
– hooks the function so that whenever a player dies the RewardKiller function is run