problem with check (+rep)
#1

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;
    }
Reply
#2

bump please help guys
Reply
#3

Check a lotto system, it may have this !!
Reply
#4

i dont have this in my game mod :/
Reply
#5

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;
}
Reply
#6

ok i will test this now ..
Reply
#7

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

EDIT: repped
Reply
#8

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.
Reply
#9

i say its fixed omg
Reply
#10

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 ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)