Who could do this script?
Forum
CS2D Scripts I wanna disable a rcon command!I wanna disable a rcon command!
15 replies 1
Who could do this script?
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).
Could you do that?
1
2
3
4
2
3
4
addhook("die","diefunc") function diefunc(victim, killer, weapon) 	msg("victim: "..victim..", killer: "..killer..", weapon: "..weapon) end
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
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.
Who can do this for me?
1
2
3
4
5
6
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
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
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
Oh right, didn't think about that. Thanks.
I still can use the /kill cmd
edited 1×, last 29.08.14 03:41:17 am
Cure Pikachu has written
1
2
3
4
5
6
2
3
4
5
6
addhook("parse","disable") function disable(cmd) 	if cmd == "kill" then 		return 2 	end end
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).
I want it to kick them directly.
1