26.03.2016, 11:51
Hello good people
I want to make history Player damage.
To death the player, displays information about the last 5 damage
help me
Привет добрые люди
Хочу сделать историю повреждений игрока.
Чтобы при смерти игрока, выводилась информация о последних 5 повреждений
I want to make history Player damage.
To death the player, displays information about the last 5 damage
help me
Привет добрые люди
Хочу сделать историю повреждений игрока.
Чтобы при смерти игрока, выводилась информация о последних 5 повреждений
Код:
#define MAX_DAMAGE 5 enum damageinfo { damSource, damPart[16], Float: damDamage, damWeapon, damTime[6] }; new damageInfo[MAX_DAMAGE][damageinfo]; new nDamage[MAX_PLAYERS];
Код:
public OnPlayerDeath(playerid, killerid, reason) { new str[MAX_DAMAGE][1024]; for(new i = 0; i < MAX_DAMAGE; i++) { if(damageInfo[i][damSource] == 1) { format(str[i], sizeof(str[i]), "Source: %d\nPart body: %s, damage %.1f\nweapon: %d\ntime: %02d/%02d/%d - %02d:%02d:%02d", damageInfo[i][damSource], damageInfo[i][damPart], damageInfo[i][damDamage], damageInfo[i][damWeapon], damageInfo[i][damTime][0], damageInfo[i][damTime][1], damageInfo[i][damTime][2], damageInfo[i][damTime][3], damageInfo[i][damTime][4], damageInfo[i][damTime][5]); } } format(str, sizeof(str), "%s\n\n%s\n\n%s\n\n%s\n\n%s", str[0], str[1], str[2], str[3], str[4]); ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "Информация", szOutput, "Закрыть", ""); return 1; }
Код:
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid, bodypart) { nDamage[damagedid] ++; if(nDamage[damagedid] >= MAX_DAMAGE) nDamage[damagedid] = 0; new bodyName[16]; switch(bodypart) { case 3: bodyName = "òóëîâèùå"; case 4: bodyName = "ãðóäü"; case 5: bodyName = "ëåâàÿ ðóêà"; case 6: bodyName = "ïðàâà ðóêà"; case 7: bodyName = "ëåâàÿ íîãà"; case 8: bodyName = "ïðàâà íîãà"; case 9: bodyName = "ãîëîâà"; } damageInfo[nDamage[damagedid]][damSource] = 1; damageInfo[nDamage[damagedid]][damPart] = bodyName; damageInfo[nDamage[damagedid]][damDamage] = amount; damageInfo[nDamage[damagedid]][damWeapon] = weaponid; getdate(damageInfo[nDamage[damagedid]][damTime][0], damageInfo[nDamage[damagedid]][damTime][1], damageInfo[nDamage[damagedid]][damTime][2]); gettime(damageInfo[nDamage[damagedid]][damTime][3], damageInfo[nDamage[damagedid]][damTime][4], damageInfo[nDamage[damagedid]][damTime][5]); return 1; }