First note: I do not understand English, the expression of the following may have errors, please understanding!
I want to modify a plug-in: slaylogo.sma, is to spray the body of the players executed.
Divided into: general audience: VIP (owned b - ADMIN_RESERVATION permissions), OP-player (with f - ADMIN_MAP permissions), GM-player (with m - ADMIN_LEVEL_A permission)
Only low-competence players sprayed high competence of the bodies of players will be put to death.
However, this plug will sometimes turn off the server, leading to hlds.exe stopped running. I do not know is wrong, please expert advice! Following is my source code plug-ins are used:
slaylogo.sma
Code:
#include <amxmod>
#include <amxmisc>
#define MAX_DISTANCE 100 // detect distance...
new player_origins[33][3]
public plugin_init() {
register_plugin("Auto-logo punisher","0.01","[PAPA]PERt+")
register_event("23", "checkspray", "a", "1=112")
register_event( "DeathMsg", "store_table", "a" )
}
public store_table() {
new victim = read_data(2)
get_user_origin(victim,player_origins[victim],0)
return PLUGIN_CONTINUE
}
public checkspray() {
new sprayid = read_data(2);
if (!is_user_alive(sprayid))
return PLUGIN_HANDLED
new player_origin[3], players[32], inum=0, dist, last_dist=99999, last_id
get_user_origin(sprayid,player_origin,0)
get_players(players,inum,"b")
if (inum > 0) {
for (new i=0;i<inum;i++) {
if (players[i]!=sprayid) {
dist = get_distance(player_origin,player_origins[players[i]])
if (dist<last_dist) {
last_id = players[i]
last_dist = dist
}
}
}
if (last_dist < MAX_DISTANCE) {
new p_name[32]
get_user_name(sprayid,p_name,31)
if (access(last_id , ADMIN_LEVEL_A)){
client_cmd(sprayid,"kill")
user_kill(sprayid,1)
client_print(0,print_chat,"%s were executed, Because slaylogo To GM !!!!!!!!!!",p_name)
} else if ((!access(sprayid , ADMIN_MAP)) && (access(last_id , ADMIN_MAP))) {
client_cmd(sprayid,"kill")
user_kill(sprayid,1)
client_print(0,print_chat,"%s were executed, Because slaylogo To OP !!!!!!!!!!",p_name)
} else if ((!access(sprayid , ADMIN_RESERVATION)) && (access(last_id , ADMIN_RESERVATION))) {
client_cmd(sprayid,"kill")
user_kill(sprayid,1)
client_print(0,print_chat,"%s were executed, Because slaylogo To VIP !!!!!!!!!!",p_name)
}
}
}
return PLUGIN_CONTINUE
}
Because I do not understand English, so please try to clear expression, give the best of the revised code complete! Thanks!