I am trying to detect when a player is hurt. This works, but I cannot determine how to get the user's ID. So here is my code:
Code:
register_event("PTakeDam","healthFunc","a");
// . . .
//Id will be 0
public healthFunc(id) {
//The message size was 14, so I made this, probably a shot in the dark
new num[15];
num[0] = read_data(-1);
num[1] = read_data(0);
num[2] = read_data(1);
num[3] = read_data(2);
num[4] = read_data(3);
num[5] = read_data(4);
num[6] = read_data(5);
num[7] = read_data(6);
num[8] = read_data(7);
num[9] = read_data(8);
num[10] = read_data(9);
num[11] = read_data(10);
num[12] = read_data(11);
num[13] = read_data(12);
num[14] = read_data(13);
//Loop so if one of the read_data's is the victim or attacker, it prints to him
new num2,players[32]
get_players(players,num2,"c")
for(new i = 1; i < num2; i++) {
new playa = players[i];
if(is_user_admin(playa)) {
for(new q = 0; q < 15; q++) {
new name[32];
get_user_name(num[q],name,31);
//If they are not the server
if(!contain(name,"justrp"))
client_print(playa,print_chat,"num[%i]: %s^n",q,name);
}
}
}
return PLUGIN_HANDLED;
}
Can anyone assist?
__________________