Raised This Month: $ Target: $400
 0% 

Messagemode : 2 arguments[solved]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
grimvh2
Veteran Member
Join Date: Nov 2007
Location: Fishdot Nation
Old 10-01-2009 , 12:45   Messagemode : 2 arguments[solved]
Reply With Quote #1

Hello evryone,

Im using message mode to execute a command with a name and a reason.

Code:
client_cmd(id, "messagemode ^"amx_warn %s ^"",name)
But when the play has a name for example : "Im Cool",
The command will be : Player Warned : Im Cool , Reason : Cool

I tried many things but none worked out.
Hope you guys can help me.

Greets Grim.
__________________
I am out of order!

Last edited by grimvh2; 10-03-2009 at 16:48.
grimvh2 is offline
minimiller
Veteran Member
Join Date: Aug 2007
Location: United Kingdom
Old 10-01-2009 , 16:31   Re: Messagemode : 2 arguments
Reply With Quote #2

replace_all(name, sizeof(name) - 1, " ", "%");
__________________
minimiller is offline
Send a message via MSN to minimiller
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 10-01-2009 , 16:44   Re: Messagemode : 2 arguments
Reply With Quote #3

As you already know the id + name of the warned player, you could just store it in memory, then use a simple messagemode, like "messagemode warnreason".
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
grimvh2
Veteran Member
Join Date: Nov 2007
Location: Fishdot Nation
Old 10-01-2009 , 16:50   Re: Messagemode : 2 arguments
Reply With Quote #4

@minimiller

First of all ty for helping me,

Second :

When my name is "Im Cool", you will change it to "Im%Cool".

Im using cmd target so it will search for players with the name "Im%Cool"
What i can do is in the cmd itself you replace the "%" back to " ".
Im going to try that.

Dont let this stop others to come with a better solution.

@Connor :

Can you give a small example, I think if I do it your way, I would need to make 2 different functions for the same effect. Not?


EDIT : Minimiller way is working with the add I have done. Tough I think there might be a cleaner solution.
__________________
I am out of order!

Last edited by grimvh2; 10-01-2009 at 16:57.
grimvh2 is offline
minimiller
Veteran Member
Join Date: Aug 2007
Location: United Kingdom
Old 10-01-2009 , 17:03   Re: Messagemode : 2 arguments
Reply With Quote #5

i thought %'s were switched with spaces when they are printed in chat
__________________
minimiller is offline
Send a message via MSN to minimiller
grimvh2
Veteran Member
Join Date: Nov 2007
Location: Fishdot Nation
Old 10-01-2009 , 17:08   Re: Messagemode : 2 arguments
Reply With Quote #6

Dont know about that, but I use messagemode to activate a command.

Amx_warn "PlayerName" "Reason"

You change the name from

"Im Cool" to "Im%Cool"

So cmd_target will search for a player named "Im%Cool", And you will get a message in console "Player cant be found"
__________________
I am out of order!
grimvh2 is offline
minimiller
Veteran Member
Join Date: Aug 2007
Location: United Kingdom
Old 10-01-2009 , 17:20   Re: Messagemode : 2 arguments
Reply With Quote #7

hmmm
im not entirely sure what ur trying to do
can i see more code?
__________________
minimiller is offline
Send a message via MSN to minimiller
grimvh2
Veteran Member
Join Date: Nov 2007
Location: Fishdot Nation
Old 10-03-2009 , 04:47   Re: Messagemode : 2 arguments
Reply With Quote #8

People can open a menu, with all playernames. When they press a name, messagemode will be used to call "amx_warn playername" and then they got to add a reason.
__________________
I am out of order!
grimvh2 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-03-2009 , 15:22   Re: Messagemode : 2 arguments
Reply With Quote #9

Just save the selected players id and then you will only need the message mode for the reason. After they hit enter then you retrieve the selected id and the message and use them to do what you want. You don't need to insert the name into the message mode (afaik you can't submit two arguments in messagemode unless you parse them manually which would probably be a pain in the butt).
__________________
fysiks is offline
grimvh2
Veteran Member
Join Date: Nov 2007
Location: Fishdot Nation
Old 10-03-2009 , 16:47   Re: Messagemode : 2 arguments
Reply With Quote #10

Well that way minimiller told me about is working, maybe yours would be better. Ill see what im about to do.

Thx all.
__________________
I am out of order!
grimvh2 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 22:34.


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