SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 22/09/2016, 02:03 PM   #1
FinStar
Big Clucker
 
Join Date: Nov 2013
Location: Instead of nothing
Posts: 155
Reputation: 0
Default dmg amount, save in-array

Hello, I want to ask how to save amount damage to that player and then how to display it in the dialogue?


Code:
#define MAX_BODY_PARTS 7
#define MAX_WEAPONS 55

new Damage[MAX_PLAYERS][MAX_BODY_PARTS][MAX_WEAPONS];


DisplayDamages(toplayer, playerid)
{
	new playername[MAX_PLAYER_NAME], title[45];
	GetPlayerName(playerid, playername, sizeof(playername));
	format(title, sizeof(title), "DMG info player: %s.", playername);
	if(!CountDamages(playerid)) return ShowPlayerDialog(toplayer, D_DAMAGES, DIALOG_STYLE_LIST, title, "Nothing injuries", ">>>", "");
	new gText[1000], fstr[200];
	new Float:armour;
	GetPlayerArmour(playerid, armour);
	for(new i = 0; i < MAX_BODY_PARTS; i++)
	{
		for(new z = 0; z < MAX_WEAPONS; z++)
		{
			if(!Damage[playerid][i][z]) continue;
			switch(i)
			{
				case 0 .. 15: format(fstr, sizeof(fstr), "%d hit(y) from %s, body part %s\n", Damage[playerid][i][z], GetWeaponNameEx(z), GetBodyPartName(i + 3));
				//case 54: format(fstr, sizeof(fstr), "%d falls to the %s\n", Damage[playerid][i][z], GetBodyPartName(i));
				//default: format(fstr, sizeof(fstr), "%d bullets from %s to the %s\n", Damage[playerid][i][z], GetWeaponNameEx(z), GetBodyPartName(i + 3));
			}
			strcat(gText, fstr);
		}
	}
	ShowPlayerDialog(toplayer, D_DAMAGES, DIALOG_STYLE_LIST, title, gText, "Close", "");
	return 1;
}


public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
	if((0 <= weaponid <= 46) || weaponid == 54)
	{
		if(BODY_PART_TORSO <= bodypart <= BODY_PART_HEAD) Damage[playerid][(bodypart - 3)][weaponid]++;
		{
		
		}
return 1;
	}
FinStar is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Amount of items in an array. Jimmy0wns Scripting Help 5 18/06/2015 12:06 PM
How Do I Do This? On Screen Amount Of Kills And amount Of Deaths HayZatic Help Archive 1 01/07/2011 02:26 PM
Using an array to save this... Scenario Help Archive 2 17/10/2010 03:03 PM
Custom bank script doesn't save properly/load amount Biesmen Help Archive 0 14/10/2010 02:42 PM
Save amount in string Mike Garber Help Archive 4 19/02/2010 08:45 AM


All times are GMT. The time now is 07:40 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.