Who type first winss....
#1

The player who type first g1w41er2FAwd win 2 score. It must also give jumbled letters and numbers. Then Show this Every 10 minutes..


Anyone know what you call this?

I'm not sure about this script below.

EDIT: It gives money not Score i need the Score one.

pawn Код:
#include <a_samp>
 
#define COLOR_GREEN 0x00A800AA
 
new MinQuestionMoney = 250; // 250 is ajustable to any number you want the minimal
new MaxQuestionMoney = 750; // 750 is ajustable to any number you want the maximal to gether it will get a number beside the min and the max
new RandomQuestionMoney;
 
new QuestionStarted;
new Question[32];
 
new PlayerName[MAX_PLAYERS][MAX_PLAYER_NAME];
 
forward SendQuestionForMoney();
 
public OnFilterScriptInit()
{
        SetTimer("SendQuestionForMoney", 240000, true);
        return 1;
}
 
public OnFilterScriptExit()
{
        return 1;
}
 
public SendQuestionForMoney()
{
        new string[128];
        new qstring[32];
        RandomQuestionMoney = MinQuestionMoney+random(MaxQuestionMoney-MinQuestionMoney);
        format(qstring, sizeof(qstring), "%d%d%d%d%d%d%d%d", random(9), random(9), random(9), random(9), random(9), random(9), random(9), random(9));
        strmid(Question, qstring, false, strlen(qstring), 32);
    format(string, sizeof(string), "** Question: Are you still alive? **: The fastest who types %s will earn $%d,-!", qstring, RandomQuestionMoney);
        SendClientMessageToAll(COLOR_GREEN, string);
        QuestionStarted = 1;
        return 1;
}
 
public OnPlayerText(playerid, text[])
{
        if(QuestionStarted == 1 && strfind(text[0], Question, false) == 0)
        {
            new string[128];
                format(string, sizeof(string), "$$$ %s has won $%d,- by typing '%s' the fastest! $$$", PlayerName[playerid], RandomQuestionMoney, Question);
                SendClientMessageToAll(COLOR_GREEN, string);
                GivePlayerMoney(playerid, RandomQuestionMoney);
                QuestionStarted = 0;
                return 0;
        }
        return 1;
}
Reply
#2

If you're not sure, test it. Run it, see if you get the money, does the competition start etc. If it works, then just give him score and whatever reward you want.
Reply
#3

pawn Код:
stock GivePlayerScore(playerid,ammount)
{
    new currentscore;
    currentscore = GetPlayerScore(playerid);
    SetPlayerScore(playerid,currentscore + ammount);
}
Reply
#4

Use this code
pawn Код:
#include <a_samp>
 
#define COLOR_GREEN 0x00A800AA
 
new MinQuestionScore = 1;
new MaxQuestionScore = 7;
new RandomQuestionScore;
 
new QuestionStarted;
new Question[32];
 
new PlayerName[MAX_PLAYERS][MAX_PLAYER_NAME];
 
forward SendQuestionForScore();
 
public OnFilterScriptInit()
{
        SetTimer("SendQuestionForScore", 240000, true);
        return 1;
}
 
public OnFilterScriptExit()
{
        return 1;
}
 
public SendQuestionForScore()
{
        new string[128];
        new qstring[32];
        RandomQuestionScore = MinQuestionScore+random(MaxQuestionScore-MinQuestionScore);
        format(qstring, sizeof(qstring), "%d%d%d%d%d%d%d%d", random(9), random(9), random(9), random(9), random(9), random(9), random(9), random(9));
        strmid(Question, qstring, false, strlen(qstring), 32);
    format(string, sizeof(string), "** Question: Are you still alive? **: The fastest who types %s will earn $%d,-!", qstring, RandomQuestionMoney);
        SendClientMessageToAll(COLOR_GREEN, string);
        QuestionStarted = 1;
        return 1;
}
 
public OnPlayerText(playerid, text[])
{
        if(QuestionStarted == 1 && strfind(text[0], Question, false) == 0)
        {
            new string[128];
                format(string, sizeof(string), "$$$ %s has won $%d,- by typing '%s' the fastest! $$$", PlayerName[playerid], RandomQuestionMoney, Question);
                SendClientMessageToAll(COLOR_GREEN, string);
                SetPlayerScore(playerid, GetPlayerScore(playerid) + RandomQuestionScore);
                QuestionStarted = 0;
                return 0;
        }
        return 1;
}
Reply
#5

Quote:
Originally Posted by [HK]Ryder[AN]
Посмотреть сообщение
Use this code
pawn Код:
#include <a_samp>
 
#define COLOR_GREEN 0x00A800AA
 
new MinQuestionScore = 1;
new MaxQuestionScore = 7;
new RandomQuestionScore;
 
new QuestionStarted;
new Question[32];
 
new PlayerName[MAX_PLAYERS][MAX_PLAYER_NAME];
 
forward SendQuestionForScore();
 
public OnFilterScriptInit()
{
        SetTimer("SendQuestionForScore", 240000, true);
        return 1;
}
 
public OnFilterScriptExit()
{
        return 1;
}
 
public SendQuestionForScore()
{
        new string[128];
        new qstring[32];
        RandomQuestionScore = MinQuestionScore+random(MaxQuestionScore-MinQuestionScore);
        format(qstring, sizeof(qstring), "%d%d%d%d%d%d%d%d", random(9), random(9), random(9), random(9), random(9), random(9), random(9), random(9));
        strmid(Question, qstring, false, strlen(qstring), 32);
    format(string, sizeof(string), "** Question: Are you still alive? **: The fastest who types %s will earn $%d,-!", qstring, RandomQuestionMoney);
        SendClientMessageToAll(COLOR_GREEN, string);
        QuestionStarted = 1;
        return 1;
}
 
public OnPlayerText(playerid, text[])
{
        if(QuestionStarted == 1 && strfind(text[0], Question, false) == 0)
        {
            new string[128];
                format(string, sizeof(string), "$$$ %s has won $%d,- by typing '%s' the fastest! $$$", PlayerName[playerid], RandomQuestionMoney, Question);
                SendClientMessageToAll(COLOR_GREEN, string);
                SetPlayerScore(playerid, GetPlayerScore(playerid) + RandomQuestionScore);
                QuestionStarted = 0;
                return 0;
        }
        return 1;
}
I'm gonna try that. But I have a question here I have already make my own return 0 at OnplayerCommandText but why after I typed the Words correctly it shows nothing?

pawn Код:
/*

#if !defined Loop
#define Loop(%0,%1) \
    for(new %0 = 0; %0 != %1; %0++)
#endif

#if !defined function
#define function%0(%1) \
    forward%0(%1); public%0(%1)
#endif

#if !defined PURPLE
#define PURPLE \
    0xBF60FFFF
#endif

#if !defined GREEN
#define GREEN \
    0x94D317FF
#endif

#if !defined TIME
#define TIME \
    180000
#endif

new
    xCharacters[][] =
    {
        "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M",
        "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z",
        "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m",
        "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z",
        "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"
    },
    xChars[16] = "",
    xReactionTimer,
    xCash,
    xScore,
    bool: xTestBusy
;

public OnFilterScriptInit()
{
    xReactionTimer = SetTimer("xReactionTest", TIME, 1);
    return 1;
}

public OnFilterScriptExit()
{
    KillTimer(xReactionTimer);
    return 1;
}

public OnPlayerText(playerid, text[])
{
    switch(xTestBusy)
    {
        case true:
        {
            if(!strcmp(xChars, text, false))
            {
                new
                    string[128],
                    pName[MAX_PLAYER_NAME]
                ;
                GetPlayerName(playerid, pName, sizeof(pName));
                format(string, sizeof(string), "« \%s\" has won the reaction test. »", pName);
                SendClientMessageToAll(GREEN, string);
                format(string, sizeof(string), "« You have earned $%d + %d score points. »", xCash, xScore);
                SendClientMessage(playerid, GREEN, string);
                GivePlayerMoney(playerid, xCash);
                SetPlayerScore(playerid, GetPlayerScore(playerid) + xScore);
                xReactionTimer = SetTimer("xReactionTest", TIME, 1);
                xTestBusy = false;
            return 0;
            }
        }
    }
    return 1;
}

function xReactionProgress()
{
    switch(xTestBusy)
    {
        case true:
        {
            new
                string[128]
            ;
            format(string, sizeof(string), "« No-one won the reaction-test. New one starting in %d minutes. »", (TIME/60000));
            SendClientMessageToAll(PURPLE, string);
            xReactionTimer = SetTimer("xReactionTest", TIME, 1);
        }
    }
    return 1;
}

function xReactionTest()
{
    new
        xLength = (random(8) + 2),
        string[128]
    ;
    xCash = (random(10000) + 20000);
    xScore = (random(2)+1);
    format(xChars, sizeof(xChars), "");
    Loop(x, xLength) format(xChars, sizeof(xChars), "%s%s", xChars, xCharacters[random(sizeof(xCharacters))][0]);
    format(string, sizeof(string), "« Who first types %s wins $%d + %d score points. »", xChars, xCash, xScore);
    SendClientMessageToAll(PURPLE, string);
    KillTimer(xReactionTimer);
    xTestBusy = true;
    SetTimer("xReactionProgress", 30000, 0);
    return 1;
}
Reply
#6

Ok ive tested this and it works for me.

pawn Код:
#include <a_samp>
 
#define COLOR_GREEN 0x00A800AA
 
new MinQuestionScore = 1;
new MaxQuestionScore = 7;
new RandomQuestionScore;
 
new QuestionStarted;
new Question[32];
 
new PlayerName[MAX_PLAYERS][MAX_PLAYER_NAME];
 
forward SendQuestionForScore();
 
public OnFilterScriptInit()
{
        SetTimer("SendQuestionForScore", 240000, true);
        return 1;
}
 
public OnFilterScriptExit()
{
        return 1;
}
 
public SendQuestionForScore()
{
        new string[128];
        new qstring[32];
        RandomQuestionScore = MinQuestionScore+random(MaxQuestionScore-MinQuestionScore);
        format(qstring, sizeof(qstring), "%d%d%d%d%d%d%d%d", random(9), random(9), random(9), random(9), random(9), random(9), random(9), random(9));
        strmid(Question, qstring, false, strlen(qstring), 32);
    format(string, sizeof(string), "** Question: Are you still alive? **: The fastest who types %s will earn $%d,-!", qstring, RandomQuestionMoney);
        SendClientMessageToAll(COLOR_GREEN, string);
        QuestionStarted = 1;
        return 1;
}
 
public OnPlayerText(playerid, text[])
{
        if(QuestionStarted == 1 && strfind(text,Question,true) != -1)
    {
            new string[128];
            format(string, sizeof(string), "$$$ %s has won $%d,- by typing '%s' the fastest! $$$", Nam, RandomQuestionMoney, Question);
            SendClientMessageToAll(COLOR_GREEN, string);
            GivePlayerMoney(playerid, RandomQuestionMoney);
            QuestionStarted = 0;
            return 0;
    }
        return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)