SA-MP Forums Archive
/damages not working - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /damages not working (/showthread.php?tid=608071)



/damages not working - lwilson - 27.05.2016

After applying PaulDinam's weapon damage encounter in my gamemode, the command doesn't work aswell its stock.
Код:
CMD:damages(playerid, params[])
{
	new id;
	if(sscanf(params, "d", id)) return Syntax(playerid,"damages", "[playerid]");
	if(!IsPlayerConnected(id)) return SendClientMessageEx(playerid, COLOR_LIGHTRED, "[ERROR]: {FFFFFF}This player is not connected.");
	DisplayDamages(playerid, id);
	return 1;
}
Код:
[DisplayDamages(playerid, giveplayerid)
{
	new playername[MAX_PLAYER_NAME], title[45];
	GetPlayerName(giveplayerid, playername, sizeof(playername));
	format(title, sizeof(title), "%s's weapon damages", playername);
	if(!CountDamages(giveplayerid)) return ShowPlayerDialog(playerid, 65000, DIALOG_STYLE_LIST, title, "There are no damages to display...", ">>>", "");
	new gText[1000], fstr[45];
	for(new i = 0; i < MAX_BODY_PARTS; i++)
	{
		for(new z = 0; z < MAX_WEAPONS; z++)
		{
			if(!Damage[giveplayerid][i][z]) continue;
			switch(i)
			{
				case 0 .. 15: format(fstr, sizeof(fstr), "%d hits from %s to the %s\n", Damage[giveplayerid][i][z], GetWeaponNameEx(z), GetBodyPartName(i + 3));
				case 54: format(fstr, sizeof(fstr), "%d falls to the %s\n", Damage[giveplayerid][i][z], GetBodyPartName(i));
				default: format(fstr, sizeof(fstr), "%d bullets from %s to the %s\n", Damage[giveplayerid][i][z], GetWeaponNameEx(z), GetBodyPartName(i + 3));
			}
			strcat(gText, fstr);
		}
	}
	ShowPlayerDialog(playerid, 65000, DIALOG_STYLE_LIST, title, gText, "Close", "");
	return 1;
}



Re: /damages not working - AliBro - 27.05.2016

remove " [ " from DisplayDamages
For Example

Код:
DisplayDamages(playerid, giveplayerid)
{
	new playername[MAX_PLAYER_NAME], title[45];
	GetPlayerName(giveplayerid, playername, sizeof(playername));
	format(title, sizeof(title), "%s's weapon damages", playername);
	if(!CountDamages(giveplayerid)) return ShowPlayerDialog(playerid, 65000, DIALOG_STYLE_LIST, title, "There are no damages to display...", ">>>", "");
	new gText[1000], fstr[45];
	for(new i = 0; i < MAX_BODY_PARTS; i++)
	{
		for(new z = 0; z < MAX_WEAPONS; z++)
		{
			if(!Damage[giveplayerid][i][z]) continue;
			switch(i)
			{
				case 0 .. 15: format(fstr, sizeof(fstr), "%d hits from %s to the %s\n", Damage[giveplayerid][i][z], GetWeaponNameEx(z), GetBodyPartName(i + 3));
				case 54: format(fstr, sizeof(fstr), "%d falls to the %s\n", Damage[giveplayerid][i][z], GetBodyPartName(i));
				default: format(fstr, sizeof(fstr), "%d bullets from %s to the %s\n", Damage[giveplayerid][i][z], GetWeaponNameEx(z), GetBodyPartName(i + 3));
			}
			strcat(gText, fstr);
		}
	}
	ShowPlayerDialog(playerid, 65000, DIALOG_STYLE_LIST, title, gText, "Close", "");
	return 1;
}