Jump to content

Problema JobGoalMoney


BaDB0y95

Recommended Posts

Deci daca setez din comanda apare in joc suma care o pun cand face jucatorul se pune la job doar ca la repornire server o ia de la 0 plus ca daca setez suma nu se modifica in stuff - goal

mai exact daca dau restart la server nu ramane salvat ca si cum nu ar citi de acolo nu stiu ce sa fie

 

YCMD:setjobgoalmoney(playerid, params[], help) {
    if(PlayerInfo[playerid][pScripter] < 1) return SCM(playerid, COLOR_RED, "Eroare: {FFFFF}Nu ai acces la aceasta comanda!");
    new amount, string[64];
    if(sscanf(params, "i", amount)) return SCM(playerid, COLOR_GREY, "Syntax: {FFFFFF}/setjobgoalmoney <amount>");
    UpdateJobGoal( amount );
    format(string, sizeof(string), "Ai adaugat %s$ la job goal.", FormatNumbers(amount));
    SCM(playerid, COLOR_YELLOW, string);
    return true; }

 

 

 

 

Discord: BaDB0y#3017

Link to comment
Share on other sites

On 7/10/2021 at 12:24 PM, Banditul said:

Arata si UpdateJobGoal pentru ca in comanda nu ai query de update. Eventual arata si cum incarci valoarea din baza de date

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

    if(TerminatJobGoal != 1) {
        if(ServerGoal >= MAXGOAL) {
            foreach(Player, b) {
                new amount, rand = random(30);
                switch(rand) {
                    case 0..10: {
                        amount = RandomEx(200, 400);
                        format(gString, 100, "Job Goal: {FFFFFF}Felicitari! Ai primit %d Gift Points pentru ca s-a umplut golul.", amount);
                        SCM(b, 0xF5C738FF, gString);
                        PlayerInfo[b][pGiftPoints] += amount;
                        if(PlayerInfo[b][pGiftPoints] >= 1000) PlayerInfo[b][pGiftPoints] = 1000;
                        Update(b, pGiftPointsx);        
                    }
                    case 11..19: {
                        amount = RandomEx(15, 30);
                        format(gString, 100, "Job Goal: {FFFFFF}Felicitari! Ai primit %d Premium Points pentru ca s-a umplut golul.", amount);
                        SCM(b, 0xF5C738FF, gString);
                        PlayerInfo[b][pPremiumPoints] += amount;
                        Update(b, pPremiumPointsx);        
                    }
                    default: {
                        amount = RandomEx(200, 350);
                        format(gString, 100, "Job Goal: {FFFFFF}Felicitari! Ai primit %d DPoints pentru ca s-a umplut golul.", amount);
                        SCM(b, 0xF5C738FF, gString);
                        PlayerInfo[b][pCPoints] += amount;
                        Update(b, pCPointsx);
                    }
                }
            }
            TerminatJobGoal = 1;
        }
    }
    return true; }

 

YCMD:resetgoal(playerid, params[], help) {
    if( PlayerInfo[ playerid ][ pAdmin ] < 7 )
    return SCM( playerid, COLOR_LGREEN, AdminOnly );
    ServerGoal = 0; TerminatJobGoal = 0;
    UpdateJobGoal( 0 );
    SCMTA( COLOR_YELLOW, "* Goal-ul a fost resetat de catre un administrator." );
    mysql_tquery(SQL, "UPDATE `stuff` SET `goal`='0'", "", "");
    return true; }

 

UpdateJobGoal(TotalMoneyy);

 

new totalmony;
                    GiveJobSalary(playerid);
                    UpdateJobGoal(totalmony + fishing);
                    GivePlayerCash(playerid, 1, fishing + totalmony);

 

asta e tot ce am gasit in gamemod de updatejobgoal

 

Discord: BaDB0y#3017

Link to comment
Share on other sites

Poti face un query la aceasta functie cu salvarea datelor ori la OnGamemodeExit.

mysql_format(SQL, gQuery, sizeof gQuery, "UPDATE `stuff` SET `goal`='%i", ServerGoal);
mysql_tquery(SQL, gQuery);

 

Edited by HPQ123
Link to comment
Share on other sites

2 hours ago, HPQ123 said:

Poti face un query la aceasta functie cu salvarea datelor ori la OnGamemodeExit.

mysql_format(SQL, gQuery, sizeof gQuery, "UPDATE `stuff` SET `goal`='%i", ServerGoal);
mysql_tquery(SQL, gQuery);

 

asta e tot ce am la ongamemodeexit

 public OnGameModeExit() {
    DestroyActor(SpawnActor);
    DestroyActor(actorbar1);
    DestroyActor(actorconvertor);
    gQuery[0] = EOS;
    mysql_format(SQL, gQuery, sizeof(gQuery), "UPDATE `stuff` SET `goal`='%d'", ServerGoal);
    mysql_tquery(SQL, gQuery, "", "");
    save_stock();
    return true; }

 

Discord: BaDB0y#3017

Link to comment
Share on other sites

1 hour ago, BaDB0y95 said:

asta e tot ce am la ongamemodeexit

 public OnGameModeExit() {
    DestroyActor(SpawnActor);
    DestroyActor(actorbar1);
    DestroyActor(actorconvertor);
    gQuery[0] = EOS;
    mysql_format(SQL, gQuery, sizeof(gQuery), "UPDATE `stuff` SET `goal`='%d'", ServerGoal);
    mysql_tquery(SQL, gQuery, "", "");
    save_stock();
    return true; }

pai ca sa se apeleze acest callback trebuie sa dai restart din joc, daca dai restart din gamecp sau opresti server-ul nu se v-a apela.

Link to comment
Share on other sites

Join the conversation

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

Guest
Reply to this topic...

×   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.