Raised This Month: $ Target: $400
 0% 

[IDEA]Store's Quiz Plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Arkarr
Veteran Member
Join Date: Sep 2012
Location: Just behind my PC screen
Old 06-22-2015 , 11:35   Re: [IDEA]Store's Quiz Plugin
Reply With Quote #31

Quote:
hey i know right now u swearword to me but please i need this plugin :'/

https://forums.alliedmods.net/showth...=264794&page=3
I'm sorry but I don't think I writed something offensive to you, if I have, then really sorry, didn't mean to.
Also, spamming me won't help at all.

Anyway, here is your version of the plugin :
PHP Code:
#include <sourcemod>
#include <sdktools>
#include <scp>

#define PLUGIN_AUTHOR     "Arkarr"
#define PLUGIN_VERSION     "1.00"
#define PLUGIN_TAG        "[Reaksiyon Testi]"
#define PLUS        "+"
#define MINUS        "-"
#define DIVISOR        "/"
#define MULTIPL        "*"

bool inQuizz;

char op[32];
char operators[4][2] = {"+""-""/""*"};

int nbrmin;
int nbrmax;
int maxcredits;
int mincredits;
int questionResult;
int credits;

Handle timerQuestionEnd;
Handle CVAR_MinimumNumber;
Handle CVAR_MaximumNumber;
Handle CVAR_MaximumCredits;
Handle CVAR_MinimumCredits;
Handle CVAR_TimeBetweenQuestion;
Handle CVAR_TimeAnswer;

public 
Plugin myinfo 
{
    
name "[ANY] Matematik Kredi",
    
author PLUGIN_AUTHOR,
    
description "Matematik sorularini bile kredi kazan!",
    
version PLUGIN_VERSION,
    
url "http://www.sourcemod.net"
};

public 
void OnPluginStart()
{
    
inQuizz false;
    
    
CVAR_MinimumNumber CreateConVar("sm_MathCredits_minimum_number""1""What should be the minimum number for questions ?");
    
CVAR_MaximumNumber CreateConVar("sm_MathCredits_maximum_number""100""What should be the maximum number for questions ?");
    
CVAR_MaximumCredits CreateConVar("sm_MathCredits_maximum_credits""50""What should be the maximum number of credits earned for a correct answers ?");
    
CVAR_MinimumCredits CreateConVar("sm_MathCredits_minimum_credits""5""What should be the minimum number of credits earned for a correct answers ?");
    
CVAR_TimeBetweenQuestion CreateConVar("sm_MathCredits_time_between_questions""50""Time in seconds between each questions.");
    
CVAR_TimeAnswer CreateConVar("sm_MathCredits_time_answer_questions""10""Time in seconds to give a answer to a question.");
    
    
AutoExecConfig(true"MathCredits");
    
    
nbrmin GetConVarInt(CVAR_MinimumNumber);
    
nbrmax GetConVarInt(CVAR_MaximumNumber);
    
maxcredits GetConVarInt(CVAR_MaximumCredits);
    
mincredits GetConVarInt(CVAR_MinimumCredits);
    
    
CreateTimer(GetConVarFloat(CVAR_TimeBetweenQuestion) + GetConVarFloat(CVAR_TimeAnswer), CreateQuestion_TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
}

public 
Action EndQuestion(Handle timer)
{
    
SendEndQuestion(-1);
}

public 
Action CreateQuestion(Handle timer)
{
    
int nbr1 GetRandomInt(nbrminnbrmax);
    
int nbr2 GetRandomInt(nbrminnbrmax);
    
credits GetRandomInt(mincreditsmaxcredits);
    
    
Format(opsizeof(op), operators[GetRandomInt(0,3)]);
    
    if(
StrEqual(opPLUS))
    {
        
questionResult nbr1 nbr2;
    }
    else if(
StrEqual(opMINUS))
    {
        
questionResult nbr1 nbr2;
    }
    else if(
StrEqual(opDIVISOR))
    {
        do{
            
questionResult nbr1 nbr2;
        }while(
questionResult nbr2 != 0);
    }
    else if(
StrEqual(opMULTIPL))
    {
        
questionResult nbr1 nbr2;
    }
    
    
PrintToChatAll("%s %i %s %i = ?? >>>%i Kredi<<<"PLUGIN_TAGnbr1opnbr2credits);
    
inQuizz true;
    
    
timerQuestionEnd CreateTimer(GetConVarFloat(CVAR_TimeAnswer), EndQuestion);
}

public 
Action OnChatMessage(&authorHandle recipientschar[] namechar[] message)
{
    if(
inQuizz)
    {
        
char bit[1][5];
        
ExplodeString(message" "bitsizeof bitsizeof bit[]);

        if(
ProcessSolution(authorStringToInt(bit[0])))
            
SendEndQuestion(author);
    }
}

public 
bool ProcessSolution(clientint number)
{
    if(
questionResult == number)
    {
        
ServerCommand("sm_krediver %i %i"GetClientUserId(client), credits);
        return 
true;
    }
    else
    {
        return 
false;
    }
}

public 
void SendEndQuestion(int client)
{
    if(
timerQuestionEnd != INVALID_HANDLE)
    {
        
KillTimer(timerQuestionEnd);
        
timerQuestionEnd INVALID_HANDLE;
    }
    
    
char answer[100];
    
    if(
client != -1)
        
Format(answersizeof(answer), "%s %N dogru cevap verdi +%i kredi kazandi!"PLUGIN_TAGclientcredits);
    else
        
Format(answersizeof(answer), "%s Sure bitti! Cevap yok."PLUGIN_TAG);
        
    
Handle pack CreateDataPack();
    
CreateDataTimer(0.3AnswerQuestionpack);
    
WritePackString(packanswer);
    
    
inQuizz false;
}

public 
Action AnswerQuestion(Handle timerHandle pack)
{
    
char str[100];
    
ResetPack(pack);
    
ReadPackString(packstrsizeof(str));
 
    
PrintToChatAll(str);

__________________
Want to check my plugins ?
Arkarr is offline
spancer35
Senior Member
Join Date: Dec 2014
Location: City 17
Old 06-22-2015 , 11:41   Re: [IDEA]Store's Quiz Plugin
Reply With Quote #32

yeah man thank you so much!! if i were you i'm gonna swear ahahah lol any way so thank you soo much!
spancer35 is offline
Drixevel
AlliedModders Donor
Join Date: Sep 2009
Location: Somewhere headbangin'
Old 06-22-2015 , 13:55   Re: [IDEA]Store's Quiz Plugin
Reply With Quote #33

Keep in mind that OP posted to Store 1.1 which only works with Store 1.5 and lower.
Drixevel is offline
ThatOneGuy
Veteran Member
Join Date: Jul 2012
Location: Oregon, USA
Old 06-22-2015 , 15:45   Re: [IDEA]Store's Quiz Plugin
Reply With Quote #34

Quote:
Originally Posted by Arkarr View Post
I don't see what is funny + I don't understand what you are doing wrong, do you use 1.7 compiller ? 'cause I writed it using 1.7 SourcePawn syntax. Anyway, I'm going to post this plugin on "Store" section of the forum, gonna post a link here in a few sec.
My guess is that he is trying to compile online without the includes. You need to either use an online compiler that allows the includes, else more preferably compile it on your local drive with your own SM build. There are several tutorials on how to compile plugins throughout the forums. Make sure everything listed as #include <blah> at the top of the plugin can be found in your scripting/includes folder in order to compile.
__________________
ThatOneGuy is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:54.


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