Injury system bug
#1

Hello, I have a problem with my injury system.
The problem is, it fucks up like insane.
Sometimes it just shows "Internal Injury" even though I shot the person in every body part...
Anyway, if someone can tell why is this Bug happening, I'll be glad for that.
Thanks.
Код:
COMMAND:injuries(playerid, params[])
{
	new targetid;
	if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /injuries [playerid]");

	if(GetPVarInt(targetid, "Dead") != 2) return SendClientMessage(playerid, COLOR_ERROR, "This player is not dead.");

	new title[60];
	format(title, sizeof(title), "Injuries of %s", PlayerInfo[playerid][pName]);

	new content[1024];
	format(content, sizeof(content), "This player is injured in the following bodyparts:\n\n");

	new injury[128], injuries = 0;
	for(new i = 0; i < 10; i++)
	{
		format(injury, sizeof(injury), "");
		if(PlayerInfo[playerid][pInjuries][i] > 0)
		{
			switch(i)
			{
				case 1:
				{
					format(injury, sizeof(injury), "Chest Injury x%i\n", PlayerInfo[playerid][pInjuries][i]);
					injuries++;
				}
				case 2:
				{
					format(injury, sizeof(injury), "Groin Injury x%i\n", PlayerInfo[playerid][pInjuries][i]);
					injuries++;
				}
				case 3:
				{
					format(injury, sizeof(injury), "Left Arm Injury x%i\n", PlayerInfo[playerid][pInjuries][i]);
					injuries++;
				}
				case 4:
				{
					format(injury, sizeof(injury), "Right Arm Injury x%i\n", PlayerInfo[playerid][pInjuries][i]);
					injuries++;
				}
				case 5:
				{
					format(injury, sizeof(injury), "Left Leg Injury x%i\n", PlayerInfo[playerid][pInjuries][i]);
					injuries++;
				}
				case 6:
				{
					format(injury, sizeof(injury), "Right Leg Injury x%i\n", PlayerInfo[playerid][pInjuries][i]);
					injuries++;
				}
				case 7:
				{
					format(injury, sizeof(injury), "Head Injury x%i\n", PlayerInfo[playerid][pInjuries][i]);
					injuries++;
				}
			}
		}

		if(strlen(injury) > 0)
		{
			format(content, sizeof(content), "%s%s", content, injury);
		}
	}

	if(injuries == 0)
	{
		format(injury, sizeof(injury), "Internal Injury\n");
		format(content, sizeof(content), "%s%s", content, injury);
	}

	ShowPlayerDialogEx(playerid, DIALOG_INJURIES, DIALOG_STYLE_MSGBOX, title, content, "Close", "");
	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)