/* AMX Mod X script.
*
* Screen Shake 1.0
*  by ThantiK
*
*
* Description:
*  This plugin is used just for annoyance purposes in general to mess with someone 
*  who is TK'ing, or to just confuse them.
*  
* Commands:
*  amx_shake - Shakes Users Screen ( NAME/@CT/@TERRORIST/* for all )
*
*/

#include <amxmodx> 
#include <amxmisc> 

public plugin_init() 
{ 
   register_plugin("Shake It baby!","1.0","ThantiK") 
   register_clcmd("amx_shake","amx_shake",ADMIN_LEVEL_A,"<name or id>") 
   return PLUGIN_CONTINUE 
} 

public amx_shake(id,level,cid){ 
   if (!cmd_access(id,level,cid,2)) 
      return PLUGIN_HANDLED 

   new target[32] 
   read_argv(1,target,31) 
   
   if (target[0]=='@') { 
      new team[32], team_num 
      get_players(team,team_num,"ae",target[1]) 
      if (!team_num) { 
         console_print(id,"[AMX] No clients found on provided team. (@CT or @TERRORIST)") 
         return   PLUGIN_HANDLED 
      } 
      for (new i=0;i<team_num;i++) { 
      new gmsgShake = get_user_msgid("ScreenShake") 
      message_begin(MSG_ONE, gmsgShake, {0,0,0}, team[i])
      write_short(255<< 14 ) //ammount 
      write_short(10 << 14) //lasts this long 
      write_short(255<< 14) //frequency 
      message_end() 
      } 
   } 

   else if (target[0]=='*') { 
      new all[32], all_num 
      get_players(all,all_num,"a") 
      for (new i=0;i<all_num;i++) { 

      new gmsgShake = get_user_msgid("ScreenShake") 
      message_begin(MSG_ONE, gmsgShake, {0,0,0}, all[i])
      write_short(255<< 14 ) //ammount 
      write_short(10 << 14) //lasts this long 
      write_short(255<< 14) //frequency 
      message_end() 
      } 
}
   else { 
      new player = cmd_target(id, target,31) 
      new gmsgShake = get_user_msgid("ScreenShake") 

      if(is_user_alive(player)){ 
      message_begin(MSG_ONE, gmsgShake, {0,0,0}, player)
      write_short(255<< 14 ) //ammount 
      write_short(10 << 14) //lasts this long 
      write_short(255<< 14) //frequency 
      message_end() 
      }

}
   return PLUGIN_HANDLED    
}