commend /top
#1

Hi !
I have a problem with this command.
Код:
	if (strcmp(cmd, "/top", true)==0) {
		new closest,tempclosest,Top5[5],expygraczy[500];

		for(new i = 0; i < 5; i++){
			Top5[i] = -1;
		}
		for(new i = 0; i < 500; i++){
		  expygraczy[i] = -1;
		}
		
		for(new i = 0; i < GetMaxPlayers(); i++){
		  if(IsPlayerConnected(i))expygraczy[i] = GetPlayerExp(i);
		}
		
		closest = -1;
		tempclosest = -1;
		
		for(new i = 0; i < GetMaxPlayers(); i++){
			if(expygraczy[i] != (-1)){
				tempclosest = expygraczy[i];
				if(tempclosest < closest){
					closest = i;
					Top5[0] = i;
				}
			}
		}
		
		closest = -1;
		tempclosest = -1;

		for(new i = 0; i < GetMaxPlayers(); i++){
			if(expygraczy[i] != (-1) && i != Top5[0]){
				tempclosest = expygraczy[i];
				if(tempclosest < closest){
					closest = i;
					Top5[1] = i;
				}
			}
		}

		closest = -1;
		tempclosest = -1;

		for(new i = 0; i < GetMaxPlayers(); i++){
			if(expygraczy[i] != (-1) && i != Top5[0] && i != Top5[1]){
				tempclosest = expygraczy[i];
				if(tempclosest < closest){
					closest = i;
					Top5[2] = i;
				}
			}
		}

		closest = -1;
		tempclosest = -1;

		for(new i = 0; i < GetMaxPlayers(); i++){
			if(expygraczy[i] != (-1) && i != Top5[0] && i != Top5[1] && i != Top5[2]){
				tempclosest = expygraczy[i];
				if(tempclosest < closest){
					closest = i;
					Top5[3] = i;
				}
			}
		}

		closest = -1;
		tempclosest = -1;

		for(new i = 0; i < GetMaxPlayers(); i++){
			if(expygraczy[i] != (-1) && i != Top5[0] && i != Top5[1] && i != Top5[2] && i != Top5[3]){
				tempclosest = expygraczy[i];
				if(tempclosest < closest){
					closest = i;
					Top5[4] = i;
				}
			}
		}
		
		SendClientMessage2(playerid, CNORMAL, "*** Top 5 Graczy:");
		new str[256];
		format(str, 256, "* 1. %s - Poziom %d" ,PlayerName(Top5[0]), GetPlayerLevel(Top5[0]));
		SendClientMessage2(playerid, CINFO, str);
		if(Top5[1] == -1){
			format(str, 256, "* 2. %s - Poziom %d" ,PlayerName(Top5[1]), GetPlayerLevel(Top5[1]));
			SendClientMessage2(playerid, CINFO, str);
		}
		if(Top5[2] == -1){
			format(str, 256, "* 3. %s - Poziom %d" ,PlayerName(Top5[2]), GetPlayerLevel(Top5[2]));
			SendClientMessage2(playerid, CINFO, str);
		}
		if(Top5[3] == -1){
			format(str, 256, "* 4. %s - Poziom %d" ,PlayerName(Top5[3]), GetPlayerLevel(Top5[3]));
			SendClientMessage2(playerid, CINFO, str);
		}
		if(Top5[4] == -1){
			format(str, 256, "* 5. %s - Poziom %d" ,PlayerName(Top5[4]), GetPlayerLevel(Top5[4]));
			SendClientMessage2(playerid, CINFO, str);
		}
When I enter it it pops up.
Top 5 players:
Server: Unknow Command.
Please help.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)