When Another Player Kill Enemy Even From Other Team The Plugin Give Coins To All... I Need To Know How To Restric Only To The Current Player Give Himself Coins Not From Others...
PHP Code:
/ * Plugin generated by AMXX-Studio * /
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#define PLUGIN "hudsync loop"
#define VERSION "3.2"
#define AUTHOR "_ | Polimpo4 | _"
// Variables
new Points = 0;
public plugin_init () {
register_plugin (PLUGIN, VERSION, AUTHOR)
register_event ("DeathMsg", "ev_DeathMsg", "a");
set_task (0.5, "Loop2", 0, "", 0, "b");
}
public client_putinserver (id) {
set_task (0.5, "Loop2", 0, "", 0, "b");
}
public ev_DeathMsg () {
// new Live = is_user_alive (id)
new Attacker = read_data (1)
new Vitima = read_data (2)
new Headshot = read_data (3)
new Arma = get_user_weapon (Attacker) // we can determine it by doing this
// new weapon [32]
// read_data (4, weapon, sizeof (weapon) -1) // but it is not important which method you will use.
new Virus_Name [32] // this is just a variable, you can call whatever you want.
get_user_name (Victim, VictimName, 31)
new Nickname [32]
get_user_name (Attacker, AttackerName, 31)
if (Gun == CSW_KNIFE) {
Points = Points + 2;
set_task (0.5, "showpoints (Attacker)")
client_print (Attacker, print_chat, "You killed% s with a knife", victim_name)
client_print (Victim, print_chat, "You were killed by% s for a knife", Name_Actuating)
}
if (Headshot) {
Points = Points + 3;
set_task (0.5, "showpoints (Attacker)")
// Show to the attacker who killed.
client_print (Attacker, print_chat, "You killed% s by HS", victim_name)
} else if (Headshot) {
// Show to the victim who killed him:
client_print (Vitima, print_chat, "You were killed by the% s by HS", Name_Actuating)
}
else {// this is the normal kill
Points = Points + 1;
set_task (0.5, "showpoints (Attacker)")
// Show to the attacker who killed.
client_print (Attacker, print_chat, "You killed% s", victim_name)
// Show to the victim who killed him:
client_print (victim, print_chat, "was dead by% s", target_name)
}
if (Attacker == Victim) {
client_print (Attacker, print_chat, "You committed suicide!")
return PLUGIN_CONTINUE
}
****
if (cs_get_user_team (Forward) == cs_get_user_team (Victim)) {
return PLUGIN_CONTINUE
}
if (Attacker! = victim) {
// if he has killed 3 this round execute a function
}
****
return PLUGIN_CONTINUE
****
}
public mostrapontos (Forward) {
****// your code here
****
****client_print (Striker, print_chat, "One More Point!")
****set_task (0.1, "Loop2")
}
public Loop2 (id, & Points) {
set_hudmessage (255, 255, 255, 0.04, 0.70, 0, 0.0, 2.0, 0.0, 0.2, false)
show_hudmessage (id, "Coins:% i", Points);
}