Help with creating "Unknown command".
Does anyone know what function is called when a user types in a console command that doesn't exist?
Example: If I were to type in "bloog" in the console, the console would read that "bloog" isn't a command, and would call a function that returns the message "Unknown command: bloog". Either this is not it's own function call and is part of the console's operation, or I can't find it. The reason I want to do this is to eliminate the console command "kill", which allows players to suicide. I want to give the illusion that the command doesn't exist, so I want to give a function call that gives a message saying that command doesn't exist. Thanks for any help, I'm new to AMXX, but not to coding (three years). |
Re: Help with creating "Unknown command".
http://forums.alliedmods.net/forumdisplay.php?f=27 look at the first couple...
|
Re: Help with creating "Unknown command".
Hook when a user calls suicide, by using the client_kill forward (make a public function named client_kill). Then use console_print to print out the message you want (ie: "Unknown command: kill"), and return PLUGIN_HANDLED to stop the initial kill request from going through.
|
Re: Help with creating "Unknown command".
organizedKaos script will not work because you can't catch the kill command like that. What XxAvalanchexX said is correct. The script below is the one that will work.
Code:
|
Re: Help with creating "Unknown command".
The method I posted:
Code:
EDIT:...My example doesnt work, just tested....thx team06. Used this method to catch and block the fullupdate command. I guess fullupdate gets called differently from kill :P |
Re: Help with creating "Unknown command".
That's not really what I was looking for, sorry if I wasn't specific enough. The examples you posted are exactly like the code I already wrote. The reason I wanted an engine function for it was because say a user got clever and typed in "kIlL", it will still say "Unknown command: kill", because that's what I wrote in. I didn't want to have to mess with storing and checking strings for no reason, because I thought there might just be a function call that would handle it and get it over with, instead of faking it.
I know this is unrelated and might deserve another thread, but I was also looking to use "set_user_deaths" in The Specialists, but the compiler can't find the function, even though I have already included amxmodx, amxmisc, fun, tsx, tsfun, fakemeta ,engine. I see other people asking about this on the forums, but I never really saw a solution. Usually people just said "include fun", or something, and it seemed to fix the problem. The takedamage function can't be found either... |
Re: Help with creating "Unknown command".
Quote:
Code:
Quote:
Quote:
|
Re: Help with creating "Unknown command".
+Karma, thanks for the input. Also, thanks for writing TalkZone, it was much easier to understand in helping me learn AMXX as opposed to Twilight's TalkArea[S2]...
And no, there is no takedamage function. Don't know why. By the way, here's how I did it. This method also let me use a smaller string. Code:
|
Re: Help with creating "Unknown command".
That will not work for two reasons:
1) It will block every command if rp_allowsuicide is 0 2) It will kill a player everytime they execute a command if rp_allowsuicide is anything other than 0. Use Avalanche's or teame06's code. |
Re: Help with creating "Unknown command".
What are you talking about? It works just fine.
|
| All times are GMT -4. The time now is 04:56. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.