Richlist Command Errors
#1

Hello,

I'm trying to make a cmd for /richlist for my TDM server.
I'm getting these errors:

C:\Users\Hassan\Desktop\server\gamemodes\COD8.test .pwn(13832) : error 001: expected token: ";", but found ")"
C:\Users\Hassan\Desktop\server\gamemodes\COD8.test .pwn(13832) : error 029: invalid expression, assumed zero
C:\Users\Hassan\Desktop\server\gamemodes\COD8.test .pwn(13832) : warning 215: expression has no effect
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.



CMD:richlist(playerid,params[]) {
#pragma unused params
new string[128], Slot1 = -1, Slot2 = -1, Slot3 = -1, Slot4 = -1, HighestCash = -9999);
SendClientMessage(playerid,white,"Rich List:");

for(new x=0; x<MAX_PLAYERS; x++) if (IsPlayerConnected(x)) if (GetPlayerMoney(x) >= HighestCash) {
HighestCash = GetPlayerMoney(x);
Slot1 = x;
}
HighestCash = -9999;
for(new x=0; x<MAX_PLAYERS; x++) if (IsPlayerConnected(x) && x != Slot1) if (GetPlayerMoney(x) >= HighestCash) {
HighestCash = GetPlayerMoney(x);
Slot2 = x;
}
HighestCash = -9999;
for(new x=0; x<MAX_PLAYERS; x++) if (IsPlayerConnected(x) && x != Slot1 && x != Slot2) if (GetPlayerMoney(x) >= HighestCash) {
HighestCash = GetPlayerMoney(x);
Slot3 = x;
}
HighestCash = -9999;
for(new x=0; x<MAX_PLAYERS; x++) if (IsPlayerConnected(x) && x != Slot1 && x != Slot2 && x != Slot3) if (GetPlayerMoney(x) >= HighestCash) {
HighestCash = GetPlayerMoney(x);
Slot4 = x;
}
format(string, sizeof(string), "(%d) %s - $%d", Slot1,PlayerName2(Slot1),GetPlayerMoney(Slot1) );
SendClientMessage(playerid,white,string);
if(Slot2 != -1) {
format(string, sizeof(string), "(%d) %s - $%d", Slot2,PlayerName2(Slot2),GetPlayerMoney(Slot2) );
SendClientMessage(playerid,white,string);
}
if(Slot3 != -1) {
format(string, sizeof(string), "(%d) %s - $%d", Slot3,PlayerName2(Slot3),GetPlayerMoney(Slot3) );
SendClientMessage(playerid,white,string);
}
if(Slot4 != -1) {
format(string, sizeof(string), "(%d) %s - $%d", Slot4,PlayerName2(Slot4),GetPlayerMoney(Slot4) );
SendClientMessage(playerid,white,string);
}
return 1;
}
Reply
#2

i if (IsPlayerConnected(x)) if (GetPlayerMoney(x) >= HighestCash)
change this to
if(IsPlayerConnected(x) && GetPlayerMoney(x) >= HighestCash)
and similarly in other if's
Reply
#3

Where is that line ?
Reply
#4

The problem is in line 13832 not in other lines.

If possible can you try to fix it and paste the whole script here please.
Reply
#5

Here
Код:
CMD:richlist(playerid,params[]) {
    #pragma unused params
         new dialogstr[656];
 		new string[128], Slot1 = -1, Slot2 = -1, Slot3 = -1, Slot4 = -1, Slot5 = -1, Slot6 = -1, Slot7 = -1, Slot8 = -1, HighestCash = -9999;
 		SendClientMessage(playerid,COLOR_WHITE,"Rich List Dialog has been Opened...");

		for(new x=0; x<MAX_PLAYERS; x++) if (IsPlayerConnected(x)) if (GetPlayerMoney(x) >= HighestCash) {
			HighestCash = GetPlayerMoney(x);
			Slot1 = x;
		}
		HighestCash = -9999;
		for(new x=0; x<MAX_PLAYERS; x++) if (IsPlayerConnected(x) && x != Slot1) if (GetPlayerMoney(x) >= HighestCash) {
			HighestCash = GetPlayerMoney(x);
			Slot2 = x;
		}
		HighestCash = -9999;
		for(new x=0; x<MAX_PLAYERS; x++) if (IsPlayerConnected(x) && x != Slot1 && x != Slot2) if (GetPlayerMoney(x) >= HighestCash) {
			HighestCash = GetPlayerMoney(x);
			Slot3 = x;
		}
		HighestCash = -9999;
		for(new x=0; x<MAX_PLAYERS; x++) if (IsPlayerConnected(x) && x != Slot1 && x != Slot2 && x != Slot3) if (GetPlayerMoney(x) >= HighestCash) {
			HighestCash = GetPlayerMoney(x);
			Slot4 = x;
		}
		HighestCash = -9999;
		for(new x=0; x<MAX_PLAYERS; x++) if (IsPlayerConnected(x) && x != Slot1 && x != Slot2 && x != Slot3 && x != Slot4) if (GetPlayerMoney(x) >= HighestCash) {
			HighestCash = GetPlayerMoney(x);
			Slot5 = x;
		}
		HighestCash = -9999;
		for(new x=0; x<MAX_PLAYERS; x++) if (IsPlayerConnected(x) && x != Slot1 && x != Slot2 && x != Slot3 && x != Slot4 && x != Slot5) if (GetPlayerMoney(x) >= HighestCash) {
			HighestCash = GetPlayerMoney(x);
			Slot6 = x;
		}
		HighestCash = -9999;
		for(new x=0; x<MAX_PLAYERS; x++) if (IsPlayerConnected(x) && x != Slot1 && x != Slot2 && x != Slot3 && x != Slot4 && x != Slot5 && x != Slot6) if (GetPlayerMoney(x) >= HighestCash) {
			HighestCash = GetPlayerMoney(x);
			Slot7 = x;
		}
		HighestCash = -9999;
		for(new x=0; x<MAX_PLAYERS; x++) if (IsPlayerConnected(x) && x != Slot1 && x != Slot2 && x != Slot3 && x != Slot4 && x != Slot5 && x != Slot6 && x != Slot7) if (GetPlayerMoney(x) >= HighestCash) {
			HighestCash = GetPlayerMoney(x);
			Slot8 = x;
		}
		    format(string, sizeof(string), ""ccyan"(%d) %s - $%d\n", Slot1,PlayerName2(Slot1),GetPlayerMoney(Slot1));
		    strcat(dialogstr, string);
		if(Slot2 != -1)	{
			format(string, sizeof(string), ""cgreen"(%d) %s - $%d\n", Slot2,PlayerName2(Slot2),GetPlayerMoney(Slot2));
			strcat(dialogstr, string);
		}
		if(Slot3 != -1)	{
			format(string, sizeof(string), ""cblue"(%d) %s - $%d\n", Slot3,PlayerName2(Slot3),GetPlayerMoney(Slot3));
			strcat(dialogstr, string);
		}
		if(Slot4 != -1)	{
			format(string, sizeof(string), ""cyellow"(%d) %s - $%d\n", Slot4,PlayerName2(Slot4),GetPlayerMoney(Slot4));
			strcat(dialogstr, string);
		}
		if(Slot5 != -1)	{
			format(string, sizeof(string), ""corange"(%d) %s - $%d\n", Slot4,PlayerName2(Slot5),GetPlayerMoney(Slot4));
			strcat(dialogstr, string);
		}
		if(Slot6 != -1)	{
			format(string, sizeof(string), ""cred"(%d) %s - $%d\n", Slot4,PlayerName2(Slot6),GetPlayerMoney(Slot4));
			strcat(dialogstr, string);
		}
		if(Slot7 != -1)	{
			format(string, sizeof(string), ""ccyan"(%d) %s - $%d\n", Slot4,PlayerName2(Slot7),GetPlayerMoney(Slot4));
			strcat(dialogstr, string);
		}
		if(Slot8 != -1)	{
			format(string, sizeof(string), ""cgrey"(%d) %s - $%d\n", Slot4,PlayerName2(Slot8),GetPlayerMoney(Slot4));
			strcat(dialogstr, string);
		}
		ShowPlayerDialog(playerid, 112, DIALOG_STYLE_LIST,"RICHLIST Stats", dialogstr,"Close","");
		return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)