#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <cstrike>
#include <sqlx>
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"
#define KILL_POINT 1
#define HEADSHOT_POINT 5
#define Tablename "Hlmodra_tabla_1" //SQL Tábla neve!//
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 FunMentes[33];
new const gMenuPrefix[] = "\w[<<< Night~Warrior >>>]~\y»\yFun";
new const gChatPrefix[] = "[<<< Night~Warrior >>>]"
enum _:DATA {
GunName[64],
ModelName[64],
Points[8]
}
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(PLUGIN, VERSION, AUTHOR)
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")
}
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\wPontjaid: \y%i\d", gChatPrefix, MainStrings[g_Wpn[id]-1], g_uPoints[id][M4A1])
else if(g_Wpn[id] == 2) formatex(szMenu, charsmax(szMenu), "%s \w%s^n\wPontjaid: \y%i\d", gChatPrefix, MainStrings[g_Wpn[id]-1], g_uPoints[id][AK47])
else if(g_Wpn[id] == 3) formatex(szMenu, charsmax(szMenu), "%s \w%s^n\wPontjaid: \y%i\d", gChatPrefix, MainStrings[g_Wpn[id]-1], g_uPoints[id][AWP])
else if(g_Wpn[id] == 4) formatex(szMenu, charsmax(szMenu), "%s \w%s^n\wPontjaid: \y%i\d", gChatPrefix, MainStrings[g_Wpn[id]-1], g_uPoints[id][SCOUT])
else if(g_Wpn[id] == 5) formatex(szMenu, charsmax(szMenu), "%s \w%s^n\wPontjaid: \y%i\d", gChatPrefix, MainStrings[g_Wpn[id]-1], g_uPoints[id][FAMAS])
else if(g_Wpn[id] == 6) formatex(szMenu, charsmax(szMenu), "%s \w%s^n\wPontjaid: \y%i\d", gChatPrefix, MainStrings[g_Wpn[id]-1], g_uPoints[id][GALIL])
else if(g_Wpn[id] == 7) formatex(szMenu, charsmax(szMenu), "%s \w%s^n\wPontjaid: \y%i\d", gChatPrefix, MainStrings[g_Wpn[id]-1], g_uPoints[id][AUG])
else if(g_Wpn[id] == 8) formatex(szMenu, charsmax(szMenu), "%s \w%s^n\wPontjaid: \y%i\d", gChatPrefix, MainStrings[g_Wpn[id]-1], g_uPoints[id][M3])
else if(g_Wpn[id] == 9) formatex(szMenu, charsmax(szMenu), "%s \w%s^n\wPontjaid: \y%i\d", gChatPrefix, MainStrings[g_Wpn[id]-1], g_uPoints[id][XM1014])
else if(g_Wpn[id] == 10) formatex(szMenu, charsmax(szMenu), "%s \w%s^n\wPontjaid: \y%i\d", gChatPrefix, MainStrings[g_Wpn[id]-1], g_uPoints[id][KNIFE])
else if(g_Wpn[id] == 11) formatex(szMenu, charsmax(szMenu), "%s \w%s^n\wPontjaid: \y%i\d", gChatPrefix, MainStrings[g_Wpn[id]-1], g_uPoints[id][DEAGLE])
else if(g_Wpn[id] == 12) formatex(szMenu, charsmax(szMenu), "%s \w%s^n\wPontjaid: \y%i\d", gChatPrefix, MainStrings[g_Wpn[id]-1], g_uPoints[id][USP])
else if(g_Wpn[id] == 13) formatex(szMenu, charsmax(szMenu), "%s \w%s^n\wPontjaid: \y%i\d", gChatPrefix, MainStrings[g_Wpn[id]-1], g_uPoints[id][GLOCK])
new menu = menu_create(szMenu, "hSkinChooser");
if(g_Wpn[id] == 1) formatex(szMenu, charsmax(szMenu), "%s \w%s^n\wPontjaid: \y%i\d", gChatPrefix,
MainStrings[g_Wpn[id]-1], g_uPoints[id][M4A1])
if(g_Wpn[id] == 2) formatex(szMenu, charsmax(szMenu), "%s \w%s^n\wPontjaid: \y%i\d", gChatPrefix,
MainStrings[g_Wpn[id]-1], g_uPoints[id][AK47])
if(g_Wpn[id] == 3) formatex(szMenu, charsmax(szMenu), "%s \w%s^n\wPontjaid: \y%i\d", gChatPrefix,
MainStrings[g_Wpn[id]-1], g_uPoints[id][AWP])
if(g_Wpn[id] == 4) formatex(szMenu, charsmax(szMenu), "%s \w%s^n\wPontjaid: \y%i\d", gChatPrefix,
MainStrings[g_Wpn[id]-1], g_uPoints[id][SCOUT])
if(g_Wpn[id] == 5) formatex(szMenu, charsmax(szMenu), "%s \w%s^n\wPontjaid: \y%i\d", gChatPrefix,
MainStrings[g_Wpn[id]-1], g_uPoints[id][FAMAS])
if(g_Wpn[id] == 6) formatex(szMenu, charsmax(szMenu), "%s \w%s^n\wPontjaid: \y%i\d", gChatPrefix,
MainStrings[g_Wpn[id]-1], g_uPoints[id][GALIL])
if(g_Wpn[id] == 7) formatex(szMenu, charsmax(szMenu), "%s \w%s^n\wPontjaid: \y%i\d", gChatPrefix,
MainStrings[g_Wpn[id]-1], g_uPoints[id][AUG])
if(g_Wpn[id] == 8) formatex(szMenu, charsmax(szMenu), "%s \w%s^n\wPontjaid: \y%i\d", gChatPrefix,
MainStrings[g_Wpn[id]-1], g_uPoints[id][M3])
if(g_Wpn[id] == 9) formatex(szMenu, charsmax(szMenu), "%s \w%s^n\wPontjaid: \y%i\d", gChatPrefix,
MainStrings[g_Wpn[id]-1], g_uPoints[id][XM1014])
if(g_Wpn[id] == 10) formatex(szMenu, charsmax(szMenu), "%s \w%s^n\wPontjaid: \y%i\d", gChatPrefix,
MainStrings[g_Wpn[id]-1], g_uPoints[id][KNIFE])
if(g_Wpn[id] == 11) formatex(szMenu, charsmax(szMenu), "%s \w%s^n\wPontjaid: \y%i\d", gChatPrefix,
MainStrings[g_Wpn[id]-1], g_uPoints[id][DEAGLE])
if(g_Wpn[id] == 12) formatex(szMenu, charsmax(szMenu), "%s \w%s^n\wPontjaid: \y%i\d", gChatPrefix,
MainStrings[g_Wpn[id]-1], g_uPoints[id][USP])
if(g_Wpn[id] == 13) formatex(szMenu, charsmax(szMenu), "%s \w%s^n\wPontjaid: \y%i\d", gChatPrefix,
MainStrings[g_Wpn[id]-1], g_uPoints[id][GLOCK])
if(g_Wpn[id] == 1) {
for(new i; i < sizeof(WeaponM4A1); i++) {
num_to_str(i, String, 5)
formatex(szMenu2, charsmax(szMenu2), "\r{%i} Ölés", 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} Ölés", 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} Ölés", 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} Ölés", 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} Ölés", 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} Ölés", 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} Ölés", 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} Ölés", 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} Ölés", 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} Ölés", 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} Ölés", 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} Ölés", 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} Ölés", 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_blue, "^4%s ^1Sikeresen aktiváltad a skint!", gChatPrefix);
}
else client_print_color(id, print_team_blue, "^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_blue, "^4%s ^1Sikeresen aktiváltad a skint!", gChatPrefix);
}
else client_print_color(id, print_team_blue, "^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_blue, "^4%s ^1Sikeresen aktiváltad a skint!", gChatPrefix);
}
else client_print_color(id, print_team_blue, "^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_blue, "^4%s ^1Sikeresen aktiváltad a skint!", gChatPrefix);
}
else client_print_color(id, print_team_blue, "^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_blue, "^4%s ^1Sikeresen aktiváltad a skint!", gChatPrefix);
}
else client_print_color(id, print_team_blue, "^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_blue, "^4%s ^1Sikeresen aktiváltad a skint!", gChatPrefix);
}
else client_print_color(id, print_team_blue, "^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_blue, "^4%s ^1Sikeresen aktiváltad a skint!", gChatPrefix);
}
else client_print_color(id, print_team_blue, "^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_blue, "^4%s ^1Sikeresen aktiváltad a skint!", gChatPrefix);
}
else client_print_color(id, print_team_blue, "^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_blue, "^4%s ^1Sikeresen aktiváltad a skint!", gChatPrefix);
}
else client_print_color(id, print_team_blue, "^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_blue, "^4%s ^1Sikeresen aktiváltad a skint!", gChatPrefix);
}
else client_print_color(id, print_team_blue, "^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_blue, "^4%s ^1Sikeresen aktiváltad a skint!", gChatPrefix);
}
else client_print_color(id, print_team_blue, "^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_blue, "^4%s ^1Sikeresen aktiváltad a skint!", gChatPrefix);
}
else client_print_color(id, print_team_blue, "^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_blue, "^4%s ^1Sikeresen aktiváltad a skint!", gChatPrefix);
}
else client_print_color(id, print_team_blue, "^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;
FunMentes[id] = 1;
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;
FunMentes[id] = 0;
TableUpdate(id);
}
new Handle:g_SqlTuple;
public plugin_cfg()
{
//Kiszolgáló | Felhasználó | Jelszó | Adatbázis
g_SqlTuple = SQL_MakeDbTuple("maria.srkhost.eu", "", "", "s17878_newszerver");
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, "`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)
{
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, "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);
}
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, 2);
}
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_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"));
}
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;
}
}