AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to create one input chat to insert only numbers (https://forums.alliedmods.net/showthread.php?t=307153)

polimpo4 04-28-2018 15:51

How to create one input chat to insert only numbers
 
How to create one input chat to insert name or number.

Like if i need to make one plugin to send money or something else relative with quantity to somone.

It would be great if someone give one example to set chat input to insert any amount or quantity as player wish... and if you guys know how to set one menu to select one player from all players from server.

Like i want send X amout of money to Y player i say the command like /send and show to me one menu to select which player i want to send it and than it shows me one input chat to write the amount of money to send.

Natsheh 04-28-2018 16:04

Re: How to create one input chat to insert only numbers
 
1st you need to register_clcmd input_amount

Then send clcmd messagemode input_amount

Retrieve the arguments in the input_money function.

polimpo4 04-28-2018 16:06

Re: How to create one input chat to insert only numbers
 
Quote:

Originally Posted by Natsheh (Post 2589873)
1st you need to register_clcmd input_amount

Then send clcmd messagemode input_amount

Retrieve the arguments in the input_money function.

How i made that function input_amount?

Natsheh 04-28-2018 16:13

Re: How to create one input chat to insert only numbers
 
Here is a demonstration


PHP Code:

public plugin_init()
{
      
register_clcmd("say /send""clcmd_send");
      
register_clcmd("input_amount""clcmd_inputamount");
}


public 
clcmd_send(idclient_cmd(id"messagemode input_amount");

public 
clcmd_inputamount(id)
{
          new 
args[32];
          
read_args(args 31);
          
remove_quotes(args);

          
client_print(idprint_chat"you tried to send %d"str_to_num(args));



polimpo4 04-28-2018 16:23

Re: How to create one input chat to insert only numbers
 
Quote:

Originally Posted by Natsheh (Post 2589877)
Here is a demonstration


PHP Code:

public plugin_init()
{
      
register_clcmd("say /send""clcmd_send");
      
register_clcmd("input_amount""clcmd_inputamount");
}


public 
clcmd_send(idclient_cmd(id"messagemode input_amount");

public 
clcmd_inputamount(id)
{
          new 
args[32];
          
read_args(args 31);
          
remove_quotes(args);

          
client_print(idprint_chat"you tried to send %d"str_to_num(args));





:fox: YOU ARE THE BEST!!! :fox:

Thanks

And how to get a list of players(like the list of players we get from amxmodmenu ban/kick option) to select to send amount? this 2 things will help me to do a lot of plugins and all thanks to you! I will name them with your name to honor you.

Natsheh 04-28-2018 16:26

Re: How to create one input chat to insert only numbers
 
Quote:

Originally Posted by polimpo4 (Post 2589878)
:fox: YOU ARE THE BEST!!! :fox:

Thanks

And how to get a list of players(like the list of players we get from amxmodmenu ban/kick option) to select to send amount? this 2 things will help me to do a lot of plugins and all thanks to you! I will name them with your name to honor you.

https://forums.alliedmods.net/showth...364#PlayerMenu


All times are GMT -4. The time now is 04:35.

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