Raised This Month: $ Target: $400
 0% 

Roundtime problem


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 07-30-2010 , 00:24   Roundtime problem
Reply With Quote #1

I'm making a plugin where u can set all the server cvars like mp_roundtime and stuff with commands like amx_roundtime so you don't have to use cvar. I know there is probably another one like this around.

So what happens is when I type amx_roundtime 3 or seomthing, it says mp_roundtime changed to "1957348738961" or some random number thats not 3... Any ideas?

Also, when I do all commands like amx_timelimit 40 for example, it works, but right before it says mp_timelimit changed to 40, it says Unknown command: amx_timelimit. Any way to remove that?

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

#include <amxmodx>
#include <amxmisc>

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


public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
    //Client Commands
    register_clcmd("say /timelimit", "sayTime")
    register_clcmd("say /roundtime", "sayRound")
    register_clcmd("say /buytime", "sayBuy")
    register_clcmd("say /freezetime", "sayFreeze")
    //Admin Commands
    register_concmd("amx_restartround", "restartround", ADMIN_RCON, "<seconds (1-20)>")
    register_concmd("amx_timelimit", "timelimit", ADMIN_RCON, "<minutes (1-60)>")
    register_concmd("amx_roundtime", "roundtime", ADMIN_RCON, "<minutes (1-9)>")
    register_concmd("amx_buytime", "buytime", ADMIN_RCON, "<seconds>")
    register_concmd("amx_freezetime", "freezetime", ADMIN_RCON, "<seconds>")
    register_concmd("amx_friendlyfire", "friendlyfire", ADMIN_RCON, "<0=No, 1=Yes>")
    register_concmd("amx_hostname", "hostname", ADMIN_RCON, "<'new name'>")
    register_concmd("amx_execfile", "exec", ADMIN_RCON, "<'file.cfg'>")
}


public restartround(id, level, cid)
{
if(!cmd_access(id, level, cid, 2))
return PLUGIN_HANDLED
    
new arg1[3]
read_argv(1, arg1, 2)
new num=str_to_num(arg1)
if(num>20 || num<1)
{
console_print(id, "Seconds must be between 1 and 20!!!")
return PLUGIN_HANDLED
}
server_cmd("sv_restartround %i", num)
client_print(0, print_chat, "Round is being restarted in %i seconds!!!", num)
return 0;
}


public timelimit(id, level, cid)
{
if(!cmd_access(id, level, cid, 2))
return PLUGIN_HANDLED
new arg1[3]
read_argv(1, arg1, 2)
new num=str_to_num(arg1)
if(num>60)
{
console_print(id, "Timelimit must be less than 60 minutes!!!")
return PLUGIN_HANDLED
}
server_cmd("mp_timelimit %i", num)
return 0;
}


public roundtime(id, level, cid)
{
if(!cmd_access(id, level, cid, 2))
return PLUGIN_HANDLED
new arg1[3]
read_argv(1, arg1, 2)
new Float:num=str_to_float(arg1)
if(num<1 || num>9)
{
console_print(id, "Roundtime must be between 1 and 9")
return PLUGIN_HANDLED
}
server_cmd("mp_roundtime %d", num)
return 0;
}


public buytime(id, level, cid)
{
if(!cmd_access(id, level, cid, 2))
return PLUGIN_HANDLED
new arg1[3]
read_argv(1, arg1, 2)
new num=str_to_num(arg1)
if(num=0)
{
console_print(id, "Buytime cannot be 0!!!")
return PLUGIN_HANDLED
}
server_cmd("mp_buytime %i", num)
return 0;
}


public freezetime(id, level, cid)
{
if(!cmd_access(id, level, cid, 2))
return PLUGIN_HANDLED
new arg1[3]
read_argv(1, arg1, 2)
new num=str_to_num(arg1)
server_cmd("mp_freezetime %i", num)
return 0;
}


public friendlyfire(id, level, cid)
{
if(!cmd_access(id, level, cid, 2))
return PLUGIN_HANDLED
new arg1[3]
read_argv(1, arg1, 2)
new num=str_to_num(arg1)
if(num>1)
{
console_print(id, "Friendlyfire must be either 1 or 0!!!")
return PLUGIN_HANDLED
}
server_cmd("mp_friendlyfire %i", num)
return 0;
}


public hostname(id, level, cid)
{
if(!cmd_access(id, level, cid, 2))
return PLUGIN_HANDLED
new arg1[256]
read_argv(1, arg1, 255)
if(arg1[0]=='"' && arg1[1]=='"')
{
console_print(id, "Server must have a name!!!")
return PLUGIN_HANDLED
}
server_cmd("hostname %s", arg1)
console_print(id, "Name has been set to '%s'", arg1)
return 0;
}


public exec(id, level, cid)
{
if(!cmd_access(id, level, cid, 2))
return PLUGIN_HANDLED
new arg1[32]
read_argv(1, arg1, 31)
trim(arg1)
if(!containi(arg1, ".cfg"))
{
console_print(id, "File name must have .cfg extension.")
return PLUGIN_HANDLED
}
server_cmd("exec %s", arg1)
return 0;
}

public sayFreeze(id)
{
new num=get_cvar_num("mp_freezetime")
client_print(id, print_chat, "Freezetime is set to %i seconds.", num)
}
public sayRound(id)
{
new num=get_cvar_num("mp_roundtime")
client_print(id, print_chat, "The time in each round is %i minutes.", num)
}
public sayBuy(id)
{
new num=get_cvar_num("mp_buytime")
client_print(id, print_chat, "The buytime is %i seconds.", num)
}
public sayTime(id)
{
new num=get_cvar_num("mp_timelimit")
client_print(id, print_chat, "Time per map is %i minutes.", num)
}
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
 



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 00:14.


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