#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <cstrike>
#include <sqlx>
//////////////////////////////////////////////////////
#define MAXPLAYERS 33 // player id-k lesznek
#define MAXLVL 50 // max szint
#define MAXRANK 11 // maximum rang
#pragma semicolon 1 // mindenhova ahova lehet tegyék ; jelet
#define ChatColor print_team_default // -1 csak szürke a ^3 -2 csak piros, -3 csak kék, print_team_default az alap
#define Tablename "skinmenuranked" //SQL Tábla neve!//
//////////////////////////////////////////////////////
#define OWNER ADMIN_IMMUNITY // OWnerben taroljuk az immunitas jogot
#define FOADMIN ADMIN_LEVEL_E // foadminban meg a o jogot
#define ADMIN ADMIN_MAP // adminban a mapvaltas jogot
#define VIP ADMIN_LEVEL_H //vipben meg egy h jogot
//////////////////////////////////////////////////////
//(valamelyik előtt mindenképpen legyen // jel!)
#define RANK_ON // ha latni akarsz rangokat chatben (tulaj admin vip)
//#define RANK_OFF // ha nem akarsz latni rangokat chatben (tulaj admin vip)
//(valamelyik előtt mindenképpen legyen // jel!)
//////////////////////////////////////////////////////
#define KILL_POINT 1
#define HEADSHOT_POINT 5
//////////////////////////////////////////////////////
enum _:GunDatas {
M4A1,
AK47,
AWP,
SCOUT,
FAMAS,
GALIL,
AUG,
M3,
XM1014,
KNIFE,
DEAGLE,
USP,
GLOCK
}
new g_SelectedGun[33][GunDatas], g_uPoints[33][GunDatas], g_Wpn[33];
new sSteamID[64];
new betoltve[33];
enum _:ePlayer{eXp,eLvl,eRank,eRankCounter,};
new g_ePlayer[ePlayer][MAXPLAYERS], cvarPrefix, gSyncHud;
new const gMenuPrefix[] = "\w[..::DarK*_*Knight::..]\y";
new const gChatPrefix[] = "[..::DarK*_*Knight::..]";
enum _:DATA {
GunName[512],
ModelName[512],
Points[8]
}
enum _:eRanks{eRankName[64], eRankLvl,};
new const cRanks[MAXRANK][eRanks] = {
{"Kezdő", 0}, //rang neve, szint
{"szőlőcukor", 5},
{"Csöves", 10},
{"Cukros Bácsi", 15},
{"Retardált", 20},
{"Hajléktalan", 25},
{"Fogyatékos", 30},
{"Drogos", 35},
{"Szittyós", 40},
{"Gyerekrabló", 45},
{"Rabszolgatartó", MAXLVL} //bővíteni ? MAXLVLt írd át a max szintre és mindenképpen legalulra kerüljön! | a szinteket ötösével adjad meg ha lehet! mert ha nem elfog csúszni a rang.
};
new const WeaponM4A1[][DATA] = {
{"M4A1 | Default", "models/v_m4a1.mdl", 0, }
};
new const WeaponAK47[][DATA] = {
{"AK47 | Default", "models/v_ak47.mdl", 0, }
};
new const WeaponAWP[][DATA] = {
{"AWP | Default", "models/v_awp.mdl", 0, },
};
new const WeaponSCOUT[][DATA] = {
{"SCOUT | Default", "models/v_scout.mdl", 0, }
};
new const WeaponFAMAS[][DATA] = {
{"FAMAS | Default", "models/v_famas.mdl", 0, }
};
new const WeaponGALIL[][DATA] = {
{"GALIL | Default", "models/v_galil.mdl", 0, }
};
new const WeaponAUG[][DATA] = {
{"AUG | Default", "models/v_aug.mdl", 0, }
};
new const WeaponM3[][DATA] = {
{"M3 | Default", "models/v_m3.mdl", 0, }
};
new const WeaponXM1014[][DATA] = {
{"XM1014 | Default", "models/v_xm1014.mdl", 0, }
};
new const WeaponKNIFE[][DATA] = {
{"KNIFE | Default", "models/v_knife.mdl", 0, }
};
new const WeaponDEAGLE[][DATA] = {
{"DEAGLE | Default", "models/v_deagle.mdl", 0, }
};
new const WeaponUSP[][DATA] = {
{"USP | Default", "models/v_usp.mdl", 0, }
};
new const WeaponGLOCK[][DATA] = {
{"GLOCK18 | Default", "models/v_glock18.mdl", 0, }
};
new const MainStrings[][] = {
"M4A1 Skinek",
"AK47 Skinek",
"AWP Skinek",
"SCOUT Skinek",
"FAMAS Skinek",
"GALIL Skinek",
"AUG Skinek",
"M3 Skinek",
"XM1014 Skinek",
"KNIFE Skinek",
"DEAGLE Skinek",
"USP Skinek",
"GLOCK18 Skinek"
};
public plugin_init() {
register_plugin("Hlmodra", "valamiverziosiskell?", "szeretjükatejetazbiztos!");
register_clcmd("say /menu", "openMainMenu");
register_clcmd("say /add", "Addolas");
register_impulse(201, "openMainMenu");
register_event("DeathMsg","Halal","a");
register_event("CurWeapon", "evChangeWeapon", "be", "1=1");
register_clcmd("say /info", "info_p");
//register_clcmd("say /rs", "statreset_p");
register_event("DeathMsg", "ev_deathmsg", "a");
cvarPrefix = register_cvar("Prefix", "^4[..::DarK*_*Knight::..]^3 »");
////////////////////////////////////////
register_clcmd("say", "sayhook"); //Maradjon alul!
////////////////////////////////////////
gSyncHud = CreateHudSyncObj();
}
public info_p(id)
{
new Xp, Xp2;
Xp = 15+g_ePlayer[eLvl][id];
Xp2 = 15*30+g_ePlayer[eLvl][id]*Xp;
client_print_color(id, ChatColor, "%s^1 Rangod: %s | Szinted/Xpd: %d/%d | Következő rang: %s", gChatPrefix, cRanks[g_ePlayer[eRank][id]][eRankName],
g_ePlayer[eXp][id], Xp2, cRanks[g_ePlayer[eRank][id]+1][eRankName]);
}
public client_PreThink(id)
LvlCheck(id);
public LvlCheck(id)
{
if(g_ePlayer[eLvl][id] == MAXLVL || g_ePlayer[eRank][id] == MAXRANK)
return PLUGIN_HANDLED;
new Xp, Xp2, sName[64];
Xp = 15+g_ePlayer[eLvl][id];
Xp2 = 15*30+g_ePlayer[eLvl][id]*Xp;
if(g_ePlayer[eXp][id] >= Xp2)
{
g_ePlayer[eLvl][id]++;
g_ePlayer[eXp][id] = 0;
g_ePlayer[eRankCounter][id]++;
if(g_ePlayer[eRankCounter][id] == 5)
{
g_ePlayer[eRank][id]++;
g_ePlayer[eRankCounter][id] = 0;
}
get_user_name(id, sName, charsmax(sName));
client_print_color(0, ChatColor, "^4%s^3 %s^1 szintet lépett, szintje: ^4%d.", gChatPrefix, sName, g_ePlayer[eLvl][id]);
}
return PLUGIN_HANDLED;
}
public ev_deathmsg()
{
new iKiller = read_data(1);
new iVictim = read_data(2);
new iHs = read_data(3);
new iRnd, sName[64];
if(!iKiller || !iVictim || iVictim == iKiller)
return PLUGIN_HANDLED;
get_user_name(iVictim, sName, charsmax(sName));
if(iHs)
{
iRnd = random_num(5, 10);
g_ePlayer[eXp][iKiller] += iRnd;
client_print_color(iKiller, ChatColor, "%s^1 Kaptál^3 %d^1 Xp-t^3 %s^1 fejbelövéséért!", gChatPrefix, iRnd, sName);
}
else
{
iRnd = random_num(1, 5);
g_ePlayer[eXp][iKiller] += iRnd;
client_print_color(iKiller, ChatColor, "%s^1 Kaptál^3 %d^1 Xp-t^3 %s^1 megöléséért!", gChatPrefix, iRnd, sName);
}
return PLUGIN_HANDLED_MAIN;
}
public hudshow_p(id)
{
if(!is_user_connected(id))
return PLUGIN_HANDLED_MAIN;
new sText[256], iLen, idT;
new Target = pev(id, pev_iuser1) == 4 ? pev(id, pev_iuser2) : id;
idT = is_user_alive(id) ? id:Target;
new Xp, Xp2;
Xp = 15+g_ePlayer[eLvl][idT];
Xp2 = 15*30+g_ePlayer[eLvl][idT]*Xp;
iLen += formatex(sText[iLen], charsmax(sText)-iLen, "Szint: [ %d --> %d ]^n", g_ePlayer[eLvl][idT], MAXLVL);
iLen += formatex(sText[iLen], charsmax(sText)-iLen, "Rang: -- %s --^n", cRanks[g_ePlayer[eRank][idT]][eRankName]);
iLen += formatex(sText[iLen], charsmax(sText)-iLen, "XP: [ %d --> %d ]", g_ePlayer[eXp][idT], Xp2);
set_hudmessage(0, 255, 0, -1.0, 0.85, 0, 6.0, 1.0, 0.1, 0.2, -1);
ShowSyncHudMsg(id, gSyncHud, "%s", sText);
set_task(1.0, "hudshow_p", id);
return PLUGIN_HANDLED;
}
public Addolas(id)
{
g_uPoints[id][M4A1] += 50;
g_uPoints[id][AK47] += 50;
g_uPoints[id][AWP] += 50;
g_uPoints[id][SCOUT] += 50;
g_uPoints[id][FAMAS] += 50;
g_uPoints[id][GALIL] += 50;
g_uPoints[id][AUG] += 50;
g_uPoints[id][M3] += 50;
g_uPoints[id][XM1014] += 50;
g_uPoints[id][KNIFE] += 50;
g_uPoints[id][DEAGLE] += 50;
g_uPoints[id][USP] += 50;
g_uPoints[id][GLOCK] += 50;
}
public plugin_precache() {
for(new i;i < sizeof(WeaponM4A1); i++) precache_model(WeaponM4A1[i][ModelName]);
for(new i;i < sizeof(WeaponAK47); i++) precache_model(WeaponAK47[i][ModelName]);
for(new i;i < sizeof(WeaponAWP); i++) precache_model(WeaponAWP[i][ModelName]);
for(new i;i < sizeof(WeaponSCOUT); i++) precache_model(WeaponSCOUT[i][ModelName]);
for(new i;i < sizeof(WeaponFAMAS); i++) precache_model(WeaponFAMAS[i][ModelName]);
for(new i;i < sizeof(WeaponGALIL); i++) precache_model(WeaponGALIL[i][ModelName]);
for(new i;i < sizeof(WeaponAUG); i++) precache_model(WeaponAUG[i][ModelName]);
for(new i;i < sizeof(WeaponM3); i++) precache_model(WeaponM3[i][ModelName]);
for(new i;i < sizeof(WeaponXM1014); i++) precache_model(WeaponXM1014[i][ModelName]);
for(new i;i < sizeof(WeaponKNIFE); i++) precache_model(WeaponKNIFE[i][ModelName]);
for(new i;i < sizeof(WeaponDEAGLE); i++) precache_model(WeaponDEAGLE[i][ModelName]);
for(new i;i < sizeof(WeaponUSP); i++) precache_model(WeaponUSP[i][ModelName]);
for(new i;i < sizeof(WeaponGLOCK); i++) precache_model(WeaponGLOCK[i][ModelName]);
}
public evChangeWeapon(id) {
switch(get_user_weapon(id)) {
case CSW_M4A1: entity_set_string(id, EV_SZ_viewmodel, WeaponM4A1[g_SelectedGun[id][M4A1]][ModelName]);
case CSW_AK47: entity_set_string(id, EV_SZ_viewmodel, WeaponAK47[g_SelectedGun[id][AK47]][ModelName]);
case CSW_AWP: entity_set_string(id, EV_SZ_viewmodel, WeaponAWP[g_SelectedGun[id][AWP]][ModelName]);
case CSW_SCOUT: entity_set_string(id, EV_SZ_viewmodel, WeaponSCOUT[g_SelectedGun[id][SCOUT]][ModelName]);
case CSW_FAMAS: entity_set_string(id, EV_SZ_viewmodel, WeaponFAMAS[g_SelectedGun[id][FAMAS]][ModelName]);
case CSW_GALIL: entity_set_string(id, EV_SZ_viewmodel, WeaponGALIL[g_SelectedGun[id][GALIL]][ModelName]);
case CSW_AUG: entity_set_string(id, EV_SZ_viewmodel, WeaponAUG[g_SelectedGun[id][AUG]][ModelName]);
case CSW_M3: entity_set_string(id, EV_SZ_viewmodel, WeaponM3[g_SelectedGun[id][M3]][ModelName]);
case CSW_XM1014: entity_set_string(id, EV_SZ_viewmodel, WeaponXM1014[g_SelectedGun[id][XM1014]][ModelName]);
case CSW_KNIFE: entity_set_string(id, EV_SZ_viewmodel, WeaponKNIFE[g_SelectedGun[id][KNIFE]][ModelName]);
case CSW_DEAGLE: entity_set_string(id, EV_SZ_viewmodel, WeaponDEAGLE[g_SelectedGun[id][DEAGLE]][ModelName]);
case CSW_USP: entity_set_string(id, EV_SZ_viewmodel, WeaponUSP[g_SelectedGun[id][USP]][ModelName]);
case CSW_GLOCK18: entity_set_string(id, EV_SZ_viewmodel, WeaponGLOCK[g_SelectedGun[id][GLOCK]][ModelName]);
}
return PLUGIN_CONTINUE;
}
public Halal() {
new iAttacker = read_data(1);
new iVictim = read_data(2);
new iHs = read_data(3);
if(iAttacker == iVictim || iAttacker == 0) return PLUGIN_HANDLED;
new iPoints = iHs ? HEADSHOT_POINT : KILL_POINT;
switch(get_user_weapon(iAttacker)) {
case CSW_M4A1: g_uPoints[iAttacker][M4A1] += iPoints;
case CSW_AK47: g_uPoints[iAttacker][AK47] += iPoints;
case CSW_AWP: g_uPoints[iAttacker][AWP] += iPoints;
case CSW_SCOUT: g_uPoints[iAttacker][SCOUT] += iPoints;
case CSW_FAMAS: g_uPoints[iAttacker][FAMAS] += iPoints;
case CSW_GALIL: g_uPoints[iAttacker][GALIL] += iPoints;
case CSW_AUG: g_uPoints[iAttacker][AUG] += iPoints;
case CSW_M3: g_uPoints[iAttacker][M3] += iPoints;
case CSW_XM1014: g_uPoints[iAttacker][XM1014] += iPoints;
case CSW_KNIFE: g_uPoints[iAttacker][KNIFE] += iPoints;
case CSW_DEAGLE: g_uPoints[iAttacker][DEAGLE] += iPoints;
case CSW_USP: g_uPoints[iAttacker][USP] += iPoints;
case CSW_GLOCK18: g_uPoints[iAttacker][GLOCK] += iPoints;
}
set_hudmessage(random(256), random(256), random(256), -1.0, 0.20, 0, 6.0, 3.0);
show_hudmessage(iAttacker, "+%i Pont", iPoints);
return PLUGIN_CONTINUE;
}
public openMainMenu(id) {
new szMenu[121], String[6];
formatex(szMenu, charsmax(szMenu), "%s \wFőMenü", gChatPrefix);
new menu = menu_create(szMenu, "hMainMenu");
for(new i ;i < sizeof(MainStrings); i++) {
num_to_str(i, String, 5);
formatex(szMenu, charsmax(szMenu), MainStrings[i]);
menu_additem(menu, szMenu, String);
}
menu_display(id, menu, 0);
return PLUGIN_HANDLED;
}
public hMainMenu(id, menu, item) {
if(item == MENU_EXIT) {
menu_destroy(menu);
return PLUGIN_HANDLED;
}
g_Wpn[id] = item+1;
openSkinMenu(id);
menu_destroy(menu);
return PLUGIN_HANDLED;
}
public openSkinMenu(id) {
new szMenu[121], szMenu2[64], String[6];
if(g_Wpn[id] == 1) formatex(szMenu, charsmax(szMenu), "%s \w%s^n\r[\dPontjaid: \y%i\r]", gChatPrefix, MainStrings[g_Wpn[id]-1], g_uPoints[id][M4A1]);
else if(g_Wpn[id] == 2) formatex(szMenu, charsmax(szMenu), "%s \w%s^n\r[\dPontjaid: \y%i\r]", gChatPrefix, MainStrings[g_Wpn[id]-1], g_uPoints[id][AK47]);
else if(g_Wpn[id] == 3) formatex(szMenu, charsmax(szMenu), "%s \w%s^n\r[\dPontjaid: \y%i\r]", gChatPrefix, MainStrings[g_Wpn[id]-1], g_uPoints[id][AWP]);
else if(g_Wpn[id] == 4) formatex(szMenu, charsmax(szMenu), "%s \w%s^n\r[\dPontjaid: \y%i\r]", gChatPrefix, MainStrings[g_Wpn[id]-1], g_uPoints[id][SCOUT]);
else if(g_Wpn[id] == 5) formatex(szMenu, charsmax(szMenu), "%s \w%s^n\r[\dPontjaid: \y%i\r]", gChatPrefix, MainStrings[g_Wpn[id]-1], g_uPoints[id][FAMAS]);
else if(g_Wpn[id] == 6) formatex(szMenu, charsmax(szMenu), "%s \w%s^n\r[\dPontjaid: \y%i\r]", gChatPrefix, MainStrings[g_Wpn[id]-1], g_uPoints[id][GALIL]);
else if(g_Wpn[id] == 7) formatex(szMenu, charsmax(szMenu), "%s \w%s^n\r[\dPontjaid: \y%i\r]", gChatPrefix, MainStrings[g_Wpn[id]-1], g_uPoints[id][AUG]);
else if(g_Wpn[id] == 8) formatex(szMenu, charsmax(szMenu), "%s \w%s^n\r[\dPontjaid: \y%i\r]", gChatPrefix, MainStrings[g_Wpn[id]-1], g_uPoints[id][M3]);
else if(g_Wpn[id] == 9) formatex(szMenu, charsmax(szMenu), "%s \w%s^n\r[\dPontjaid: \y%i\r]", gChatPrefix, MainStrings[g_Wpn[id]-1], g_uPoints[id][XM1014]);
else if(g_Wpn[id] == 10) formatex(szMenu, charsmax(szMenu), "%s \w%s^n\r[\dPontjaid: \y%i\r]", gChatPrefix, MainStrings[g_Wpn[id]-1], g_uPoints[id][KNIFE]);
else if(g_Wpn[id] == 11) formatex(szMenu, charsmax(szMenu), "%s \w%s^n\r[\dPontjaid: \y%i\r]", gChatPrefix, MainStrings[g_Wpn[id]-1], g_uPoints[id][DEAGLE]);
else if(g_Wpn[id] == 12) formatex(szMenu, charsmax(szMenu), "%s \w%s^n\r[\dPontjaid: \y%i\r]", gChatPrefix, MainStrings[g_Wpn[id]-1], g_uPoints[id][USP]);
else if(g_Wpn[id] == 13) formatex(szMenu, charsmax(szMenu), "%s \w%s^n\r[\dPontjaid: \y%i\r]", gChatPrefix, MainStrings[g_Wpn[id]-1], g_uPoints[id][GLOCK]);
new menu = menu_create(szMenu, "hSkinChooser");
if(g_Wpn[id] == 1) {
for(new i; i < sizeof(WeaponM4A1); i++) {
num_to_str(i, String, 5);
formatex(szMenu2, charsmax(szMenu2), "\r{%i} Pont", WeaponM4A1[i][Points]);
formatex(szMenu, charsmax(szMenu), "%s %s", WeaponM4A1[i][GunName], g_SelectedGun[id][M4A1] == i ? "\y{Kiválasztva}": szMenu2);
menu_additem(menu, szMenu, String);
}
}
else if(g_Wpn[id] == 2) {
for(new i; i < sizeof(WeaponAK47); i++) {
num_to_str(i, String, 5);
formatex(szMenu2, charsmax(szMenu2), "\r{%i} Pont", WeaponAK47[i][Points]);
formatex(szMenu, charsmax(szMenu), "%s %s", WeaponAK47[i][GunName], g_SelectedGun[id][AK47] == i ? "\y{Kiválasztva}": szMenu2);
menu_additem(menu, szMenu, String);
}
}
else if(g_Wpn[id] == 3) {
for(new i; i < sizeof(WeaponAWP); i++) {
num_to_str(i, String, 5);
formatex(szMenu2, charsmax(szMenu2), "\r{%i} Pont", WeaponAWP[i][Points]);
formatex(szMenu, charsmax(szMenu), "%s %s", WeaponAWP[i][GunName], g_SelectedGun[id][AWP] == i ? "\y{Kiválasztva}": szMenu2);
menu_additem(menu, szMenu, String);
}
}
else if(g_Wpn[id] == 4) {
for(new i; i < sizeof(WeaponSCOUT); i++) {
num_to_str(i, String, 5);
formatex(szMenu2, charsmax(szMenu2), "\r{%i} Pont", WeaponSCOUT[i][Points]);
formatex(szMenu, charsmax(szMenu), "%s %s", WeaponSCOUT[i][GunName], g_SelectedGun[id][SCOUT] == i ? "\y{Kiválasztva}": szMenu2);
menu_additem(menu, szMenu, String);
}
}
else if(g_Wpn[id] == 5) {
for(new i; i < sizeof(WeaponFAMAS); i++) {
num_to_str(i, String, 5);
formatex(szMenu2, charsmax(szMenu2), "\r{%i} Pont", WeaponFAMAS[i][Points]);
formatex(szMenu, charsmax(szMenu), "%s %s", WeaponFAMAS[i][GunName], g_SelectedGun[id][FAMAS] == i ? "\y{Kiválasztva}": szMenu2);
menu_additem(menu, szMenu, String);
}
}
else if(g_Wpn[id] == 6) {
for(new i; i < sizeof(WeaponGALIL); i++) {
num_to_str(i, String, 5);
formatex(szMenu2, charsmax(szMenu2), "\r{%i} Pont", WeaponGALIL[i][Points]);
formatex(szMenu, charsmax(szMenu), "%s %s", WeaponGALIL[i][GunName], g_SelectedGun[id][GALIL] == i ? "\y{Kiválasztva}": szMenu2);
menu_additem(menu, szMenu, String);
}
}
else if(g_Wpn[id] == 7) {
for(new i; i < sizeof(WeaponAUG); i++) {
num_to_str(i, String, 5);
formatex(szMenu2, charsmax(szMenu2), "\r{%i} Pont", WeaponAUG[i][Points]);
formatex(szMenu, charsmax(szMenu), "%s %s", WeaponAUG[i][GunName], g_SelectedGun[id][AUG] == i ? "\y{Kiválasztva}": szMenu2);
menu_additem(menu, szMenu, String);
}
}
else if(g_Wpn[id] == 8) {
for(new i; i < sizeof(WeaponM3); i++) {
num_to_str(i, String, 5);
formatex(szMenu2, charsmax(szMenu2), "\r{%i} Pont", WeaponM3[i][Points]);
formatex(szMenu, charsmax(szMenu), "%s %s", WeaponM3[i][GunName], g_SelectedGun[id][M3] == i ? "\y{Kiválasztva}": szMenu2);
menu_additem(menu, szMenu, String);
}
}
else if(g_Wpn[id] == 9) {
for(new i; i < sizeof(WeaponXM1014); i++) {
num_to_str(i, String, 5);
formatex(szMenu2, charsmax(szMenu2), "\r{%i} Pont", WeaponXM1014[i][Points]);
formatex(szMenu, charsmax(szMenu), "%s %s", WeaponXM1014[i][GunName], g_SelectedGun[id][XM1014] == i ? "\y{Kiválasztva}": szMenu2);
menu_additem(menu, szMenu, String);
}
}
else if(g_Wpn[id] == 10) {
for(new i; i < sizeof(WeaponKNIFE); i++) {
num_to_str(i, String, 5);
formatex(szMenu2, charsmax(szMenu2), "\r{%i} Pont", WeaponKNIFE[i][Points]);
formatex(szMenu, charsmax(szMenu), "%s %s", WeaponKNIFE[i][GunName], g_SelectedGun[id][KNIFE] == i ? "\y{Kiválasztva}": szMenu2);
menu_additem(menu, szMenu, String);
}
}
else if(g_Wpn[id] == 11) {
for(new i; i < sizeof(WeaponDEAGLE); i++) {
num_to_str(i, String, 5);
formatex(szMenu2, charsmax(szMenu2), "\r{%i} Pont", WeaponDEAGLE[i][Points]);
formatex(szMenu, charsmax(szMenu), "%s %s", WeaponDEAGLE[i][GunName], g_SelectedGun[id][DEAGLE] == i ? "\y{Kiválasztva}": szMenu2);
menu_additem(menu, szMenu, String);
}
}
else if(g_Wpn[id] == 12) {
for(new i; i < sizeof(WeaponUSP); i++) {
num_to_str(i, String, 5);
formatex(szMenu2, charsmax(szMenu2), "\r{%i} Pont", WeaponUSP[i][Points]);
formatex(szMenu, charsmax(szMenu), "%s %s", WeaponUSP[i][GunName], g_SelectedGun[id][USP] == i ? "\y{Kiválasztva}": szMenu2);
menu_additem(menu, szMenu, String);
}
}
else if(g_Wpn[id] == 13) {
for(new i; i < sizeof(WeaponGLOCK); i++) {
num_to_str(i, String, 5);
formatex(szMenu2, charsmax(szMenu2), "\r{%i} Pont", WeaponGLOCK[i][Points]);
formatex(szMenu, charsmax(szMenu), "%s %s", WeaponGLOCK[i][GunName], g_SelectedGun[id][GLOCK] == i ? "\y{Kiválasztva}": szMenu2);
menu_additem(menu, szMenu, String);
}
}
menu_display(id, menu, 0);
return PLUGIN_HANDLED;
}
public hSkinChooser(id, menu, item) {
if(item == MENU_EXIT)
{
menu_destroy(menu);
return PLUGIN_CONTINUE;
}
switch(g_Wpn[id]) {
case 1: {
if(g_uPoints[id][M4A1] >= WeaponM4A1[item][Points]) {
g_SelectedGun[id][M4A1] = item;
client_print_color(id, print_team_default, "^4%s ^1Sikeresen aktiváltad a skint!", gChatPrefix);
}
else client_print_color(id, print_team_default, "^4%s ^1Sajnálom, nincs elegendő ^3pontod^3!", gChatPrefix);
}
case 2: {
if(g_uPoints[id][AK47] >= WeaponAK47[item][Points]) {
g_SelectedGun[id][AK47] = item;
client_print_color(id, print_team_default, "^4%s ^1Sikeresen aktiváltad a skint!", gChatPrefix);
}
else client_print_color(id, print_team_default, "^4%s ^1Sajnálom, nincs elegendő ^3pontod^3!", gChatPrefix);
}
case 3: {
if(g_uPoints[id][AWP] >= WeaponAWP[item][Points]) {
g_SelectedGun[id][AWP] = item;
client_print_color(id, print_team_default, "^4%s ^1Sikeresen aktiváltad a skint!", gChatPrefix);
}
else client_print_color(id, print_team_default, "^4%s ^1Sajnálom, nincs elegendő ^3pontod^3!", gChatPrefix);
}
case 4: {
if(g_uPoints[id][SCOUT] >= WeaponSCOUT[item][Points]) {
g_SelectedGun[id][SCOUT] = item;
client_print_color(id, print_team_default, "^4%s ^1Sikeresen aktiváltad a skint!", gChatPrefix);
}
else client_print_color(id, print_team_default, "^4%s ^1Sajnálom, nincs elegendő ^3pontod^3!", gChatPrefix);
}
case 5: {
if(g_uPoints[id][FAMAS] >= WeaponFAMAS[item][Points]) {
g_SelectedGun[id][FAMAS] = item;
client_print_color(id, print_team_default, "^4%s ^1Sikeresen aktiváltad a skint!", gChatPrefix);
}
else client_print_color(id, print_team_default, "^4%s ^1Sajnálom, nincs elegendő ^3pontod^3!", gChatPrefix);
}
case 6: {
if(g_uPoints[id][GALIL] >= WeaponGALIL[item][Points]) {
g_SelectedGun[id][GALIL] = item;
client_print_color(id, print_team_default, "^4%s ^1Sikeresen aktiváltad a skint!", gChatPrefix);
}
else client_print_color(id, print_team_default, "^4%s ^1Sajnálom, nincs elegendő ^3pontod^3!", gChatPrefix);
}
case 7: {
if(g_uPoints[id][AUG] >= WeaponAUG[item][Points]) {
g_SelectedGun[id][AUG] = item;
client_print_color(id, print_team_default, "^4%s ^1Sikeresen aktiváltad a skint!", gChatPrefix);
}
else client_print_color(id, print_team_default, "^4%s ^1Sajnálom, nincs elegendő ^3pontod^3!", gChatPrefix);
}
case 8: {
if(g_uPoints[id][M3] >= WeaponM3[item][Points]) {
g_SelectedGun[id][M3] = item;
client_print_color(id, print_team_default, "^4%s ^1Sikeresen aktiváltad a skint!", gChatPrefix);
}
else client_print_color(id, print_team_default, "^4%s ^1Sajnálom, nincs elegendő ^3pontod^3!", gChatPrefix);
}
case 9: {
if(g_uPoints[id][XM1014] >= WeaponXM1014[item][Points]) {
g_SelectedGun[id][XM1014] = item;
client_print_color(id, print_team_default, "^4%s ^1Sikeresen aktiváltad a skint!", gChatPrefix);
}
else client_print_color(id, print_team_default, "^4%s ^1Sajnálom, nincs elegendő ^3pontod^3!", gChatPrefix);
}
case 10: {
if(g_uPoints[id][KNIFE] >= WeaponKNIFE[item][Points]) {
g_SelectedGun[id][KNIFE] = item;
client_print_color(id, print_team_default, "^4%s ^1Sikeresen aktiváltad a skint!", gChatPrefix);
}
else client_print_color(id, print_team_default, "^4%s ^1Sajnálom, nincs elegendő ^3pontod^3!", gChatPrefix);
}
case 11: {
if(g_uPoints[id][DEAGLE] >= WeaponDEAGLE[item][Points]) {
g_SelectedGun[id][DEAGLE] = item;
client_print_color(id, print_team_default, "^4%s ^1Sikeresen aktiváltad a skint!", gChatPrefix);
}
else client_print_color(id, print_team_default, "^4%s ^1Sajnálom, nincs elegendő ^3pontod^3!", gChatPrefix);
}
case 12: {
if(g_uPoints[id][USP] >= WeaponUSP[item][Points]) {
g_SelectedGun[id][USP] = item;
client_print_color(id, print_team_default, "^4%s ^1Sikeresen aktiváltad a skint!", gChatPrefix);
}
else client_print_color(id, print_team_default, "^4%s ^1Sajnálom, nincs elegendő ^3pontod^3!", gChatPrefix);
}
case 13: {
if(g_uPoints[id][GLOCK] >= WeaponGLOCK[item][Points]) {
g_SelectedGun[id][GLOCK] = item;
client_print_color(id, print_team_default, "^4%s ^1Sikeresen aktiváltad a skint!", gChatPrefix);
}
else client_print_color(id, print_team_default, "^4%s ^1Sajnálom, nincs elegendő ^3pontod^3!", gChatPrefix);
}
}
menu_destroy(menu);
return PLUGIN_HANDLED;
}
public client_putinserver(id)
{
if(is_user_bot(id))
return;
set_task(5.0, "hudshow_p", id);
betoltve[id] = false;
g_ePlayer[id][eLvl] = 0;
g_ePlayer[id][eXp] = 0;
g_ePlayer[id][eRank] = 0;
g_ePlayer[id][eRankCounter] = 0;
g_uPoints[id][M4A1] = 0;
g_uPoints[id][AK47] = 0;
g_uPoints[id][AWP] = 0;
g_uPoints[id][SCOUT] = 0;
g_uPoints[id][FAMAS] = 0;
g_uPoints[id][GALIL] = 0;
g_uPoints[id][AUG] = 0;
g_uPoints[id][M3] = 0;
g_uPoints[id][XM1014] = 0;
g_uPoints[id][KNIFE] = 0;
g_uPoints[id][DEAGLE] = 0;
g_uPoints[id][USP] = 0;
g_uPoints[id][GLOCK] = 0;
g_SelectedGun[id][M4A1] = 0;
g_SelectedGun[id][AK47] = 0;
g_SelectedGun[id][AWP] = 0;
g_SelectedGun[id][SCOUT] = 0;
g_SelectedGun[id][FAMAS] = 0;
g_SelectedGun[id][GALIL] = 0;
g_SelectedGun[id][AUG] = 0;
g_SelectedGun[id][M3] = 0;
g_SelectedGun[id][XM1014] = 0;
g_SelectedGun[id][KNIFE] = 0;
g_SelectedGun[id][DEAGLE] = 0;
g_SelectedGun[id][USP] = 0;
g_SelectedGun[id][GLOCK] = 0;
SelectDataTable(id);
}
public client_disconnected(id)
{
if(is_user_bot(id))
return;
TableUpdate(id);
if(task_exists(id))
remove_task(id);
}
new Handle:g_SqlTuple;
public plugin_cfg()
{
//Kiszolgáló | Felhasználó | Jelszó | Adatbázis
g_SqlTuple = SQL_MakeDbTuple("mysql.srkhost.eu:3306", "u952_mavMGzrSyv", "", "s952_skinmenuranked");
CreateTable();
}
public CreateTable(){
new iLen;
static sQuery[10048];
iLen += formatex(sQuery[iLen], charsmax(sQuery), "CREATE TABLE IF NOT EXISTS `%s` ", Tablename);
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "( ");
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "`Id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,");
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "`SteamId` varchar(64) NOT NULL,");
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "`qSzint` int(11) NOT NULL,");
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "`qXp` int(11) NOT NULL,");
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "`qRank` int(11) NOT NULL,");
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "`qRankCounter` int(11) NOT NULL,");
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "`g_uPointsM4A1` int(11) NOT NULL,");
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "`g_uPointsAK47` int(11) NOT NULL,");
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "`g_uPointsAWP` int(11) NOT NULL,");
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "`g_uPointsSCOUT` int(11) NOT NULL,");
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "`g_uPointsFAMAS` int(11) NOT NULL,");
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "`g_uPointsGALIL` int(11) NOT NULL,");
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "`g_uPointsAUG` int(11) NOT NULL,");
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "`g_uPointsM3` int(11) NOT NULL,");
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "`g_uPointsXM1014` int(11) NOT NULL,");
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "`g_uPointsKNIFE` int(11) NOT NULL,");
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "`g_uPointsDEAGLE` int(11) NOT NULL,");
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "`g_uPointsUSP` int(11) NOT NULL,");
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "`g_uPointsGLOCK` int(11) NOT NULL,");
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "`g_SelectedGunM4A1` int(11) NOT NULL,");
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "`g_SelectedGunAK47` int(11) NOT NULL,");
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "`g_SelectedGunAWP` int(11) NOT NULL,");
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "`g_SelectedGunSCOUT` int(11) NOT NULL,");
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "`g_SelectedGunFAMAS` int(11) NOT NULL,");
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "`g_SelectedGunGALIL` int(11) NOT NULL,");
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "`g_SelectedGunAUG` int(11) NOT NULL,");
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "`g_SelectedGunM3` int(11) NOT NULL,");
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "`g_SelectedGunXM1014` int(11) NOT NULL,");
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "`g_SelectedGunKNIFE` int(11) NOT NULL,");
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "`g_SelectedGunDEAGLE` int(11) NOT NULL,");
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "`g_SelectedGunUSP` int(11) NOT NULL,");
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "`g_SelectedGunGLOCK` int(11) NOT NULL)");
SQL_ThreadQuery(g_SqlTuple, "TableCreateThread", sQuery);
}
public TableUpdate(id)
{
if(betoltve[id]) {
static sQuery[10048];
new iLen, sSteamID[64];
get_user_authid(id, sSteamID, charsmax(sSteamID));
iLen += formatex(sQuery[iLen], charsmax(sQuery), "UPDATE `%s` SET ", Tablename);
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "qSzint = ^"%i^",", g_ePlayer[id][eLvl]);
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "qXp = ^"%i^",", g_ePlayer[id][eXp]);
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "qRank = ^"%i^",", g_ePlayer[id][eRank]);
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "qRankCounter = ^"%i^",", g_ePlayer[id][eRankCounter]);
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "g_uPointsM4A1 = ^"%i^",", g_uPoints[id][M4A1]);
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "g_uPointsAK47 = ^"%i^",", g_uPoints[id][AK47]);
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "g_uPointsAWP = ^"%i^",", g_uPoints[id][AWP]);
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "g_uPointsSCOUT = ^"%i^",", g_uPoints[id][SCOUT]);
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "g_uPointsFAMAS = ^"%i^",", g_uPoints[id][FAMAS]);
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "g_uPointsGALIL = ^"%i^",", g_uPoints[id][GALIL]);
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "g_uPointsAUG = ^"%i^",", g_uPoints[id][AUG]);
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "g_uPointsM3 = ^"%i^",", g_uPoints[id][M3]);
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "g_uPointsXM1014 = ^"%i^",", g_uPoints[id][XM1014]);
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "g_uPointsKNIFE = ^"%i^",", g_uPoints[id][KNIFE]);
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "g_uPointsDEAGLE = ^"%i^",", g_uPoints[id][DEAGLE]);
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "g_uPointsUSP = ^"%i^",", g_uPoints[id][USP]);
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "g_uPointsGLOCK = ^"%i^",", g_uPoints[id][GLOCK]);
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "g_SelectedGunAK47 = ^"%i^",", g_SelectedGun[id][AK47]);
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "g_SelectedGunAWP = ^"%i^",", g_SelectedGun[id][AWP]);
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "g_SelectedGunSCOUT = ^"%i^",", g_SelectedGun[id][SCOUT]);
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "g_SelectedGunFAMAS = ^"%i^",", g_SelectedGun[id][FAMAS]);
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "g_SelectedGunGALIL = ^"%i^",", g_SelectedGun[id][GALIL]);
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "g_SelectedGunAUG = ^"%i^",", g_SelectedGun[id][AUG]);
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "g_SelectedGunM3 = ^"%i^",", g_SelectedGun[id][M3]);
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "g_SelectedGunXM1014 = ^"%i^",", g_SelectedGun[id][XM1014]);
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "g_SelectedGunKNIFE = ^"%i^",", g_SelectedGun[id][KNIFE]);
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "g_SelectedGunDEAGLE = ^"%i^",", g_SelectedGun[id][DEAGLE]);
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "g_SelectedGunUSP = ^"%i^",", g_SelectedGun[id][USP]);
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "g_SelectedGunGLOCK = ^"%i^",", g_SelectedGun[id][GLOCK]);
iLen += formatex(sQuery[iLen], charsmax(sQuery)-iLen, "g_SelectedGunM4A1 = ^"%i^" WHERE `SteamId` = ^"%s^";", g_SelectedGun[id][M4A1], sSteamID);
SQL_ThreadQuery(g_SqlTuple, "QuerySetDataTable", sQuery);
}
}
public TableCreateThread(iFailState, Handle:sQuery, sError[], iErrcode, sData[], iDataSize, Float:fQueuetime)
{
if(iFailState == TQUERY_CONNECT_FAILED)
set_fail_state("[Create] Nem lehet csatlakozni az adatbazishoz!");
else if(iFailState == TQUERY_QUERY_FAILED)
set_fail_state("[Create] Lekerdezesi hiba");
if(iErrcode)
log_amx("[Create] Hiba:**!! %s !!**", sError);
}
public TableInsert(id)
{
static sQuery[10048], sSteamID[64];
get_user_authid(id, sSteamID, charsmax(sSteamID));
formatex(sQuery, charsmax(sQuery), "INSERT INTO `%s` (`SteamId`) VALUES (^"%s^");", Tablename, sSteamID);
SQL_ThreadQuery(g_SqlTuple, "QuerySetDataTable", sQuery);
betoltve[id] = true;
}
public SelectDataTable(id)
{
static sQuery[10048];
new sData[1], sSteamID[64];
sData[0] = id;
get_user_authid(id, sSteamID, charsmax(sSteamID));
formatex(sQuery, charsmax(sQuery), "SELECT * FROM `%s` WHERE SteamId = ^"%s^";", Tablename, sSteamID);
SQL_ThreadQuery(g_SqlTuple, "QuerySelectDataTable", sQuery, sData, 1);
}
public QuerySelectDataTable(iFailState, Handle:sQuery, sError[], iErrcode, sData[], iDataSize, Float:fQueuetime)
{
if(iFailState == TQUERY_CONNECT_FAILED || iFailState == TQUERY_QUERY_FAILED)
{
log_amx("[Insert] Hiba:**!! %s !!**", sError);
return;
}
else
{
new id = sData[0];
if(SQL_NumRows(sQuery) > 0)
{
g_ePlayer[id][eLvl] = SQL_ReadResult(sQuery, SQL_FieldNameToNum(sQuery, "qSzint"));
g_ePlayer[id][eXp] = SQL_ReadResult(sQuery, SQL_FieldNameToNum(sQuery, "qXp"));
g_ePlayer[id][eRank] = SQL_ReadResult(sQuery, SQL_FieldNameToNum(sQuery, "qRank"));
g_ePlayer[id][eRankCounter] = SQL_ReadResult(sQuery, SQL_FieldNameToNum(sQuery, "qRankCounter"));
g_uPoints[id][M4A1] = SQL_ReadResult(sQuery, SQL_FieldNameToNum(sQuery, "g_uPointsM4A1"));
g_uPoints[id][AK47] = SQL_ReadResult(sQuery, SQL_FieldNameToNum(sQuery, "g_uPointsAK47"));
g_uPoints[id][AWP] = SQL_ReadResult(sQuery, SQL_FieldNameToNum(sQuery, "g_uPointsAWP"));
g_uPoints[id][SCOUT] = SQL_ReadResult(sQuery, SQL_FieldNameToNum(sQuery, "g_uPointsSCOUT"));
g_uPoints[id][FAMAS] = SQL_ReadResult(sQuery, SQL_FieldNameToNum(sQuery, "g_uPointsFAMAS"));
g_uPoints[id][GALIL] = SQL_ReadResult(sQuery, SQL_FieldNameToNum(sQuery, "g_uPointsGALIL"));
g_uPoints[id][AUG] = SQL_ReadResult(sQuery, SQL_FieldNameToNum(sQuery, "g_uPointsAUG"));
g_uPoints[id][M3] = SQL_ReadResult(sQuery, SQL_FieldNameToNum(sQuery, "g_uPointsM3"));
g_uPoints[id][XM1014] = SQL_ReadResult(sQuery, SQL_FieldNameToNum(sQuery, "g_uPointsXM1014"));
g_uPoints[id][KNIFE] = SQL_ReadResult(sQuery, SQL_FieldNameToNum(sQuery, "g_uPointsKNIFE"));
g_uPoints[id][DEAGLE] = SQL_ReadResult(sQuery, SQL_FieldNameToNum(sQuery, "g_uPointsDEAGLE"));
g_uPoints[id][USP] = SQL_ReadResult(sQuery, SQL_FieldNameToNum(sQuery, "g_uPointsUSP"));
g_uPoints[id][GLOCK] = SQL_ReadResult(sQuery, SQL_FieldNameToNum(sQuery, "g_uPointsGLOCK"));
g_SelectedGun[id][M4A1] = SQL_ReadResult(sQuery, SQL_FieldNameToNum(sQuery, "g_SelectedGunM4A1"));
g_SelectedGun[id][AK47] = SQL_ReadResult(sQuery, SQL_FieldNameToNum(sQuery, "g_SelectedGunAK47"));
g_SelectedGun[id][AWP] = SQL_ReadResult(sQuery, SQL_FieldNameToNum(sQuery, "g_SelectedGunAWP"));
g_SelectedGun[id][SCOUT] = SQL_ReadResult(sQuery, SQL_FieldNameToNum(sQuery, "g_SelectedGunSCOUT"));
g_SelectedGun[id][FAMAS] = SQL_ReadResult(sQuery, SQL_FieldNameToNum(sQuery, "g_SelectedGunFAMAS"));
g_SelectedGun[id][GALIL] = SQL_ReadResult(sQuery, SQL_FieldNameToNum(sQuery, "g_SelectedGunGALIL"));
g_SelectedGun[id][AUG] = SQL_ReadResult(sQuery, SQL_FieldNameToNum(sQuery, "g_SelectedGunAUG"));
g_SelectedGun[id][M3] = SQL_ReadResult(sQuery, SQL_FieldNameToNum(sQuery, "g_SelectedGunM3"));
g_SelectedGun[id][XM1014] = SQL_ReadResult(sQuery, SQL_FieldNameToNum(sQuery, "g_SelectedGunXM1014"));
g_SelectedGun[id][KNIFE] = SQL_ReadResult(sQuery, SQL_FieldNameToNum(sQuery, "g_SelectedGunKNIFE"));
g_SelectedGun[id][DEAGLE] = SQL_ReadResult(sQuery, SQL_FieldNameToNum(sQuery, "g_SelectedGunDEAGLE"));
g_SelectedGun[id][USP] = SQL_ReadResult(sQuery, SQL_FieldNameToNum(sQuery, "g_SelectedGunUSP"));
g_SelectedGun[id][GLOCK] = SQL_ReadResult(sQuery, SQL_FieldNameToNum(sQuery, "g_SelectedGunGLOCK"));
betoltve[id] = true;
}
else
TableInsert(id);
}
}
public QuerySetDataTable(iFailState, Handle:sQuery, sError[], iErrcode, sData[], iDataSize, Float:fQueuetime)
{
if(iFailState == TQUERY_CONNECT_FAILED || iFailState == TQUERY_QUERY_FAILED)
{
log_amx("[SetData] Hiba:**!! %s !!**", sError);
return;
}
}
public sayhook(id)
{
new sMessage[512], sText[128], sDeath[16], iLen, sName[64];
read_args(sMessage, charsmax(sMessage));
remove_quotes(sMessage);
if(strlen(sMessage) == 0 || sMessage[0] == '/' || sMessage[0] == '@')
return PLUGIN_HANDLED_MAIN;
new iTeam, iColor;
iTeam = get_user_team(id);
switch(iTeam) //itt lehet elvalasztani hogy ha ctk irnak a tk kéken lássák, és fordítva, ha specek akkor szürkén látják.
{
case CS_TEAM_CT: iColor = -3; //kék
case CS_TEAM_T: iColor = -2;//piros
case CS_TEAM_SPECTATOR: iColor = -1;//szürke
}
format(sDeath, charsmax(sDeath), is_user_alive(id) ? "":"*Halott*");
iLen += formatex(sText[iLen], charsmax(sText)-iLen, "^1%s", sDeath);
#if defined RANK_ON
if(get_user_flags(id) & OWNER)
iLen += formatex(sText[iLen], charsmax(sText)-iLen, "^3[^4Tulajdonos^3]^1");
else if(get_user_flags(id) & ADMIN)
iLen += formatex(sText[iLen], charsmax(sText)-iLen, "^3[^4FőAdmin^3]^1");
else if(get_user_flags(id) & FOADMIN)
iLen += formatex(sText[iLen], charsmax(sText)-iLen, "^3[^4Admin^3]^1");
else if(get_user_flags(id) & VIP)
iLen += formatex(sText[iLen], charsmax(sText)-iLen, "^3[^4VIP^3]^1");
else
iLen += formatex(sText[iLen], charsmax(sText)-iLen, "^3[^4Játékos^3]^1");
iLen += formatex(sText[iLen], charsmax(sText)-iLen, "^3[^4Szint: %d^3]", g_ePlayer[eLvl][id]);
#endif
#if defined RANK_OFF
iLen += formatex(sText[iLen], charsmax(sText)-iLen, "^3[^4Szint: %d^3]", g_ePlayer[eLvl][id]);
#endif
get_user_name(id, sName, charsmax(sName));
format(sMessage, charsmax(sMessage), "^1%s ^4%s ^3%s ^1%s", sText, sName, (get_user_flags(id) & ADMIN_KICK) ? "^4" : "^3", sMessage);
for(new i; i < get_maxplayers(); i++)
{
if(!is_user_connected(i))
continue;
client_print_color(i, iColor, sMessage);
}
return PLUGIN_HANDLED_MAIN;
}