I wanted to make a code where it will make the player use the command +attack if they are looking at another player, but I have no idea how to put it into code and have looked at other people's code but to no success.
This is what I've tried
PHP Code:
public plugin_init()
{
register_plugin(PLUGIN,VERSION,AUTHOR);
register_concmd("start","detect");
}
public detect(id){
for(new i=1;i>0;i++){
new target,body;
get_user_aiming(id, target, body, 9999);
if(!is_user_alive(id))
{
if(target>0){
client_cmd(id,"+attack");
} else {
client_cmd(id,"-attack");
}
}
client_print(id,print_chat,"You are dead");
return PLUGIN_HANDLED;
}
}
But this ended up in me crashing and burning with it literally crashing (or at most freezing)