adding variable to cmd so u cant use it.. again
#1

How do i add a variable to this script witch gives them an else "you can only try once!" ?

Here is script..

pawn Код:
if (strcmp("/lotto", cmd, true) == 0)
    {
        new tmp[256], cmdid, string[256], pname[MAX_PLAYER_NAME];
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) return SendClientMessage(playerid, red, "USAGE: /Lotto (number)");
        cmdid = strval(tmp);

        if(cmdid < answer || cmdid > answer)
        {
            SendClientMessage(playerid, red, "Not a winner! bummer! 15000$ Has been taken for the lotto ticket!");
            GivePlayerMoney(playerid, -15000);
        }
       
        if(cmdid == answer && answered == 0)
        {
        new RandomCash = random(125000)+25000;
        new month, day, year;
        getdate(year, month, day);
        GetPlayerName(playerid, pname, sizeof(pname));
        format(string, sizeof(string), "%s has won $%d from the lottery! Winning Number: %d !", pname,GetPlayersOnline() + RandomCash,cmdid);
        SendClientMessageToAll(green, string);
        print(string);
        new File:mw = fopen("lottowins.txt", io_append);
        format(string, sizeof string, "%s Has won $%d On %d/%d/%d from lotto! Winning Number: %d--\r\n",pname,GetPlayersOnline() + RandomCash,month,day,year,score,cmdid);
        fwrite(mw, string);
        fclose(mw);

            answered = 1;
            SetPlayerScore(playerid, GetPlayerScore(playerid) + score);
            GivePlayerMoney(playerid, GetPlayersOnline() + RandomCash);
            score = 0;
            //money = 0;
            return 1;
        }
        else if(cmdid == answer && answered == 1)
        {
            SendClientMessage(playerid, red, "Lotto has already been won!");
        }
        return 1;
    }
Trying to make a lotto script!

But i dont want them guessing the lotto number spamming the command like..

/lotto 1
/lotto 2
/lotto 3

and so on..
Reply
#2

could u add a timer or disable the command for so long...
or even better when they use the command it disables it.
then when the lotto goes off it re in ables it ...

as a idea.
Reply
#3

yes.. i want it to disable the command for them untill it re-calls the lotto..
Reply
#4

then use a enum or something >.>

then when they use the command have it set it to = 1
and when the lotto goes off have it set it for everyplayer connected = 0
and if the player has it set to = 1 then have it return something
Ex return SendClientMessage(playerid, COLOR, "Error: you can only use the lotto once per round");
Reply
#5

thx blabla i got it workin
Reply
#6

no problem

im a small clucker but im not and idiot xD
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)