Forum

> > CS2D > Scripts > I wanna disable a rcon command!
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch I wanna disable a rcon command!

15 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Re: I wanna disable a rcon command!

Infinite Rain
Reviewer Off Offline

Zitieren
It's not a RCon command.
And you cannot stop people from using /kill.

But you can do a thing to stop them. Make so that player will be insta respawned on the same position with same health/wealth/armor, if a player hasn't been killed by a legitimate reason (killed, died by environment).

alt Re: I wanna disable a rcon command!

DC
Admin Off Offline

Zitieren
Simply use the cs2d lua hook die hook (maybe cs2d lua hook kill works as well). I think the parameters killer and victim should have the same value when someone commits suicide with kill. The weapon id also probably has a special value or is just zero. Simply test it with:

1
2
3
4
addhook("die","diefunc")
function diefunc(victim, killer, weapon)
	msg("victim: "..victim..", killer: "..killer..", weapon: "..weapon)
end
and by executing /kill yourself to see what msg prints.

If it works you can use a conidition like the following one. 0 might have to be replaced with another displayed value from your test:
1
2
3
if victim == killer and weapon == 0 then
	-- dosomething like kick
end

It might be sufficient to test if killer equals victim but this depends on the server settings. It's possible to kill yourself with grenades and other explosives when friendly fire is on for example. This would trigger your scripted action as well when you skip the weapon check.

alt Re: I wanna disable a rcon command!

Infinite Rain
Reviewer Off Offline

Zitieren
1
2
3
4
5
6
addhook("die","diefunc")
function diefunc(victim, killer, weapon)
	if victim == killer then
		parse('kick '.. killer ..' "You're not allowed to use \'/kill\' command!"')
	end
end

alt Re: I wanna disable a rcon command!

mafia_man
User Off Offline

Zitieren
@user Infinite Rain:
Player is going to get kicked when his turret kills him, or he kills himself with grenade/gas grenade etc.

1
2
3
4
5
6
addhook("die","diefunc")
function diefunc(victim, killer, weapon)
     if victim == killer and weapon == 0 then
          parse('kick '.. killer ..' "You're not allowed to use \'/kill\' command!"')
     end
end

alt Re: I wanna disable a rcon command!

DC
Admin Off Offline

Zitieren
cs2d lua hook parse only works for commands entered by the server (or which are sent to the server with RCon). It's clearly not the right solution here.

Clientside command execution can NOT be prevented because the commands are not sent to the server at all. Only the resulting action is sent (if necessary - changes in local settings for instance aren't sent to the server at all). Scripts however run on the server only so it's impossible to intercept the actual command execution for clients. You can only handle the resulting action with hooks (if appropiate hooks are provided by the CS2D Lua API).

alt Re: I wanna disable a rcon command!

DC
Admin Off Offline

Zitieren
I think it's impossible to do that. You currently can't avoid deaths (for technical reasons because that would potentially lead to a lot of bugs and problems) and there is no extra hook for suicides with cs2d cmd kill. It would theoretically be possible for me to add such a hook but I don't see a way to do what you want with the current CS2D release.
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht