Raised This Month: $ Target: $400
 0% 

Solved get_timeleft function


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
beginnercs
Junior Member
Join Date: Jul 2020
Old 07-17-2020 , 19:21   get_timeleft function
Reply With Quote #1

*sorry for my bad english, i'm using google translator

Hello guys, I think this is the right section for my question, I'm trying to code a plugin, my first question I was able to solve, can be seen here

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

now what i want to do is make this plugin run when the map time runs out.
I'm not able to use the get_timeleft function
currently the code looks like this

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

#include <amxmodx>
#include <amxmisc>
#include <colorchat>
#include <csstats>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

new cvar_ranks

public plugin_init(){
	register_plugin(PLUGIN, VERSION, AUTHOR)
	cvar_ranks = register_cvar("topranks", "1")
	register_clcmd("tempadm", "tempadmin")
} 
public tempadmin(id){
	
	if(!(get_user_flags(id) & ADMIN_USER))
	return PLUGIN_CONTINUE
	new stats[8], bodyhits[8]
	new iRank,rank
	rank = get_pcvar_num(cvar_ranks)
	iRank = get_user_stats(id, stats, bodyhits)
	if(iRank <= rank){
	new name[32]
	get_user_name(id, name, 31)	
	server_cmd("amx_tempadmin ^"%s^" ^"7^" ^"bcdefghijut^"", name)
	ColorChat(0, print_center, "^3The player ^4%s ^3won the ^4Admin", name)
	return PLUGIN_CONTINUE
	}
	else
	{
     
	}
	return PLUGIN_CONTINUE
}
it works with a command on the console and makes the first one in top15 as admin, so that part of the code is right, but I can't get it to run when the map time runs out.
I tried like that

Code:
public plugin_init(){
	register_plugin(PLUGIN, VERSION, AUTHOR)
	cvar_ranks = register_cvar("topranks", "1")
	new gmtm
	gmtm = get_timeleft()
	if(gmtm == 1)
	set_task(1.0,"tempadmin");
but without success...

I also tried like this:

Code:
public plugin_init(){
	register_plugin(PLUGIN, VERSION, AUTHOR)
	cvar_ranks = register_cvar("topranks", "1")
	register_clcmd("tempadm", "tempadmin")
	new gmtm
	gmtm = get_timeleft()
	if(gmtm == 1)
	server_cmd("tempadm")
}
but also without success
could someone help me how should i do?

Last edited by beginnercs; 07-23-2020 at 14:25. Reason: doubt resolved
beginnercs is offline
 



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 13:54.


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