Raised This Month: $51 Target: $400
 12% 

PTakeDam (The Specialists)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Des12
Senior Member
Join Date: Jan 2005
Old 03-17-2006 , 21:51   PTakeDam (The Specialists)
Reply With Quote #1

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?
__________________
-Dest Romano

www.JustRP.com
A TSRP Server

Quote:
Originally Posted by Brad
Don't you go be bringing reality into this.
Des12 is offline
Maddo
Member
Join Date: Dec 2004
Old 03-18-2006 , 03:34  
Reply With Quote #2

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.
Maddo is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 00:09.


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