credit me if you use this
In player connect:
Code:
if(self getGuid()!=0)
{
f=openfile("info/"+self getGuid()+".dobr","read");
if(f==-1)
{
f=openfile("lastposition/"+"flick"+".dobr","read");
freadln(F);
level.lastposition = int(fgetarg(f,0));
closefile(F);
f=openfile("lastposition/"+"flick"+".dobr", "write");
fprintln(f, (level.lastposition+1));
closefile(f);
self.position=(level.lastposition+1);
self.killplayers=0;
f=openfile("statistik/"+self.position+".dobr", "write");
fprintln(f, self getGuid());
closefile(f);
f=openfile("info/"+self getGuid()+".dobr", "write");
fprintln(f, self.position);
fprintln(f, self.killplayers);
fprintln(f, self.name);
closefile(f);
}
else
{
freadln(F);
self.position = int(fgetarg(f,0));
self.killplayers = int(fgetarg(f,1));
closefile(F);
f=openfile("info/"+self getGuid()+".dobr", "write");
fprintln(f, self.position);
fprintln(f, self.killplayers);
fprintln(f, self.name);
closefile(f);
}
}
self thread maps\mp\gametype\_killstat::init();
file killstat:
init()
{
while(isdefined(self))
{
wait 3;
f=openfile("info/"+self getGuid()+".dobr","read");
freadln(F);
self.position = int(fgetarg(f,0));
closefile(F);
f=openfile("info/"+self getGuid()+".dobr", "write");
fprintln(f, self.position);
fprintln(f, self.killplayers);
fprintln(f, self.name);
closefile(f);
self.playerposition=(self.position-1);
f=openfile("statistik/"+self.playerposition+".dobr", "read");
freadln(F);
self.playerguid = int(fgetarg(f,0));
closefile(F);
f=openfile("info/"+self.playerguid+".dobr","read");
freadln(F);
self.playerfrags = int(fgetarg(f,1));
closefile(F);
if(self.position>1)
{
if(self.killplayers>self.playerfrags)
{
f=openfile("statistik/"+self.playerposition+".dobr", "write");
fprintln(f, self getGuid());
closefile(f);
f=openfile("statistik/"+self.position+".dobr", "write");
fprintln(f, self.playerguid);
closefile(f);
f=openfile("info/"+self.playerguid+".dobr", "write");
fprintln(f, self.position);
closefile(f);
f=openfile("info/"+self getGuid()+".dobr", "write");
fprintln(f, self.playerposition);
closefile(f);
self.position=self.playerposition;
player=getentarray("player","classname");
for(i=0;i<player.size;i++)
{
if(player[i] getguid()==self.playerguid)
{
player[i].position=(self.position+1);
}
}
}
}
}
}
file for cvar top5
Code:
for(i=1;i<6;i++)
{
f=openfile("statistik/"+i+".dobr","read");
freadln(f);
level.guids[i]=int(fgetarg(f,0));
closefile(f);
f=openfile("info/"+level.guids[i]+".dobr","read");
freadln(f);
level.frags[i] = int(fgetarg(f,1));
level.nick[i] = fgetarg(f,2);
closefile(f);
nuk = "nuk"+i;
frags = "frags"+i;
self setClientCvar(nuk, "^2`^9[^7Nick^9] - ^2`^9[^7"+level.nick[i]+"^9]^2`");
self setClientCvar(frags, "^2`^9[^7Killed^9]^2` - ^2`^9[^7"+level.frags[i]+"^9]^2`");
}
use cvar nuk1,nuk2...nuk5 and frags1,frags2...frags5 in your menu with top5 players
this is only for example
Code:
#include "ui_mp/menudef.h"
#define ORIGIN_TITLE 260 90
#define ORIGIN_TITLEA 260 90
#define ORIGIN_CHOICE1 120 180
#define ORIGIN_CHOICE2 120 220
#define ORIGIN_CHOICE3 120 260
#define ORIGIN_CHOICE4 120 300
#define ORIGIN_CHOICE21 120 340
#define ORIGIN_CHOICEA1 120 180
#define ORIGIN_CHOICEA2 120 220
#define ORIGIN_CHOICEF -90 0
#define ORIGIN_CHOICETOP1 350 120
#define ORIGIN_CHOICETOP2 350 180
#define ORIGIN_CHOICETOP3 350 240
#define ORIGIN_CHOICETOP4 350 300
#define ORIGIN_CHOICETOP5 350 360
#define ORIGIN_CHOICEFRAGS1 350 140
#define ORIGIN_CHOICEFRAGS2 350 200
#define ORIGIN_CHOICEFRAGS3 350 260
#define ORIGIN_CHOICEFRAGS4 350 320
#define ORIGIN_CHOICEFRAGS5 350 380
#define ORIGIN_CHOICEMN1 350 180
#define ORIGIN_CHOICERA1 350 200
#define ORIGIN_CHOICEHU1 350 220
#define ORIGIN_CHOICENE1 350 240
#define ORIGIN_CHOICELI1 350 260
#define ORIGIN_CHOICEFR1 350 280
{
menuDef
{
name "ingame"
rect 0 0 640 480
focuscolor GLOBAL_FOCUSED_COLOR
style WINDOW_STYLE_EMPTY
blurWorld 5.0
onEsc
{
close ingame;
}
onOpen
{
hide top;
scriptMenuResponse "top";
hide statskill;
scriptMenuResponse "statskill";
}
onClose
{
hide top;
hide statskill;
}
// Gradient
itemDef
{
style WINDOW_STYLE_SHADER
//rect -107 0 554 480
rect 0 0 640 480 HORIZONTAL_ALIGN_FULLSCREEN VERTICAL_ALIGN_FULLSCREEN
background "gradient"
visible 1
decoration
}
// WINDOW BACKGROUND
itemDef
{
name "window_background"
visible 1
rect 0 0 850 480
origin ORIGIN_CHOICEF
style WINDOW_STYLE_FILLED
forecolor 1 1 1 1
backcolor 0 0 0 0.7975
decoration
}
itemDef
{
type ITEM_TYPE_TEXT
visible 1
origin ORIGIN_TITLE
forecolor 1 1 1 1
text "@^2`^9Общее Меню^2`"
textfont UI_FONT_NORMAL
textscale GLOBAL_HEADER_SIZE
decoration
}
// MENU CHOICES
execKey "1" { play "mouse_click"; scriptMenuResponse "changeweapon" }
execKey "2" { play "mouse_click"; scriptMenuResponse "changeteam" }
execKey "3" { play "mouse_click"; scriptMenuResponse "top" ; show top }
execKey "4" { play "mouse_click"; close ingame; open leavegame }
execKey "5" { play "mouse_click"; scriptMenuResponse "statskill" ; show statskill }
///////////////////////топ 1
itemDef
{
name "top"
type ITEM_TYPE_TEXT
visible 1
origin ORIGIN_CHOICETOP1
forecolor 1 1 1 1
dvar "nuk1"
textfont UI_FONT_NORMAL
textscale .32
textstyle ITEM_TEXTSTYLE_SHADOWED
textaligny 20
}
itemDef
{
name "top"
type ITEM_TYPE_TEXT
visible 1
origin ORIGIN_CHOICEFRAGS1
forecolor 1 1 1 1
dvar "frags1"
textfont UI_FONT_NORMAL
textscale .32
textstyle ITEM_TEXTSTYLE_SHADOWED
textaligny 20
}
/////////////////////////топ 2
itemDef
{
name "top"
type ITEM_TYPE_TEXT
visible 1
origin ORIGIN_CHOICETOP2
forecolor 1 1 1 1
dvar "nuk2"
textfont UI_FONT_NORMAL
textscale .32
textstyle ITEM_TEXTSTYLE_SHADOWED
textaligny 20
}
itemDef
{
name "top"
type ITEM_TYPE_TEXT
visible 1
origin ORIGIN_CHOICEFRAGS2
forecolor 1 1 1 1
dvar "frags2"
textfont UI_FONT_NORMAL
textscale .32
textstyle ITEM_TEXTSTYLE_SHADOWED
textaligny 20
}
/////////////////////////топ 3
itemDef
{
name "top"
type ITEM_TYPE_TEXT
visible 1
origin ORIGIN_CHOICETOP3
forecolor 1 1 1 1
dvar "nuk3"
textfont UI_FONT_NORMAL
textscale .32
textstyle ITEM_TEXTSTYLE_SHADOWED
textaligny 20
}
itemDef
{
name "top"
type ITEM_TYPE_TEXT
visible 1
origin ORIGIN_CHOICEFRAGS3
forecolor 1 1 1 1
dvar "frags3"
textfont UI_FONT_NORMAL
textscale .32
textstyle ITEM_TEXTSTYLE_SHADOWED
textaligny 20
}
/////////////////////////топ 4
itemDef
{
name "top"
type ITEM_TYPE_TEXT
visible 1
origin ORIGIN_CHOICETOP4
forecolor 1 1 1 1
dvar "nuk4"
textfont UI_FONT_NORMAL
textscale .32
textstyle ITEM_TEXTSTYLE_SHADOWED
textaligny 20
}
itemDef
{
name "top"
type ITEM_TYPE_TEXT
visible 1
origin ORIGIN_CHOICEFRAGS4
forecolor 1 1 1 1
dvar "frags4"
textfont UI_FONT_NORMAL
textscale .32
textstyle ITEM_TEXTSTYLE_SHADOWED
textaligny 20
}
/////////////////////////топ 5
itemDef
{
name "top"
type ITEM_TYPE_TEXT
visible 1
origin ORIGIN_CHOICETOP5
forecolor 1 1 1 1
dvar "nuk5"
textfont UI_FONT_NORMAL
textscale .32
textstyle ITEM_TEXTSTYLE_SHADOWED
textaligny 20
}
itemDef
{
name "top"
type ITEM_TYPE_TEXT
visible 1
origin ORIGIN_CHOICEFRAGS5
forecolor 1 1 1 1
dvar "frags5"
textfont UI_FONT_NORMAL
textscale .32
textstyle ITEM_TEXTSTYLE_SHADOWED
textaligny 20
}
///////////////////////////////////////////////////
itemDef
{
name "statskill"
type ITEM_TYPE_TEXT
visible 1
origin ORIGIN_CHOICEMN1
forecolor 1 1 1 1
dvar "menuk"
textfont UI_FONT_NORMAL
textscale .45
textstyle ITEM_TEXTSTYLE_SHADOWED
textaligny 20
}
itemDef
{
name "statskill"
type ITEM_TYPE_TEXT
visible 1
origin ORIGIN_CHOICERA1
forecolor 1 1 1 1
dvar "merank"
textfont UI_FONT_NORMAL
textscale .45
textstyle ITEM_TEXTSTYLE_SHADOWED
textaligny 20
}
itemDef
{
name "statskill"
type ITEM_TYPE_TEXT
visible 1
origin ORIGIN_CHOICEHU1
forecolor 1 1 1 1
dvar "mehun"
textfont UI_FONT_NORMAL
textscale .45
textstyle ITEM_TEXTSTYLE_SHADOWED
textaligny 20
}
itemDef
{
name "statskill"
type ITEM_TYPE_TEXT
visible 1
origin ORIGIN_CHOICENE1
forecolor 1 1 1 1
dvar "menext"
textfont UI_FONT_NORMAL
textscale .45
textstyle ITEM_TEXTSTYLE_SHADOWED
textaligny 20
}
itemDef
{
name "statskill"
type ITEM_TYPE_TEXT
visible 1
origin ORIGIN_CHOICELI1
forecolor 1 1 1 1
dvar "melil"
textfont UI_FONT_NORMAL
textscale .45
textstyle ITEM_TEXTSTYLE_SHADOWED
textaligny 20
}
itemDef
{
name "statskill"
type ITEM_TYPE_TEXT
visible 1
origin ORIGIN_CHOICEFR1
forecolor 1 1 1 1
dvar "mefrags"
textfont UI_FONT_NORMAL
textscale .45
textstyle ITEM_TEXTSTYLE_SHADOWED
textaligny 20
}
itemDef
{
name "button_changeweapon"
visible 1
rect 0 0 128 24
origin ORIGIN_CHOICE1
forecolor GLOBAL_UNFOCUSED_COLOR
type ITEM_TYPE_BUTTON
text "@^91^2.^2`^9Выбор Оружие^2`"
textfont UI_FONT_NORMAL
textscale .45
textstyle ITEM_TEXTSTYLE_SHADOWED
textaligny 20
dvartest "ui_allow_weaponchange"
showDvar { "1" }
action
{
play "mouse_click";
scriptMenuResponse "changeweapon";
}
onFocus
{
play "mouse_over";
}
}
itemDef
{
name "button_changeteam"
visible 1
rect 0 0 128 24
origin ORIGIN_CHOICE2
forecolor GLOBAL_UNFOCUSED_COLOR
type ITEM_TYPE_BUTTON
text "@^92^2.^2`^9Выбор Команды^2`"
textfont UI_FONT_NORMAL
textscale .45
textstyle ITEM_TEXTSTYLE_SHADOWED
textaligny 20
action
{
play "mouse_click";
scriptMenuResponse "changeteam";
}
onFocus
{
play "mouse_over";
}
}
itemDef
{
name "button_top"
visible 1
rect 0 0 128 24
origin ORIGIN_CHOICE3
forecolor GLOBAL_UNFOCUSED_COLOR
type ITEM_TYPE_BUTTON
text "@^93^2.^2`^9Топ 5 Игроков^2`"
textfont UI_FONT_NORMAL
textscale .45
textstyle ITEM_TEXTSTYLE_SHADOWED
textaligny 20
action
{
play "mouse_click";
show top;
hide statskill;
scriptMenuResponse "top";
}
onFocus
{
play "mouse_over";
}
}
itemDef
{
name "button_stat"
visible 1
rect 0 0 128 24
origin ORIGIN_CHOICE21
forecolor GLOBAL_UNFOCUSED_COLOR
type ITEM_TYPE_BUTTON
text "@^95^2.^2`^9Моя Статистика^2`"
textfont UI_FONT_NORMAL
textscale .45
textstyle ITEM_TEXTSTYLE_SHADOWED
textaligny 20
action
{
play "mouse_click";
hide top;
show statskill;
scriptMenuResponse "statskill";
}
onFocus
{
play "mouse_over";
}
}
itemDef
{
name "button_leavegame"
visible 1
rect 0 0 128 24
origin ORIGIN_CHOICE4
forecolor GLOBAL_UNFOCUSED_COLOR
type ITEM_TYPE_BUTTON
text "@^94^2.^2`^9Выйти с Сервера^2`"
textfont UI_FONT_NORMAL
textscale .45
textstyle ITEM_TEXTSTYLE_SHADOWED
textaligny 20
action
{
play "mouse_click";
close ingame;
open leavegame;
}
onFocus
{
play "mouse_over";
}
}
itemDef
{
#include "ui_mp/button_mainmenu.menu"
action
{
play "mouse_click";
close ingame;
open main;
}
onFocus
{
play "mouse_over";
}
}
}
menuDef
{
name "leavegame"
rect 0 0 640 480
focuscolor GLOBAL_FOCUSED_COLOR
style WINDOW_STYLE_EMPTY
blurWorld 5.0
onEsc
{
close leavegame;
}
onOpen
{
}
onClose
{
setfocus button_no;
}
// Gradient
itemDef
{
style WINDOW_STYLE_SHADER
//rect -107 0 554 480
rect 0 0 640 480 HORIZONTAL_ALIGN_FULLSCREEN VERTICAL_ALIGN_FULLSCREEN
background "gradient"
visible 1
decoration
}
itemDef
{
type ITEM_TYPE_TEXT
visible 1
origin ORIGIN_TITLEA
forecolor 1 1 1 1
text "^2`^9Выйти с Сервера^2`"
textfont UI_FONT_NORMAL
textscale .50
decoration
}
// MENU CHOICES
execKey "1" { play "mouse_click"; close leavegame; exec "disconnect" }
execKey "2" { play "mouse_click"; close leavegame; }
itemDef
{
name "button_yes"
visible 1
rect 0 0 128 24
origin ORIGIN_CHOICEA1
forecolor GLOBAL_UNFOCUSED_COLOR
type ITEM_TYPE_BUTTON
text "^2`^9Да,простите я ухожу^2`"
textfont UI_FONT_NORMAL
textscale .55
textstyle ITEM_TEXTSTYLE_SHADOWED
textaligny 20
action
{
play "mouse_click";
close leavegame;
exec "disconnect";
}
onFocus
{
play "mouse_over";
}
}
itemDef
{
name "button_no"
visible 1
rect 0 0 128 24
origin ORIGIN_CHOICEA2
forecolor GLOBAL_UNFOCUSED_COLOR
type ITEM_TYPE_BUTTON
text "^2`^9Нет,я еще не ухожу^2`"
textfont UI_FONT_NORMAL
textscale .55
textstyle ITEM_TEXTSTYLE_SHADOWED
textaligny 20
action
{
play "mouse_click";
close leavegame;
}
onFocus
{
play "mouse_over";
}
}
itemDef
{
#include "ui_mp/button_mainmenu.menu"
action
{
play "mouse_click";
close leavegame;
open main;
}
onFocus
{
play "mouse_over";
}
}
}
}