*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?