Raised This Month: $51 Target: $400
 12% 

Can some one add dhud in this plugin in countdown part


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Sanjay Singh
Veteran Member
Join Date: Sep 2016
Old 09-24-2018 , 00:30   Can some one add dhud in this plugin in countdown part
Reply With Quote #1

Just change client print to dhud, countdown should work properly

Code:
if(get_systime() - gLastShove[id] < get_pcvar_num(cCooldown))
	{
		client_print(id, print_chat, "[Shove Mod] Your muscles are weak from shoving the player. You must wait to do it again. (%i)", (get_pcvar_num(cCooldown) - (get_systime() - gLastShove[id])))
		return PLUGIN_HANDLED
	}

Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>

#define PLUGIN "Shove Mod"
#define VERSION "1.0"
#define AUTHOR "Styles"

new cShove, cCooldown, cInUse
new gLastShove[32]

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	register_clcmd("say /shove", "shovePlayer")
	cShove = register_cvar("shove_force", "7")
	cCooldown = register_cvar("shove_cooldown", "10")
	cInUse = register_cvar("shove_allow_inuse", "1")
	
	register_forward(FM_PlayerPreThink, "Forward_PlayerPreThink")
}

public Forward_PlayerPreThink(id)
{
	if(!get_pcvar_num(cInUse))
		return PLUGIN_HANDLED
	if(pev( id, pev_button ) & IN_USE && !(pev( id, pev_oldbuttons ) & IN_USE ) & !is_user_bot(id))
		shovePlayer(id)
	
	return PLUGIN_CONTINUE
}

public shovePlayer(id)
{
	if(!is_user_alive(id))
		return PLUGIN_HANDLED
	
	if(get_systime() - gLastShove[id] < get_pcvar_num(cCooldown))
	{
		client_print(id, print_chat, "[Shove Mod] Your muscles are weak from shoving the player. You must wait to do it again. (%i)", (get_pcvar_num(cCooldown) - (get_systime() - gLastShove[id])))
		return PLUGIN_HANDLED
	}
	
	new Index,Body, pName[64], tName[64]
	get_user_aiming(id,Index,Body,200)
	
	if(!Index || !is_user_alive(Index))
		return PLUGIN_HANDLED
	
	new Float:size[3]
	pev(id, pev_size, size)
	if(size[2] < 72.0)
	{
		client_print(id, print_chat, "[Shove Mod] You can't shove somebody while doing that action.")
		return PLUGIN_HANDLED
	}
	
	get_user_name(id, pName, 63)
	get_user_name(Index, tName, 63)
	new Float:velocity[3], Float:shover[3], Float:shovee[3]
	pev(id, pev_origin, shover)
	pev(Index, pev_origin, shovee)
	
	for(new Count;Count < 3;Count++)
	velocity[Count] = (shovee[Count] - shover[Count]) * get_pcvar_float(cShove)
	set_pev(Index, pev_velocity, velocity)
	client_print(id, print_chat, "[Shove Mod] You have just shoved %s!", tName)
	client_print(Index, print_chat, "[Shove Mod] You have just been shoved by %s!", pName)
	gLastShove[id] = get_systime()
	return PLUGIN_HANDLED
	
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/
__________________
Sanjay Singh is offline
Send a message via AIM to Sanjay Singh
Nutu_
AlliedModders Donor
Join Date: Mar 2016
Location: Germany
Old 09-24-2018 , 08:08   Re: Can some one add dhud in this plugin in countdown part
Reply With Quote #2

try this
Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <dhudmessage>

#define PLUGIN "Shove Mod"
#define VERSION "1.0"
#define AUTHOR "Styles"

new cShove, cCooldown, cInUse
new gLastShove[32]

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	register_clcmd("say /shove", "shovePlayer")
	cShove = register_cvar("shove_force", "7")
	cCooldown = register_cvar("shove_cooldown", "10")
	cInUse = register_cvar("shove_allow_inuse", "1")
	
	register_forward(FM_PlayerPreThink, "Forward_PlayerPreThink")
}

public Forward_PlayerPreThink(id)
{
	if(!get_pcvar_num(cInUse))
		return PLUGIN_HANDLED
	if(pev( id, pev_button ) & IN_USE && !(pev( id, pev_oldbuttons ) & IN_USE ) & !is_user_bot(id))
		shovePlayer(id)
	
	return PLUGIN_CONTINUE
}

public shovePlayer(id)
{
	if(!is_user_alive(id))
		return PLUGIN_HANDLED
	
	if(get_systime() - gLastShove[id] < get_pcvar_num(cCooldown))
	{
		set_dhudmessage(0, 255, 0, -1.0, 0.15, 0, 6.0, 12.0)
		show_dhudmessage(id, "[Shove Mod] Your muscles are weak from shoving the player. You must wait to do it again. (%id)", (get_pcvar_num(cCooldown) - (get_systime() - gLastShove[id])))
		return PLUGIN_HANDLED
	}
	
	new Index,Body, pName[64], tName[64]
	get_user_aiming(id,Index,Body,200)
	
	if(!Index || !is_user_alive(Index))
		return PLUGIN_HANDLED
	
	new Float:size[3]
	pev(id, pev_size, size)
	if(size[2] < 72.0)
	{
		set_dhudmessage(0, 255, 0, -1.0, 0.15, 0, 6.0, 12.0)
		show_dhudmessage(id, "[Shove Mod] You can't shove somebody while doing that action.")
		return PLUGIN_HANDLED
	}
	
	get_user_name(id, pName, 63)
	get_user_name(Index, tName, 63)
	new Float:velocity[3], Float:shover[3], Float:shovee[3]
	pev(id, pev_origin, shover)
	pev(Index, pev_origin, shovee)
	
	for(new Count;Count < 3;Count++)
		velocity[Count] = (shovee[Count] - shover[Count]) * get_pcvar_float(cShove)
	set_pev(Index, pev_velocity, velocity)
	set_dhudmessage(0, 255, 0, -1.0, 0.15, 0, 6.0, 12.0)
	show_dhudmessage(id, "[Shove Mod] You have just shoved %s!", tName)
	show_dhudmessage(id, "[Shove Mod] You have just been shoved by %s!", pName)
	gLastShove[id] = get_systime()
	return PLUGIN_HANDLED
	
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/
edit: oh, i've put everything in dhud, but you can put them back to print chat by copying.
__________________
a simple act of caring creates an endless ripple.

Last edited by Nutu_; 09-24-2018 at 08:11.
Nutu_ is offline
Sanjay Singh
Veteran Member
Join Date: Sep 2016
Old 09-27-2018 , 10:42   Re: Can some one add dhud in this plugin in countdown part
Reply With Quote #3

Quote:
Originally Posted by Nutu_ View Post
try this
Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <dhudmessage>

#define PLUGIN "Shove Mod"
#define VERSION "1.0"
#define AUTHOR "Styles"

new cShove, cCooldown, cInUse
new gLastShove[32]

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	register_clcmd("say /shove", "shovePlayer")
	cShove = register_cvar("shove_force", "7")
	cCooldown = register_cvar("shove_cooldown", "10")
	cInUse = register_cvar("shove_allow_inuse", "1")
	
	register_forward(FM_PlayerPreThink, "Forward_PlayerPreThink")
}

public Forward_PlayerPreThink(id)
{
	if(!get_pcvar_num(cInUse))
		return PLUGIN_HANDLED
	if(pev( id, pev_button ) & IN_USE && !(pev( id, pev_oldbuttons ) & IN_USE ) & !is_user_bot(id))
		shovePlayer(id)
	
	return PLUGIN_CONTINUE
}

public shovePlayer(id)
{
	if(!is_user_alive(id))
		return PLUGIN_HANDLED
	
	if(get_systime() - gLastShove[id] < get_pcvar_num(cCooldown))
	{
		set_dhudmessage(0, 255, 0, -1.0, 0.15, 0, 6.0, 12.0)
		show_dhudmessage(id, "[Shove Mod] Your muscles are weak from shoving the player. You must wait to do it again. (%id)", (get_pcvar_num(cCooldown) - (get_systime() - gLastShove[id])))
		return PLUGIN_HANDLED
	}
	
	new Index,Body, pName[64], tName[64]
	get_user_aiming(id,Index,Body,200)
	
	if(!Index || !is_user_alive(Index))
		return PLUGIN_HANDLED
	
	new Float:size[3]
	pev(id, pev_size, size)
	if(size[2] < 72.0)
	{
		set_dhudmessage(0, 255, 0, -1.0, 0.15, 0, 6.0, 12.0)
		show_dhudmessage(id, "[Shove Mod] You can't shove somebody while doing that action.")
		return PLUGIN_HANDLED
	}
	
	get_user_name(id, pName, 63)
	get_user_name(Index, tName, 63)
	new Float:velocity[3], Float:shover[3], Float:shovee[3]
	pev(id, pev_origin, shover)
	pev(Index, pev_origin, shovee)
	
	for(new Count;Count < 3;Count++)
		velocity[Count] = (shovee[Count] - shover[Count]) * get_pcvar_float(cShove)
	set_pev(Index, pev_velocity, velocity)
	set_dhudmessage(0, 255, 0, -1.0, 0.15, 0, 6.0, 12.0)
	show_dhudmessage(id, "[Shove Mod] You have just shoved %s!", tName)
	show_dhudmessage(id, "[Shove Mod] You have just been shoved by %s!", pName)
	gLastShove[id] = get_systime()
	return PLUGIN_HANDLED
	
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/
edit: oh, i've put everything in dhud, but you can put them back to print chat by copying.

What if i use sync hud using dhud? Will it be better for countdown better hud without coming 1 over 1.
__________________
Sanjay Singh is offline
Send a message via AIM to Sanjay Singh
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 09-27-2018 , 12:29   Re: Can some one add dhud in this plugin in countdown part
Reply With Quote #4

SyncHud work only with Hud Messages.
__________________


Quote:
Originally Posted by fysiks View Post
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.
https://iceeedr.com.br/
iceeedr is offline
Send a message via Skype™ to iceeedr
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:31.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode