Problem plata i broj s tackama

Započeo kim3205, Februar 16, 2018, 05:23:12 PRE PODNE

prethodna tema - sledeća tema

0 članova i 2 gostiju pregledaju ovu temu.

Detaljan opis problema:
1.Kad igrac udje na serv(bilo kad) od tog momenta pa za 1h mu je plata, ali ja tako ne zelim vec zelim da bude u satima, svaki sat,a ne da odbrojava 1h igracu od kako udje!
2.Kako da namestim na TD da budu tackice da se vidi prosto npr je 10.000.000e itd..
Dio skripte:
[pawn]public PayDay( playerid ) {

    if( PlayerLogged[ playerid ] == true ) {

       new stariiznos = PlayerInfo[ playerid ][ xBRacun ];

       new donatorkamata = 0, platapd = 0, plataadms = 0, plataprom = 0;

       PlayerInfo[ playerid ][ xRespekt ]++;
       PlayerInfo[ playerid ][ xOnlineSati ]++;
       PlayerInfo[ playerid ][ xPayDay ] = 0;
       PlayerInfo[ playerid ][ xLesLimit ] = 0;

      if( PlayerInfo[ playerid ][ xNovac ] < 0 ) {
          if( PlayerInfo[ playerid ][ xZatvor ] == 0 ) {
             SCM( playerid, 0xFF6347AA, "Niste platili vas dug, vreme je za zatvor(5 min)." );

             ResetAllWeapons( playerid );

             PlayerInfo[ playerid ][ xZatvor ] = OBICAN_ZATVOR;
            PlayerInfo[ playerid ][ xZatvorVreme ] = 5;

             new rand = random( sizeof( RandomZatvor ) );
            Pinki_SetPlayerPos( playerid, RandomZatvor[ rand ][ 0 ], RandomZatvor[ rand ][ 1 ], RandomZatvor[ rand ][ 2 ] );
            SetTimerEx( "SlobodnoSada", 4000, false, "i", playerid );
            GameTextForPlayer( playerid, "Ucitavanje ...", 1000, 4 );
            TogglePlayerControllable( playerid, false );
            SetCameraBehindPlayer( playerid );
            SetPlayerInterior( playerid, 0 );
            SetPlayerVirtualWorld( playerid, 0 );
         }
      }


        if( GetFactionType( playerid ) == ORG_TIP_PD ) {
            if( antiCheatCS[ playerid ][ AFKMinute ] == 0 && !IsPlayerPaused( playerid ) ) {
            platapd = 9000;
         }
      }
      else if( GetFactionType( playerid ) == ORG_TIP_CNN ) {
            if( antiCheatCS[ playerid ][ AFKMinute ] == 0 && !IsPlayerPaused( playerid ) ) {
            platapd = 8200;
         }
      }
      else if( GetFactionType( playerid ) == ORG_TIP_MD ) {
            if( antiCheatCS[ playerid ][ AFKMinute ] == 0 && !IsPlayerPaused( playerid ) ) {
            platapd = 1200;
         }
      }

        if( PlayerInfo[ playerid ][ xPromoter ] > 0 ) {
            if( antiCheatCS[ playerid ][ AFKMinute ] == 0 && !IsPlayerPaused( playerid ) ) {
            plataprom = 1200;
         }
      }

        if( PlayerInfo[ playerid ][ xHelper ] > 0 ) {
            if( antiCheatCS[ playerid ][ AFKMinute ] < 2 && !IsPlayerPaused( playerid ) ) {
            plataadms = 9000+(PlayerInfo[ playerid ][ xHelper ]*200);
         }
      }

      if( PlayerInfo[ playerid ][ xHiac ] > 0 ) {
            if( antiCheatCS[ playerid ][ AFKMinute ] < 2 && !IsPlayerPaused( playerid ) ) {
            plataadms = 9200+(PlayerInfo[ playerid ][ xHiac ]*200);
         }
      }

        if( PlayerInfo[ playerid ][ xRentID ] != -1 ) {
            new id = PlayerInfo[ playerid ][ xRentID ];
            if( II[ id ][ iRentable ] == 1 ) {
               if( II[ id ][ iRentPrice ] > PlayerInfo[ playerid ][ xNovac ] ) {

                   II[ id ][ iRentovano ]--;
                   SaveProperty( id );

                PlayerInfo[ playerid ][ xRentID ] = -1;
                PlayerInfo[ playerid ][ xSpawn ] = SPAWN_OBICAN_LS_1;
                SendClientMessageEx( playerid, ZUTA, "Niste imali dovoljno novca za rent, izbaceni ste." );
               }
               else {
                   II[ id ][ iMoney ] += II[ id ][ iRentPrice ];
                   SaveProperty( id );

                   DajIgracuNovac( playerid, -II[ id ][ iRentPrice ] );
                   UpdateDzepTD( playerid );
                   SendClientMessageEx( playerid, ZUTA, "Platili ste rent %de.", II[ id ][ iRentPrice ] );
               }
         }
         else if( II[ id ][ iRentable ] == 0 ) {
             II[ id ][ iRentovano ]--;
               SaveProperty( id );

             PlayerInfo[ playerid ][ xRentID ] = -1;
             PlayerInfo[ playerid ][ xSpawn ] = SPAWN_OBICAN_LS_1;

             SendClientMessageEx( playerid, ZUTA, "Kuca koju ste rentali vise nije na iznajmljivanje." );
         }
        }

        if( ServerInfo[ HappyHours ] == true ) PlayerInfo[ playerid ][ xRespekt ]++;

       if( PlayerInfo[ playerid ][ xIznosRate ] > 0 &&
         PlayerInfo[ playerid ][ xPreostaloZaOtplatu ] > 0 &&
         PlayerInfo[ playerid ][ xIznosKredita ] > 0 )
      {
          if( PlayerInfo[ playerid ][ xPreostaloZaOtplatu ] < PlayerInfo[ playerid ][ xIznosRate ] ) {
              PlayerInfo[ playerid ][ xIznosRate ] = PlayerInfo[ playerid ][ xPreostaloZaOtplatu ];
         }
          PlayerInfo[ playerid ][ xPreostaloZaOtplatu ] -= PlayerInfo[ playerid ][ xIznosRate ];
          PlayerInfo[ playerid ][ xBRacun ] -= PlayerInfo[ playerid ][ xIznosRate ];
          if( PlayerInfo[ playerid ][ xPreostaloZaOtplatu ] < 0 ) PlayerInfo[ playerid ][ xPreostaloZaOtplatu ] = 0;
          if( PlayerInfo[ playerid ][ xPreostaloZaOtplatu ] <= 0 ) { PlayerInfo[ playerid ][ xIznosKredita ] = 0; PlayerInfo[ playerid ][ xIznosRate ] = 0; }
      }

        if( PlayerInfo[ playerid ][ xHotelRoom ] != -1 ) {
            new hid = PlayerInfo[ playerid ][ xHotelRoom ];
            hotelInfo[ hid ][ hMoney ] += (hotelInfo[ hid ][ hRoomPrice ]/2);
            DajIgracuNovac( playerid, -hotelInfo[ hid ][ hRoomPrice ] );
            UpdateDzepTD( playerid );
            SaveHotel( hid );
            SendClientMessageEx( playerid, -1, "Platili ste %de cenu najma.", hotelInfo[ hid ][ hRoomPrice ] );
        }

       new iznosplate = 0, osnova = 0, prihod = 0, rashod = 0, struja = 0, voda = 0, smece = 0, grijanje = 0, porez = 0, stecaj = 0;
      osnova = 45 + random( 5 );
      iznosplate = ((osnova*PlayerInfo[ playerid ][ xLevel ])+PlayerInfo[ playerid ][ xPlatniRacun ]);


      if( PlayerInfo[ playerid ][ xProperty ][ 0 ] != -1 ) {
          new imovina = PlayerInfo[ playerid ][ xProperty ][ 0 ];
          if( II[ imovina ][ iUsage ] == IMOVINA_KUCA ) {
              if( II[ imovina ][ iVrsta ] == MALA_KUCA ) { porez += 3000; }
            else if( II[ imovina ][ iVrsta ] == SREDNJA_KUCA ) { porez += 5000; }
            else if( II[ imovina ][ iVrsta ] == VELIKA_KUCA ) { porez += 6500; }
            else if( II[ imovina ][ iVrsta ] == VILA_KUCA ) { porez += 9000; }
         }
         else if( II[ imovina ][ iUsage ] == IMOVINA_STAN ) { porez += 150; }
         else if( II[ imovina ][ iUsage ] == IMOVINA_VIKENDICA ) { porez += 400; }
         struja += (250 + random(50)); voda += (1500 + random(50)); smece += 1500; grijanje += 2500;
         donatorkamata = 2;

         if( PlayerInfo[ playerid ][ xVIPLevel ] >= 3 ) {
             donatorkamata = 4;
         }

         if( PlayerInfo[ playerid ][ xVIPLevel ] >= 3 ) {
               donatorkamata = 5;
         }

           if( PlayerInfo[ playerid ][ xHiac ] >= 1 ) {
               donatorkamata = 5;
         }

      }

      if( PlayerInfo[ playerid ][ xProperty ][ 1 ] != -1 ) {
          new imovina = PlayerInfo[ playerid ][ xProperty ][ 1 ];
          if( II[ imovina ][ iUsage ] == IMOVINA_KUCA ) {
              if( II[ imovina ][ iVrsta ] == MALA_KUCA ) { porez += 3000; }
            else if( II[ imovina ][ iVrsta ] == SREDNJA_KUCA ) { porez += 5000; }
            else if( II[ imovina ][ iVrsta ] == VELIKA_KUCA ) { porez += 6500; }
            else if( II[ imovina ][ iVrsta ] == VILA_KUCA ) { porez += 9000; }
         }
         else if( II[ imovina ][ iUsage ] == IMOVINA_STAN ) { porez += 150; }
         else if( II[ imovina ][ iUsage ] == IMOVINA_VIKENDICA ) { porez += 400; }
         struja += (250 + random(50)); voda += (1500 + random(50)); smece += 1500; grijanje += 2500;
         donatorkamata = 2;

         if( PlayerInfo[ playerid ][ xVIPLevel ] >= 3 ) {
             donatorkamata = 4;
         }

         if( PlayerInfo[ playerid ][ xVIPLevel ] >= 3 ) {
               donatorkamata = 5;
         }

           if( PlayerInfo[ playerid ][ xHiac ] >= 1 ) {
               donatorkamata = 5;
         }

      }

      if( PlayerInfo[ playerid ][ xProperty ][ 2 ] != -1 ) {
          new imovina = PlayerInfo[ playerid ][ xProperty ][ 2 ];
          if( II[ imovina ][ iUsage ] == IMOVINA_KUCA ) {
              if( II[ imovina ][ iVrsta ] == MALA_KUCA ) { porez += 3000; }
            else if( II[ imovina ][ iVrsta ] == SREDNJA_KUCA ) { porez += 5000; }
            else if( II[ imovina ][ iVrsta ] == VELIKA_KUCA ) { porez += 6500; }
            else if( II[ imovina ][ iVrsta ] == VILA_KUCA ) { porez += 9000; }
         }
         else if( II[ imovina ][ iUsage ] == IMOVINA_STAN ) { porez += 150; }
         else if( II[ imovina ][ iUsage ] == IMOVINA_VIKENDICA ) { porez += 400; }
         struja += (250 + random(50)); voda += (1500 + random(50)); smece += 1500; grijanje += 2500;
         donatorkamata = 2;

         if( PlayerInfo[ playerid ][ xVIPLevel ] >= 3 ) {
             donatorkamata = 4;
         }

         if( PlayerInfo[ playerid ][ xVIPLevel ] >= 3 ) {
               donatorkamata = 5;
         }

           if( PlayerInfo[ playerid ][ xHiac ] >= 1 ) {
               donatorkamata = 5;
         }

      }

      if( PlayerInfo[ playerid ][ xVIPLevel ] > 1 ) {
         PlayerInfo[ playerid ][ xRespekt ]++;
      }

      if( PlayerInfo[ playerid ][ xFirmaID ] != -1 ) { porez += 50; }

      if( donatorkamata != 0 ) {
          if( PlayerInfo[ playerid ][ xBRacun ] >= 100000 && PlayerInfo[ playerid ][ xBRacun ] <= 4000000 ) {
             stecaj = ( PlayerInfo[ playerid ][ xBRacun ]/1000 ) * donatorkamata;
         }
      }

        BussinesVodovodMoney( ( (voda/10)*3 ) );
        BussinesElektranaMoney( ( (struja/10)*3 ) );
        BussinesKomunalijeMoney( ( (smece/10)*3 ) );

       new strp1[ 300 ], strp2[ 300 ], strp[ 600 ];

        prihod = iznosplate + stecaj + platapd + plataadms + plataprom;
      rashod = struja + voda + porez + smece + grijanje;
      PlayerInfo[ playerid ][ xBRacun ] += prihod;
      PlayerInfo[ playerid ][ xBRacun ] -= rashod;
      PlayerInfo[ playerid ][ xPlatniRacun ] = 0;

       format( strp1, sizeof( strp1 ), ""col_red"Plata je stigla na vas racun\n\n"col_white"Plata: %de\nSteceni interes: %de\n\nKredit Informacije\nIznos kredita: %de\nIznos rate: %de\nZa otplatu: %d%\n\n", (iznosplate+platapd+plataadms+plataprom), stecaj, PlayerInfo[ playerid ][ xIznosKredita ], PlayerInfo[ playerid ][ xIznosRate ], PlayerInfo[ playerid ][ xPreostaloZaOtplatu ] );
        format( strp2, sizeof( strp2 ), ""col_red"Platili ste\n"col_white"Porez na imovinu: %de\nStruja: %de\nVoda: %de\nSmece: %de\nGrejanje: %de\n\nStari iznos: %de\nNovi iznos: %de", porez, struja, voda, smece, grijanje, stariiznos, PlayerInfo[ playerid ][ xBRacun ] );

       format( strp, sizeof( strp ), "%s%s", strp1, strp2);
      SPD( playerid, dialog_PAYDAY, DSMSG, D_NASLOV, strp, D_ODABERI, "" );

       SCM( playerid, ZUTA, "Plata je stigla na vas bankovni racun!" );

       if( PlayerInfo[ playerid ][ xPosao ] > 0 ) PlayerInfo[ playerid ][ xUgovor ] += 1;

      if( PlayerInfo[ playerid ][ xClan ] != 0 ) PlayerInfo[ playerid ][ xOrgUgovor ]++;

        if( PlayerInfo[ playerid ][ xKazneniUgovor ] != 0 ) PlayerInfo[ playerid ][ xKazneniUgovor ]--;

      if( PlayerInfo[ playerid ][ xBRacun ] <= -200000 ) {
          if( PlayerInfo[ playerid ][ xProperty ][ 0 ] != -1 ) {
              new imovina = PlayerInfo[ playerid ][ xProperty ][ 0 ];
              II[ imovina ][ iLevel ] = 99;
              II[ imovina ][ iOwned ] = 0;
                II[ imovina ][ iNeaktivnost ] = 0;
            strmid( II[ imovina ][ iOwner], "Drzava", 0, strlen( "Drzava" ), 32);
            PropertyRefresh( imovina );
            SaveProperty( imovina );
            PlayerInfo[ playerid ][ xProperty ][ 0 ] = -1;
         }
          if( PlayerInfo[ playerid ][ xProperty ][ 1 ] != -1 ) {
              new imovina = PlayerInfo[ playerid ][ xProperty ][ 1 ];
              II[ imovina ][ iLevel ] = 99;
              II[ imovina ][ iOwned ] = 0;
                II[ imovina ][ iNeaktivnost ] = 0;
            strmid( II[ imovina ][ iOwner], "Drzava", 0, strlen( "Drzava" ), 32);
            PropertyRefresh( imovina );
            SaveProperty( imovina );
            PlayerInfo[ playerid ][ xProperty ][ 1 ] = -1;
         }
          if( PlayerInfo[ playerid ][ xProperty ][ 2 ] != -1 ) {
              new imovina = PlayerInfo[ playerid ][ xProperty ][ 2 ];
              II[ imovina ][ iLevel ] = 99;
              II[ imovina ][ iOwned ] = 0;
                II[ imovina ][ iNeaktivnost ] = 0;
            strmid( II[ imovina ][ iOwner], "Drzava", 0, strlen( "Drzava" ), 32);
            PropertyRefresh( imovina );
            SaveProperty( imovina );
            PlayerInfo[ playerid ][ xProperty ][ 2 ] = -1;
         }
          SCM( playerid, ZUTA, "Zbog neizmirenih dugova u banci(-200.000$), oduzeta vam je sva imovina!" );
      }

          new nxtlevel = PlayerInfo[ playerid ][ xLevel ]+1;
      new expamount = nxtlevel*levelexp;
      if( PlayerInfo[ playerid ][ xRespekt ] >= expamount ) {
         format( globalstring, sizeof( globalstring ), "~g~LEVEL UP~n~~w~Sada si Level %d", nxtlevel );
         GameTextForPlayer( playerid, globalstring, 5000, 1);
         PlayerPlaySound( playerid, 1052, 0.0, 0.0, 0.0);
         PlayerPlayMusic( playerid );
         PlayerInfo[ playerid ][ xLevel ]++;
         SetPlayerScore( playerid, PlayerInfo[ playerid ][ xLevel ] );
         PlayerInfo[ playerid ][ xPoboljsanja ] += 2;
            PlayerInfo[ playerid ][ xRespekt ] = 0;
         format( globalstring, sizeof( globalstring ), "Sada si level %d ukucaj /upgrade za neke bonuse", nxtlevel );
         SCM( playerid, SVETLOPLAVA, globalstring);
         format( globalstring, sizeof( globalstring ), "Imas %d neiskoristenih Upgrade Poena", PlayerInfo[ playerid ][ xPoboljsanja ] );
         SCM( playerid, BELA, globalstring);
      }

      if( PlayerInfo[ playerid ][ xRPPoen ] > 0 ) {

          DajIgracuNovac( playerid, PlayerInfo[ playerid ][ xRPPoen ]*1000 );
          UpdateDzepTD( playerid );

          SendClientMessageEx( playerid, ZUTA, "Dobili ste %de zbog %d HP poena.", PlayerInfo[ playerid ][ xRPPoen ]*1000, PlayerInfo[ playerid ][ xRPPoen ] );

      }

      if( PlayerInfo[ playerid ][ xRPPoen ] < 0 ) {

          DajIgracuNovac( playerid, PlayerInfo[ playerid ][ xRPPoen ]*1000 );
          UpdateDzepTD( playerid );

          SendClientMessageEx( playerid, BELA, "Izgubili ste %de zbog %d HP poena.", PlayerInfo[ playerid ][ xRPPoen ]*-1000, PlayerInfo[ playerid ][ xRPPoen ] );

      }

      if( PlayerInfo[ playerid ][ xOnlineSati ] == 500 || PlayerInfo[ playerid ][ xOnlineSati ] == 1000 ||
         PlayerInfo[ playerid ][ xOnlineSati ] == 1500 || PlayerInfo[ playerid ][ xOnlineSati ] == 2000 ||
         PlayerInfo[ playerid ][ xOnlineSati ] == 2500 || PlayerInfo[ playerid ][ xOnlineSati ] == 3000 ||
         PlayerInfo[ playerid ][ xOnlineSati ] == 3500 || PlayerInfo[ playerid ][ xOnlineSati ] == 4000 ||
         PlayerInfo[ playerid ][ xOnlineSati ] == 4500 || PlayerInfo[ playerid ][ xOnlineSati ] == 5000 ||
         PlayerInfo[ playerid ][ xOnlineSati ] == 5500 || PlayerInfo[ playerid ][ xOnlineSati ] == 6000 ) {

         PlayerInfo[ playerid ][ xEMpoints ]++;
         SendClientMessageEx( playerid, ZUTA, "Dobili ste jedan HP poen zbog %d online sati.", PlayerInfo[ playerid ][ xOnlineSati ] );
      }

      new time = gettime( );
      if( PlayerInfo[ playerid ][ xVIPLevel ] > 0 && PlayerInfo[ playerid ][ xVipTime ] != 0 && ( time - PlayerInfo[ playerid ][ xVipTime ] ) >= 2592000 )
      {
         SCM( playerid, ZUTA, "Vas VIP level je istekao." );
         PlayerInfo[ playerid ][ xVIPLevel ] = 0;
         PlayerInfo[ playerid ][ xVipTime ] = 0;
      }

      SavePlayer( playerid );
          UpdateBankTD( playerid );
          //UpdatePlataTD( playerid );

   }
   return 1;
}[/pawn]
Neke slike/video za lakse dobivanje pomoci(neobavezno)://

i am king!

Ovaj tajmer promjeni u global tajmer, pozovi ga u ongamemodeinit, stavi mu time na 3600000. Unutra ces dodat for loop/foreach za igrace te ces umjesto parametar playerid koristit varijablu deklarisanu u loopu.


bilo je lijepo dok je trajalo.


Citat: Bašovski poslato Februar 16, 2018, 07:11:32 PRE PODNE
Ovaj tajmer promjeni u global tajmer, pozovi ga u ongamemodeinit, stavi mu time na 3600000. Unutra ces dodat for loop/foreach za igrace te ces umjesto parametar playerid koristit varijablu deklarisanu u loopu.

Bukvalno te nisam razumeo ?

i am king!

Prvo napravis tajmer da se odaziva na svakih 1min ovako:

SetTimer("Plata", 60000, 1);


Onda napravis public za platu gde ce da proverava kada je tacno toliko i toliko sati


        forward Plata();
public Plata()
{

new tmphour, tmpminute, tmpsecond;
gettime(tmphour, tmpminute, tmpsecond);
if(tmpminute >= 0 && tmpminute <= 2 && bilaplata == 0)
{

  foreach(Player, i)
         {
if(Ulogovan[i] == 1 && PI[i][pReg] == 1)
{

        PayDay(i);
        bilaplata = 1;
}
}


}
}


Ovo je primer procesa kako se radi ti sad prilagodi sebi

A sto se tice tacki tih jednostavno dodas kad formatias "1.000.000$" i to je to
Poslednja Izmena: Februar 19, 2018, 11:22:19 PRE PODNE od Majkl Script