• Print

Author Topic: Disabling /drop to a certain job  (Read 5232 times)

0 Members and 1 Guest are viewing this topic.

Offline Rain

  • Newbie
  • *
  • Posts: 16
  • Karma: 0
Disabling /drop to a certain job
« on: July 06, 2017, 08:29:08 am »
DarkRP Help,

I've ran into an issue, I'm currently in dev of my server and came across an issue, I have armory for government teams and the weapons are quite alot cheaper and the issue i have come across is that i cannot find a way to disable the /drop for specific teams! i have tried searching around for the last 2 days and have had no luck. I'm wondering if any of you god(s)(esses) can assist me in the pickle ive got myself in.

My knowledge of lua is not that great and what im good at is editing lua not creating it! so please bare in mind thank you in advanced to any helpers!


So i have managed to try some things but no luck!

i have tried these 2 hooks but nothing is working, placing them in lua/autorun/server

// 1
hook.Add( "canDropWeapon", "DisableCPDrops", function( _p, wep )
if _p:isCP() then return false
end )
// 2
hook.Add( "canDropWeapon", "DisableCPDrop", function( _p, wep ) return false !_p:isCP()
end )

any help would be amazing thanks!
« Last Edit: July 06, 2017, 08:38:51 am by Rain »

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 803
  • Karma: 58
Re: Disabling /drop to a certain job
« Reply #1 on: July 06, 2017, 04:18:17 pm »
If you look a bit closer at your first chunk of code:

Code: Lua
  1. hook.Add( "canDropWeapon", "DisableCPDrops", function( _p, wep )
  2. if _p:isCP() then return false
  3. end )

You can notice that your 'if' statement doesn't have an end. If you check your server's startup log it probably throws an error saying there is no end to your if.

Code: Lua
  1. hook.Add( "canDropWeapon", "DisableCPDrops", function( _p, wep )
  2.     if _p:isCP() then return false end
  3. end )

should work :)
I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.

Offline Rain

  • Newbie
  • *
  • Posts: 16
  • Karma: 0
Re: Disabling /drop to a certain job
« Reply #2 on: July 07, 2017, 09:16:09 am »
Oh thank you so much it worked!

  • Print