[HELP] payday problem
#1

Hello I can't solve this so every hour when it's time for payday only payday get player id 0 and rest of player don't get payday or sometimes even id 0 doesn't get payday.

so first under ongamemodeinit is timer for synctime

pawn Код:
SetTimer("SyncTime",60000,1);
second is the public SyncTime

pawn Код:
forward SyncTime();
public SyncTime()
{
    new string[128],tmphour,tmpminute,tmpsecond;
    gettime(tmphour,tmpminute,tmpsecond);
    FixHour(tmphour);
    tmphour = shifthour;
    if((tmphour > ghour) || (tmphour == 0 && ghour == 23))
    {
        format(string,sizeof(string),"{48E31C}G-Unit: {FFFFFF}Sada je {00C0FF}%d:00 {FFFFFF}sati.",tmphour);
        VrijemeKanal(ZELENA,string);
        ghour = tmphour;
        PayDay();
        if(realtime)
        {
            SetWorldTime(tmphour);
        }
    }
    return 1;
}
and public payday

pawn Код:
forward PayDay();
public PayDay()
{
    foreach(Player,i)
    {
        new stariiznos = PlayerInfo[i][Banka],string[128],hotelnajam = 0,kucanajam = 0;
        if(PlayerInfo[i][RentaHotel] == -1) hotelnajam = 0;
        else if(PlayerInfo[i][RentaHotel] != -1) hotelnajam = HotelInfo[PlayerInfo[i][RentaHotel]][hCijenaSobe];
        if(PlayerInfo[i][RentaKucu] > -1)
        {
            if(PlayerInfo[i][Banka] < KucaInfo[PlayerInfo[i][RentaKucu]][hRentCijena])
            {
                new x[200];
                PlayerInfo[i][RentaKucu] = -1;
                PlayerInfo[i][SpawnPromijena] = 1;
                SCM(i,COLOR_LIGHTRED,"*Izbaceni ste iz kuce!");
                mysql_format(mysql,x,200,"UPDATE `users` SET `RentaKucu` = '-1',`SpawnPromijena` = '1' WHERE `ID` = '%d'",PlayerInfo[i][ID]);
                mysql_tquery(mysql,x,"","");
            }
            if(PlayerInfo[i][RentaKucu] > -1)
            {
                PlayerInfo[i][Banka] -= KucaInfo[PlayerInfo[i][RentaKucu]][hRentCijena];
                KucaInfo[PlayerInfo[i][RentaKucu]][hSef] += KucaInfo[PlayerInfo[i][RentaKucu]][hRentCijena];
                new query[200];
                mysql_format(mysql,query,200,"UPDATE `kuce` SET `hSef` = '%d' WHERE `ID` = '%d'",KucaInfo[PlayerInfo[i][RentaKucu]][hSef],PlayerInfo[i][RentaKucu]);
                mysql_tquery(mysql,query,"","");
            }
        }
        if(PlayerInfo[i][Level] > 0)
        {
            if(DugNovacProvjera[i] == 1)
            {
                SCM(i,COLOR_LIGHTRED,"*Niste uspjeli da podmirite dug, idete u zatvor!");
                SetPlayerInterior(i,0);
                SetPlayerVirtualWorld(i,0);
                new rand = random(sizeof(aCellSpawns));
                SetPlayerPos_H(i,aCellSpawns[rand][0],aCellSpawns[rand][1],aCellSpawns[rand][2]);
                PlayerInfo[i][Zatvoren] = 1;
                ResetPlayerWeapons(i);
                SetPlayerWantedLevel(i,0);
                PlayerInfo[i][ZatvorenVrijeme] = 600;
                format(string,sizeof(string),"*Uhiceni ste na %d sekundi. Jamcevina: Nedostupna",PlayerInfo[i][ZatvorenVrijeme]);
                SCM(i,COLOR_LIGHTRED,string);
            }
            if(PlayerInfo[i][RadarKazna] != 0)
            {
                SCMF(i,SVIJETLOPLAVA,"*Imate neplacenih kazni u iznosu od: %d$ | Kaznu uplatite u Gradskoj Vijecnici!",PlayerInfo[i][RadarKazna]);
            }
            new playername2[MAX_PLAYER_NAME],query[200];
            GetPlayerName(i,playername2,sizeof(playername2));
            if(PlayerInfo[i][RentaHotel] != -1)
            {
                if(PlayerInfo[i][Banka] < HotelInfo[PlayerInfo[i][RentaHotel]][hCijenaSobe])
                {
                    PlayerInfo[i][RentaHotel] = -1;
                    PlayerInfo[i][SpawnPromijena] = 1;
                    SCM(i,COLOR_BIJELA,"*Izbaceni ste iz hotela!");
                    mysql_format(mysql,query,200,"UPDATE `users` SET `RentaHotel` = '-1',`SpawnPromijena` = '1' WHERE `ID` = '%d'",PlayerInfo[i][ID]);
                    mysql_tquery(mysql,query,"","");
                }
                if(PlayerInfo[i][RentaHotel] > -1) PlayerInfo[i][Banka] -= HotelInfo[PlayerInfo[i][RentaHotel]][hCijenaSobe];
            }
            if(PlayerInfo[i][Clan] > 0 || PlayerInfo[i][Lider] > 0) PlayerInfo[i][TimUgovor]++;
            if(PlayerInfo[i][KaznaUgovor] > 0)
            {
                PlayerInfo[i][KaznaUgovor]--;
            }
            if(PlayerInfo[i][PayDayPoeni] < 30) return SCM(i,COLOR_LIGHTRED,"*G-Unit: You don't have 30 payday points to get pay!");
            new osnova = 0,iznosplace = 0,iskustvo = 0;
            osnova = 40 + random(70);
            iznosplace = osnova*PlayerInfo[i][Level];
            new nxlvl = PlayerInfo[i][Level]+1;
            if(PlayerInfo[i][Respekti] >= nxlvl)
            {
                format(string,sizeof(string),"[Level up +++] Cestitamo,Presli ste na slijedeci Level: %d",nxlvl);
                SendClientMessage(i,SVIJETLOPLAVA,string);
                PlayerInfo[i][Level]++;
                PlayerInfo[i][Respekti] = 0;
            }
            if(PlayerInfo[i][Banka] >= PlayerInfo[i][IznosRate] && PlayerInfo[i][PreostaloZaOtplatu] > 0)
            {
                if(PlayerInfo[i][PreostaloZaOtplatu] < PlayerInfo[i][IznosRate])
                {
                    PlayerInfo[i][IznosRate] = PlayerInfo[i][PreostaloZaOtplatu];
                }
                PlayerInfo[i][PreostaloZaOtplatu] -= PlayerInfo[i][IznosRate];
                PlayerInfo[i][Banka] -= PlayerInfo[i][IznosRate];
                if(PlayerInfo[i][PreostaloZaOtplatu] < 0) PlayerInfo[i][PreostaloZaOtplatu] = 0;
            }
            new struja = 0,voda = 0,porez = 0,smece = 0,prihod = 0,rashod = 0;
            if(PlayerInfo[i][Kuca] != -1)
            {
                if(!strcmp(KucaInfo[PlayerInfo[i][Kuca]][hOpis],"Mala kuca",false))
                {
                    struja += (40 + random(20)); voda += (20 + random(10)); porez += 35; smece += 20;
                }
                else if(!strcmp(KucaInfo[PlayerInfo[i][Kuca]][hOpis],"Srednja kuca",false))
                {
                    struja += (80 + random(50)); voda += (40 + random(20)); porez += 70; smece += 30;
                }
                else if(!strcmp(KucaInfo[PlayerInfo[i][Kuca]][hOpis],"Velika kuca",false))
                {
                    struja += (250 + random(100)); voda += (100 + random(50)); porez += 100; smece += 40;
                }
                else if(!strcmp(KucaInfo[PlayerInfo[i][Kuca]][hOpis],"Vila",false))
                {
                    struja += (550 + random(250)); voda += (200 + random(100)); porez += 200; smece += 50;
                }
                if(!strcmp(KucaInfo[PlayerInfo[i][Kuca]][hOpis],"Prikolica",false))
                {
                    struja += (20 + random(20)); voda += (5 + random(5)); porez += 15; smece += 10;
                }
            }
            if(PlayerInfo[i][Stan] != -1) { struja += (50 + random(50)); voda += (30 + random(30)); porez += 40; smece += 35; }
            if(PlayerInfo[i][Vikendica] != -1) { struja += (200 + random(100)); voda += (80 + random(80)); porez += 120; smece += 45; }
            if(PlayerInfo[i][Firma] != -1) { porez += 150; }
            if(PlayerInfo[i][SFirma] != -1) { porez += 70; }
            if(PlayerInfo[i][RentaKucu] == -1) kucanajam = 0;
            else if(PlayerInfo[i][RentaKucu] != -1) kucanajam = KucaInfo[PlayerInfo[i][RentaKucu]][hRentCijena];
            new xstr1[858],xstr2[858],xstr[900];
            iskustvo = (PlayerInfo[i][Level] *2) + 2;
            if(PlayerInfo[i][Respekti] < iskustvo)
            {
                format(xstr1,858,"{FFFFFF}Los Santos Banka\n\nPostovani,ovo je bankovno izvijesce za proteklo razdoblje\n\n\
                {FFFFFF}Prihodi:\n{FFFFFF}-Iznos place: $%d,Dodatci: $0\n\n\
                {FFFFFF}Rashodi:\n{FFFFFF}-Struja: $%d | Voda: $%d | Komunalije: $%d\n\
                {FFFFFF}-Rent Kuce: $%d {FFFFFF}| Hotel: $%d\n\
                {FFFFFF}-Porez na imovinu: $%d\n\n\
                {FFFFFF}Kredit:\n{FFFFFF}-Iznos rate kredita: $%d {FFFFFF}| Preostalo kredita: $%d"
,
                iznosplace,struja,voda,smece,kucanajam,hotelnajam,porez,PlayerInfo[i][IznosRate],PlayerInfo[i][PreostaloZaOtplatu]);
                format(xstr2,858,"\n\n\
                {FFFFFF}Stari iznos racuna: {FFFFFF}$%d\n\
                {FFFFFF}Novi iznos uplate na racun: {FFFFFF}$%d"
,stariiznos,PlayerInfo[i][Banka]+iznosplace);
            }
            else if(PlayerInfo[i][Respekti] < iskustvo)
            {
                PlayerInfo[i][Level]++;
                SetPlayerScore(i,PlayerInfo[i][Level]);
                PlayerInfo[i][Respekti] = 0;
                format(xstr1,858,"{FFFFFF}Banka Los Santosa\n\nPostovani,ovo je bankovno izvijesce za proteklo razdoblje\n\n\
                {FFFFFF}Prihodi:\n{FFFFFF}-Iznos place: $%d,Dodatci: $0 n\n\
                FFFFFF}Rashodi:\n{FFFFFF}-Struja: $%d | Voda: $%d | Komunalije: $%d\n\
                {FFFFFF}-Rent Kuce: $%d {FFFFFF}| Hotel: $%d\n\
                {FFFFFF}-Porez na imovinu: $%d\n\n\
                {FFFFFF}Kredit:\n{FFFFFF}-Iznos rate kredita: $%d {FFFFFF}| Preostalo kredita: $%d"
,
                iznosplace,struja,voda,smece,kucanajam,hotelnajam,porez,PlayerInfo[i][IznosRate],PlayerInfo[i][PreostaloZaOtplatu]);
                format(xstr2,858,"\n\n\
                {FFFFFF}Stari iznos racuna: {FFFFFF}$%d\n\
                {FFFFFF}Novi iznos uplate na racun: {FFFFFF}$%d\n\n\
                {FFFFFF} - Level Up - Cestitamo,sada ste level: %d"

                ,stariiznos,PlayerInfo[i][Banka]+iznosplace,PlayerInfo[i][Level]);
            }
            format(xstr,900,"%s%s",xstr1,xstr2);
            ShowPlayerDialog(i,999,DIALOG_STYLE_MSGBOX,"{33BBFF}LS BANKA | Izlistanje racuna",xstr,"U redu","Odustani");
            prihod = iznosplace;
            rashod = struja + voda + porez + smece;
            PlayerInfo[i][Banka] += prihod;
            PlayerInfo[i][Banka] -= rashod;
            PlayerInfo[i][PayDayPoeni] = 0;
            PlayerInfo[i][SatiIgranja] ++;
            PlayerInfo[i][Respekti]++;
            PlayerInfo[i][PosaoUgovor]++;
            PlayerInfo[i][PayDayova]++;
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)