AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Messagemode : 2 arguments[solved] (https://forums.alliedmods.net/showthread.php?t=105126)

grimvh2 10-01-2009 12:45

Messagemode : 2 arguments[solved]
 
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.

minimiller 10-01-2009 16:31

Re: Messagemode : 2 arguments
 
replace_all(name, sizeof(name) - 1, " ", "%");

ConnorMcLeod 10-01-2009 16:44

Re: Messagemode : 2 arguments
 
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".

grimvh2 10-01-2009 16:50

Re: Messagemode : 2 arguments
 
@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.

minimiller 10-01-2009 17:03

Re: Messagemode : 2 arguments
 
i thought %'s were switched with spaces when they are printed in chat

grimvh2 10-01-2009 17:08

Re: Messagemode : 2 arguments
 
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"

minimiller 10-01-2009 17:20

Re: Messagemode : 2 arguments
 
hmmm
im not entirely sure what ur trying to do
can i see more code?

grimvh2 10-03-2009 04:47

Re: Messagemode : 2 arguments
 
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.

fysiks 10-03-2009 15:22

Re: Messagemode : 2 arguments
 
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).

grimvh2 10-03-2009 16:47

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

Thx all.


All times are GMT -4. The time now is 22:34.

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