Junior Member
Join Date: Jun 2020
Location: Slovakia
07-05-2020
, 10:55
Re: Math and get integer from clcmd "say"
#7
Okey, I was coding all day long.
I did it, i think.
Spoiler
PHP Code:
#include <amxmodx> #define PLUGIN "math" #define VERSION "0.1" #define AUTHOR "chick" new bool : bExample new Result = 0 public plugin_init ( ) { register_plugin ( PLUGIN , VERSION , AUTHOR ) register_clcmd ( "say" , "fHandle_say" ) set_task ( 60.0 , "fExample" , 0 , _ , _ , "b" ) } public fHandle_say ( id ) { new said [ 64 ], ResultString [ 64 ] read_argv ( 1 , said , charsmax ( said ) ) num_to_str ( Result , ResultString , 63 ) if ( equali ( said , ResultString ) ) { if ( ! bExample ) { return 0 } else { client_print ( id , print_chat , "You're right!" ) bExample = false } } return PLUGIN_CONTINUE } public fExampleNoOne ( id ) { if ( bExample ) { client_print ( id , print_chat , "No one has answered the result! Example is out!" ) bExample = false } return PLUGIN_CONTINUE } public fExample ( ) { set_task ( 10.0 , "fExampleNoOne" ) bExample = true new a , b a = random_num ( 1 , 5 ) b = random_num ( 1 , 5 ) client_print ( 0 , print_chat , "Example: %i + %i" , a , b ) Result = a + b return PLUGIN_HANDLED }
It's working. But, if something is wrong, can you tell me what?
Thanks.
Last edited by chickez; 07-06-2020 at 10:29 .
Reason: a