AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Store (https://forums.alliedmods.net/forumdisplay.php?f=157)
-   -   Release Math Credits (https://forums.alliedmods.net/showthread.php?t=264848)

Arkarr 06-22-2015 09:40

Math Credits
 
19 Attachment(s)
Description :
This plugin display math question and the first player who answer correctly earn a random ammount of credits !
Based on this request.

Code:

[QUIZ]100 + 64 = ?? >>5 Credits<<
*DEAD* Spancer : 164
[QUIZ]Spancer is the winner he got 5 credits.

Screenshots & Videos :
None. Feel free to give me some nice shots ;) !

Cvar & Commands

Cvar :

sm_MathCredits_minimum_number 1 What should be the minimum number for questions ?
sm_MathCredits_maximum_number 100 What should be the maximum number for questions ?
sm_MathCredits_maximum_credits 50 What should be the maximum number of credits earned for a correct answers ?
sm_MathCredits_minimum_credits 5 What should be the minimum number of credits earned for a correct answers ?
sm_MathCredits_time_between_questions 50 Time in seconds between each questions.
sm_MathCredits_time_answer_questions 10 Time in seconds to give a answer to a question.
sm_MathCredits_store_select DEFAULT DEFAULT=Sourcemod store/ZEPHYRUS=use zephyrus store"

A config file is created on the first run of the plugin in cfg/sourcemod folder called MathCredits.cfg !

Commands :

None

Installation


1) Download the smx file
2) Put it into your plugins folder
3) Install Simple Chat Processor Redux
4) reload plugins folder by restarting server OR changing map OR typing sm reload plugins

Bugs :


Any ! Yay everything is fully working !

Request :

  • Nothing :|

Logs :
------
0.1 : First public release.
-------

Proz 06-22-2015 12:00

Re: Math Credits
 
Nice one.

Any plans on making a quiz based on questions that you can add in a config file along with the answer itself?

Arkarr 06-22-2015 12:11

Re: Math Credits
 
Quote:

Originally Posted by Proz (Post 2310655)
Nice one.

Any plans on making a quiz based on questions that you can add in a config file along with the answer itself?

Well, I guess, it's possible, but I don't see how I can implemant that, should I create a new plugin ?

Arrow768 06-22-2015 12:32

Re: Math Credits
 
Quote:

Originally Posted by Arkarr (Post 2310660)
Well, I guess, it's possible, but I don't see how I can implemant that, should I create a new plugin ?

I think a new module would be the way to go.

Maybe make it configurable via (dummy)-items in the webpanel.
So there is a item for each question.
The Question and the Results are defined via the json attrs.

Not sure if you can implement it this way, but I think it would be useful to do it that way.


About the Math Module:
I think it might be useful if you add the option to only ask questions if a certain number of players are dead.

Btw. I added the module to the overview

Arkarr 06-22-2015 13:42

Re: Math Credits
 
Quote:

Originally Posted by Arrow768 (Post 2310664)
Maybe make it configurable via (dummy)-items in the webpanel.

Like, how ? Question aren't things you can buy, can you ?
Quote:

Originally Posted by Arrow768 (Post 2310664)
So there is a item for each question.
The Question and the Results are defined via the json attrs.

I do not understand that. Something like that ? (I know it's not formatted like json should be)
PHP Code:

//
//NBR1 - Get a random number between CVAR_MAX and CVAR_MIN
//NBR2 - Get a random number between CVAR_MAX and CVAR_MIN
//
"1"
{
      
"Question"     "How much does NBR1 + NBR2 ?"
      "Answer"       "NBR1 + NBR2"
      "Reward"       "10"
      "Time"           "3"
}
"2"
{
      
"Question"     "How is the server callled ?"
      "Answer"       "Test server #1"
      "Reward"       "20"
      "Time"           "20"


Quote:

Originally Posted by Arrow768 (Post 2310664)
Not sure if you can implement it this way, but I think it would be useful to do it that way.

understandable.

Quote:

Originally Posted by Arrow768 (Post 2310664)
About the Math Module:
I think it might be useful if you add the option to only ask questions if a certain number of players are dead.

I will add that.

Quote:

Originally Posted by Arrow768 (Post 2310664)
Btw. I added the module to the overview

What does that mean ?

PS:
By the way, you have done a pretty nice job with the webpanel :3 !

Drixevel 06-22-2015 14:03

Re: Math Credits
 
Looks fine to me, only issue I see is the lack of registration. When you have a chance, have a look at the native in the backend module to register your plugin to the store database.

Code:

/**
 * Registers the plugin module for the webpanel to handle.
 * It's recommended that all modules register & refresh each plugin load. This is required in order for the webpanel to manage modules properly.
 *
 * @param sName                            Name of the plugin, this is just for reference.
 * @param sDescription                Description of the plugin, this is just for reference as well.
 * @param sVersion_ConVar        Name of the version ConVar the plugin uses.
 * @param sVersion                        Current version number of the plugin.
 * @noreturn
 */
native Store_RegisterPluginModule(const String:sName[], const String:sDescription[], const String:sVersion_ConVar[], const String:sVersion[]);


Arrow768 06-22-2015 14:08

Re: Math Credits
 
Quote:

Originally Posted by Arkarr (Post 2310685)
Like, how ? Question aren't things you can buy, can you ?

Currently we do not have a way to distribute configuration files across multiple servers.
So my idea is to use the json_attrs to distribute the data.
Basically the user adds 1 item for each question that contains the below mentioned attrs.
These items will be flagged as unbuyable (so its not listed in the store menu)

Once your module loads, it should be possible to get all the items that belong to that category.
Once you got the items, you can look at the attrs from each item to get the questions.
(Maybe you can use the item price as the reward thats given to the user)

Quote:

Originally Posted by Arkarr (Post 2310685)
I do not understand that. Something like that ? (I know it's not formatted like json should be)
PHP Code:

//
//NBR1 - Get a random number between CVAR_MAX and CVAR_MIN
//NBR2 - Get a random number between CVAR_MAX and CVAR_MIN
//
"1"
{
      
"Question"     "How much does NBR1 + NBR2 ?"
      "Answer"       "NBR1 + NBR2"
      "Reward"       "10"
      "Time"           "3"
}
"2"
{
      
"Question"     "How is the server callled ?"
      "Answer"       "Test server #1"
      "Reward"       "20"
      "Time"           "20"



Yes like that, but it should be json, so the webpanel can mass check all attrs if they are a valid json object. (Its a common error that people mess up the json syntax, so theres a json checker in the webpanel)
Oh, and multiple answers would be awesome


As I said, this are just some ideas.


Quote:

Originally Posted by Arkarr (Post 2310685)
What does that mean ?

Its listed here
https://forums.alliedmods.net/showthread.php?t=208774


Quote:

Originally Posted by Arkarr (Post 2310685)
PS:
By the way, you have done a pretty nice job with the webpanel :3 !

Thanks, but if you like the v1 panel, then you should take a look at the v2 panel

Arkarr 06-22-2015 14:11

Re: Math Credits
 
@r3dw3r3w0lf
Right, in fact, I scripted this without knowing anything about Store (wich was not that clever, I understand.) but, what ?
It's recommended that all modules register & refresh each plugin load.
What does that part mean ? Like I have to do ServerCommand("sm plugins reload [PLUGIN_NAME]"); after Store_RegisterPluginModule() ?

Drixevel 06-22-2015 14:14

Re: Math Credits
 
Quote:

Originally Posted by Arkarr (Post 2310703)
@r3dw3r3w0lf
Right, in fact, I scripted this without knowing anything about Store (wich was not that clever, I understand.) but, what ?
It's recommended that all modules register & refresh each plugin load.
What does that part mean ? Like I have to do ServerCommand("sm plugins reload [PLUGIN_NAME]"); after Store_RegisterPluginModule() ?

I'll re-type it but basically, it means it will register the module every time you input the function and update the settings in the web panel. This must be refreshed so the web panel can track which versions are running on which servers and tell you otherwise if they're outdated.

I'm making a post about it now since It's needed now but basically, this is how you should code it.

(Taken from the core module)
Code:

public Store_OnDatabaseInitialized()
{
        Store_RegisterPluginModule(PLUGIN_NAME, PLUGIN_DESCRIPTION, PLUGIN_VERSION_CONVAR, STORE_VERSION);
}

Everytime the database initializes, It'll register the plugin to the database for the web panel to use. If the version is the same, It'll just refresh stuff like the name, description, etc.

Arkarr 06-22-2015 14:18

Re: Math Credits
 
Quote:

Originally Posted by r3dw3r3w0lf (Post 2310704)
[...]

Oh... pretty easy-to-use in fact. Thanks adding that now.

EDIT:
Woups
Did I forgot a #include ? Currently I only have the <store> one.

lantecer 06-22-2015 20:02

Re: Math Credits
 
Hey,
i don't know what it is (there are no error logs), but when a new round starts the plugin stops working (no questions anymore).
No error logs.
I am using SourceMod 1.7.3-dev+5214.

Drixevel 06-22-2015 20:08

Re: Math Credits
 
Quote:

Originally Posted by Arkarr (Post 2310706)
Oh... pretty easy-to-use in fact. Thanks adding that now.

EDIT:
Woups
Did I forgot a #include ? Currently I only have the <store> one.

'store.inc' is basically a bunch of the other includes to organize things so you would look in 'store/store_backend.inc' for the native.

cam0 06-22-2015 20:30

Re: Math Credits
 
Quote:

Originally Posted by lantecer (Post 2310833)
Hey,
i don't know what it is (there are no error logs), but when a new round starts the plugin stops working (no questions anymore).
No error logs.
I am using SourceMod 1.7.3-dev+5214.

Is it when a new round starts or when the map changes?

I think if you give a timer TIMER_NO_MAPCHANGE, it needs to be in OnMapStart instead of OnPluginStart.

Arkarr 06-23-2015 03:43

Re: Math Credits
 
Quote:

Originally Posted by cam0 (Post 2310845)
Is it when a new round starts or when the map changes?

I think if you give a timer TIMER_NO_MAPCHANGE, it needs to be in OnMapStart instead of OnPluginStart.

Yep definitily. Please, download the last version.

lantecer 06-23-2015 11:45

Re: Math Credits
 
Quote:

Originally Posted by cam0 (Post 2310845)
Is it when a new round starts or when the map changes?

I think if you give a timer TIMER_NO_MAPCHANGE, it needs to be in OnMapStart instead of OnPluginStart.

I can't really follow, sorry.. :o

Is it a setting of my server or a setting of the plugin?

Arkarr 06-23-2015 12:11

Re: Math Credits
 
Quote:

Originally Posted by lantecer (Post 2311082)
I can't really follow, sorry.. :o

Is it a setting of my server or a setting of the plugin?

In the plugin, it's fixed now, you just simply have to drag'n'drop the smx file into your plugins folder.

lantecer 06-23-2015 12:28

Re: Math Credits
 
Works, thank you!

Arkarr 06-23-2015 14:09

Re: Math Credits
 
Quote:

Originally Posted by lantecer (Post 2311098)
Works, thank you!

Anytime, I (always) usually leave those kind of stupid errors...

DJ Data 06-26-2015 22:22

Re: Math Credits
 
Arkarr I've seen this in may of your plugins; at the bugs part you say: "any". I suggest using "none".

Thats it really, nice work either way.

Arkarr 06-27-2015 02:41

Re: Math Credits
 
Quote:

Originally Posted by DJ Data (Post 2312563)
Arkarr I've seen this in may of your plugins; at the bugs part you say: "any". I suggest using "none".

Thats it really, nice work either way.

The reason of that error is because I copy paste my template. Anyway. Thanks ! Not gonna correct that now (I'm using my phone right now.)

LiMaaa 07-06-2015 08:47

Re: Math Credits
 
Nice plugin Arkar,

Request: Could you make it have a config where we can actually supply custom questions and answers, and deligate the amount of credits per correct response. So instead of boring math questions (no offence), we can put questions relating to the game we are playing?

would be awesome, regards!

Arkarr 07-07-2015 09:16

Re: Math Credits
 
Quote:

Originally Posted by AdRianaLiMaaa (Post 2316166)
Nice plugin Arkar,

Request: Could you make it have a config where we can actually supply custom questions and answers, and deligate the amount of credits per correct response. So instead of boring math questions (no offence), we can put questions relating to the game we are playing?

would be awesome, regards!

I'm in away from home for 2 more weeks. But I take note of your request.

NotHappy 12-16-2015 10:58

Re: Math Credits
 
Bug report.

When someone will have equiped chatcolor fron this plugin https://forums.alliedmods.net/showthread.php?t=263730 the quizz won't register his answer.

supreeda 12-16-2015 12:27

Re: Math Credits
 
Quote:

Originally Posted by NotHappy (Post 2372928)
Bug report.

When someone will have equiped chatcolor fron this plugin https://forums.alliedmods.net/showthread.php?t=263730 the quizz won't register his answer.

WTF it work fine for me xD

i use green color and answer it work ,

braak0327 12-18-2015 05:07

Re: Math Credits
 
need more difficult math problems like calculus or vector things haha let the John von Neumann fortress 2 BEGINS!

Arkarr 12-18-2015 07:34

Re: Math Credits
 
Quote:

Originally Posted by braak0327 (Post 2373499)
need more difficult math problems like calculus or vector things haha let the John von Neumann fortress 2 BEGINS!

Hahaha, yeah, but I don't usually start game to do math, still it's kinda easy to edit to do what you asked for.

NotHappy 12-18-2015 13:31

Re: Math Credits
 
Quote:

Originally Posted by supreeda (Post 2372957)
WTF it work fine for me xD

i use green color and answer it work ,


For me it doesn't :/. And i have another problem even though i changed my .cfg file it still thinks that everything is set to default

My .cfg:
Spoiler

Arkarr 12-18-2015 14:35

Re: Math Credits
 
Quote:

Originally Posted by NotHappy (Post 2373660)
[...]

Fixed your config bug.

barvica 02-17-2016 10:54

Re: Math Credits
 
Answers doesnt work on admins with custom flag "o".

Arkarr 02-17-2016 12:49

Re: Math Credits
 
Quote:

Originally Posted by barvica (Post 2393730)
Answers doesnt work on admins with custom flag "o".

What ?

barvica 02-17-2016 16:32

Re: Math Credits
 
The answers of admins are not getting registered, so if admin types the correct answer it wont register it. The next person without admin flag will write completely same answer and will get it right.

Arkarr 02-17-2016 16:55

Re: Math Credits
 
Quote:

Originally Posted by barvica (Post 2393830)
The answers of admins are not getting registered, so if admin types the correct answer it wont register it. The next person without admin flag will write completely same answer and will get it right.

What the heck ? I don't really do anything with the admins. Like, it shouldn't create any problems. What the hell... I'm actually searching from where the error comes... probably Simple Chat Prossesor... but, I can't find anyting !

barvica 02-18-2016 11:08

Re: Math Credits
 
Or it might be for the people that uses colors in their name/tag/text.

shanapu 04-22-2016 06:51

Re: Math Credits
 
1 Attachment(s)
i made a non store and called by trigger version of Math Credits.

sm_math for a new Quiz.

all Credits to Arkarr!

shanapu 04-22-2016 06:57

Re: Math Credits
 
Quote:

Originally Posted by barvica (Post 2394092)
Or it might be for the people that uses colors in their name/tag/text.

do you use simple chat prozessor?
or a plugin that make player tags this way? https://github.com/ecca/SourceMod-Pl...warden.sp#L160 this break some cmds. It's a bad solution in my opinion.

IAMZEUS 04-27-2016 13:10

Re: Math Credits
 
Hey, am getting this error;
PHP Code:

L 04/28/2016 15:02:21: [SMUnable to load plugin "MathCredits.smx"Could not find required plugin "store-loadouts" 

but I see the store-loadouts.smx file in my folder, whats the problem here?

Arkarr 04-27-2016 14:58

Re: Math Credits
 
Quote:

Originally Posted by IAMZEUS (Post 2414656)
Hey, am getting this error;
PHP Code:

L 04/28/2016 15:02:21: [SMUnable to load plugin "MathCredits.smx"Could not find required plugin "store-loadouts" 

but I see the store-loadouts.smx file in my folder, whats the problem here?

store-loadouts.smx not loaded sucessfully. Try "sm plugins load store-loadouts" and give me the result, please.

IAMZEUS 04-27-2016 15:09

Re: Math Credits
 
Quote:

Originally Posted by Arkarr (Post 2414684)
store-loadouts.smx not loaded sucessfully. Try "sm plugins load store-loadouts" and give me the result, please.

This is the store side of plugins loaded.

PHP Code:

"[Store] Equipment" (1.1-alphaby alongub
 
"[Store] Skins" (1.1-alphaby alongub
 
"[Store] Titles" (1.1-alphaby alongub
 
"[Store] Trails" (1.1-alphaby alongub
 
"[Store] Backend Module" (1.2.4bby AlongubKeith Warren(Drixevel), Arrow768
 
"[Store] Logging Module" (1.2.4bby AlongubKeith Warren(Drixevel), Arrow768
"[Store] Name Colors" (1.1by Panduh
 
"[Store] Tracers" (1.0.1by Franc1sco steamfranug
 
"[Store] Weapon Colors" (1.1-alphaby Phault
 
"[Store] Chat Color" (1.2by Panduhcsgo fix by wyd3x
 
"KZ Guides" (1.2by JWL
 
"KZTimer" (1.84 Global) by 1NutWunDeR
 
"Stopwatch" (1.0by JWL
 
"[Store] Core Module" (1.2.4bby AlongubKeith Warren(Drixevel), Arrow768
 
"[Store] Distributor Module" (1.2.4bby AlongubKeith Warren(Drixevel), Arrow768
 
"[Store] Gifting Module" (1.2.4bby AlongubKeith Warren(Drixevel), Arrow768
"[Store] Inventory Module" (1.2.4bby AlongubKeith Warren(Drixevel), Arrow768
 
"[Store] Loadouts Module" (1.2.4bby AlongubKeith Warren(Drixevel), Arrow768
 
"[Store] Refunds Module" (1.2.4bby AlongubKeith Warren(Drixevel), Arrow768
 
"[Store] Shop Module" (1.2.4bby AlongubKeith Warren(Drixevel), Arrow768 


Arkarr 04-27-2016 15:35

Re: Math Credits
 
Quote:

Originally Posted by IAMZEUS (Post 2414688)
This is the store side of plugins loaded. [...]

Wich store do you use ?

IAMZEUS 04-27-2016 15:38

Re: Math Credits
 
Quote:

Originally Posted by Arkarr (Post 2414697)
Wich store do you use ?

I rmb installing this one;
https://forums.alliedmods.net/showpo...&postcount=688


All times are GMT -4. The time now is 01:13.

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