• [DarkRP] Weapons in Jail
    6 replies, posted
Hello!, I'm trying to add a weapon to a jailed person, yet it does not seem to give the jailed person the weapon. Here's the code: local function WeaponJail(crim, num, cop) crim:Give("WEAPONAME") end hook.Add("playerArrested", "Plyarrest", WeaponJail) Any help?, thanks!
DarkRP/sv_init.lua at master · FPtje/DarkRP · GitHub This is due to the function stripping your weapons every time it is called.
There might be some evil hooks restricting you from getting a weapon by the way.
oh my god you're a lifesaver! I looked in the code, and changed it to this: function DarkRP.hooks:playerArrested(ply, time, arrester)     if ply:isWanted() then ply:unWanted(arrester) end     ply:setDarkRPVar("HasGunlicense", nil)     if ply:GetActiveWeapon():GetClass() != "WEAPONNAME" then     ply:StripWeapons() ply:Give("WEAPONNAME") end     ply:StripAmmo() Works perfectly fine and of course I overwrote the darkrp gamemode module and have not touched the files.
Alright, so it does work but one issue is everytime I die I lose all my weapons again, even though I made it so when it strips me it gives me the weapon like you can see above ^ any help'? https://www.youtube.com/watch?v=lCwMGYW4KH8
You could use PlayerSpawn and use an if command to check if the player is arrested, and if they are, give said weapon. The reason your function doesn't work is because it's only called once, I think. If you look at the github code again it may make more sense to you. However, I digress. The reason the player's loadout isn't given is because once your weapons are stripped in jail, it doesn't call gamemode.Call("PlayerLoadout", ply).
I tried the following: local function FistsJail(ply) if ply:isArrested() then ply:Give("weapon_fists") return end end hook.Add("PlayerSpawn", "Plyarrestfist", FistsJail) still doesn't work, and does not give any errors either. :/
Sorry, you need to Log In to post a reply to this thread.