Compiler won't compile
#1

Hi guys,
I just did some code but, for some reason, compiler won't compile. I press F5 and nothing happend so I need to shut down pawncc.exe over Task Manager. I found where are problems(with /* and */) but visualy I don't see any mistakes in code(or something I missed)? Code's below

Код:
	if(_pitanje == 10)
	{
		new _string[212];
		new _bonus = 0;
		new _bodovi = Bit4_Get(_HRP_RPTestBodovi, _playerid);
		new Float:_postotak = 0.00;
		new _ocjena = 1;

		
		switch(_HRP_HaswellaRPTestVrijeme[_playerid]) // THIS SWITCH IS A PROBLEM
		{
			case 0 .. 60000: _bonus = 4;
			case 60001 .. 70000: _bonus = 3;
			case 70001 .. 90000: _bonus = 2;
			case 90001 .. 120000: _bonus = 1;
		}
		_postotak = (_bodovi + _bonus / 14) * 100;

		switch(_postotak) // AND THIS
		{
			case 50.01 .. 60.00: _ocjena = 2;
			case 50.01 .. 60.00: _ocjena = 3;
			case 60.01 .. 85.00: _ocjena = 4;
			case 85.01 .. 100.00: _ocjena = 5;
		}

		if(_ocjena > 1)
		{
			format(_string, 128, "UPDATE "_HRP_MYSQL_USR" SET RPTest = 1, RPTestBodovi = %d, RPTestVrijeme = %d WHERE ID = %d", Bit4_Get(_HRP_RPTestBodovi, _playerid), _HRP_HaswellaRPTestVrijeme[_playerid], _HRP_Korisnik[_playerid][_kID]);
			mysql_tquery(_HRP_database, _string);

			format(_string, 212, ""_HRP_SZELENA"Čestitamo, uspjeљno ste rijeљili roleplay test."_HRP_BIJELA" Sada ste slobodan igrač!\n\n- Vrijeme rjeљavanja testa: %.2f s\n- Bodovi: %d/10\n- Dodatni bodovi na vrijeme: %d/4\n- Ukupna ocjena: %d(%.2f %%)"
			,_HRP_HaswellaRPTestVrijeme[_playerid] / 1000, _bodovi, _bonus, _ocjena, _postotak);
			Dialog_Show(_playerid, _HRP_HASWELLA_RPTEST_D, DIALOG_STYLE_MSGBOX, "Čestitamo!", _string, "U redu", "");
		}
		else
		{
			format(_string, 212, ""_HRP_TCRVENA"Naћalost niљte poloћili roleplay test.\n\n"_HRP_BIJELA"- Vrijeme rjeљavanja testa: %.2f s\n- Bodovi: %d/10\n- Dodatni bodovi na vrijeme: %d/4\n- Ukupna ocjena: %d(%.2f %%)"
			,_HRP_HaswellaRPTestVrijeme[_playerid] / 1000, _bodovi, _bonus, _ocjena, _postotak);
			Dialog_Show(_playerid, _HRP_HASWELLA_RPTEST_D, DIALOG_STYLE_MSGBOX, "Naћalost...", _string, "Ponovno", "Izađi");			
		}	
		return (true);
	}
Reply
#2

Do not switch through large ranges. The compiler can't optimize this. I don't think you can use floating point numbers, either. You could try something like:
PHP код:
bonus 4;

if(var > 
60000) { bonus--; }
if(var > 
70000) { bonus--; }
if(var > 
90000) { bonus--; } 
Reply
#3

I'm not sure, I'll try with normal checks tomorrow... Thanks Vince, rep++
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)