[Ajuda] Salario
#1

meu sistema de salario era um eu mudei o relogio pra horario certo queria coloca pro cara ganhar o salario em 1 hora certinha de jogo poderia mi ajudar ?

Код HTML:
public Usoudroga()
{
	minu++;
	if (horas == 0)
	{
		SetWorldTime(0);
	}
	if (minu >= 59)
	{
		minu = 0;
		horas++;
		SetWorldTime(horas);
	}
	if (horas > 23)
	{
		horas = 0;
	}
	new string[128];
	if (minu <= 9)
	{
		format(string, 25, "~w~%d:0%d", horas, minu);
	}
	else
	{
		format(string, 25, "~w~%d:%d", horas, minu);
	}
	//Salariooooooooooo
	if (horas == 00 && minu == 5)
	{
		Up();
	}
	for (new i = 0; i < MAX_PLAYERS; i++)
	{
		if (IsPlayerConnected(i))
		{
			//
			ResetPlayerMoney(i);
			GivePlayerMoney(i, GetPlayerGrana(i));
			GetPlayerPos(i, PlayerCurrentPos[0], PlayerCurrentPos[1], PlayerCurrentPos[2]);
			if (!floatcmp(PlayerCurrentPos[0], PlayerLastPos[i][LastX]) && !floatcmp(PlayerCurrentPos[1], PlayerLastPos[i][LastY]))
			{
				PlayerAfkTicks[i]++;
			}
			else
			{
				PlayerAfkTicks[i] = 0;
			}
			PlayerLastPos[i][LastX] = PlayerCurrentPos[0];
			PlayerLastPos[i][LastY] = PlayerCurrentPos[1];
			PlayerLastPos[i][LastZ] = PlayerCurrentPos[2];
			if (PlayerAfkTicks[i] == MAX_IDLE_TIME * 60)
			{
				AFK[i] = 1;
				SendClientMessage(i, 0x11B1FFAA, "=============================================================================================");
				SendClientMessage(i, 0x11B1FFAA, "Voзк foi impedido de jogar e upar (Motivo ficou 5 minutos sem se mecher volte para o jogo Use: /on");
				SendClientMessage(i, 0x11B1FFAA, "=============================================================================================");
				SetPlayerVirtualWorld(i, 1);
				SetCameraBehindPlayer(i);
				TogglePlayerControllable(i, 0);
				TextDrawShowForPlayer(i, AfkText);
				TextDrawShowForPlayer(i, AfkBackText);
			}
			//
			new aname[MAX_PLAYER_NAME];
			GetPlayerName(i, aname, sizeof(aname));
			format(file, sizeof(file), PASTA_CONTAS, aname);
			new Float: health;
			GetPlayerHealth(i, health);
			if (dini_Int(file, "usoudroga") == 1)
			{
				SetPlayerHealth(i, health - 1);
			}
		}
	}
}


public Atualizartempo()
{
    gettime(HoraRoYal, MinutosRoYal);
    format(StringRoYalTempo,32,"%02d:%02d",HoraRoYal,MinutosRoYal);
    TextDrawSetString(TempoRoYal,StringRoYalTempo);

    SetWorldTime(HoraRoYal);

    new x=0;
    while(x!=MAX_PLAYERS) {
        if(IsPlayerConnected(x) && GetPlayerState(x) != PLAYER_STATE_NONE) {
            SetPlayerTime(x,HoraRoYal,MinutosRoYal);
        }
        x++;
    }
}
Reply
#2

pawn Код:
//Topo:
forward CheckSeconds();
new Hours, Minutes, Seconds;

// No OnGameModeInit:
SetTimer("CheckSeconds", 1000, true);

// No Final:
public CheckSeconds() {
    gettime(Hours, Minutes, Seconds);
    if (Minutes == 0 && Seconds == 0) {
        switch (Hours) {
        case 1:
            Up(); // Para Depositar o salбrio аs 1h da manhг de todos os dias
        case 2:
            Up();
        case 3:
            Up();
        case 4:
            Up();
        case 5:
            Up();
        case 6:
            Up();
        case 7:
            Up();
        case 8:
            Up();
        case 9:
            Up();
        case 10:
            Up();
        case 11:
            Up();
        case 12:
            Up();
        case 13:
            Up();
        case 14:
            Up();
        case 15:
            Up();
        case 16:
            Up();
        case 17:
            Up();
        case 18:
            Up();
        case 19:
            Up();
        case 20:
            Up();
        case 21:
            Up();
        case 22:
            Up();
        case 23:
            Up();
        case 0:
            Up(); //meia noite
        }
    }
    return 1;
}
Reply
#3

eu tambйm estou com o mesmo problema. fiz de um jeito mudando a variavel do if e definindo a hora, porem quando chega a hora ele recebe o salario e fica flood, tambйm tentei fazer de 3 em 3 horas e nao consegui, alguem me ajuda ?

o GM й o mesmo que o SynVengeance estб usando..

Vlw aee
Reply
#4

pega isso de base, e monta de acordo com o teu.

pawn Код:
// em OngameModeInit
    SetTimer("pagamento",1000,true);

// no final do GM..
    forward pagamento();
    public pagamento()
    {
        new sHour, sMinute, sSecond;
        gettime(sHour, sMinute, sSecond);
        if(!sMinute)
        {
        for(new i; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
                SendClientMessage(i, COLOR_PINK, "Pagamento");
                GivePlayerMoney(i, SALARIO); //mude salario para o valor que quer que os players recebam a cada hora.
            }
        }
        }
        return 1;
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)