Shadowless
Пользователь
- Регистрация
- 24 Фев 2019
- Сообщения
- 237
- Симпатии
- 4
- Пол
- Мужской
ищу плагин который показывает <сервер инфо> что то вроде этого
толка ано amxmod или исели можна переделать на amxmodx
вообщем то мне нужна функция а нагрузке сервера
C++:
/* Plugin generated by AMXX-Studio */
#include <amxmod>
new cpuinfo_f[128] = "../../../../../proc/cpuinfo"
new uptime_f[128] = "../../../../../proc/uptime"
new load_f[128] = "../../../../../proc/loadavg"
public plugin_init()
{
register_plugin("Server Info","0.8","JustinHoMi")
register_concmd("amx_cpuinfo","admin_cpuinfo",ADMIN_IMMUNITY,"- displays processor info")
register_concmd("amx_uptime","admin_uptime",ADMIN_IMMUNITY,"- shows server uptime")
register_concmd("amx_load","admin_load",ADMIN_IMMUNITY,"- show cpu load")
return PLUGIN_CONTINUE
}
public admin_cpuinfo(id,level)
{
if (!(get_user_flags(id)&level)){
console_print(id,"[AMX] You have no access to that command.")
return PLUGIN_HANDLED
}
new i = 0
new line[128]
new len, mhz, cpu
new msg[64] = "[AMX] CPU info: "
new msg_t[64]
new mhz_t[10]
if (file_exists(cpuinfo_f))
{
while(read_file(cpuinfo_f,i++,line,128,len))
{
mhz = (contain(line,"MHz"))
cpu = (contain(line,"model name"))
if(mhz != -1)
{
mhz = contain(line,":")
copyc(mhz_t,10,line[mhz+2],'.')
format(msg_t,32," %smhz ",mhz_t)
add(msg,64,msg_t)
}
else if(cpu != -1)
{
cpu = contain(line,":")
add(msg,64,line[cpu+2])
}
}
console_print(id,msg)
}
else
console_print(id,"[AMX] Unable to find %s",cpuinfo_f)
return PLUGIN_HANDLED
}
public admin_uptime(id,level)
{
if (!(get_user_flags(id)&level)){
console_print(id,"[AMX] You have no access to that command.")
return PLUGIN_HANDLED
}
new i = 0
new line[128]
new len
if (file_exists(uptime_f))
{
read_file(uptime_f,i++,line,128,len)
new uptime_s[64]
parse(line,uptime_s,64)
new uptime = strtonum(uptime_s)
new days = uptime / 86400
new hours = uptime % 86400 / 60 / 60
new minutes = uptime % 86400 / 60 % 60
console_print(id,"[AMX] Uptime: %i days, %i:%i",days,hours,minutes)
}
else
console_print(id,"[AMX] Unable to find %s",uptime_f)
return PLUGIN_HANDLED
}
public admin_load(id,level)
{
if (!(get_user_flags(id)&level)){
console_print(id,"[AMX] You have no access to that command.")
return PLUGIN_HANDLED
}
if (file_exists(load_f))
{
new i=0,len,line[128]
read_file(load_f,i++,line,128,len)
new one_s[6],five_s[6],fifteen_s[6]
parse(line,one_s,6,five_s,6,fifteen_s,6)
new Float:one_i = floatstr(one_s) * 100.0
new Float:five_i = floatstr(five_s) * 100.0
new Float:fifteen_i = floatstr(fifteen_s) * 100.0
new pct = '%'
console_print(id,"[AMX] Load: 1min:%i%c 5min:%i%c 15min:%i%c",floatround(one_i),pct,floatround(five_i),pct,floatround(fifteen_i),pct)
}
else
console_print(id,"[AMX] Unable to find %s",load_f)
return PLUGIN_HANDLED
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1049\\ f0\\ fs16 \n\\ par }
*/
толка ано amxmod или исели можна переделать на amxmodx
вообщем то мне нужна функция а нагрузке сервера
Последнее редактирование: