SA-MP Forums Archive
Math [Record System] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Math [Record System] (/showthread.php?tid=420262)



Math [Record System] - JaKe Elite - 04.03.2013

Hello folks once again.

I've been making a record system on my server.

If player creates new record. He will be the all new "Fast Player For Answering Math as First"

So, that i will save his name and the milesecond when he answer the Math.
After storing. I will answer another math contest again. But this time much faster than before.

But accidentally i calculate the Math late. I Expect Resulting to be lose
But i was suprised that i won again but as i thought. It was a bug.

Код:
Jake Hero holds new record 21472 milesecond, Beating Jake_Hero's milsecond 20482
I hold the record even i'm late. I mean like. I would like to make the record system work only if the milesecond is lower than the saved record milesecond for example. 20482.

Codes

pawn Код:
if(strval(text) == answer && endm == 1)
    {
        ReactionTest[1] = GetTickCount();
        new timeresult = ReactionTest[1] - ReactionTest[0];
        if(Record[MathTime] <= 0)
        {
            if(timeresult > Record[MathTime])
            {
                format(strg, sizeof(strg), "NEWRECORD: %s(%d) has made a new record for answering the Math for %i mileseconds", GetName(playerid), playerid, timeresult);
                SendClientMessageToAll(COLOR_YELLOW, strg);
                format(strg, sizeof(strg), "%s(%d) won $1,000 + 2 score for winning a new record!", GetName(playerid), playerid);
                SendClientMessageToAll(COLOR_YELLOW, strg);
                GivePlayerMoney(playerid, 1000);
                SetPlayerScore(playerid, GetPlayerScore(playerid) + 2);
                new INI:file = INI_Open("fungaming/Records/game.ini");
                INI_SetTag(file, "Game Record");
                INI_WriteString(file, "HolderMath", GetName(playerid));
                INI_WriteInt(file, "MathMilesecond", timeresult);
                INI_Close(file);
            }
        }
        else
        {
            if(timeresult > Record[MathTime])
            {
                format(strg, sizeof(strg), "NEWRECORD: %s(%d) has defeat %s's Math Record as answering the Math First for %i mileseconds", GetName(playerid), playerid, Record[HolderMath], timeresult);
                SendClientMessageToAll(COLOR_YELLOW, strg);
                format(strg, sizeof(strg), "%s(%d) won $2,000 + 4 score for winning a new record!", GetName(playerid), playerid);
                SendClientMessageToAll(COLOR_YELLOW, strg);
                format(strg, sizeof(strg), "RECORD: %s(%d) now holds the ''Faster Player To Answer Math'' Record, %s lose", GetName(playerid), playerid, Record[HolderMath]);
                SendClientMessageToAll(COLOR_ORANGE, strg);
                GivePlayerMoney(playerid, 2000);
                SetPlayerScore(playerid, GetPlayerScore(playerid) + 4);
                new INI:file = INI_Open("fungaming/Records/game.ini");
                INI_SetTag(file, "Game Record");
                INI_WriteString(file, "HolderMath", GetName(playerid));
                INI_WriteInt(file, "MathMilesecond", timeresult);
                INI_Close(file);
            }
        }
        format(strg, sizeof(strg), "MATH: %s(%d) won the Math Contest, He/She won the $3,000 + 5 score [ Answer: %d ] | MS: %i", GetName(playerid), playerid, answer, timeresult);
        SendClientMessageToAll(COLOR_LIME, strg);
        GivePlayerMoney(playerid, 3000);
        SetPlayerScore(playerid, GetPlayerScore(playerid) + 5);
        endm = 0;
        timeresult = 0;
        ReactionTest[0] = 0;
        ReactionTest[1] = 0;
        KillTimer(timer2[3]);
        return 0;
    }



Re: Math [Record System] - Threshold - 04.03.2013

pawn Код:
if(timeresult < Record[MathTime])
If I'm correct...??


Re: Math [Record System] - JaKe Elite - 04.03.2013

Thanks.
Rep++


Re: Math [Record System] - JaKe Elite - 08.03.2013

Another problem.
Now, it doesn't work please help me

pawn Код:
if(strval(text) == answer && endm == 1)
    {
        ReactionTest[1] = GetTickCount();
        new timeresult = ReactionTest[1] - ReactionTest[0];
        if(Record[MathTime] <= -1)
        {
            if(timeresult < Record[MathTime])
            {
                format(strg, sizeof(strg), "NEWRECORD: %s(%d) has made a new record for answering the Math for %i mileseconds", GetName(playerid), playerid, timeresult);
                SendClientMessageToAll(COLOR_YELLOW, strg);
                format(strg, sizeof(strg), "%s(%d) won $1,000 + 2 score for winning a new record!", GetName(playerid), playerid);
                SendClientMessageToAll(COLOR_YELLOW, strg);
                GivePlayerMoney(playerid, 1000);
                SetPlayerScore(playerid, GetPlayerScore(playerid) + 2);
                new INI:file = INI_Open("fungaming/Records/game.ini");
                INI_SetTag(file, "Game Record");
                INI_WriteString(file, "HolderMath", GetName(playerid));
                format(name, sizeof(name), "%s", GetName(playerid));
                Record[HolderMath] = name;
                Record[MathTime] = timeresult;
                INI_Close(file);
            }
        }
        else if(Record[MathTime] >= 1)
        {
            if(timeresult < Record[MathTime])
            {
                format(strg, sizeof(strg), "NEWRECORD: %s(%d) has break the record of %s as Fastest Player To Answer Math, answering the Math First for %i mileseconds", GetName(playerid), playerid, Record[HolderMath], timeresult);
                SendClientMessageToAll(COLOR_YELLOW, strg);
                format(strg, sizeof(strg), "%s(%d) won $2,000 + 4 score for winning a new record!", GetName(playerid), playerid);
                SendClientMessageToAll(COLOR_YELLOW, strg);
                format(strg, sizeof(strg), "RECORD: %s(%d) now holds the ''Fastest Player To Answer Math'' Record, %s lose", GetName(playerid), playerid, Record[HolderMath]);
                SendClientMessageToAll(COLOR_ORANGE, strg);
                GivePlayerMoney(playerid, 2000);
                SetPlayerScore(playerid, GetPlayerScore(playerid) + 4);
                new INI:file = INI_Open("fungaming/Records/game.ini");
                INI_SetTag(file, "Game Record");
                INI_WriteString(file, "HolderMath", GetName(playerid));
                format(name, sizeof(name), "%s", GetName(playerid));
                Record[HolderMath] = name;
                Record[MathTime] = timeresult;
                INI_Close(file);
            }
        }
        format(strg, sizeof(strg), "MATH: %s(%d) won the Math Contest, He/She won the $1,000 + 5 score [ Answer: %d ] | MS: %i", GetName(playerid), playerid, answer, timeresult);
        SendClientMessageToAll(COLOR_LIME, strg);
        GivePlayerMoney(playerid, 1000);
        SetPlayerScore(playerid, GetPlayerScore(playerid) + 5);
        endm = 0;
        timeresult = 0;
        ReactionTest[0] = 0;
        ReactionTest[1] = 0;
        KillTimer(timer2[3]);
        return 0;
    }
    if(!strcmp(Chars, text, false) && endr == 1)
    {
        ReactionTest[3] = GetTickCount();
        new timeresult = ReactionTest[3] - ReactionTest[2];
        if(Record[ReacTime] <= -1)
        {
            if(timeresult < Record[ReacTime])
            {
                format(strg, sizeof(strg), "NEWRECORD: %s(%d) has made a new record for answering the Typing Contest for %i mileseconds", GetName(playerid), playerid, timeresult);
                SendClientMessageToAll(COLOR_YELLOW, strg);
                format(strg, sizeof(strg), "%s(%d) won $1,000 + 2 score for winning a new record!", GetName(playerid), playerid);
                SendClientMessageToAll(COLOR_YELLOW, strg);
                GivePlayerMoney(playerid, 1000);
                SetPlayerScore(playerid, GetPlayerScore(playerid) + 2);
                new INI:file = INI_Open("fungaming/Records/game.ini");
                INI_SetTag(file, "Game Record");
                INI_WriteString(file, "HolderReac", GetName(playerid));
                format(name, sizeof(name), "%s", GetName(playerid));
                Record[HolderReac] = name;
                Record[ReacTime] = timeresult;
                INI_Close(file);
            }
        }
        else if(Record[MathTime] >= 1)
        {
            if(timeresult < Record[MathTime])
            {
                format(strg, sizeof(strg), "NEWRECORD: %s(%d) has break the record of %s as Fastest Player To Type, typing the Type Contest as first for %i mileseconds", GetName(playerid), playerid, Record[HolderMath], timeresult);
                SendClientMessageToAll(COLOR_YELLOW, strg);
                format(strg, sizeof(strg), "%s(%d) won $2,000 + 4 score for winning a new record!", GetName(playerid), playerid);
                SendClientMessageToAll(COLOR_YELLOW, strg);
                format(strg, sizeof(strg), "RECORD: %s(%d) now holds the ''Fastest Player To Type'' Record, %s lose", GetName(playerid), playerid, Record[HolderMath]);
                SendClientMessageToAll(COLOR_ORANGE, strg);
                GivePlayerMoney(playerid, 2000);
                SetPlayerScore(playerid, GetPlayerScore(playerid) + 4);
                new INI:file = INI_Open("fungaming/Records/game.ini");
                INI_SetTag(file, "Game Record");
                INI_WriteString(file, "HolderReac", GetName(playerid));
                format(name, sizeof(name), "%s", GetName(playerid));
                Record[HolderReac] = name;
                Record[ReacTime] = timeresult;
                INI_Close(file);
            }
        }
        format(strg, sizeof(strg), "TYPING: %s(%d) won the Typing Contest, He/She won the $1,000 + 5 score | MS: %i", GetName(playerid), playerid, timeresult);
        SendClientMessageToAll(COLOR_LIME, strg);
        GivePlayerMoney(playerid, 3000);
        SetPlayerScore(playerid, GetPlayerScore(playerid) + 5);
        endr = 0;
        timeresult = 0;
        ReactionTest[2] = 0;
        ReactionTest[3] = 0;
        KillTimer(timer2[6]);
        return 0;
    }
And also is this working i think not.

pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    new str[128];
    if(pickupid == Pickup[0])
    {
        if(InP[playerid] == 1)
        {
            if(Record[ParkourTime] == -1)
            {
                TimeParkour[1] = GetTickCount();
                new t = TimeParkour[1] - TimeParkour[0];
                if(t < Record[ParkourTime])
                {
                    format(strg, sizeof(strg), "RECORD: %s(%d) has create new record for ''Fastest Player To Finish Parkour 1''", GetName(playerid), playerid);
                    SendClientMessageToAll(COLOR_YELLOW, strg);
                    format(strg, sizeof(strg), "%s(%d) won $1,000 + 2 score", GetName(playerid), playerid);
                    SendClientMessage(playerid, COLOR_ORANGE, strg);
                    GivePlayerMoney(playerid, 1000);
                    SetPlayerScore(playerid, GetPlayerScore(playerid) + 2);
                    new INI:file = INI_Open("fungaming/Records/game.ini");
                    INI_SetTag(file, "Game Record");
                    INI_WriteString(file, "HolderParkour", GetName(playerid));
                    INI_Close(file);
                    Record[ParkourTime] = t;
                    format(strg, sizeof(strg), ""red"Holder: "white"%s\n"yellow"Milesecond: "white"%i\nParkour 1", Record[HolderParkour], Record[ParkourTime]);
                    Update3DTextLabelText(Labels[0], -1, strg);
                    t = 0;
                }
            }
            else if(Record[ParkourTime] >= 1)
            {
                TimeParkour[1] = GetTickCount();
                new t = TimeParkour[1] - TimeParkour[0];
                if(t < Record[ParkourTime])
                {
                    format(strg, sizeof(strg), "RECORD: %s(%d) now holds the ''Fastest Player To Finish Parkour 1'' defeating %s's old record", GetName(playerid), playerid, Record[HolderParkour]);
                    SendClientMessageToAll(COLOR_YELLOW, strg);
                    format(strg, sizeof(strg), "%s(%d) won $2,000 + 4 score", GetName(playerid), playerid);
                    SendClientMessage(playerid, COLOR_ORANGE, strg);
                    GivePlayerMoney(playerid, 2000);
                    SetPlayerScore(playerid, GetPlayerScore(playerid) + 4);
                    new INI:file = INI_Open("fungaming/Records/game.ini");
                    INI_SetTag(file, "Game Record");
                    INI_WriteString(file, "HolderParkour", GetName(playerid));
                    INI_Close(file);
                    Record[ParkourTime] = t;
                    format(strg, sizeof(strg), ""red"Holder: "white"%s\n"yellow"Milesecond: "white"%i\nParkour 1", Record[HolderParkour], Record[ParkourTime]);
                    Update3DTextLabelText(Labels[0], -1, strg);
                    t = 0;
                }
            }
            SetPlayerScore(playerid, GetPlayerScore(playerid) + 5);
            GivePlayerMoney(playerid, 4000);
            format(str, sizeof(str), "[Parkour]: %s(%d) has finished the Parkour!", GetName(playerid), playerid);
            SendClientMessageToAll(COLOR_LIME, str);
            SendClientMessage(playerid, COLOR_YELLOW, "[Finished]: You finished the Parkour, Received $4,000 + 5 score!");
            GameTextForPlayer(playerid, "~w~Parkour ~g~Finished~n~~n~~w~Reward: ~g~$4,000 ~w~+ ~g~5+ ~w~score", 5000, 3);
            if(God[playerid][1] == 0)
            {
                TextDrawHideForPlayer(playerid, Textdraw4);
                TextDrawShowForPlayer(playerid, Textdraw5);
                SetPlayerHealth(playerid, 100.0);
                SetPlayerArmour(playerid, 100.0);
            }
            SpawnPlayer(playerid);
            InP[playerid] = 0;
        }
        else if(InP[playerid] <= 1)
        {
            SendClientMessage(playerid, COLOR_RED, "[Error]: You are not Parkouring, You cheat, You cannot get the reward!");
        }
    }
    if(pickupid == Pickup[1])
    {
        if(InP[playerid] == 2)
        {
            if(Record[ParkourCTime] == -1)
            {
                TimeParkour[3] = GetTickCount();
                new t = TimeParkour[3] - TimeParkour[2];
                if(t < Record[ParkourCTime])
                {
                    format(strg, sizeof(strg), "RECORD: %s(%d) has create new record for ''Fastest Player To Finish Parkour City''", GetName(playerid), playerid);
                    SendClientMessageToAll(COLOR_YELLOW, strg);
                    format(strg, sizeof(strg), "%s(%d) won $1,000 + 2 score", GetName(playerid), playerid);
                    SendClientMessage(playerid, COLOR_ORANGE, strg);
                    GivePlayerMoney(playerid, 1000);
                    SetPlayerScore(playerid, GetPlayerScore(playerid) + 2);
                    new INI:file = INI_Open("fungaming/Records/game.ini");
                    INI_SetTag(file, "Game Record");
                    INI_WriteString(file, "HolderParkour2", GetName(playerid));
                    INI_Close(file);
                    Record[Parkour2Time] = t;
                    format(strg, sizeof(strg), ""red"Holder: "white"%s\n"yellow"Milesecond: "white"%i\nParkour City", Record[HolderParkourC], Record[ParkourCTime]);
                    Update3DTextLabelText(Labels[1], -1, strg);
                    t = 0;
                }
            }
            else if(Record[ParkourCTime] >= 1)
            {
                TimeParkour[3] = GetTickCount();
                new t = TimeParkour[3] - TimeParkour[2];
                if(t < Record[ParkourCTime])
                {
                    format(strg, sizeof(strg), "RECORD: %s(%d) now holds the ''Fastest Player To Finish Parkour City'' defeating %s's old record", GetName(playerid), playerid, Record[HolderParkour]);
                    SendClientMessageToAll(COLOR_YELLOW, strg);
                    format(strg, sizeof(strg), "%s(%d) won $2,000 + 4 score", GetName(playerid), playerid);
                    SendClientMessage(playerid, COLOR_ORANGE, strg);
                    GivePlayerMoney(playerid, 2000);
                    SetPlayerScore(playerid, GetPlayerScore(playerid) + 4);
                    new INI:file = INI_Open("fungaming/Records/game.ini");
                    INI_SetTag(file, "Game Record");
                    INI_WriteString(file, "HolderParkour2", GetName(playerid));
                    INI_Close(file);
                    Record[Parkour2Time] = t;
                    format(strg, sizeof(strg), ""red"Holder: "white"%s\n"yellow"Milesecond: "white"%i\nParkour City", Record[HolderParkourC], Record[ParkourCTime]);
                    Update3DTextLabelText(Labels[1], -1, strg);
                    t = 0;
                }
            }
            SetPlayerScore(playerid, GetPlayerScore(playerid) + 5);
            GivePlayerMoney(playerid, 4000);
            format(str, sizeof(str), "[Parkour]: %s(%d) has finished the Parkour City!", GetName(playerid), playerid);
            SendClientMessageToAll(COLOR_LIME, str);
            SendClientMessage(playerid, COLOR_YELLOW, "[Finished]: You finished the Parkour City, Received $4,000 + 5 score!");
            GameTextForPlayer(playerid, "~w~Parkour City ~g~Finished~n~~n~~w~Reward: ~g~$4,000 ~w~+ ~g~5+ ~w~score", 6500, 3);
            SetPlayerVirtualWorld(playerid, 0);
            ResetPlayerWeapons(playerid);
            if(God[playerid][1] == 0)
            {
                TextDrawHideForPlayer(playerid, Textdraw4);
                TextDrawShowForPlayer(playerid, Textdraw5);
                SetPlayerHealth(playerid, 100.0);
                SetPlayerArmour(playerid, 100.0);
            }
            SpawnPlayer(playerid);
            InP[playerid] = 0;
        }
        else if(InP[playerid] <= 2)
        {
            SendClientMessage(playerid, COLOR_RED, "[Error]: You are not Parkouring, You cheat, You cannot get the reward!");
        }
    }
    if(pickupid == Pickup[2])
    {
        if(InP[playerid] == 1)
        {
            SendClientMessage(playerid, COLOR_YELLOW, "Jump, and go to the ground to exit!");
            GameTextForPlayer(playerid, "~w~Parachute Received!", 3000, 3);
            GivePlayerWeapon(playerid, 46, 1);
            SetPlayerVirtualWorld(playerid, 0);
        }
    }
    if(pickupid == Pickup[3])
    {
        if(InP[playerid] == 3)
        {
            if(Record[ParkourTTime] == -1)
            {
                TimeParkour[7] = GetTickCount();
                new t = TimeParkour[7] - TimeParkour[6];
                if(t < Record[ParkourTTime])
                {
                    format(strg, sizeof(strg), "RECORD: %s(%d) has create new record for ''Fastest Player To Finish Parkour Tower''", GetName(playerid), playerid);
                    SendClientMessageToAll(COLOR_YELLOW, strg);
                    format(strg, sizeof(strg), "%s(%d) won $1,000 + 2 score", GetName(playerid), playerid);
                    SendClientMessage(playerid, COLOR_ORANGE, strg);
                    GivePlayerMoney(playerid, 1000);
                    SetPlayerScore(playerid, GetPlayerScore(playerid) + 2);
                    new INI:file = INI_Open("fungaming/Records/game.ini");
                    INI_SetTag(file, "Game Record");
                    INI_WriteString(file, "HolderParkourT", GetName(playerid));
                    INI_Close(file);
                    Record[ParkourTTime] = t;
                    format(strg, sizeof(strg), ""red"Holder: "white"%s\n"yellow"Milesecond: "white"%i\nParkour Tower", Record[HolderParkourT], Record[ParkourTTime]);
                    Update3DTextLabelText(Labels[3], -1, strg);
                    t = 0;
                }
            }
            else if(Record[ParkourTTime] >= 1)
            {
                TimeParkour[7] = GetTickCount();
                new t = TimeParkour[7] - TimeParkour[6];
                if(t < Record[ParkourTTime])
                {
                    format(strg, sizeof(strg), "RECORD: %s(%d) now holds the ''Fastest Player To Finish Parkour Tower'' defeating %s's old record", GetName(playerid), playerid, Record[HolderParkourT]);
                    SendClientMessageToAll(COLOR_YELLOW, strg);
                    format(strg, sizeof(strg), "%s(%d) won $2,000 + 4 score", GetName(playerid), playerid);
                    SendClientMessage(playerid, COLOR_ORANGE, strg);
                    GivePlayerMoney(playerid, 2000);
                    SetPlayerScore(playerid, GetPlayerScore(playerid) + 4);
                    new INI:file = INI_Open("fungaming/Records/game.ini");
                    INI_SetTag(file, "Game Record");
                    INI_WriteString(file, "HolderParkourT", GetName(playerid));
                    INI_Close(file);
                    Record[ParkourTTime] = t;
                    format(strg, sizeof(strg), ""red"Holder: "white"%s\n"yellow"Milesecond: "white"%i\nParkour Tower", Record[HolderParkourT], Record[ParkourTTime]);
                    Update3DTextLabelText(Labels[3], -1, strg);
                    t = 0;
                }
            }
            SetPlayerScore(playerid, GetPlayerScore(playerid) + 5);
            GivePlayerMoney(playerid, 4000);
            format(str, sizeof(str), "[Parkour]: %s(%d) has finished the Parkour Tower!", GetName(playerid), playerid);
            SendClientMessageToAll(COLOR_LIME, str);
            SendClientMessage(playerid, COLOR_YELLOW, "[Finished]: You finished the Parkour Tower, Received $4,000 + 5 score!");
            GameTextForPlayer(playerid, "~w~Parkour Tower ~g~Finished~n~~n~~w~Reward: ~g~$4,000 ~w~+ ~g~5+ ~w~score", 6500, 3);
            if(God[playerid][1] == 0)
            {
                TextDrawHideForPlayer(playerid, Textdraw4);
                TextDrawShowForPlayer(playerid, Textdraw5);
                SetPlayerHealth(playerid, 100.0);
                SetPlayerArmour(playerid, 100.0);
            }
            SpawnPlayer(playerid);
            InP[playerid] = 0;
        }
        else if(InP[playerid] <= 3)
        {
            SendClientMessage(playerid, COLOR_RED, "[Error]: You are not Parkouring, You cheat, You cannot get the reward!");
        }
    }
    if(pickupid == Pickup[4])
    {
        if(InP[playerid] == 4)
        {
            if(Record[Parkour2Time] == -1)
            {
                TimeParkour[5] = GetTickCount();
                new t = TimeParkour[5] - TimeParkour[4];
                if(t < Record[Parkour2Time])
                {
                    format(strg, sizeof(strg), "RECORD: %s(%d) has create new record for ''Fastest Player To Finish Parkour 2''", GetName(playerid), playerid);
                    SendClientMessageToAll(COLOR_YELLOW, strg);
                    format(strg, sizeof(strg), "%s(%d) won $1,000 + 2 score", GetName(playerid), playerid);
                    SendClientMessage(playerid, COLOR_ORANGE, strg);
                    GivePlayerMoney(playerid, 1000);
                    SetPlayerScore(playerid, GetPlayerScore(playerid) + 2);
                    new INI:file = INI_Open("fungaming/Records/game.ini");
                    INI_SetTag(file, "Game Record");
                    INI_WriteString(file, "HolderParkourC", GetName(playerid));
                    INI_Close(file);
                    Record[ParkourCTime] = t;
                    format(strg, sizeof(strg), ""red"Holder: "white"%s\n"yellow"Milesecond: "white"%i\nParkour 2", Record[HolderParkour2], Record[Parkour2Time]);
                    Update3DTextLabelText(Labels[2], -1, strg);
                    t = 0;
                }
            }
            else if(Record[Parkour2Time] >= 1)
            {
                TimeParkour[5] = GetTickCount();
                new t = TimeParkour[5] - TimeParkour[4];
                if(t < Record[Parkour2Time])
                {
                    format(strg, sizeof(strg), "RECORD: %s(%d) now holds the ''Fastest Player To Finish Parkour 2'' defeating %s's old record", GetName(playerid), playerid, Record[HolderParkour2]);
                    SendClientMessageToAll(COLOR_YELLOW, strg);
                    format(strg, sizeof(strg), "%s(%d) won $2,000 + 4 score", GetName(playerid), playerid);
                    SendClientMessage(playerid, COLOR_ORANGE, strg);
                    GivePlayerMoney(playerid, 2000);
                    SetPlayerScore(playerid, GetPlayerScore(playerid) + 4);
                    new INI:file = INI_Open("fungaming/Records/game.ini");
                    INI_SetTag(file, "Game Record");
                    INI_WriteString(file, "HolderParkourC", GetName(playerid));
                    INI_Close(file);
                    Record[ParkourCTime] = t;
                    format(strg, sizeof(strg), ""red"Holder: "white"%s\n"yellow"Milesecond: "white"%i\nParkour 2", Record[HolderParkour2], Record[Parkour2Time]);
                    Update3DTextLabelText(Labels[2], -1, strg);
                    t = 0;
                }
            }
            SetPlayerScore(playerid, GetPlayerScore(playerid) + 5);
            GivePlayerMoney(playerid, 4000);
            format(str, sizeof(str), "[Parkour]: %s(%d) has finished the Parkour 2!", GetName(playerid), playerid);
            SendClientMessageToAll(COLOR_LIME, str);
            SendClientMessage(playerid, COLOR_YELLOW, "[Finished]: You finished the Parkour 2, Received $4,000 + 5 score!");
            GameTextForPlayer(playerid, "~w~Parkour 2 ~g~Finished~n~~n~~w~Reward: ~g~$4,000 ~w~+ ~g~5+ ~w~score", 6500, 3);
            if(God[playerid][1] == 0)
            {
                TextDrawHideForPlayer(playerid, Textdraw4);
                TextDrawShowForPlayer(playerid, Textdraw5);
                SetPlayerHealth(playerid, 100.0);
                SetPlayerArmour(playerid, 100.0);
            }
            SpawnPlayer(playerid);
            InP[playerid] = 0;
        }
        else if(InP[playerid] <= 4)
        {
            SendClientMessage(playerid, COLOR_RED, "[Error]: You are not Parkouring, You cheat, You cannot get the reward!");
        }
    }
    return 1;
}



Re: Math [Record System] - RajatPawar - 08.03.2013

Why are you using an array Reactiontest[1]? Just use a var ! I know, though, that it's the same as a var (taking in account the NULL character, but anyways!)
Also, I would request you to cut short the code a bit, no one quite has the time to go through the whole code! Debug and show the parts where you feel the problem is! Cheers


Re: Math [Record System] - JaKe Elite - 09.03.2013

I got this from Kostas's Reaction Contest.
But base on it.
The array 0 get's the tick count when the contest start (timer).
Then the array 1 get's the tick count of player's answer milesecond.

Both of the array will be subtracted and will be stored in the var that i created.
Then it will be saved in the files.