plata

Započeo Sinner.man, Februar 03, 2018, 18:17:08 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

Radim na athlone modu i plata je kada igras 1 sat vremena dobijes platu,

KAKO da ja nastimam da je plata svaki sat, tj na svaki puni sat i da ako nisi igrao 30min ne dobijes platu ?

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 ) );
				Khalifa_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 = 2000;
			}
		}
		else if( GetFactionType( playerid ) == ORG_TIP_CNN ) {
            if( antiCheatCS[ playerid ][ AFKMinute ] == 0 && !IsPlayerPaused( playerid ) ) {
				platapd = 1200;
			}
		}
		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 = 2000+(PlayerInfo[ playerid ][ xHelper ]*200);
			}
		}

		if( PlayerInfo[ playerid ][ xHiac ] > 0 ) {
            if( antiCheatCS[ playerid ][ AFKMinute ] < 2 && !IsPlayerPaused( playerid ) ) {
				plataadms = 2200+(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 %d$.", 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 %d$ 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 += 300; }
				else if( II[ imovina ][ iVrsta ] == SREDNJA_KUCA ) { porez += 500; }
				else if( II[ imovina ][ iVrsta ] == VELIKA_KUCA ) { porez += 650; }
				else if( II[ imovina ][ iVrsta ] == VILA_KUCA ) { porez += 900; }
			}
			else if( II[ imovina ][ iUsage ] == IMOVINA_STAN ) { porez += 150; }
			else if( II[ imovina ][ iUsage ] == IMOVINA_VIKENDICA ) { porez += 400; }
			struja += (250 + random(50)); voda += (150 + random(50)); smece += 150; grijanje += 250;
			donatorkamata = 2;

			if( PlayerInfo[ playerid ][ xVIPLevel ] >= 2 ) {
			    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 += 300; }
				else if( II[ imovina ][ iVrsta ] == SREDNJA_KUCA ) { porez += 500; }
				else if( II[ imovina ][ iVrsta ] == VELIKA_KUCA ) { porez += 650; }
				else if( II[ imovina ][ iVrsta ] == VILA_KUCA ) { porez += 900; }
			}
			else if( II[ imovina ][ iUsage ] == IMOVINA_STAN ) { porez += 150; }
			else if( II[ imovina ][ iUsage ] == IMOVINA_VIKENDICA ) { porez += 400; }
			struja += (250 + random(50)); voda += (150 + random(50)); smece += 150; grijanje += 250;
			donatorkamata = 2;

			if( PlayerInfo[ playerid ][ xVIPLevel ] >= 2 ) {
			    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 += 300; }
				else if( II[ imovina ][ iVrsta ] == SREDNJA_KUCA ) { porez += 500; }
				else if( II[ imovina ][ iVrsta ] == VELIKA_KUCA ) { porez += 650; }
				else if( II[ imovina ][ iVrsta ] == VILA_KUCA ) { porez += 900; }
			}
			else if( II[ imovina ][ iUsage ] == IMOVINA_STAN ) { porez += 150; }
			else if( II[ imovina ][ iUsage ] == IMOVINA_VIKENDICA ) { porez += 400; }
			struja += (250 + random(50)); voda += (150 + random(50)); smece += 150; grijanje += 250;
			donatorkamata = 2;

			if( PlayerInfo[ playerid ][ xVIPLevel ] >= 2 ) {
			    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 ), "Banka | Plata je stigla na vas racun\n\nPlata: %d$\nSteceni interes: %d$\n\nKredit Informacije\nIznos kredita: %d$\nIznos rate: %d$\nZa otplatu: %d%\n\n", (iznosplate+platapd+plataadms+plataprom), stecaj, PlayerInfo[ playerid ][ xIznosKredita ], PlayerInfo[ playerid ][ xIznosRate ], PlayerInfo[ playerid ][ xPreostaloZaOtplatu ] );
        format( strp2, sizeof( strp2 ), "Platili ste\nPorez na imovinu: %d$\nStruja: %d$\nVoda: %d$\nSmece: %d$\nGrejanje: %d$\n\nStari iznos: %d$\nNovi iznos: %d$", 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 %d$ zbog %d RP poena.", PlayerInfo[ playerid ][ xRPPoen ]*1000, PlayerInfo[ playerid ][ xRPPoen ] );

		}

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

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

		    SendClientMessageEx( playerid, ZUTA, "Izgubili ste %d$ zbog %d RP 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 EM 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;
}


public PayCheck( playerid ) {
   if( PlayerLogged[ playerid ] == true ) {

      PlayerInfo[ playerid ][ xPayDay ] += 1;

        if( PlayerInfo[ playerid ][ xHiac ] >= 1 ) PlayerInfo[ playerid ][ xStaffMin ]++;

        if( PlayerInfo[ playerid ][ xHelper ] >= 1  ) PlayerInfo[ playerid ][ xStaffMin ]++;

        VremeZaCuvanje[ playerid ]++;
        if( VremeZaCuvanje[ playerid ] == 30 ) {
           VremeZaCuvanje[ playerid ] = 0;
           SavePlayer( playerid );
      }

        if( PlayerInfo[ playerid ][ xPayDay ] == 30) {
            if( PlayerInfo[ playerid ][ xHeroinAddict ] == true ) {
             if( PlayerInfo[ playerid ][ xHeroinUsed ] > 0)
                  PlayerInfo[ playerid ][ xHeroinUsed ] -= 1;
           }
         else {
             if( PlayerInfo[ playerid ][ xHeroinIndicator ] > 0)
                PlayerInfo[ playerid ][ xHeroinIndicator ] -= 10;
         }
         if( PlayerInfo[ playerid ][ xMethAddict ] == true ) {
             if( PlayerInfo[ playerid ][ xMethUsed ] > 0)
                  PlayerInfo[ playerid ][ xMethUsed ] -= 1;
           }
         else {
             if(PlayerInfo[ playerid ][ xMethIndicator ] > 0 )
                PlayerInfo[ playerid ][ xMethIndicator ] -= 10;
         }
         if( PlayerInfo[ playerid ][ xCokeCrackAddict ] == true ) {
             if( PlayerInfo[ playerid ][ xCokeCrackUsed ] > 0 )
                  PlayerInfo[ playerid ][ xCokeCrackUsed ] -= 1;
           }
         else {
             if( PlayerInfo[ playerid ][ xCokeCrackIndicator ] > 0)
                PlayerInfo[ playerid ][ xCokeCrackIndicator ] -= 10;
         }
        }

      if( PlayerInfo[ playerid ][ xPayDay ] >= 60 ) {
         PayDay( playerid );
      }
   }
   return 1;
}
:)

Napravis timer kojim ces davati minute igre tipa
SetTimer("DajMinutIgre", 1000 * 60, true); // svaki minut poziva timer

forward DajMinutIgre();
public DajMinutIgre() {
foreach(new i : Player) MinutiIgre[i] ++;

static minute;

gettime(_, minute, _);

if (minute == 1) {
foreach(new i : Player) {
if (MinutiIgre[i] >= 40) {
// dajes payday
}
else SendClientMessage(i, -1, "nemas 40 minuta igre");
}
}
return 1;
}

Iz paychecka izbacis
if( PlayerInfo[ playerid ][ xPayDay ] >= 60 ) {
         PayDay( playerid );
      }


Nadjes u modu SyncTime
I odmah u ispunjenom uslovu
if( ( tmphour > ghour ) || ( tmphour == 0 && ghour == 23 ) ) {

Dodas
foreach( Player, i ) {
            if( PlayerInfo[ i ][ xPayDay ] >= 30 ) PayDay( i );
        }


pravila
heroin rap - Moskri u kuci, od sledece lajne glava ce mi puci