Jump to content
  • 0

Payday individual problema


AndyAdv

Question

Cand intru pe server imi da payday chiar daca eu nu am 0 la PayDayIn. Si nu stiu ce are.

Code:

ptask payday[1000](playerid) 
    {
    new hour,minn,sec;
    gettime(hour,minn,sec);
    if(PlayerInfo[playerid][pSleeping] == 0 && Spectate[playerid] == 255 && AFKSeconds[playerid] < 15)
    if(PlayerInfo[playerid][pPayDayIn] < 1) {
        new string[128];
        new interest,account[MAX_PLAYERS];

        new rent[MAX_PLAYERS];
        SetTimer("ScadeLicentele", 4000, false);
        new key = PlayerInfo[playerid][pHouse];
        if(key != 999)
        {
            rent[playerid] = HouseInfo[key][hRent];
            HouseInfo[key][hTakings] += rent[playerid];
        }
        new tmpintrate;
        SendClientMessage(playerid, -1, "{2b46e2}-------------------------------------------------------------------------------------------------------------{FFFFFF}");
        if(PlayerInfo[playerid][pPremiumAccount] == 1)
        {
            tmpintrate = 2;
            PlayerInfo[playerid][pPayDayHad] += 1;
            if(PlayerInfo[playerid][pPayDayHad] >= 5) {
                PlayerInfo[playerid][pExp]++;
                PlayerInfo[playerid][pPayDayHad] = 0;
            }
            new bonus = PlayerInfo[playerid][pPayCheck] / 2;
            PlayerInfo[playerid][pPayCheck] += bonus;
        }
        else
        {
            tmpintrate = 1;
        }
        account[playerid] = PlayerInfo[playerid][pAccount];
        Tax += TaxValue;
        
        //PlayerInfo[playerid][pAccount] -= TaxValue;
        new checks = PlayerInfo[playerid][pLevel]*2500+random(3000);
        if(PlayerInfo[playerid][pDailyLogin] == 0) checks = checks*2;          
        GivePlayerCash(playerid, checks);
        interest = (PlayerInfo[playerid][pAccount]/5000)*(tmpintrate);
        if(PlayerInfo[playerid][pDailyLogin] == 0) interest = interest*2;
        if(PlayerInfo[playerid][pDailyLogin] == 0) PlayerInfo[playerid][pExp] += 100;
        else PlayerInfo[playerid][pExp] += 200;
        UpdateProgress(playerid, 0);
        PlayerInfo[playerid][pAccount] += interest+1000;           
        SendClientMessage(playerid, -1, "Ai primit o ora jucata.");
        PlayerInfo[playerid][pConnectTime] += 1;
        format(string, sizeof(string), "UPDATE `users` SET `DayHours`=`DayHours`+1 WHERE `ID`='%d'", PlayerInfo[playerid][pSQLID]);
        mysql_query(SQL, string);
        format(string, sizeof(string), "UPDATE `users` SET `HoursMonth`=`HoursMonth`+1 WHERE `ID`='%d'", PlayerInfo[playerid][pSQLID]);
        mysql_query(SQL, string);
        PlayerInfo[playerid][pSeconds] = 0;
        
        if(PlayerInfo[playerid][pDailyLogin] == 0) {
            PlayerInfo[playerid][pDailyLogin] = 1;
            UpdateVar(playerid, "DailyLogin", 1);
            SCM(playerid, -1, "You got +100 experience points because it's your first payday from this day.");
        }   
        PlayerInfo[playerid][pPayDay] = 0;
        PlayerInfo[playerid][pPayCheck] = 0;
        PlayerInfo[playerid][pPayDayIn] = 3600;
        PlayerInfo[playerid][pSpinPoints] += 1;
        PlayerInfo[playerid][pPetPoints] += 15;
        PlayerInfo[playerid][pLSTPoints] += 5;
        format(string, sizeof(string), "Paycheck (without taxes): %s $  | Experience earned: 200.", FormatNumber(checks));
        SendClientMessage(playerid, -1, string);
        format(string, sizeof(string), "Visit bank if you want to withdraw your money.");
        SendClientMessage(playerid, -1, "{FFFFFF}Ai primit 1 Spin Point{FFFFFF}");
        SendClientMessage(playerid, -1, "{FFFFFF}Ai primit 15 Pet Points{FFFFFF}");
        SendClientMessage(playerid, -1, "{8A2BE2}LST Points:{FFFFFF}Ai primit 5 LST Points");
        SendClientMessage(playerid, -1, string);                                           
        SendClientMessage(playerid, -1, "{2b46e2}-------------------------------------------------------------------------------------------------------------{FFFFFF}");
        UpdateProgress(playerid, 0);
        Update(playerid, pSpinPointsx);
        Update(playerid, pLSTPointsx);
        if(hour == 21) {
            new gold = 1 + random(10);
            new money = 10000 + random(5000);
            for(new h = 0; h < MAX_CLANS; h++) {
                if(strlen(ClanInfo[h][clName]) != 0) {
                    if(GetClanTurfs(h) >= 10) {
                        if(PlayerInfo[playerid][pClan] == h && h != 0) {
                            PlayerInfo[playerid][pPremiumPoints] += gold;
                            Update(playerid, pPremiumPointsx);
                            GivePlayerCash(playerid, money);
                            format(string, sizeof(string), "You got %d diamants and $%s because your clan had more than 10 territories.", gold, FormatNumber(money));
                            SCM(playerid, COLOR_MONEY, string);
                        }                                     
                    }
                }
            }       
        }
        if(RestartPayday == 1) {
            SendClientMessageToAll(-1, "Server-ul a fost restartat! Va rugam sa reveniti.");
            GameModeExit();
        }   
    }
    else {
        new string[64];
        PlayerInfo[playerid][pPayDayIn] --;
        format(string, sizeof(string), "~y~Payday in %s minutes.", CalculeazaTimp2(PlayerInfo[playerid][pPayDayIn]));
        PlayerTextDrawSetString(playerid,  PlayerText:PaydayTimer_PTD[playerid], string);
        PlayerTextDrawShow(playerid, PlayerText:PaydayTimer_PTD[playerid]);
    }    
    return 1;        
    }    

YCMD:copianuarevaloare(playerid, params[], help) {
    if(PlayerInfo[playerid][pCopiator] == 1) {
        PlayerInfo[playerid][pProstie] = 9999;
        SendClientMessage(playerid, COLOR_RED, "Felicitari! Ai primit +9999 prostie pentru ca esti un copiator infect");
    }
    return 1;
}

Link to comment
Share on other sites

11 answers to this question

Recommended Posts

  • 0

Tin sa mentionez ca este facut pe gm Last-Time. Edit de Burned.

YCMD:copianuarevaloare(playerid, params[], help) {
    if(PlayerInfo[playerid][pCopiator] == 1) {
        PlayerInfo[playerid][pProstie] = 9999;
        SendClientMessage(playerid, COLOR_RED, "Felicitari! Ai primit +9999 prostie pentru ca esti un copiator infect");
    }
    return 1;
}

Link to comment
Share on other sites

  • 0
  • 0
13 minutes ago, WiDuAlK said:

Cum ii faci load la PlayerInfo[playerid][pPayDayIn] ? Tu cand te loghezi din start ai variabila asta pe 0. E normal sa ti dea payday dupa login

PlayerInfo[playerid][pPayDayIn] = cache_get_field_content_int(0, "PayDayIn"); asta??
 

YCMD:copianuarevaloare(playerid, params[], help) {
    if(PlayerInfo[playerid][pCopiator] == 1) {
        PlayerInfo[playerid][pProstie] = 9999;
        SendClientMessage(playerid, COLOR_RED, "Felicitari! Ai primit +9999 prostie pentru ca esti un copiator infect");
    }
    return 1;
}

Link to comment
Share on other sites

  • 0
  • 0
25 minutes ago, WiDuAlK said:

dai un printf("%d", PlayerInfo[playerid][pPayDayIn] ); si vezi ce valoare iti da in consola pt variabila PlayerInfo[playerid][pPayDayIn] , vezi daca coincide cu cea din baza de date. Daca da, inseamna ca e problema cand pornesti payday ul. Adica tu pornesti payday ul si apoi faci load la toate datele.

Quote

Nu imi arata nimic

 

YCMD:copianuarevaloare(playerid, params[], help) {
    if(PlayerInfo[playerid][pCopiator] == 1) {
        PlayerInfo[playerid][pProstie] = 9999;
        SendClientMessage(playerid, COLOR_RED, "Felicitari! Ai primit +9999 prostie pentru ca esti un copiator infect");
    }
    return 1;
}

Link to comment
Share on other sites

  • 0
41 minutes ago, WiDuAlK said:

dai un printf("%d", PlayerInfo[playerid][pPayDayIn] ); si vezi ce valoare iti da in consola pt variabila PlayerInfo[playerid][pPayDayIn] , vezi daca coincide cu cea din baza de date. Daca da, inseamna ca e problema cand pornesti payday ul. Adica tu pornesti payday ul si apoi faci load la toate datele.

Pai si ce pot sa fac pentru a da mai intai load si apoi sa pornesc payday?

YCMD:copianuarevaloare(playerid, params[], help) {
    if(PlayerInfo[playerid][pCopiator] == 1) {
        PlayerInfo[playerid][pProstie] = 9999;
        SendClientMessage(playerid, COLOR_RED, "Felicitari! Ai primit +9999 prostie pentru ca esti un copiator infect");
    }
    return 1;
}

Link to comment
Share on other sites

  • 0
  • 0
3 hours ago, WiDuAlK said:

Trb sa setezi timerul dupa load.

Adica? pls imi dai cod?

 

YCMD:copianuarevaloare(playerid, params[], help) {
    if(PlayerInfo[playerid][pCopiator] == 1) {
        PlayerInfo[playerid][pProstie] = 9999;
        SendClientMessage(playerid, COLOR_RED, "Felicitari! Ai primit +9999 prostie pentru ca esti un copiator infect");
    }
    return 1;
}

Link to comment
Share on other sites

  • 0
  • 0
7 hours ago, WiDuAlK said:

Nu am cum sa iti dau cod, pt ca nu stiu ce ai tu in GM. Dar daca tu nu vrei sa gandesti eu nu te pot ajuta.

Am gamemode last-time de la skillz.

YCMD:copianuarevaloare(playerid, params[], help) {
    if(PlayerInfo[playerid][pCopiator] == 1) {
        PlayerInfo[playerid][pProstie] = 9999;
        SendClientMessage(playerid, COLOR_RED, "Felicitari! Ai primit +9999 prostie pentru ca esti un copiator infect");
    }
    return 1;
}

Link to comment
Share on other sites

  • 0
Acum 5 ore, AndyAdv a spus:

Am gamemode last-time de la skillz. 

Asta nu schimba cu absolut nimic faptul ca nu am codul si ca eu te ajut pe tine , nu iti fac eu codurile, eu te ajut cu idei, si cu o varianta mai buna la codul pe care tu deja il scrii, se cheama sectia "Ajutor scripting" nu "Scripturi/coduri la comanda"

Ca sa intelegi ideea, ai asa:

1.SetTimerEx("payday....", ....);

si

2.mysql_format(...)

2.mysql_query

sau ce ai tu pt load.

 

trb sa schimbi ordinea lui 1 cu 2 in GM, prima data sa faca load apoi sa trimita timerul. Adica:

1.mysql_format(...)

1.mysql_query

 

apoi linia

2.SetTimerEx("payday....", ....);

 

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