Help with hud!!!
Hello, could you help me to put a hud to this plugin so that the level appears and exp? I would also like to know how to give more exp example a death 1 exp a death with a shot in the head 2 exp
sorry bad english.
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <csx>
#include <nvault>
#include <fakemeta>
#define PLUGIN "Top10 + Levels"
#define AUTHOR "Frnc"
#define VERSION "1.0"
new const LEVELS[241] =
{
10, // 1
20, // 2
30, // 3
40, // 4
50, // 5
60, // 6
70, // 7
80, // 8
90, // 9
100, // 10
110, // 11
120, // 12
130, // 13
140, // 14
150, // 15
160, // 16
170, // 17
180, // 18
190, // 19
200, // 20
215, // 21
230, // 22
245, // 23
260, // 24
275, // 25
290, // 26
305, // 27
325, // 28
345, // 29
365, // 30
385, // 31
405, // 32
430, // 33
455, // 34
480, // 35
505, // 36
530, // 37
555, // 38
580, // 39
605, // 40
635, // 41
665, // 42
695, // 43
725, // 44
760, // 45
795, // 46
830, // 47
865, // 48
900, // 49
940, // 50
980, // 51
1020, // 52
1060, // 53
1100, // 54
1145, // 55
1190, // 56
1235, // 57
1280, // 58
1325, // 59
1375, // 60
1425, // 61
1475, // 62
1525, // 63
1575, // 64
1625, // 65
1675, // 66
1725, // 67
1780, // 68
1835, // 69
1890, // 70
1945, // 71
2000, // 72
2060, // 73
2120, // 74
2180, // 75
2240, // 76
2300, // 77
2365, // 78
2430, // 79
2495, // 80
2560, // 81
2625, // 82
2690, // 83
2755, // 84
2825, // 85
2895, // 86
2965, // 87
3035, // 88
3105, // 89
3175, // 90
3250, // 91
3325, // 92
3400, // 93
3480, // 94
3560, // 95
3640, // 96
3720, // 97
3800, // 98
3880, // 99
3960, // 100
4040, // 101
4125, // 102
4210, // 103
4295, // 104
4380, // 105
4465, // 106
4550, // 107
4635, // 108
4720, // 109
4805, // 110
4890, // 111
4975, // 112
5060, // 113
5155, // 114
5250, // 115
5345, // 116
5440, // 117
5535, // 118
5630, // 119
5725, // 120
5520, // 121
5915, // 122
6010, // 123
6110, // 124
6210, // 125
6310, // 126
6410, // 127
6510, // 128
6610, // 129
6710, // 130
6810, // 131
6910, // 132
7010, // 133
7115, // 134
7220, // 135
7325, // 136
7430, // 137
7535, // 138
7640, // 139
7745, // 140
7850, // 141
7955, // 142
8060, // 143
8170, // 144
8280, // 145
8390, // 146
8500, // 147
8610, // 148
8720, // 149
8830, // 150
8940, // 151
9050, // 152
9165, // 153
9280, // 154
9395, // 155
9510, // 156
9625, // 157
9740, // 158
9855, // 159
10085, // 160
10205, // 161
10325, // 162
10445, // 163
10565, // 164
10685, // 165
10805, // 166
10925, // 167
11045, // 168
11165, // 169
11285, // 170
11405, // 171
11525, // 172
11645, // 173
11765, // 174
11885, // 175
12005, // 176
12130, // 177
12255, // 178
12380, // 179
12505, // 180
12630, // 181
12755, // 182
12880, // 183
13005, // 184
13130, // 185
13255, // 186
13380, // 187
13505, // 188
13630, // 189
13755, // 190
13880, // 191
14005, // 192
14135, // 193
14265, // 194
14395, // 195
14525, // 196
14655, // 197
14785, // 198
14915, // 199
15045, // 200
15175, // 201
15305, // 202
15435, // 203
15565, // 204
15695, // 205
15825, // 206
15955, // 207
16085, // 208
16220, // 209
16355, // 210
16490, // 211
16625, // 212
16760, // 213
16895, // 214
17030, // 215
17165, // 216
17300, // 217
17435, // 218
17570, // 219
17705, // 220
17840, // 221
17975, // 222
18110, // 223
18250, // 224
18390, // 225
18530, // 226
18670, // 227
18810, // 228
18950, // 229
19090, // 230
19230, // 231
19370, // 232
19510, // 233
19650, // 234
19790, // 235
19930, // 236
20070, // 238
20215, // 239
20360, // 240
99999999 // 241
}
new PFRAGS[ 33 ]
new PLEVEL[ 33 ]
new PDEADS[ 33 ]
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event( "DeathMsg", "EventDeathMsg", "a" );
register_clcmd("say /level", "printLevel", -1, "Print player level" );
register_clcmd("say /ontop","show_top", _, "TOP 10 Players");
}
public client_putinserver( id )
{
PDEADS[id] = 0
PLEVEL[id] = 0
PFRAGS[id] = 0
Load(id)
}
public client_disconnect( id )
{
Save(id)
PDEADS[id] = 0
PLEVEL[id] = 0
PFRAGS[id] = 0
}
public EventDeathMsg()
{
new killer = read_data( 1 )
new victim = read_data( 2 )
if( victim == killer )
{
return PLUGIN_CONTINUE
}
if(victim)
PDEADS[victim]++
if(killer)
PFRAGS[killer]++
check_level(killer)
return PLUGIN_CONTINUE
}
public check_level( id )
{
if(PFRAGS[ id ] >= LEVELS[PLEVEL[ id ]])
{
PLEVEL[ id ]++
print_color(id,"!gSubiste A Nivel: !t%d", PLEVEL[ id ])
}
}
public printLevel( id )
{
new newlevel = LEVELS[PLEVEL[ id ]]-PFRAGS[ id ]
print_color(id, "!gTu Nivel Es !t%d !gY Te Faltan !t%d !gFrags Para Subir", PLEVEL[id],newlevel)
}
public Load(id)
{
new timestamp
new g_vault = nvault_open("mro")
new name[32], key[40], data[200], szfrags[15], szLevel[15], szMuertes[15]
get_user_name(id, name, charsmax(name))
formatex(key, charsmax(key), "^"%s^"", name)
if(nvault_lookup(g_vault, key, data, charsmax(data), timestamp))
{
parse(data, szfrags, 14, szLevel, 14, szMuertes, 14)
PFRAGS[id] = str_to_num(szfrags)
PLEVEL[id] = str_to_num(szLevel)
PDEADS[id] = str_to_num(szMuertes)
}
nvault_close(g_vault)
}
public Save(id)
{
new g_vault = nvault_open("mro")
new name[32], key[40], szValue[64]
get_user_name(id,name,charsmax(name))
formatex(key, charsmax(key), "^"%s^"", name)
formatex(szValue, charsmax(szValue), "%d %d %d", PFRAGS[id], PLEVEL[id], PDEADS[id])
nvault_set(g_vault, key, szValue)
nvault_close(g_vault)
}
public show_top(id)
{
static Sort[33][4];
new players[32],num,count,index;
get_players(players,num);
for(new i = 0; i < num; i++)
{
index = players[i];
Sort[count][0] = index;
Sort[count][1] = PLEVEL[index];
Sort[count][2] = PFRAGS[index];
Sort[count][3] = PDEADS[index];
count++;
}
SortCustom2D(Sort,count,"compare_xp");
new motd[1501],iLen;
iLen = format(motd, sizeof motd - 1,"<body bgcolor=#000000 text=#98f5ff><pre>");
iLen += format(motd[iLen], (sizeof motd - 1) - iLen,"%s %-22.22s %3s %6s %6s^n", "#", "Name", "Nivel", "Asesinatos", "Muertes");
new y = clamp(count,0,100);
new name[32],kindex;
for(new x = 0; x < y; x++)
{
kindex = Sort[x][0];
get_user_name(kindex,name,sizeof name - 1);
iLen += format(motd[iLen], (sizeof motd - 1) - iLen,"%d %-22.22s %6d %6d %6d^n", x + 1, name, Sort[x][1],Sort[x][2],Sort[x][3]);
}
iLen += format(motd[iLen], (sizeof motd - 1) - iLen,"</body></pre>");
show_motd(id,motd, "ontop");
}
public compare_xp(elem1[], elem2[])
{
if(elem1[1] > elem2[1])
return -1;
else if(elem1[1] < elem2[1])
return 1;
return 0;
}
stock print_color(id, const msg[], any:...) {
static buffer[512], msg_SayText = 0
if(!msg_SayText)
msg_SayText = get_user_msgid("SayText")
vformat(buffer, charsmax(buffer), msg, 3)
replace_all( buffer, charsmax( buffer ), "!n", "^1" ); // Default Color
replace_all( buffer, charsmax( buffer ), "!g", "^4" ); // Green Color
replace_all( buffer, charsmax( buffer ), "!t", "^3" ); // Team Color
message_begin(MSG_ONE_UNRELIABLE, msg_SayText, _, id)
write_byte(id)
write_string(buffer)
message_end()
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang21514\\ f0\\ fs16 \n\\ par }
*/
|