[REQ] Edit Plugin

K

khashayar007

Guest
#1
Hi. I want this plugin to have an admin flag(bcdefghijkmnopqrstu) beside the vip flag(bitz) after 1500 kills. For example when a player reaches 500 kills it becomes vip and if reaches 1500 kills it becomes admin. The plugin below has the vip with 500 kills but not admin flag for 1500 kills.


PHP Code:
#include <amxmodx>
#include <cstrike>
#include <hamsandwich>
#include <nvault>

new g_vault;

new
g_iMaxPlayers;

new
bool:g_bConnected[33];
new
bool:g_bFlags[33];

new
g_szFlags[22];

new
g_kills[33];
new
g_szSave[33][32];

new
p_kills_for_vip, p_vip_flags;
new
p_savetype, p_expire;

public
plugin_init()
{
register_plugin("Pro Become VIP", "2.0", "didoWEE");

g_vault = nvault_open("pb_vip");
g_iMaxPlayers = get_maxplayers();

register_event("DeathMsg", "eDeath", "a")
RegisterHam(Ham_Spawn, "player", "fwdSpawn", 1);

p_kills_for_vip = register_cvar("amx_kills", "500"); // Needed kill to become VIP
p_vip_flags = register_cvar("amx_kills_flags", "bitz"); // The flags which you get when you become VIP
p_savetype = register_cvar("amx_kills_savetype", "3"); // Save type [1 - by name / 2 - by IP / 3 - by SteamID]
p_expire = register_cvar("amx_kills_expiredays", "14"); // Expire days
}
public
plugin_cfg()
{
nvault_prune(g_vault, 0, get_systime() - (86400 * get_pcvar_num(p_expire)));
get_pcvar_string(p_vip_flags, g_szFlags, charsmax(g_szFlags));
}

LoadData(id)
{
new
data[16];
if(
nvault_get(g_vault, g_szSave[id], data, charsmax(data))) g_kills[id] = str_to_num(data);
else
g_kills[id] = 0;
}

SaveData(id)
{
new
data[16];
num_to_str(g_kills[id], data, charsmax(data));
nvault_set(g_vault, g_szSave[id], data);
}

ShowHud(id)
{
set_hudmessage(195, 195, 0, 0.25, 0.50, 0, 3.0, 5.0, 0.0, 0.0, -1);
show_hudmessage(id, "Reach %i kills and become VIP^nYour have: %i kills", get_pcvar_num(p_kills_for_vip), g_kills[id]);
}

FlaggingFunc(id)
{
set_user_flags(id, read_flags(g_szFlags));
g_bFlags[id] = true;
}
public
eDeath()
{
new
killer = read_data(1);

if(
killer && killer <= g_iMaxPlayers)
{
if(
g_bConnected[killer])
{
if(
killer != read_data(2))
{
if(!
g_bFlags[killer])
{
g_kills[killer]++;

if(
g_kills[killer] < get_pcvar_num(p_kills_for_vip)) ShowHud(killer);
else
if(
g_kills[killer] == get_pcvar_num(p_kills_for_vip))
{
FlaggingFunc(killer);

set_hudmessage(235, 0, 235, 0.25, 0.65, 1, 7.5, 15.0, 0.0, 0.0, -1);
show_hudmessage(killer, "Congratilations^nYou are VIP");
}
}
}
}
}
}

public
fwdSpawn(id)
{
if(
g_bConnected[id])
{
if (
g_kills[id] < get_pcvar_num(p_kills_for_vip)) ShowHud(id);
}
}
public
client_connect(id)
{
if(!(
is_user_bot(id) && is_user_hltv(id)))
{
g_bConnected[id] = true;

new
savetype = get_pcvar_num(p_savetype);
switch(
savetype)
{
case
1: get_user_name(id, g_szSave[id], charsmax(g_szSave[]));
case
2: get_user_ip(id, g_szSave[id], charsmax(g_szSave[]));
case
3: get_user_authid(id, g_szSave[id], charsmax(g_szSave[]));
}

LoadData(id);

if(
get_user_flags(id) & read_flags(g_szFlags)) g_bFlags[id] = true;
else
{
if(
g_kills[id] >= get_pcvar_num(p_kills_for_vip)) FlaggingFunc(id);
else
g_bFlags[id] = false;
}
}
}
public
client_disconnect(id)
{
if(!(
is_user_bot(id) && is_user_hltv(id)))
{
g_bConnected[id] = false;
if(
g_kills[id] > 0) SaveData(id);
}
}
public
plugin_end()
{
for(new
id=1; id <= g_iMaxPlayers; id++)
{
if(
g_bConnected[id])
{
if(!(
is_user_bot(id) && is_user_hltv(id)))
{
if(
g_kills[id] > 0) SaveData(id);
}
}
}
nvault_close(g_vault);
}
 
   
   
   
Top