View Single Post
Author Message
EDUTz
Senior Member
Join Date: Jun 2010
Location: Dracula's Homeland
Old 02-21-2013 , 22:34   Re: [REQUEST] Harlem Shake event
Reply With Quote #1

please, make the slap sound stop, it ruins everything ) recreate the slap part without the sound

edit: here it is without the slaping sound part, optimized for exact starting and stoping according to the music,

Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <dhudmessage>
#define PLUGIN "HarlemShake"
#define VERSION "2.0"
#define AUTHOR "ironskillz1&edutz"

public plugin_init() {
 register_plugin(PLUGIN, VERSION, AUTHOR)
 
 register_clcmd( "say /shake", "Shake" ) // Command!
 register_clcmd( "say /harlemshake", "Shake" ) // Command!
} 
public plugin_precache()
{
 precache_generic("sound/harlemshake.mp3") // sound
}
public Shake(id) 
{
 if(!(get_user_flags(id) & ADMIN_CFG)) // is user admin?
 {
  client_print(id, print_chat, "Only ADMINS can use this command!") // if not print this 
 }
else
{
 set_task(0.1,"Music"); // start music
 set_task(0.1,"Dhud"); // Dhud message
 set_task(15.5,"Slap"); // start slaping 
 set_task(28.0,"Remove"); // remove slaping
}
}
public Music() 
{
 client_cmd(0, "mp3 play ^"sound/harlemshake.mp3^"") // play music
}
public Dhud() 
{
 set_dhudmessage(0, 30, 50, 0.01, 0.15, 0, 1.0, 1.0, 0.1, 0.2)
 show_dhudmessage ( 0, ".:: Harlem Shake Event ::.") // print permanent dhud message in left top corner
 set_task(0.1,"Dhud");
}
public Slap() // SLAP !!
{
 new iTotal, all[32]
 get_players( all, iTotal, "a")
 
 for ( new i = 0; i < iTotal; i++ ) 
 {  
         new id = all[i]
         slap_new(id)
 }
 
 set_task(0.5,"Slap"); // SLAP TIME
}

public slap_new(id) 
{ 

	if(!is_user_alive(id)) 
	return

	new Float:velocity[3] 
	pev(id, pev_velocity, velocity) 

	new Float:angles[3], Float:v_forward[3] 
	pev(id, pev_angles, angles) 

	angle_vector(angles, ANGLEVECTOR_FORWARD, v_forward) 

	xs_vec_mul_scalar(v_forward, 220.0, v_forward) 
	xs_vec_add(velocity, v_forward, velocity) 
	velocity[2] += 20.0 

	set_pev(id, pev_velocity, velocity) 

	new Float:punchangle[3] 
	punchangle[0] = random_float(-20.0, 20.0) 
	punchangle[1] = random_float(-20.0, 20.0) 
	set_pev(id, pev_punchangle, punchangle)             
} 
public Remove() // remove slap!
{
 remove_task();
}

Last edited by EDUTz; 02-22-2013 at 01:30. Reason: forgot an else statement
EDUTz is offline