[FilterScript] Simple Math Quiz System
#1

INTRO:
It's just a simple FilterScript which allow you to create math quiz....

COMMANDS:
/quiz,(rcon admin)
/qanswer.


LINKS:
Dini 1.6 : Dini 1.6 or Dini 2 : Dini 2
Sscanf : Sscanf
ZCMD : ZCMD
MerRandom : MerRandom

CODES:
PHP Code:
//Simple Math Quiz System by Usman
#include <a_samp>
#include <zcmd>
#include <sscanf>
#include <merrandom>
#define COLOR_DARKRED 0xAA3333FF
#define COLOR_GREY 0xAFAFAFFF
#define COLOR_BROWN 0x654321FF
#define COLOR_WHITE 0xFFFFFFFF
#define COLOR_YELLOW 0xFFFF00FF
#define COLOR_RED 0xFF0000FF
#define COLOR_LRED 0xFF4747FF
new quizquizansquizpr;
new 
mtimer[MAX_PLAYERS];
public 
OnFilterScriptInit()
{
    print(
"\n--------------------------------------");
    print(
" Simple Math Quiz System by Usman");
    print(
"--------------------------------------\n");
    
    
SetTimer("timer_quiz"4000001);
    return 
1;
}
CMD:quiz(playeridparams[])
{
    
//Add your admin level here i am not using any thing!
    
SendClientMessage(playeridCOLOR_YELLOW"You have started the math quiz.");
    
quiz 0;
    
timer_quiz();
    return 
1;
}
CMD:qanswer(playerid,params[])
{
    new 
playername[25], ansstr[256];
    if(
quiz == 0) return SendClientMessage(playeridCOLOR_RED"Error: There is no math quiz right now or it might have been already solved.");
    
GetPlayerName(playeridplayernameMAX_PLAYER_NAME);
    if (
mtimer[playerid] != 0) return SendClientMessage(playeridCOLOR_RED"Error: You are muted smart ass!");
    if(
sscanf(params,"d"ans)) return SendClientMessage(playeridCOLOR_WHITE"Usage: /qanswer [answer]");
    if(
ans != quizans) return SendClientMessage(playeridCOLOR_RED"Wrong answer better luck next time!");
     
format(strsizeof(str), "Well done {FF00FF}%s{FFFF00} you have answered an correct answer and won $%d."playernamequizpr);
     
SendClientMessage(playeridCOLOR_YELLOWstr);
    
GivePlayerMoney(playeridquizpr);
     
format(strsizeof(str), "[Math Quiz]{FFFFFF}: {FF00FF}%s{FFFFFF} have answered the quiz with %d and won $%d."playernameansquizpr);
    for (new 
0MAX_PLAYERSi++)
    {
        if (
IsPlayerConnected(i))
        {
         
SendClientMessage(iCOLOR_REDstr);
        }
    }
    
quiz 0;
    return 
1;
}
forward timer_quiz();
public 
timer_quiz()
{
    if(
quiz == 0)
    {
        new 
vv1v2v3mon;
        
random(50); v1 random(20); v2 random(30); v3 random(80);
        
quiz 1quizans v1 v2 v3;
        
mon random(10000)+5000;
        
quizpr mon;
        for (new 
0MAX_PLAYERSi++)
        {
            if (
IsPlayerConnected(i))
            {
                new 
str[256];
                
format(strsizeof(str), "[Math Quiz]{FFFFFF}: What is the answer of %dx%d-%d+%d ?? ({FF00FF}$%d{FFFFFF}) [/qanswer]."vv1v2v3mon);
                
SendClientMessage(iCOLOR_REDstr);
            }
        }
    }
    return 
1;

Reply
#2

Great Work
Reply
#3

Great Usman
Reply
#4

Quote:
Originally Posted by Wherethescripters
View Post
Great Work
Thank You

Quote:
Originally Posted by BulletRaja
View Post
Great Usman
Thank You too
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)