Jump to content
  • 0

Job goal


TheGodfather

Question

Salut, as vrea ca dupa restart sa imi puna valoarea pe care a avut-o job goal-ul inainte de restart. Job goal-ul se salveaza bine in baza de date de fiecare data cand un player face job. Doar ca atunci cand pornesc server-ul din nou o sa aiba valoarea 0.

function UpdateJobGoal(update) {
    ServerGoal += update;
    gString[0] = EOS;
    format(gString, 60, "~y~$%s ~w~/ ~r~$%s", ServerGoal >= MAXGOAL ? FormatNumbers(MAXGOAL) : FormatNumbers(ServerGoal), FormatNumbers(MAXGOAL));
    TextDrawSetString(GoalTD[0], gString);

    if(TerminatJobGoal != 1) {
        //goal
        gQuery[0] = EOS;
        mysql_format(SQL, gQuery, sizeof(gQuery), "UPDATE `stuff` SET `goal`='%d'", ServerGoal);
        mysql_tquery(SQL, gQuery, "", "");
        //goal
        if(ServerGoal >= MAXGOAL) {
            foreach(Player, b) {
                new amount, rand = random(30);
                switch(rand) {
                    case 0..10: {
                        amount = RandomEx(50, 100);
                        format(gString, 100, "Job Goal: {FFFFFF}Congratulations! You received %d Gift Points because the job goal is full.", amount);
                        SCM(b, 0xF5C738FF, gString);
                        PlayerInfo[b][pGiftPoints] += amount;
                        if(PlayerInfo[b][pGiftPoints] >= 500) PlayerInfo[b][pGiftPoints] = 500;
                        Update(b, pGiftPointsx);        
                    }
                    case 11..19: {
                        amount = RandomEx(15, 30);
                        format(gString, 100, "Job Goal: {FFFFFF}Congratulations! You received %d Premium Points because the job goal is full.", amount);
                        SCM(b, 0xF5C738FF, gString);
                        PlayerInfo[b][pPremiumPoints] += amount;
                        Update(b, pPremiumPointsx);        
                    }
                    default: {
                        amount = RandomEx(200, 300);
                        format(gString, 100, "Job Goal: {FFFFFF}Congratulations! You received %d Q-Points because the job goal is full.", amount);
                        SCM(b, 0xF5C738FF, gString);
                        PlayerInfo[b][pHpoints] += amount;
                        Update(b, pHpointsx);
                    }
                }
            }
            TerminatJobGoal = 1;
        }
    }
    return true;
}

GoalTD[0] este definit astfel in Booter.inc

GoalTD[0] = TextDrawCreate(320.281829, 435.829803, "~y~$0~w~ /~g~ $50.000.000");

Goal-ul se salveaza aici: stuff - goal

image.thumb.png.672d8560d9dc48d05c6ebda20d312d48.png

 

Edited by TheGodfather
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.