Код Фпс
Код за потвърждение: Избери целия код
#include <amxmodx>
#include <fakemeta>
#define PLUGIN "Server Frames"
#define VERSION "1.0"
#define AUTHOR "Alka"
new bool:ShowFramesStatus[33];
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR);
register_forward(FM_StartFrame, "Fwd_StartFrame");
register_clcmd("say /showfps", "CmdShowFps");
register_clcmd("say /fps", "CmdShowFps");
}
public CmdShowFps(id)
{
if(!ShowFramesStatus[id])
{
ShowFramesStatus[id] = true;
client_print(id, print_chat, "From now, you will see server frames/sec.");
}
else
{
ShowFramesStatus[id] = false;
client_print(id, print_chat, "You will no longer see server frames/sec.");
}
}
public client_disconnect(id)
ShowFramesStatus[id] = false;
public Fwd_StartFrame()
{
static Float:GameTime, Float:FramesPer = 0.0;
static Float:Fps;
GameTime = get_gametime();
if(FramesPer >= GameTime)
Fps += 1.0;
else
{
FramesPer = FramesPer + 1.0; //Frames per 1 sec.
static Players[32], Num;
get_players(Players, Num);
for(new i = 0 ; i < Num ; i++)
{
if(!ShowFramesStatus[Players[i]])
continue;
set_hudmessage(255, 0, 0, -1.0, 0.05, 0, 2.0, 1.0, 0.5, 1.0);
show_hudmessage(Players[i], "FPS : %.1f", Fps);
}
Fps = 0.0;
}
}
Код за потвърждение: Избери целия код
#include < amxmodx >
#include < amxmisc >
#include < nvault >
#include < fakemeta >
#define PLUGIN_NAME "Level__System"
#define PLUGIN_VERSION "0.1"
#define PLUGIN_AUTHOR "Bos93 & FirsT & xoymiii"
#define MAX_CLIENTS 32
#define ID_SHOWHUD (taskid - TASK_SHOWHUD)
enum (+= 100)
{
TASK_SHOWHUD = 10
}
new const g_Rank[21] [ ] =
{
"x","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","r","s","t","u"
};
new const MAX_LEVELS[20] =
{
100, //1
300, //2
400, //3
500, //4
600, //5
800, //6
900, //7
1000, //8
1200, //9
1300, //10
1500, //11
2000, //12
2500, //13
3000, //14
3500, //15
4500, //16
5000, //17
6000, //18
8000, //19
12000 //20
}
const Float:HUD_STATS_X = 0.40;
const Float:HUD_STATS_Y = 0.9;
const Float:HUD_SPECT_X = -1.0;
const Float:HUD_SPECT_Y = 0.8;
const PEV_SPEC_TARGET = pev_iuser2
new g_iLevel[ MAX_CLIENTS + 1 ],
g_iExp[ MAX_CLIENTS + 1 ],
g_playername[ MAX_CLIENTS + 1 ][ MAX_CLIENTS ];
new g_vault
public plugin_init( )
{
register_plugin ( PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR );
register_event( "DeathMsg", "EV_DeathMsg", "a" );
g_vault = nvault_open("Levels__System")
register_dictionary("levels.txt" );
}
public plugin_natives()
{
register_native("zp_get_user_level", "native_get_user_level", 1)
register_native("zp_set_user_level", "native_set_user_level", 1)
register_native("zp_get_user_exp", "native_get_user_exp", 1)
register_native("zp_set_user_exp", "native_set_user_exp", 1)
register_native("get_user_rankname", "native_get_user_rankname")
}
public client_disconnect(id)
{
SaveData(id);
}
public client_putinserver( iPlayer )
{
get_user_name(iPlayer, g_playername[iPlayer], charsmax(g_playername[]))
set_task(0.1, "ShowHUD", iPlayer+TASK_SHOWHUD, _, _, "b")
LoadData( iPlayer );
}
public plugin_end()
{
nvault_close(g_vault)
}
public EV_DeathMsg( )
{
static iVictim, iKiller;
iVictim = read_data( 2 );
iKiller = read_data( 1 );
if( !is_user_connected( iVictim ) )
return;
if( iKiller == iVictim || !iKiller )
return;
g_iExp[ iKiller ] += 1;
while( g_iExp[ iKiller ] >= MAX_LEVELS[ g_iLevel[ iKiller ] ] )
{
g_iLevel[ iKiller ] += 1;
new name[32];
get_user_name(iKiller, name, 31);
color_print(0, "!g[New-Rank] !yПоздравления! Играч !g%s !yполучи нов ранк !g%L", name, LANG_PLAYER, (g_Rank[ g_iLevel[ iKiller ] ]) )
}
}
public ShowHUD(taskid)
{
static iPlayer
iPlayer = ID_SHOWHUD;
if (!is_user_alive( iPlayer ) )
{
iPlayer = pev(iPlayer, PEV_SPEC_TARGET)
// Target not alive
if (!is_user_alive(iPlayer) ) return;
}
if (iPlayer != ID_SHOWHUD)
{
set_hudmessage( 0, 191, 255, HUD_SPECT_X, HUD_SPECT_Y, 0, 5.0, 3.0, 1.0, 1.0 );
show_hudmessage( ID_SHOWHUD , "Наблюдение за: %s^n[Ранк: %L] [Статус: %d / %d]", g_playername[ iPlayer ] , LANG_PLAYER, (g_Rank[g_iLevel[ ID_SHOWHUD ]]) , g_iExp[ ID_SHOWHUD ] , (MAX_LEVELS[g_iLevel[ ID_SHOWHUD ]]) );
}
else
{
set_hudmessage( 0, 191, 255, HUD_STATS_X, HUD_STATS_Y, 0, 5.0, 3.0, 1.0, 1.0 );
show_hudmessage( ID_SHOWHUD , "Ранк: %L | Статус: %d от %d", LANG_PLAYER, (g_Rank[g_iLevel[ ID_SHOWHUD ]]) , g_iExp[ ID_SHOWHUD ] , (MAX_LEVELS[g_iLevel[ ID_SHOWHUD ]]));
}
}
public SaveData(id) {
new AuthID[35]
get_user_authid(id,AuthID,34)
new vaultkey[64],vaultdata[256]
format(vaultkey,63,"%s-cso",AuthID)
format(vaultdata,255,"%i#%i#",g_iLevel[id],g_iExp[id])
nvault_set(g_vault,vaultkey,vaultdata)
return PLUGIN_CONTINUE
}
public LoadData(id)
{
new AuthID[35]
get_user_authid(id,AuthID,34)
new vaultkey[64],vaultdata[256]
format(vaultkey,63,"%s-cso",AuthID)
format(vaultdata,255,"%i#%i#",g_iLevel[id],g_iExp[id])
nvault_get(g_vault,vaultkey,vaultdata,255)
replace_all(vaultdata, 255, "#", " ")
new experience[32], playerlevel[32]
parse(vaultdata, experience, 31, playerlevel, 31)
g_iLevel[id] = str_to_num(experience)
g_iExp[id] = str_to_num(playerlevel)
return PLUGIN_CONTINUE
}
public native_get_user_exp(id)
{
return g_iExp[id];
}
public native_set_user_exp(id, amount)
{
g_iExp[id] = amount;
}
public native_get_user_level(id)
{
return g_iLevel[id];
}
public native_set_user_level(id, amount)
{
g_iLevel[id] = amount;
}
public native_get_user_rankname(plugin, params)
{
new id = get_param(1)
if (!is_user_connected(id))
{
return false
}
new szRank[32]
formatex(szRank, charsmax(szRank), "%L", LANG_PLAYER, g_Rank[g_iLevel[id]])
set_string(2, szRank, get_param(3))
return true
}
stock color_print( const id , const input[], any:...)
{
new count = 1, players[32]
static msg[191]
vformat(msg, 190, input, 3)
replace_all(msg, 190, "!g", "^4" ) // Green Color
replace_all(msg, 190, "!y", "^1" ) // Default Color
replace_all(msg, 190, "!team", "^3" ) // Team Color
if (id) players[0] = id; else get_players(players, count, "ch")
{
for (new i = 0; i < count; i++)
{
if (is_user_connected(players[i]))
{
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText" ), _, players[i])
write_byte(players[i]);
write_string(msg);
message_end();
}
}
}
}