AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved Math and and hook "say" (https://forums.alliedmods.net/showthread.php?t=325714)

chickez 07-03-2020 12:07

Math and and hook "say"
 
Hey.

I was looking for plugin, which is - math examples, and who first write right sum *do something*.
But I didn't find.

Code:
Spoiler


I want to get from client right sum, then do something (in the comments of code explained)

Can you explain me it please? :)

HamletEagle 07-04-2020 03:00

Re: Math and get integer from clcmd "say"
 
Hook say(with register_clcmd), read the arguments(the chat message) and process it to get the sum.

chickez 07-05-2020 03:58

Re: Math and get integer from clcmd "say"
 
I changed code a little.

Spoiler


This doesn't work. Error:
Code:

Error: Argument type mismatch (argument 2) on line 29
Warning: Symbol is assigned a value that is never used: "sum" on line 33

What's wrong? Why it doesn't get the sum?

HamletEagle 07-05-2020 05:10

Re: Math and get integer from clcmd "say"
 
You have a lot of mistakes in that code. I suggest you dearch how to use read_argv, str_to_num, equal correctly and what they do.

Give it one more try. If you can't figure it out I'll show you the correct way.

condoriano90 07-05-2020 05:53

Re: Math and get integer from clcmd "say"
 
nevermind

chickez 07-05-2020 06:32

Re: Math and get integer from clcmd "say"
 
Okey, i think, i know how to use read_argv(). So str_to_num doesn't know, if i'm right.

What about equali? It is for compare two strings. So I must use num_to_str for equali?

I tried this:
Spoiler


It's compiled without errors or warnings. I tried it on server, but when I wrote anything, it called func. When I predicted right sum, it's called "You're right!".

chickez 07-05-2020 10:55

Re: Math and get integer from clcmd "say"
 
Okey, I was coding all day long.

I did it, i think.

Spoiler


It's working. But, if something is wrong, can you tell me what? :)
Thanks.


All times are GMT -4. The time now is 19:41.

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