Body Parts Not Showing up.
#1

I'm trying to Show the last bodypart which was shot OnPlayerDeath.

this my line under OnPlayerDeath -

Код:
SendClientMessageToAllEx(-1, "{FF0000}%s(%d) Died (%s). Killed By: %s(%d) (%s).", ReturnName(playerid), playerid, LastShot[playerid], ReturnName(killerid), killerid, DeathReason[reason]);
Код:
// Body Parts define.
#define WEAPON_BODY_PART_CHEST 3
#define WEAPON_BODY_PART_CROTCH 4
#define WEAPON_BODY_PART_LEFT_ARM 5
#define WEAPON_BODY_PART_RIGHT_ARM 6
#define WEAPON_BODY_PART_LEFT_LEG 7
#define WEAPON_BODY_PART_RIGHT_LEG 8
#define WEAPON_BODY_PART_HEAD 9
I just set the bodypart Under OnPlayerTakeDamage, like

LastShot[playerid] = bodypart;

All this shows ingame is empty brackets where body part should appear.
Reply
#2

Body parts are just numbers you've to make function to get them

PHP код:
GetBodyPartName(bodypart) {
   switch(
bodypart) {
       case 
3: return "BODY_PART_CHEST";
       case 
4: return "BODY_PART_CROTCH";
       case 
5: return "BODY_PART_LEFT_ARM";
       case 
6: return "BODY_PART_RIGHT_ARM";
       case 
7: return "BODY_PART_LEFT_LEG";
       case 
8: return "BODY_PART_RIGHT_LEG";
       case 
9: return "BODY_PART_HEAD";
   }
   return 
"UnKnow";
}
// Then
SendClientMessageToAllEx(-1"{FF0000}%s(%d) Died (%s). Killed By: %s(%d) (%s)."ReturnName(playerid), playeridGetBodyPartName(LastShot[playerid]), ReturnName(killerid), killeridDeathReason[reason]); 
Reply
#3

Crashes the Compiler :/

This is what i've added.

Код:
stock GetBodyPartName(bodypart)
{
   switch(bodypart)
   {
       case 3: return "Chest";
       case 4: return "Balls";
       case 5: return "Left Arm";
       case 6: return "Right Arm";
       case 7: return "Left Leg";
       case 8: return "Right Leg";
       case 9: return "Head";
   }
   return "Unknown";
}
And the same how you do OnPlayerDeath.
Reply
#4

Try this .-.
PHP код:

GetBodyPartName
(bodypart) {
   new 
partnn[35];
   switch(
bodypart) {
       case 
3format(partnn,sizeof partnn,"Chest");
       case 
4format(partnn,sizeof partnn,"Balls");
       case 
5format(partnn,sizeof partnn,"Left Arm");
       case 
6format(partnn,sizeof partnn,"Right Arm");
       case 
7format(partnn,sizeof partnn,"Right Arm");
       case 
8format(partnn,sizeof partnn,"Right Leg");
       case 
9format(partnn,sizeof partnn,"Head");
       default: 
format(partnn,sizeof partnn,"UnKnow");
   }
   return 
partnn;
}
// Then
SendClientMessageToAllEx(-1"{FF0000}%s(%d) Died (%s). Killed By: %s(%d) (%s)."ReturnName(playerid), playeridGetBodyPartName(LastShot[playerid]), ReturnName(killerid), killeridDeathReason[reason]); 
Reply
#5

Your Code is faulty, i guess. But anyways i think ill be able to do it, you gave me fair amount of help, and you deserve a rep for that.

EDIT - out of reps, but will rep you.
Reply
#6

I do not believe that the code does not work.
I tested it and it worked!

Код:
public OnGameModeInit()
{
	new bodypart = 5;
	
	printf("%s", GetBodyPartName(bodypart));
	
	return 1;
}

GetBodyPartName(bodypart) { 
   new partnn[35]; 
   switch(bodypart) { 
       case 3: format(partnn,sizeof partnn,"Chest"); 
       case 4: format(partnn,sizeof partnn,"Balls"); 
       case 5: format(partnn,sizeof partnn,"Left Arm"); 
       case 6: format(partnn,sizeof partnn,"Right Arm"); 
       case 7: format(partnn,sizeof partnn,"Right Arm"); 
       case 8: format(partnn,sizeof partnn,"Right Leg"); 
       case 9: format(partnn,sizeof partnn,"Head"); 
       default: format(partnn,sizeof partnn,"UnKnow"); 
   } 
   return partnn; 
}
Reply
#7

Well it showed me errors, But i put brackets like - sizeof(partnn) But okay, its solved. thanks jlat.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)