/* * This plugin let you show your status to team mates in a custom text * include the symbols below into your chat * * %a - replaced by your current armor * %c - replaced by your current class * %e - replaced by number of sighted enemies in range * %f - replaced by number of sighted friends in range * %h - replaced by your current health * %k - replaced by playername of last killer * %l - replaced by the name of the location you are currently in * %r - replaced by amount of res (aliens only) * %v - replaced by playername of last victim * * eg: say "HP: %h AP: %a Class: %c Enemies: %e Friends: %f Res: %r Killer: %k Victim: %v" will show * ": HP: 70 AP: 10 Class: Skulk Enemies: 2 Friends: 3 Res: 33 Killer: NSPlayer Victim: Mr. X" * * by White Panther * * INFO: * %l (location) only works when there are at least two players, otherwise it will be blank * * v1.0: * - initial release * * v1.1: * - bug fix (thx Steve_Dudenhoeffer) * * v1.2.4: * - new features * - included antiflood (original code, just adjusted) * * v1.3.3b: * - changed way of getting message * - antiflood is not implemented anymore (you can use the standard antiflood) * - new feature (%l = location) * - fix of possible error * - moved from ns2amx to engine + fakemeta + ns * - fixed bug for 32 players * * v1.3.4: * - fixed: * - minor error with message * * v1.3.5: * - changes: * - moved from pev/set_pev to entity_get/entity_set (no fakemeta) */ #include #include #include #define view_range 600 //#define RES_OFFSET 0x18E new check, allow_change = 1, Speech[256] new my_victim[33][33], my_killer[33][33] /* Init and forwards */ public plugin_init(){ register_plugin("Status Report","1.3.4","White Panther") register_message(get_user_msgid("SayText"), "handlesay") register_event("DeathMsg","eDeath","a") } public plugin_modules(){ require_module("engine") require_module("ns") } /* Status Report */ public handlesay(msgid,dummy,receiver){ new id = get_msg_arg_int(1) if ( is_user_connected(id) ){ if ( allow_change ){ allow_change = 0 get_msg_arg_string(2, Speech, 255) check = change_speech(id) } if ( check && id != receiver ){ if ( entity_get_int(id,EV_INT_team) == entity_get_int(receiver,EV_INT_team) ){ set_msg_arg_string(2, Speech) return PLUGIN_CONTINUE }else return PLUGIN_HANDLED }else if ( id == receiver ){ if ( check ){ set_msg_arg_string(2, Speech) } reset() } } return PLUGIN_CONTINUE } public eDeath(){ new killer = read_data(1) new victim = read_data(2) if ( is_user_connected(killer) && is_user_connected(victim) ){ get_user_name(killer,my_killer[victim],32) get_user_name(victim,my_victim[killer],32) } } /* additional Functions */ change_speech(id){ new found = 0 new class = ns_get_class(id) if ( class != 11 && class != 12 ){ new location[64] // Health if ( contain(Speech,"%h") != -1 ){ new health = get_user_health(id) new health_str[5] num_to_str(health,health_str,4) replace(Speech,255,"%h",health_str) found = 1 } // Armor if ( contain(Speech,"%a") != -1 ){ new armor = get_user_armor(id) new armor_str[5] num_to_str(armor,armor_str,4) replace(Speech,255,"%a",armor_str) found = 1 } // Class if ( contain(Speech,"%c") != -1 ){ new class_str[10] if ( class == 1 ) class_str = "Skulk" else if ( class == 2 ) class_str = "Gorge" else if ( class == 3 ) class_str = "Lerk" else if ( class == 4 ) class_str = "Fade" else if ( class == 5 ) class_str = "Onos" else if ( class == 6 ) class_str = "Marine" else if ( class == 7 ) class_str = "Jetpacker" else if ( class == 8 ) class_str = "Heavy" else if ( class == 9 ) class_str = "Commander" else if ( class == 10 ) class_str = "Gestate" else class_str = "Unknown" replace(Speech,255,"%c",class_str) found = 1 } // Ressources if ( contain(Speech,"%r") != -1 && 3 <= get_user_team(id) <= 9 ){ new res = floatround(ns_get_res(id)) new res_str[5] num_to_str(res,res_str,4) replace(Speech,255,"%r",res_str) found = 1 } // Amount of Enemys & Friends if ( contain(Speech,"%e") != -1 || contain(Speech,"%f") != -1 ){ new enemys, friends, team = entity_get_int(id, EV_INT_team) new orig[3] get_user_origin(id,orig) for ( new a = 1; a <= get_maxplayers(); a++ ){ if ( is_user_connected(a) ){ if ( is_user_alive(a) ){ new orig_enemy[3] get_user_origin(a,orig_enemy) if( orig[0]-orig_enemy[0] < view_range && orig[0]-orig_enemy[0] > - view_range && orig[1]-orig_enemy[1] < view_range && orig[1]-orig_enemy[1] > - view_range && orig[2]-orig_enemy[2] < view_range && orig[2]-orig_enemy[2] > - view_range ){ new Float:orig_start[3], Float:orig_end[3], Float:vec_ret[3] new team_en = entity_get_int(a, EV_INT_team) orig_start[0] = float(orig[0]) orig_start[1] = float(orig[1]) orig_start[2] = float(orig[2]) orig_end[0] = float(orig_enemy[0]) orig_end[1] = float(orig_enemy[1]) orig_end[2] = float(orig_enemy[2]) trace_line(id, orig_start, orig_end, vec_ret) new class_a = ns_get_class(a) // Onos if ( class_a == 5 && ( -120 < orig_end[0] - vec_ret[0] < 120 ) && ( -120 < orig_end[1] - vec_ret[1] < 120 ) && ( -120 < orig_end[2] - vec_ret[2] < 120 ) ){ if ( team_en != team ) enemys += 1 else if( a != id ) friends += 1 } // Heavy else if ( class_a == 8 && ( -70 < orig_end[0] - vec_ret[0] < 70 ) && ( -70 < orig_end[1] - vec_ret[1] < 70 ) && ( -70 < orig_end[2] - vec_ret[2] < 70 ) ){ if ( team_en != team ) enemys += 1 else if( a != id ) friends += 1 } // Fade, Marine, Jetpack else if ( ( class_a == 4 || class_a == 6 || class_a == 7) && ( -50 < orig_end[0] - vec_ret[0] < 50 ) && ( -50 < orig_end[1] - vec_ret[1] < 50 ) && ( -50 < orig_end[2] - vec_ret[2] < 50 ) ){ if ( team_en != team ) enemys += 1 else if( a != id ) friends += 1 } // Gorge, Lerk, Skulk, Gestate else if ( ( class_a != 11 && class_a != 12 ) && ( -40 < orig_end[0] - vec_ret[0] < 40 ) && ( -40 < orig_end[1] - vec_ret[1] < 40 ) && ( -40 < orig_end[2] - vec_ret[2] < 40 ) ){ if ( team_en != team ) enemys += 1 else if( a != id ) friends += 1 } } } } } new enemys_str[5], friends_str[5] num_to_str(enemys,enemys_str,4) replace(Speech,255,"%e",enemys_str) num_to_str(friends,friends_str,4) replace(Speech,255,"%f",friends_str) found = 1 } // Killer if ( contain(Speech,"%k") != -1 ){ if ( strlen(my_killer[id]) > 0 ) replace(Speech,255,"%k",my_killer[id]) else replace(Speech,255,"%k","Unknown") found = 1 } // Victim if ( contain(Speech,"%v") != -1 ){ if ( strlen(my_victim[id]) > 0 ) replace(Speech,255,"%v",my_victim[id]) else replace(Speech,255,"%v","Unknown") found = 1 } // Location if ( contain(Speech,"%l") != -1 ){ get_msg_arg_string(3, location,63) if ( strlen(location) > 0 ) replace(Speech,255,"%l",location) else replace(Speech,255,"%l","Unknown") found = 1 } } return found } reset(){ allow_change = 1 check = 0 Speech[0] = 0 }