AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   register_clcmd(say /model.... (https://forums.alliedmods.net/showthread.php?t=5998)

Ramirez 09-19-2004 03:01

register_clcmd(say /model....
 
ALright...
I made a plugin that allows player to change their models...
The thing is, I want it to be in chat...
Example, I write: /model "modelname"
And it changes my model..
if I type: say /model "modelname" in console, it works fine..
But if I use my standard talk button it doesnt work..
The standard talk button wich is "Y" is bound to "Messagemode"
How would I make it work so I dont have to write say bla bla bla in console...?
Any help?
Thanks :D

Twilight Suzuka 09-19-2004 04:08

registering it as say /model will not work
register say, and hook it to a function, then look through the arguements to see if it contains "/model", then do your function.

Ramirez 09-19-2004 13:27

Huh, what do you mean register say?

twistedeuphoria 09-19-2004 13:27

Code:
register_clcmd("say /model","modelfunction")
is one way.

Ramirez 09-19-2004 13:37

I did that... but when I type: /model something it doesnt work..
BUt if I type: say /model something in console it works...

Twilight Suzuka 09-19-2004 15:30

Arg, you didnt get me. Watch and learn.

Code:

public plugin_init() {
        register_clcmd("say","event_say");

}

public event_say(id) {
        new text[64]
        read_args(text,63);
        remove_quotes(text);

        if(containi(text, "/model"))
                do_stuff(id)

        return PLUGIN_CONTINUE
}

It hooks say, sees if it has something inside it, checks for model, and then forwards it.

Your way of "say /model" will ONLY WORK if you ONLY say "/model"
anything else and it screws up. My way looks for it inside the say, so you can put stuff after it.

Get it? Got it? Good.

Votorx 09-20-2004 07:20

Psycho Bitch :shock:

Ramirez 09-20-2004 18:18

Hmmmm
Thanks, I wouldve never figuere that out by myself.
ill try it out right now.

Twilight Suzuka 09-20-2004 18:50

Quote:

Originally Posted by Votorx
Psycho Bitch :shock:

.....
*goes and sits in her corner and crys*

Ramirez 09-20-2004 19:33

Alright...
Here's my source.
Now, I can't make the say work...
Example: my "containi" is /model
BUt the plugin only responds to "model"

Code:
#include <amxmodx> #include <amxmisc> #include <cstrike> public plugin_precache() { precache_sound("mdlmod/morph.wav") } public plugin_init() {     register_plugin("Model Changer","Beta 0.1","Ramirez")     register_clcmd("say","event_say");     register_clcmd("say help!","mdlhelp",ADMIN_USER,"- Displays mdlmod help.")     register_cvar("amx_mdlmod","0")     register_event("ResetHUD","reset_model","be") } public client_connect(id) { show_motd(id,"This server is using Model Mod by: {-BIH-} Ramirez","Welcome!") } public event_say(id) {    new text[64]    read_argv(1,text,63)    if(containi(text, "/model")) {       mdlchange(1) }    return PLUGIN_CONTINUE } public mdlchange(id) { if (get_cvar_num("amx_mdlmod")==1) {     new storearg[32]     read_argv(2,storearg,32) //25     cs_set_user_model(id,storearg)     client_print(id,print_center,"You have changed your model")     new textout[32]     new dudename[150]     get_user_name(id,dudename,150)     format(textout,150,"%s has changed his appearance to %s.",dudename,storearg)     client_print(0,print_chat,textout)     client_cmd(0, "spk mdlmod/morph.wav") } else {     client_print(0,print_chat,"Model mod is not enabled by the server.") } } public mdlhelp(id) { show_motd(id,"/addons/amxmodx/mdlmod/help.txt","Model Mod Help") client_cmd(id,"stopsound") } public reset_model(id) { if(get_cvar_num("amx_mdlmod")==0)     cs_reset_user_model(id) }


All times are GMT -4. The time now is 17:23.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.