command returns 0 once again
#1

Harro zer ma ferrow SAMP-mates this command returns 0 or "Unknown command" to me. Is there any error?
Код:
GetPlayerRank(playerid)
{
	new string[128];
	for(new i = 0; i < sizeof(rInfo[]); i++)
	{
	    if(GetPlayerScore(playerid) >= rInfo[i][ScoreMin] && GetPlayerScore(playerid) < rInfo[i][ScoreMax])
	    {
	        format(string, sizeof(string), rInfo[i][Name]);
	        return string;
		}
	}
	return string;
}
CMD:ranks(playerid, params[])
{
	new string[1000];
	for(new i = 0; i < sizeof(rInfo[]); i++)
	{
 		format(string, sizeof(string), "%s (%d - %d)\n", GetPlayerRank(playerid), rInfo[i][ScoreMin], rInfo[i][ScoreMax]);
	}
	ShowPlayerDialog(playerid, d_rank, DIALOG_STYLE_MSGBOX, "Ranks", string, "OK", "");
	return 1;
}
Reply
#2

Change sizeof(rInfo[]) to sizeof(rInfo). The first one would be valid only if you have a 2D, 3D array and wanted to get the size of the second dimension. Note that it would not work with enumerators.
Reply
#3

Thank you
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)