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

Slay all after certain time


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
lowel
New Member
Join Date: Jun 2017
Old 06-21-2017 , 20:03   Slay all after certain time
Reply With Quote #1

Hey everyone,
I'm new to scripting and I was trying to make a plugin that slays everyone after a certain time.
Here's my code:
Code:
#include <amxmodx>

new amx_slay_time, count
public plugin_init()
{
	register_plugin("SLAY_ALL", "1.2", "lowel")
	register_logevent("roundstart", 2, "0=World triggered", "1=Round_Start")
	amx_slay_time = register_cvar("amx_slay_time", "30", FCVAR_SERVER)
}



public roundstart()
{
	
	count = get_pcvar_num(amx_slay_time)
	set_task(1.0, "slay_all")
}

public slay_all()
{
	if (count <= 0 ) {
	new player[32], playersnum
	new id

	get_players(player,playersnum,"a")

	for(new i = 0; i < playersnum; ++i)
	{
		id = player[i]

		user_kill(id, 1)
	}
	}
	count--
}
Although it doesn't seem to work. could anyone help me please?
lowel is offline
HoussamBenmouna
Member
Join Date: Jun 2017
Location: Morocco
Old 06-21-2017 , 20:04   Re: Slay all after certain time
Reply With Quote #2

Wrong thread, must posted on Scripting Help.
__________________
Working on Hulk's Mode (10%)
HoussamBenmouna is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 06-21-2017 , 20:11   Re: Slay all after certain time
Reply With Quote #3

PHP Code:
#include <amxmodx>

#define PLUGIN "Auto kill players"
#define VERSION "1.0"
#define AUTHOR "author"

const TASK_KILL =         2017
new pCvarTimeToKill

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
pCvarTimeToKill register_cvar("akp_time_in_seconds""60")
    
    
register_logevent("RoundEnd"2"1=Round_End")
    
register_logevent("RoundStart"2"0=World triggered""1=Round_Start")
}

public 
RoundEnd()
{
    
remove_task(TASK_KILL)
}

public 
RoundStart()
{
    
set_task(get_pcvar_float(pCvarTimeToKill), "killPlayers"TASK_KILL)
}

public 
killPlayers()
{
    new 
iPlayers[32], iNum
    get_players
(iPlayersiNum"a")
    for(new 
i;iNum;i++)
    {
        
user_silentkill(iPlayers[i])
    }

__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo
EFFx is offline
lowel
New Member
Join Date: Jun 2017
Old 06-21-2017 , 20:21   Re: Slay all after certain time
Reply With Quote #4

Quote:
Originally Posted by EFFx View Post
PHP Code:
#include <amxmodx>

#define PLUGIN "Auto kill players"
#define VERSION "1.0"
#define AUTHOR "author"

const TASK_KILL =         2017
new pCvarTimeToKill

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
pCvarTimeToKill register_cvar("akp_time_in_seconds""60")
    
    
register_logevent("RoundEnd"2"1=Round_End")
    
register_logevent("RoundStart"2"0=World triggered""1=Round_Start")
}

public 
RoundEnd()
{
    
remove_task(TASK_KILL)
}

public 
RoundStart()
{
    
set_task(get_pcvar_float(pCvarTimeToKill), "killPlayers"TASK_KILL)
}

public 
killPlayers()
{
    new 
iPlayers[32], iNum
    get_players
(iPlayersiNum"a")
    for(new 
i;iNum;i++)
    {
        
user_silentkill(iPlayers[i])
    }

working, thank you!
edit: no idea how to lock the thread :d

Last edited by lowel; 06-21-2017 at 20:22. Reason: avoid to post again.
lowel is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 06-21-2017 , 20:26   Re: Slay all after certain time
Reply With Quote #5

You do not need. Recommend to add some message, 'cuz the players will not understand why they dead.
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo

Last edited by EFFx; 06-21-2017 at 20:27.
EFFx is offline
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 21:47.


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