Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void SendDeathMessage(int id, int victim, int health, int writesocket)
- {
- buffer[position] = 19;
- position++;
- buffer[position] = id;
- position++;
- buffer[position] = victim;
- position++;
- buffer[position] = wpnid; //player[id].actualweapon
- position++;
- memcpy(buffer + position, &player[victim].x, sizeof(unsigned short));
- position+= sizeof(unsigned short);
- memcpy(buffer + position, &player[victim].y, sizeof(unsigned short));
- position += sizeof(unsigned short);
- memcpy(buffer + position, (unsigned short)240,sizeof(unsigned short));
- position += sizeof(unsigned short);
- buffer[position] = 1;
- char sHealth[4];
- char sArmor[4]; //= player[id].health
- int sHealthLength = sprintf(sHealth,"%i",(int)player[id].health);
- int sArmorLength = sprintf(sArmor,"%i",(int)player[id].armor);
- int sNameLength = strlen(player[id].name);
- int length = 4 + sNameLength + sHealthLength + sArmorLength; // 4 for a6 spaces
- memcpy(buffer + position,(unsigned short)length,sizeof(unsigned short));
- position += sizeof(unsigned short);
- buffer[position] = 'k';
- position+=1;
- buffer[position] = 166; //166 acts like string seperator
- position+=1;
- memcpy(buffer + position, &player[id].name, sNameLength);
- position+= sNameLength;
- buffer[position] = 166;
- position++;
- memcpy(buffer + position, &sHealth, sHealthLength);
- position+= sHealthLength;
- buffer[position] = 166;
- position++;
- memcpy(buffer + position, &sArmor, sArmorLength);
- position += sArmorLength;
- buffer[position] = 24;
- position++;
- buffer[position] = 2;
- position++;
- buffer[position] = 2;
- position++;
- memcpy(buffer+position, (unsigned short)20,sizeof(unsigned short));
- position += sizeof(unsigned short);
- buffer[position] = 118;
- position++;
- buffer[position] = 0;
- position++;
- buffer[position] = 0;
- position++;
- buffer[position] = 1;
- position++;
- buffer[position] = 0;
- position++;
- memcpy( buffer + position,(int)(player[victim].x / 32),4);
- position+=4;
- memcpy(buffer + position,(int)(player[victim].y / 32),4);
- position+=4;
- buffer[position] = 2;
- position++;
- buffer[position] = 7;
- position++;
- buffer[position] = 1;
- position++;
- }
Add Comment
Please, Sign In to add comment