• Need help to create something
    5 replies, posted
On my server there is a bug nobody can drop a weapon So I found a soluce, I downloaded an addon on the workshop that make that you need to enter dropweapon in the console to drop the weapon, I want to create an addon with a RunConsoleCommand that make that when the player write /drop in the chat it execute the dropweapon of the console Can you please help me
The weapon drop bug was fixed a few updates ago. Update your DarkRP.
Very close, pay attention to if the hook runs on the Server or Client. (The little box next to the function on the wiki is blue for server, and yellow for client). Since the PlayerSay hook runs on the server, you need to network the command to the client that said it, and have the client run the console command like this: if SERVER then -- Only run this part on the server local PANEL_COMMAND = "/drop" util.AddNetworkString("dropweapon") hook.Add("PlayerSay", "dropweaponpls", function(ply, text, public) if string.lower( text ) == PANEL_COMMAND then net.Start("dropweapon") net.Send(ply) return "" end end) elseif CLIENT then --Only run this part on the client net.Receive("dropweapon",function() RunConsoleCommand("dropweapon") end) end Make sure your script in running shared.
You can just use Player/ConCommand and skip the Lua networking.
I have the 2.7.0V this is the DarkRP that my hoster give
You should use versions directly from GitHub - they are giving you an outdated version.
Sorry, you need to Log In to post a reply to this thread.