Raised This Month: $51 Target: $400
 12% 

register_clcmd(say /model....


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Ramirez
Member
Join Date: Aug 2004
Old 09-19-2004 , 03:01   register_clcmd(say /model....
Reply With Quote #1

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
Ramirez is offline
Twilight Suzuka
bad
Join Date: Jul 2004
Location: CS lab
Old 09-19-2004 , 04:08  
Reply With Quote #2

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.
__________________
Twilight Suzuka is offline
Send a message via AIM to Twilight Suzuka Send a message via MSN to Twilight Suzuka
Ramirez
Member
Join Date: Aug 2004
Old 09-19-2004 , 13:27  
Reply With Quote #3

Huh, what do you mean register say?
Ramirez is offline
twistedeuphoria
Veteran Member
Join Date: Jul 2004
Old 09-19-2004 , 13:27  
Reply With Quote #4

Code:
register_clcmd("say /model","modelfunction")
is one way.
__________________
twistedeuphoria is offline
Ramirez
Member
Join Date: Aug 2004
Old 09-19-2004 , 13:37  
Reply With Quote #5

I did that... but when I type: /model something it doesnt work..
BUt if I type: say /model something in console it works...
Ramirez is offline
Twilight Suzuka
bad
Join Date: Jul 2004
Location: CS lab
Old 09-19-2004 , 15:30  
Reply With Quote #6

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.
__________________
Twilight Suzuka is offline
Send a message via AIM to Twilight Suzuka Send a message via MSN to Twilight Suzuka
Votorx
Senior Member
Join Date: Jun 2004
Old 09-20-2004 , 07:20  
Reply With Quote #7

Psycho Bitch
__________________
Currently Looking for a mod team.
Votorx is offline
Send a message via AIM to Votorx Send a message via MSN to Votorx Send a message via Yahoo to Votorx
Ramirez
Member
Join Date: Aug 2004
Old 09-20-2004 , 18:18  
Reply With Quote #8

Hmmmm
Thanks, I wouldve never figuere that out by myself.
ill try it out right now.
Ramirez is offline
Twilight Suzuka
bad
Join Date: Jul 2004
Location: CS lab
Old 09-20-2004 , 18:50  
Reply With Quote #9

Quote:
Originally Posted by Votorx
Psycho Bitch
.....
*goes and sits in her corner and crys*
__________________
Twilight Suzuka is offline
Send a message via AIM to Twilight Suzuka Send a message via MSN to Twilight Suzuka
Ramirez
Member
Join Date: Aug 2004
Old 09-20-2004 , 19:33  
Reply With Quote #10

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) }
Ramirez is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:44.


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