Need Some Help
#1

Hi guys,I Put Reaction Test On My GM And It Doesn't Work Even It's A True Answer Can You Help Me? I Think The Problem Is At OnPlayerText So This Is The Script
P/S:Sorry For Bad English
PHP код:
public OnPlayerText(playeridtext[])
{
    if(
Enable && text[0] && Answer == strval(text))
    {
        new 
string[218];
        
Enable false;
        
format(stringsizeof(string),""Red"[MATH]%s[%d] "Blue"Answered The Right Answer Of Math Quiz | "Red"REWARD: +%d XP & $%d!"IsPlayerName(playerid), playeridEXPCash);
        
SendClientMessageToAll(-1string);
        
GivePlayerMoney(playeridCash);
           
SetPlayerScore(playeridGetPlayerScore(playerid) + EXP);
        
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
        return 
0;
    }
    switch (
TestBusy)
    {
        case 
true:
        {
            if(!
strcmp(Charstextfalse))
            {
                new 
string[218];
                
format(stringsizeof(string), ""Red"[REACTION]%s[%d] "Blue"Has Won The Reaction Test | "Red"REWARD: +%d XP & $%d!"IsPlayerName(playerid), playeridEXPCash);
                
SendClientMessageToAll(0xADFF2FFFstring);
                
GivePlayerMoney(playeridCash);
                
SetPlayerScore(playeridGetPlayerScore(playerid) + EXP);
                
ReactionTimer SetTimer("ReactionTest"600001);
                
TestBusy false;
            }
        }
    }
    return 
1;

Reply
#2

EDIT: nvm I guess.
Reply
#3

Look at Ryder Reaction Test FS at or Check Ryder Reaction test FS Code:

Код:
#include <a_samp>
 
#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 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
#4

Quote:
Originally Posted by MicroKyrr
Посмотреть сообщение
Look at Ryder Reaction Test FS at

or Check Ryder Reaction test FS Code:

Код:
#include <a_samp>
 
#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 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;
}
Mine Is Same But I Edit The Script Before I Add Thing At OnPlayerText It Fine But After I Add It Being Crazy
Reply
#5

Can you please show all code related to this feature? Also, tell us what happens when the reaction test starts. Or does it not even start to begin with?
Reply
#6

https://sampforum.blast.hk/showthread.php?tid=594239
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)