Ban SWEP, car dealer and somes questions about Dark RP

Hello,

How to make a SWEP that can freez and ban target and how to ban frozen players who disconnects ? (done, code below)
How to make a simple car dealer wich works with the cars on simfphys base ?

And how can I remove what is shown on the folowing picture: (I know there is an official forum for Dark RP)

Sorry if my English is bad, this isn’t my native language

This is no a request forum, and doesn’t seems like you’re really enthusiast about learning how to do that stuff

You didn’t say what did you try, what do you have problems with, nothing, just do me this thing…About your second request, i recommend you gmodstore.com

I do not ask for request, I ask how to do it

Don’t edit your post, you literally asked us a weapon that can freeze players, ban them if they disconnect and gives you godmode

About the cardealer, just create a derma panel, create a table with vehicles you want to sell, and do some netmessages, it’s not something that easy if you don’t have your feets in the ground regarding creating stores and interactions between client and server

There’s no functions to create a simple car dealer, everything comes with understanding how communication between server and client works, also how do you structure your system for it
You can come here and take a look here this addon to check how does it works, but remember, there’s no a function to create dealers, that’s something up to you http://forum.facepunch.com/showthread.php?t=1481400

This is like saying, “It’s not bribing. It’s paying someone in exchange for influence…”

No one’s going to spoonfeed code for you to use. Do as gonzalolog said and use gmodstore.

Assuming you know at least something about Lua, these pages should be useful

Player:GetEyeTrace

Chair Throwing Gun (Obviously don’t make a chair-throwing gun, but it should be a nice start to learning SWEP’s by reading it and using the parts you need)
As for doing stuff with the player they are looking at, you can surely figure it out, and, assuming you’re using ULX, you can read through the ULX documentation here.

I do not have money

Thanks I’ll take a look

On the contrary of what monkeymacman said, if you don’t know lua and would like to make it yourself, start here.

I already do know lua basics

It doesn’t seem so, as you’re asking for quite simple additions.

Thanks for the help, here is the code for who wants it (you will need ulx and ulib for this code to works)

I used:

http://ulyssesmod.net/favicon.ico

ban

http://ulyssesmod.net/favicon.ico

kick

Player:Freeze

Player:IsFrozen

Code of the SWEP in lua/weapons :


SWEP.PrintName = "Admin Gun"
SWEP.Author = "Quozul"
SWEP.Contact = "quozul@outlook.com"
SWEP.Instructions = "Left mouse to freez the player
Right mouse to quick ban the player"

 -- Makes the SWEP only spawnable by admin
SWEP.Spawnable = true
SWEP.AdminOnly = true

 -- Makes all the ammo infinite
SWEP.Primary.ClipSize = -1
SWEP.Primary.DefaultClip = -1
SWEP.Primary.Automatic = false
SWEP.Primary.Ammo = "none"

SWEP.Secondary.ClipSize = -1
SWEP.Secondary.DefaultClip = -1
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"

SWEP.Weight = 0
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false

SWEP.Slot = 5 -- Position of the SWEP
SWEP.SlotPos = 1 -- Position of the SWEP
SWEP.DrawAmmo = false
SWEP.DrawCrosshair = true

SWEP.ViewModel = "models/weapons/v_pistol.mdl" -- Change model
SWEP.WorldModel = "models/weapons/w_pistol.mdl" -- Change world model

local ShootSound = Sound( "Metal.SawbladeStick" ) -- Set the sound


-- Left mouse: Freez
function SWEP:PrimaryAttack()

	-- Wait 0.5 seconds.
	self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 ) -- Prevent from freez and unfreez spam

    if self:GetOwner():GetEyeTrace().Entity:IsPlayer() then
        if self:GetOwner():GetEyeTrace().Entity:IsFrozen() == true then
            self:GetOwner():GetEyeTrace().Entity:Freeze( false )
            self:GetOwner():PrintMessage( HUD_PRINTCENTER, "You unfrozen your target." ) -- Change the message when you unfreezed the targeted player here
        elseif self:GetOwner():GetEyeTrace().Entity:IsFrozen() == false then
            self:GetOwner():GetEyeTrace().Entity:Freeze( true )
            self:GetOwner():PrintMessage( HUD_PRINTCENTER, "You frozen your target." ) -- Change the message when you freezed the targeted player here
        end
    self:EmitSound( ShootSound ) -- Emit sound when a player gets freezed
    else
        self:GetOwner():PrintMessage( HUD_PRINTCENTER, "Aim at a player." ) -- Change the message when the user does not aim at a playere here
    end

end


-- Right mouse: Ban menu
function SWEP:SecondaryAttack()

    if self:GetOwner():GetEyeTrace().Entity:IsPlayer() then
        if AdminSWEPKick == 1 then
            ULib.kick( self:GetOwner():GetEyeTrace().Entity, AdminSWEPBanMessage, self:GetOwner() ) -- Kick the player using ULX
            PrintMessage( HUD_PRINTCENTER, "The player " ..self:GetOwner():GetEyeTrace().Entity:GetName().. " got kicked by an admin." ) -- Message in game for other players
        elseif AdminSWEPKick == 0 then
            ULib.ban( self:GetOwner():GetEyeTrace().Entity, AdminSWEPBanTime, AdminSWEPBanMessage, admin ) -- Ban the player using ULX
            PrintMessage( HUD_PRINTCENTER, "The player " ..self:GetOwner():GetEyeTrace().Entity:GetName().. " got banned by an admin." ) -- Message in game for other players
        end
    else
        self:GetOwner():PrintMessage( HUD_PRINTCENTER, "Aim at a player." ) -- Change the message when the user does not aim at a playere here
    end

end

Ban players who disconnects while being freezed in lua/autorun/server :


local function banFrozenPlayers( ply )
    if ply:IsFrozen() == true then
        ULib.ban( ply, 15, "You disconnected while being frozen.", admin ) -- Ban the player using ULX for 15 minutes

        PrintMessage( HUD_PRINTCENTER, "The player " ..ply.. " got banned for quitting the server while being frozen." ) -- Change the message in game here
    end
end
hook.Add( "PlayerDisconnected", "PunishFrozenPlayers", banFrozenPlayers ) -- Execute the function banFrozenPlayers when a player disconnects

In the GetEyeTrace you seem to be using it from Entity(1), which seems to just be the first player to join the server (and sometimes nil). Instead, you should try using self.Owner or self:GetOwner() in replace of those spots. Also, when you put the name in chat, you are just printing the player entity, which is a table, instead of getting the name of the player to put in its spot.

I edited my previous post and I was wondering how to change variables value using

DNumSlider and

DCheckBoxLabel

Try replacing the variables with convars, as both those elements appear to by default support being assigned to a convar.

I don’t understand, can you give me exemples ?

CreateConVar

Panel:SetConVar

The examples for DNumSlider and DCheckBoxLabel have them being tied to convars, so, bind them to convars, and instead of having variables determine the length of ban/ if it bans, just check the convar values.

Also, don’t forget to actually make the convars. Use the wiki in depth if you still don’t understand