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

[REQ] Earth Quake plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Joce93
Senior Member
Join Date: Feb 2016
Old 06-25-2016 , 20:24   [REQ] Earth Quake plugin
Reply With Quote #1

Hey guys,

I need a plugin to allow me to make a earth quake while playing (just the admin could do it). Writing just "earthquake" or something else in console to make it would be great. (I'm playing on Sven Co-op, HL 1 mod).

I already tried this one but it's not working:

https://forums.alliedmods.net/showthread.php?t=162530

Can you help me ?

Thank you !
Joce93 is offline
Joce93
Senior Member
Join Date: Feb 2016
Old 06-28-2016 , 09:52   Re: [REQ] Earth Quake plugin
Reply With Quote #2

Nobody ?
Joce93 is offline
Kazalu
Senior Member
Join Date: Dec 2013
Location: Romania
Old 06-28-2016 , 10:47   Re: [REQ] Earth Quake plugin
Reply With Quote #3

What would an earthquake do? Just shake all players' screen?
Kazalu is offline
Joce93
Senior Member
Join Date: Feb 2016
Old 06-28-2016 , 11:07   Re: [REQ] Earth Quake plugin
Reply With Quote #4

Quote:
Originally Posted by Kazalu View Post
What would an earthquake do? Just shake all players' screen?
Exactly, like on this video:

https://www.youtube.com/watch?v=OrI0Wmf4W6M#t=0m12s

10 seconds of Earthquake would be perfect, (for all players) by typing a command in console (just admin).
Joce93 is offline
Kazalu
Senior Member
Join Date: Dec 2013
Location: Romania
Old 06-28-2016 , 11:27   Re: [REQ] Earth Quake plugin
Reply With Quote #5

Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Earthquake"
#define VERSION "1.0"
#define AUTHOR "Kazalu"

#define DEFINED_TIME 10
#define TASK_FINISH_QUAKE 4071
#define TASK_QUAKE_PERSECOND 4072

new bool:quake_started = false;
new g_msgidScreenShake;

public plugin_init() 
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	g_msgidScreenShake = get_user_msgid("ScreenShake");
	register_clcmd( "say /earthquake", "CmdEarthQuake", ADMIN_ADMIN );
}

public CmdEarthQuake( id, level, cid )
{
	if(!cmd_access(id, level, cid, 0))
		return PLUGIN_HANDLED;
		
	quake_started = true;
	set_task(0.2,"ShakeTheScreen",TASK_QUAKE_PERSECOND,"",0,"b")
	set_task(0.2 + DEFINED_TIME,"StopQuake",TASK_FINISH_QUAKE)
	
	return PLUGIN_HANDLED;
}

public StopQuake( TaskID )
{
	if(quake_started)
	{
		remove_task(TASK_FINISH_QUAKE)
		quake_started = false
		remove_task(TaskID)	
	}
}
public ShakeTheScreen( TaskID )
{
	for(new i = 1; i < 33; i++)
	{
		if(is_user_connected(i) && is_user_alive(i) && quake_started)
		{
			message_begin(MSG_ONE_UNRELIABLE, g_msgidScreenShake, {0,0,0}, i)  
			write_short(0xFFFF)
			write_short(1<<13)
			write_short(0xFFFF) 
			message_end()
		}
	}
}
Kazalu is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 06-28-2016 , 11:47   Re: [REQ] Earth Quake plugin
Reply With Quote #6

DEFINED_TIME should be a float.
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Joce93
Senior Member
Join Date: Feb 2016
Old 06-28-2016 , 11:53   Re: [REQ] Earth Quake plugin
Reply With Quote #7

Quote:
Originally Posted by Kazalu View Post
Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Earthquake"
#define VERSION "1.0"
#define AUTHOR "Kazalu"

#define DEFINED_TIME 10
#define TASK_FINISH_QUAKE 4071
#define TASK_QUAKE_PERSECOND 4072

new bool:quake_started = false;
new g_msgidScreenShake;

public plugin_init() 
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	g_msgidScreenShake = get_user_msgid("ScreenShake");
	register_clcmd( "say /earthquake", "CmdEarthQuake", ADMIN_ADMIN );
}

public CmdEarthQuake( id, level, cid )
{
	if(!cmd_access(id, level, cid, 0))
		return PLUGIN_HANDLED;
		
	quake_started = true;
	set_task(0.2,"ShakeTheScreen",TASK_QUAKE_PERSECOND,"",0,"b")
	set_task(0.2 + DEFINED_TIME,"StopQuake",TASK_FINISH_QUAKE)
	
	return PLUGIN_HANDLED;
}

public StopQuake( TaskID )
{
	if(quake_started)
	{
		remove_task(TASK_FINISH_QUAKE)
		quake_started = false
		remove_task(TaskID)	
	}
}
public ShakeTheScreen( TaskID )
{
	for(new i = 1; i < 33; i++)
	{
		if(is_user_connected(i) && is_user_alive(i) && quake_started)
		{
			message_begin(MSG_ONE_UNRELIABLE, g_msgidScreenShake, {0,0,0}, i)  
			write_short(0xFFFF)
			write_short(1<<13)
			write_short(0xFFFF) 
			message_end()
		}
	}
}

Wow thank you, exactly what i wanted
Joce93 is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 06-28-2016 , 13:03   Re: [REQ] Earth Quake plugin
Reply With Quote #8

Quote:
Originally Posted by Napoleon_be View Post
DEFINED_TIME should be a float.
I dont think, this is because it's summed with 0.2 and it returns float.

I mean if you add 0.2 with 10 then it would be 10.2 and it will return float.
So i think doesnt matter DEFINED_TIME to be float.
siriusmd99 is offline
Kazalu
Senior Member
Join Date: Dec 2013
Location: Romania
Old 07-04-2016 , 14:13   Re: [REQ] Earth Quake plugin
Reply With Quote #9

Quote:
Originally Posted by siriusmd99 View Post
I dont think, this is because it's summed with 0.2 and it returns float.

I mean if you add 0.2 with 10 then it would be 10.2 and it will return float.
So i think doesnt matter DEFINED_TIME to be float.
Exactly. No warnings, no errors. Works as it should.
Kazalu is offline
Amine Belokda
Senior Member
Join Date: Oct 2015
Location: ML_NOT_FOUND
Old 07-05-2016 , 01:27   Re: [REQ] Earth Quake plugin
Reply With Quote #10

:/
__________________
Amine Belokda is offline
Send a message via MSN to Amine Belokda
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 11:14.


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