Greetings Everyone,
I'm currently trying to modify the RDM Script for Dark RP for a friend. I'd like to know if it is possible to change the action that the script does to a automatic arrest to the jail instead of making it a kick?
Of course it is, simply find the line about kicking and replace it with one that will arrest the player.
This should help :
[url]http://wiki.garrysmod.com/?title=DarkRP:Functions[/url]
Thanks Crazy!
______________________
if CfgVars["dmautokick"] == 1 and killer:IsPlayer() and killer ~= ply then
if not killer.kills or killer.kills == 0 then
killer.kills = 1
timer.Simple(CfgVars["dmgracetime"], killer.ResetDMCounter, killer)
else
-- if this player is going over their limit, arrest their ass
if killer.kills + 1 > CfgVars["dmmaxkills"] then
function ArrestAll ( )
for k, v in pairs (player.GetAll())) do v:Arrest ()
end
end
end
Would that be correct?
I'm going to say no because what that code is very messy looking, and the punishment for going over the limit is creating a function that would arrest all players if it was called, which it isn't.
Maybe you could post what script you're using? Because how it keeps count of kills seems rather unclear.
[QUOTE=Crazy Quebec;20922228]I'm going to say no because what that code is very messy looking, and the punishment for going over the limit is creating a function that would arrest all players if it was called, which it isn't.
Maybe you could post what script you're using? Because how it keeps count of kills seems rather unclear.[/QUOTE]
I would say he used the one thats build in DarkRP? (A guess)
Oh right, I didn't read properly.
[editline]05:18PM[/editline]
In sv_gamemode_functions.lua replace
[lua] if CfgVars["dmautokick"] == 1 and killer and killer:IsPlayer() and killer ~= ply then
if not killer.kills or killer.kills == 0 then
killer.kills = 1
timer.Simple(CfgVars["dmgracetime"], killer.ResetDMCounter, killer)
else
-- if this player is going over their limit, kick their ass
if killer.kills + 1 > CfgVars["dmmaxkills"] then
game.ConsoleCommand("kickid " .. killer:UserID() .. " Auto-kicked. Excessive Deathmatching.\n")
else
-- killed another player
killer.kills = killer.kills + 1
end
end
end[/lua]
with :
[lua] if CfgVars["dmautokick"] == 1 and killer and killer:IsPlayer() and killer ~= ply then
if not killer.kills or killer.kills == 0 then
killer.kills = 1
timer.Simple(CfgVars["dmgracetime"], killer.ResetDMCounter, killer)
else
-- if this player is going over their limit, kick their ass
if killer.kills + 1 > CfgVars["dmmaxkills"] then
killer:Arrest(120) -- Use your own value here
killer:ChatPrint("You were arrested for excessive killing!")
else
-- killed another player
killer.kills = killer.kills + 1
end
end
end
[/lua]
Try this:
[lua]
if CfgVars["dmautokick"] == 1 and killer and killer:IsPlayer() and killer ~= ply then
if not killer.kills or killer.kills == 0 then
killer.kills = 1
timer.Simple(CfgVars["dmgracetime"], killer.ResetDMCounter, killer)
else
-- if this player is going over their limit, kick their ass
if killer.kills + 1 > CfgVars["dmmaxkills"] then
killer:Arrest()
else
-- killed another player
killer.kills = killer.kills + 1
end
end
end
[/lua]
Ninja'd :3 But Mine works! :P
and Crazy Quebec might just be me, but why do you do like this: Arrest(120)
I looked in the arrest stick and it only used Arrest() :3
[QUOTE=Trivkz;20922679]Try this:
[lua]
if CfgVars["dmautokick"] == 1 and killer and killer:IsPlayer() and killer ~= ply then
if not killer.kills or killer.kills == 0 then
killer.kills = 1
timer.Simple(CfgVars["dmgracetime"], killer.ResetDMCounter, killer)
else
-- if this player is going over their limit, kick their ass
if killer.kills + 1 > CfgVars["dmmaxkills"] then
killer:Arrest()
else
-- killed another player
killer.kills = killer.kills + 1
end
end
end
[/lua]
Ninja'd :3 But Mine works! :P[/QUOTE]
Well so does mine, at least it should.
Also :
:ninja: :ninja: :ninja: :ninja: :ninja:
Thanks.
The script looks like yours, I just didn't quote it so it wasn't exactly in that organization.
[QUOTE=Trivkz;20922679]and Crazy Quebec might just be me, but why do you do like this: Arrest(120)
I looked in the arrest stick and it only used Arrest() :3[/QUOTE]
You can specify your own arrest time, if you don't then it will use the default value. This is good if you hate RDMers and want them arrested for 10 minutes.
[QUOTE=Beckett;20922860]Thanks.
The script looks like yours, I just didn't quote it so it wasn't exactly in that organization.[/QUOTE]
Well you also had some extra brackets and it would've arrested every player the second one abused, if it did work. :wink:
Thanks!
I'm just starting in how to code Lua. I can code other languages - but not Lua and I like playing around with Garrysmod. Been doing alot of Video Editing / Producing lately and I have become very good at that. So time to move onto another thing!
[QUOTE=Crazy Quebec;20922883]You can specify your own arrest time, if you don't then it will use the default value. This is good if you hate RDMers and want them arrested for 10 minutes.[/QUOTE]
Ahh didn't have time to find the arrest function :P
Sorry, you need to Log In to post a reply to this thread.