Okay, so I recently found a script, that when you typed /destroy it destroyed the weapon you were holding. That script is:
[CODE]hook.Add( "PlayerSay", "WeaponRemove", function( ply, text )
if ( string.sub( text, 1, 8 ) == "/destroy" ) then
ply:StripWeapon( ply:GetActiveWeapon():GetClass() )
end
end)[/CODE]
Now this works fine, and I like it a lot but I have a handcuff mod [URL="https://scriptfodder.com/scripts/view/910/cuffs-handcuffs-and-hand-ties"]https://scriptfodder.com/scripts/view/910/cuffs-handcuffs-and-hand-ties[/URL]
and when your handcuffed, you can destroy it. any help?
Check if the active weapon is the handcuff, if not then run the rest.
Both the handcuff and being handcuffed is active and can be both deleted
Not sure if it's considered leaking, it's such a minor thing, but if so then I can't really help you. Can you post the name of the weapon and/or entities. It should be weapon_handcuff or something. It would be in a /weapons/ or /entities/ folder inside of the addon. Do not post the code, only the name of the file.
weapon_cuff_police and weapon_cuff_elastic and weapon_leash_elastic all three I use, thanks so much!
Try this, I'm not home so I can't really test it, but this might work. I don't really like spoonfeeding, but I'm not good at explaining things.
[code]local weaponremove_blacklist = {
["weapon_cuff_police"] = true,
["weapon_cuff_elastic"] = true,
["weapon_leash_elastic"] = true
}
hook.Add("PlayerSay", "WeaponRemove", function(ply, text)
if string.sub(text, 1, 8) == "/destroy" and not weaponremove_blacklist[ply:GetActiveWeapon():GetClass()] then
ply:StripWeapon(ply:GetActiveWeapon():GetClass())
end
end)[/code]
Edit: Changed weaponremove_whitelist to weaponremove_blacklist to avoid confusion, should have made it that in the first place.
Also, using sub to find command names is worse than just checking equality since /destroywhatever will work
[QUOTE=Matsumoto;50812530]Try this, I'm not home so I can't really test it, but this might work. I don't really like spoonfeeding, but I'm not good at explaining things.
[code]local weaponremove_whitelist = {
["weapon_cuff_police"] = true,
["weapon_cuff_elastic"] = true,
["weapon_leash_elastic"] = true
}
hook.Add("PlayerSay", "WeaponRemove", function(ply, text)
if string.sub(text, 1, 8) == "/destroy" and not weaponremove_whitelist[ply:GetActiveWeapon():GetClass()] then
ply:StripWeapon(ply:GetActiveWeapon():GetClass())
end
end)[/code][/QUOTE]
Nearly, but you'll want to reverse your second check, this will allow every weapon except those in the whitelist to be removed with /destroy.
[QUOTE=Phoenixf129;50815237]Nearly, but you'll want to reverse your second check, this will allow every weapon except those in the whitelist to be removed with /destroy.[/QUOTE]
Isn't that what he wants? He doesn't want the person to be able to remove the handcuffs.
[QUOTE=Matsumoto;50815416]Isn't that what he wants? He doesn't want the person to be able to remove the handcuffs, not sure how the addon sets it.[/QUOTE]
Yep that works thanks!
[QUOTE=Matsumoto;50815416]Isn't that what he wants? He doesn't want the person to be able to remove the handcuffs.[/QUOTE]
Shit no, it didn't work don't knwo why :/
Can you give some context of how it is not working? Going to guess if the player is arrested he can still do it? If so, then I can not really help you, I have not purchased the addon. You would have to go into the code and see how it is doing the arresting. I do not know the content creator personally but you can try to contact them, they might help you out, unlikely though.
Sorry, you need to Log In to post a reply to this thread.