AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   PTakeDam (The Specialists) (https://forums.alliedmods.net/showthread.php?t=25647)

Des12 03-17-2006 21:51

PTakeDam (The Specialists)
 
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?

Maddo 03-18-2006 03:34

PTakeDam isn't directed to a player, so from what I gather, you can't find out who took damage and who dealt damage. There are a couple of other things you could do:
-The easiest way would be to use the client_damage foward from the TSX module.
-You could use the TSHealth event, but then you have to watch for when people get the Health powerup, since it was cause their health to tick down.


All times are GMT -4. The time now is 16:37.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.