[Ajuda] Payday
#1

entгo meu payday nгo ta dando hora certa!!!

Код:
SetTimer("PayDay",30*60000, true);
Код:
public SyncTime()
{
	new string[64];
	new tmphour;
	new tmpminute;
	new tmpsecond;
	gettime(tmphour, tmpminute, tmpsecond);
	Fixhour(tmphour);
	tmphour = shifthour;
	if ((tmphour > ghour) || (tmphour == 0 && ghour == 23))
	{
		format(string, sizeof(string), "[BEG]: Agora sгo %d:00 horas",shifthour);
		BroadCast(COLOR_WHITE,string);
		ghour = tmphour;
		PayDay();
		SetHora();
	}
}
Код:
public PayDay()
{
	new Conta,interest;
	new rent = 0;
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i) && !IsPlayerNPC(i))
		{
		    if(PlayerInfo[i][pLevel] > 0)
		    {
		    	if(MoneyMessage[i]==1)
				{
				    SendClientMessage(i, COR_TRIADS, "Vocк devia ter debitado suas dнvidas, lhe enviaram um pedido de prisгo.");
				    GameTextForPlayer(i, "~r~apreendido !", 2000, 1);
				    SetPlayerInterior(i, 6);
			   		SetPlayerPos(i, 264.6288,77.5742,1001.0391);
		            PlayerInfo[i][pJailed] = 1;
		            ResetPlayerWeapons(i);
					WantedPoints[i] = 0;
					PlayerInfo[i][pJailTime] = 240;
					format(gstring, sizeof(gstring), "Vocк foi preso por %d segundos.   Fianзa: Desativada", PlayerInfo[i][pJailTime]);
					SendClientMessage(i, COLOR_LIGHTBLUE, gstring);
				}
				if(Multa[i] > 1)
				{
				    SendClientMessage(i, COR_TRIADS, "Vocк devia ter debitado suas dнvidas, lhe enviaram um pedido de prisгo.");
				    GameTextForPlayer(i, "~r~apreendido !", 2000, 1);
				    SetPlayerInterior(i, 6);
			   		SetPlayerPos(i, 264.6288,77.5742,1001.0391);
		            PlayerInfo[i][pJailed] = 1;
		            ResetPlayerWeapons(i);
					WantedPoints[i] = 0;
					PlayerInfo[i][pJailTime] = 240;
					format(gstring, sizeof(gstring), "Vocк foi preso por %d segundos.   Fianзa: Desativada", PlayerInfo[i][pJailTime]);
					SendClientMessage(i, COLOR_LIGHTBLUE, gstring);
				}
			    if(MoneyMessage[i]==1)
				{
				    SendClientMessage(i, COLOR_LIGHTRED, "Vocк nгo pagou a sua dнvida e foi preso.");
				    GameTextForPlayer(i, "~r~Preso!", 2000, 1);
				    SetPlayerInterior(i, 6);
			   		SetPlayerPos(i, 264.6288,77.5742,1001.0391);
		            PlayerInfo[i][pJailed] = 1;
		            ResetPlayerWeaponsEx(i);
                    WantedPoints[i] = 0;
      				SetPlayerWantedLevel(i, 0);
					PlayerInfo[i][pJailTime] = 600;
					format(gstring, sizeof(gstring), "Vocк foi preso por %d segundos.", PlayerInfo[i][pJailTime]);
					SendClientMessage(i, COLOR_LIGHTBLUE, gstring);
				}
				new playername2[MAX_PLAYER_NAME];
				GetPlayerName(i, playername2, sizeof(playername2));
				Conta = PlayerInfo[i][pConta];
				new key = PlayerInfo[i][pPHousekey];
				if(key != 255)
				{
					rent = HouseInfo[key][hRent];
					if(strcmp(playername2, HouseInfo[key][hOwner], true) == 0)
					{
						rent = 0;
					}
					else if(rent > GetPlayerMoneyEx(i))
					{
						PlayerInfo[i][pPHousekey] = 255;
						SendClientMessage(i, COLOR_WHITE, "Vocк foi expulso(a).");
						rent = 0;
					}
					HouseInfo[key][hTakings] = HouseInfo[key][hTakings]+rent;
				}
				new tmpintrate;
			    if(PlayerInfo[i][pVIP] == 1) { tmpintrate = 3; }
			    else if(PlayerInfo[i][pVIP] == 2) { tmpintrate = 4; }
				else { tmpintrate = 1; }
				if(PlayerInfo[i][pPayDay] >= 3)
				{
				    Tax += TaxValue;//Shorld work for every player online
				    PlayerInfo[i][pConta] -= TaxValue;
					new checks = PlayerInfo[i][pSalario];
				    new ebill = (PlayerInfo[i][pConta]/30000)*(PlayerInfo[i][pLevel]);
				    ConsumingMoney[i] = 1;
				    GivePlayerMoneyEx(i, checks);
				    if(PlayerInfo[i][pConta] > 0)
				    {
				    	PlayerInfo[i][pConta] -= ebill;
				    	SBizzInfo[4][sbTill] += ebill;
					}
					else
					{
					    ebill = 0;
					}
					if(CHitman == CTriad && Avisouc == 0)
					{
					SendClientMessageToAll(COLOR_LIGHTBLUE, "Os Hitmans e os Triads concluiram o mesmo nъmero de contratos.");
					Avisouc = 1;
					}
					if(CHitman > CTriad && Avisouc == 0)
					{
					SendClientMessageToAll(COLOR_LIGHTBLUE, "Os Hitmans concluiram um maior nъmero de contratos do que os Triads e ganharam um Bфnus Especial.");
					CHitman = 0;
					CTriad = 0;
					Avisouc = 1;
					GanhouArmamento = 8;
					}
	 				if(CTriad > CHitman && Avisouc == 0)
					{
					SendClientMessageToAll(COLOR_LIGHTBLUE, "Os Triads concluiram um maior nъmero de contratos do que os Hitmans e ganharam um Bфnus Especial.");
					CHitman = 0;
					CTriad = 0;
					Avisouc = 1;
					GanhouArmamento = 26;
                    }
					interest = (PlayerInfo[i][pConta]/1000)*(tmpintrate);
					PlayerInfo[i][pExp]++;
					PlayerPlayMusic(i);
					PlayerInfo[i][pConta] = Conta+interest;
					SendClientMessage(i, COLOR_WHITE, "|_____ Mensagem do Banco _____|");
					format(gstring, sizeof(gstring), "  Salario: {33AA33}R$%d   {FFFFFF}Imposto: {FF6347}-R$%d", checks, TaxValue);
					SendClientMessage(i, COLOR_GRAD1, gstring);
					SendClientMessage(i, COLOR_GRAD1, "  Mйdico: {FF6347}-R$100");
					if(PlayerInfo[i][pPHousekey] != 255 || PlayerInfo[i][pPbiskey] != 255)
					{
					    format(gstring, sizeof(gstring), "  Taxa de Iluminaзгo Pъblica: {FF6347}-R$%d", ebill);
						SendClientMessage(i, COLOR_GRAD1, gstring);
					}
					format(gstring, sizeof(gstring), "  Banco: {FF6347}R$%d", Conta);
					SendClientMessage(i, COLOR_GRAD1, gstring);
					format(gstring, sizeof(gstring), "  Juros: {FF6347}0.%d  por cento",tmpintrate);
					SendClientMessage(i, COLOR_GRAD2, gstring);
					SendClientMessage(i, COLOR_GRAD4, "|_______________________________________|");
					format(gstring, sizeof(gstring), "  Novo Saldo: {FF6347}R$%d", PlayerInfo[i][pConta]);
					SendClientMessage(i, COLOR_GRAD5, gstring);
					format(gstring, sizeof(gstring), "  Aluguel: {FF6347}-R$%d", rent);
					SendClientMessage(i, COLOR_GRAD5, gstring);
					PlayerPlaySound(i, 1185, 0.0, 0.0, 0.0);
					format(gstring, sizeof(gstring), "~p~-==- ~g~Salario ~p~ -==-");
					GameTextForPlayer(i, gstring, 5000, 1);
					GivePlayerMoney(i,- 100);
					rent = 0;
					PlayerInfo[i][pPayDay] = 0;
					PlayerInfo[i][pSalario] = 0;
					PlayerInfo[i][pConnectTime] += 15;
                    PlayerInfo[i][pCaixinha] = 0;
					pban[i] = 0;
					if(PlayerInfo[i][pEmprego] > 0)
	    			{
	    	    		if(PlayerInfo[i][pContractTime] < 25)
	    	    		{
							PlayerInfo[i][pContractTime] ++;
						}
	    			}
				}
				else
				{
				    SendClientMessage(i, COLOR_LIGHTRED, "* Vocк nгo jogou tempo suficiente para receber salбrio!.");
				}
			}
		}
Reply
#2

Faltou o SendClientMessageToAll() no SyncTime, vocк sу colocou o format()
Reply
#3

Quote:
Originally Posted by Juniiro3
Посмотреть сообщение
Faltou o SendClientMessageToAll() no SyncTime, vocк sу colocou o format()
pode escrever como ficaria? para eu nгo por lugar errado...
Reply
#4

pawn Код:
format(string, sizeof(string), "[BEG]: Agora sгo %d:00 horas",shifthour);
SendClientMessageToAll ( CorDaMensagem /*Aqui vc muda*/ , string /*Essa string vc nao muda*/ );
Se precisar de uma explicaзгo mais detalhada й sу falar, mas acho que dб pra entender o que estб acontecendo ai...
Reply
#5

Quote:
Originally Posted by Juniiro3
Посмотреть сообщение
pawn Код:
format(string, sizeof(string), "[BEG]: Agora sгo %d:00 horas",shifthour);
SendClientMessageToAll ( CorDaMensagem /*Aqui vc muda*/ , string /*Essa string vc nao muda*/ );
Se precisar de uma explicaзгo mais detalhada й sу falar, mas acho que dб pra entender o que estб acontecendo ai...
entгo ficaria assim correto?
Код:
public SyncTime()
{
	new string[64];
	new tmphour;
	new tmpminute;
	new tmpsecond;
	gettime(tmphour, tmpminute, tmpsecond);
	Fixhour(tmphour);
	tmphour = shifthour;
	if ((tmphour > ghour) || (tmphour == 0 && ghour == 23))
	{
		format(string, sizeof(string), "[BEG]: Agora sгo %d:00 horas",shifthour);
		SendClientMessageToAll ( COLOR_WHITE , string /*Essa string vc nao muda*/ );
		BroadCast(COLOR_WHITE,string);
		ghour = tmphour;
		PayDay();
		SetHora();
	}
}
Reply
#6

Quote:
Originally Posted by AssasinoLM
Посмотреть сообщение
entгo ficaria assim correto?
Код:
public SyncTime()
{
	new string[64];
	new tmphour;
	new tmpminute;
	new tmpsecond;
	gettime(tmphour, tmpminute, tmpsecond);
	Fixhour(tmphour);
	tmphour = shifthour;
	if ((tmphour > ghour) || (tmphour == 0 && ghour == 23))
	{
		format(string, sizeof(string), "[BEG]: Agora sгo %d:00 horas",shifthour);
		SendClientMessageToAll ( COLOR_WHITE , string /*Essa string vc nao muda*/ );
		BroadCast(COLOR_WHITE,string);
		ghour = tmphour;
		PayDay();
		SetHora();
	}
}
Sim.
Reply
#7

tambem pode usar assim

pawn Код:
public SyncTime()
{
    new string[64], tempo[3];
    gettime(tempo[0], tempo[1], tempo[2]);
    Fixhour(tempo[0]);
    tempo[0] = shifthour;
    if ((tempo[0] > ghour) || (tempo[0] == 0 && ghour == 23))
    {
        format(string, sizeof(string), "[BEG]: Agora sгo %d:00 horas", shifthour);
        SendClientMessageToAll(-1 , string);
        BroadCast(-1, string);
        ghour = tempo[0];
        PayDay();
        SetHora();
    }
}
assim evita criar varias new's..
Reply
#8

Quote:
Originally Posted by Juniiro3
Посмотреть сообщение
Sim.
oks vlw +resp
Reply
#9

os 2 ta com:

Код:
C:\Users\Leonardo Monteiro\Desktop\Brasil Extreme Games\gamemodes\BEG.pwn(17057) : error 029: invalid expression, assumed zero
C:\Users\Leonardo Monteiro\Desktop\Brasil Extreme Games\gamemodes\BEG.pwn(17058) : error 001: expected token: ";", but found "{"
C:\Users\Leonardo Monteiro\Desktop\Brasil Extreme Games\gamemodes\BEG.pwn(17059) : warning 219: local variable "string" shadows a variable at a preceding level
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Reply
#10

Quote:
Originally Posted by PT
Посмотреть сообщение
tambem pode usar assim

pawn Код:
public SyncTime()
{
    new string[64], tempo[3];
    gettime(tempo[0], tempo[1], tempo[2]);
    Fixhour(tempo[0]);
    tempo[0] = shifthour;
    if ((tempo[0] > ghour) || (tempo[0] == 0 && ghour == 23))
    {
        format(string, sizeof(string), "[BEG]: Agora sгo %d:00 horas", shifthour);
        SendClientMessageToAll(-1 , string);
        BroadCast(-1, string);
        ghour = tempo[0];
        PayDay();
        SetHora();
    }
}
assim evita criar varias new's..
uma olhadinha aqui e funciono agora ver se vai da payday na hora certinha rsrs vlw
+resp (PT e Juniiro3)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)