SA-MP Forums Archive
problem with check (+rep) - 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: problem with check (+rep) (/showthread.php?tid=521585)



problem with check (+rep) - ScripteRMKD - 23.06.2014

Hello guys..I have problem with karting system.I maked a map and right now i maked /kupikarta (/buyticket) command and right now he giving a random number of karting and right now how can i make if any player get ex. number 3 to not fall again on other player number 3.HOw can i maked it ?

Command:

pawn Код:
if(strcmp(cmdtext, "/kupikarta", true) == 0)
    {
        KartingRandom[playerid] = random(6);
        SCMF(playerid, COLOR_WHITE, "{00C0FF}[INFO]{FFFFFF} Kupivte karting karta, plativte 150$, vlezete vo karting broj %d", KartingRandom[playerid]);
        GivePlayerMoney(playerid, -150);
        KartingBroj[playerid] = KartingRandom[playerid];
        KartingKarta[playerid] = 1;
    }



Re: problem with check (+rep) - ScripteRMKD - 23.06.2014

bump please help guys


Re: problem with check (+rep) - GeekSiMo - 23.06.2014

Check a lotto system, it may have this !!


Re: problem with check (+rep) - ScripteRMKD - 23.06.2014

i dont have this in my game mod :/


Re: problem with check (+rep) - Juvanii - 23.06.2014

I think this will work!
pawn Код:
if(strcmp(cmdtext, "/kupikarta", true) == 0)
{
    new ticketnum, string[128];
    ticketnum = random(6);
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && ticketnum == KartingRandom[i])
        {
            ticketnum = KartingRandom[i] - 1;
            format(string, sizeof(string),"{00C0FF}[INFO]{FFFFFF} Kupivte karting karta, plativte 150$, vlezete vo karting broj %d.", ticketnum);
            SendClientMessage(playerid, COLOR_RED, string);
            KartingRandom[playerid] = ticketnum;
            GivePlayerMoney(playerid, -150);
            KartingBroj[playerid] = KartingRandom[playerid];
            KartingKarta[playerid] = 1;
            return 1;
        }
    }
    format(string, sizeof(string),"{00C0FF}[INFO]{FFFFFF} Kupivte karting karta, plativte 150$, vlezete vo karting broj %d.", ticketnum);
    SendClientMessage(playerid, COLOR_RED, string);
    KartingRandom[playerid] = ticketnum;
    GivePlayerMoney(playerid, -150);
    KartingBroj[playerid] = KartingRandom[playerid];
    KartingKarta[playerid] = 1;
    return 1;
}



Re: problem with check (+rep) - ScripteRMKD - 23.06.2014

ok i will test this now ..


Re: problem with check (+rep) - ScripteRMKD - 24.06.2014

Thanks you @Juavanii in which is the problem ? Btw your code is working

EDIT: repped


Re: problem with check (+rep) - Juvanii - 05.07.2014

Quote:
Originally Posted by ScripteRMKD
Посмотреть сообщение
Thanks you @Juavanii in which is the problem ? Btw your code is working

EDIT: repped
You must loop all the players first to check if somebody has the same ticket number that the new player would take.


Re: problem with check (+rep) - ScripteRMKD - 05.07.2014

i say its fixed omg


Re: problem with check (+rep) - Juvanii - 05.07.2014

Quote:
Originally Posted by ScripteRMKD
Посмотреть сообщение
i say its fixed omg
i know that it's fixed -.-'
but you just said "what was the problem in it" and i'm telling you omg

Quote:
Originally Posted by ScripteRMKD
Посмотреть сообщение
which is the problem ?