15.08.2016, 09:42
I'm trying to create damage system which displays all damage a player takes. I've encountered a problem.
Whenever a player takes a headshot, I want function GetWeaponDamage(I made it) to multiply and show it as, for example, 60 instead of 30. This is the error:
The actual line:
The GetWeaponDamage(i)*2 does the error
This is GetWeaponDamage:
And the defines of WEAPON_DMG_something are 5.0, 20.0 etc...
Whenever a player takes a headshot, I want function GetWeaponDamage(I made it) to multiply and show it as, for example, 60 instead of 30. This is the error:
pawn Код:
error 033: array must be indexed (variable "GetWeaponDamage")
pawn Код:
format(AddStr, sizeof(AddStr), "\n%d hits from %s("COL_RED"-%d"COL_WHITE") to HEAD", ShotAt[playerid][i][Bodypart][z], WeaponName(i), GetWeaponDamage(i)*2), strcat(dmgstring, AddStr);
This is GetWeaponDamage:
pawn Код:
GetWeaponDamage(WeaponID)
{
new wepdamage[20];
switch(WeaponID)
{
case 0,1..8: format(wepdamage,sizeof(wepdamage), "%d", floatround(WEAPON_DMG_BRASS));
case 22: format(wepdamage,sizeof(wepdamage), "%d", floatround(WEAPON_DMG_COLT));
case 23: format(wepdamage,sizeof(wepdamage), "%d", floatround(WEAPON_DMG_SILENCED));
case 24: format(wepdamage,sizeof(wepdamage), "%d", floatround(WEAPON_DMG_DEAGLE));
case 25: format(wepdamage,sizeof(wepdamage), "%d", floatround(WEAPON_DMG_SHOTGUN));
case 27: format(wepdamage,sizeof(wepdamage), "%d", floatround(WEAPON_DMG_COMBAT));
case 28: format(wepdamage,sizeof(wepdamage), "%d", floatround(WEAPON_DMG_UZI));
case 29: format(wepdamage,sizeof(wepdamage), "%d", floatround(WEAPON_DMG_MP5));
case 30: format(wepdamage,sizeof(wepdamage), "%d", floatround(WEAPON_DMG_AK47));
case 31: format(wepdamage,sizeof(wepdamage), "%d", floatround(WEAPON_DMG_M4));
case 32: format(wepdamage,sizeof(wepdamage), "%d", floatround(WEAPON_DMG_TEC9));
case 33: format(wepdamage,sizeof(wepdamage), "%d", floatround(WEAPON_DMG_RIFLE));
case 34: format(wepdamage,sizeof(wepdamage), "%d", floatround(WEAPON_DMG_SNIPER));
}
return wepdamage;
}