Skocz do zawartości

Witamy w Nieoficjalnym polskim support'cie AMX Mod X

Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.
  • Rozpoczynaj nowe tematy i odpowiedaj na inne
  • Zapisz się do tematów i for, aby otrzymywać automatyczne uaktualnienia
  • Dodawaj wydarzenia do kalendarza społecznościowego
  • Stwórz swój własny profil i zdobywaj nowych znajomych
  • Zdobywaj nowe doświadczenia

Dołączona grafika Dołączona grafika

Guest Message by DevFuse
 

Zdjęcie

[KOSZ] Problemmam problem to skomplikować czy ktoś pomoze

pomoc

  • Zamknięty Temat jest zamknięty
1 odpowiedź w tym temacie

#1 Memorable1991

    Początkujący

  • Użytkownik

Reputacja: 0
zer0.

  • Postów:10
  • Imię:Kamil
  • Lokalizacja:Otwock
Offline

Napisano 24.06.2021 16:08

Witam mam problem bo nie moge to skomplikować czy ktoś pomoze podaj to na dole  

 

 to bedzie pierwsze 

#include <amxmodx>
#include <amxmisc
#include <sqlx>
#include <hamsandwich>
#include <fun>
#include <cstrike>
#include <engine>
#include <fakemeta_util>
#include <nvault>
#include <jailbreak>
 
#define VIP ADMIN_LEVEL_H
#define SVIP ADMIN_LEVEL_G
 
#define PLUGIN "JBPacki"
#define VERSION "1.0"
#define AUTHOR "Zero"
 
#define prefix "Sklep"
 
#define FL_WATERJUMP (1<<11) 
#define FL_ONGROUND (1<<9) 
#define autobhopkeys (1<<0)|(1<<1) 
 
native get_user_jbpack(id)
native set_user_jbpack(id, amount)
 
new pPcvarDBHost;
new pPcvarDBUser;
new pPcvarDBPassword;
new pPcvarDBBase;
 
new Handle:g_SqlTuple;
new g_Cache[512];
new bool:SQLenabled;
new bool:gIntermission;
new gTablesLoaded[33];
new gSaveKey[33][32];
new g_iMsgStatusText;
new g_iZyczeniaGracza[33];
new g_iBuntyGracza[33];
 
new target;
new konto[20]
new name[33]
 
 
 
new ilosc_jbpack[33];
new bool:bhop_enabled[33];
new bool:blokada
new longjump[33];
new id;
new g_Mission[33], g_Bonus[33]
 
new ranga[33];
new const rangi[][] = {
{10, "1"}, // Poziom 1 (10 zabojstw)
{20, "2"}, // Poziom 2 (20 zabojstw)
{30, "3"}, // Poziom 3 (30 zabojstw)
{40, "4"}, // Poziom 4 (40 zabojstw)
{50, "5"}, // Poziom 5 (50 zabojstw)
{60, "6"}, // Poziom 6 (60 zabojstw) 
{70, "7"}, // Poziom 7 (70 zabojstw)
{80, "8"}, // Poziom 8 (80 zabojstw)
{90, "9"}, // Poziom 9 (90 zabojstw)
{100, "10"}, // Poziom 10 (100 zabojstw)
{110, "11"}, // Poziom 11 (110 zabojstw)
{120, "12"}, // Poziom 12 (120 zabojstw)
{130, "13"}, // Poziom 13 (130 zabojstw)
{150, "14"}, // Poziom 14 (140 zabojstw)
{150, "15"}, // Poziom 15 (150 zabojstw)
{160, "16"}, // Poziom 16 (160 zabojstw)
{170, "17"}, // Poziom 17 (170 zabojstw)
{180, "18"}, // Poziom 18 (180 zabojstw)
{190, "19"}, // Poziom 19 (190 zabojstw)
{200, "20"}, // Poziom 20 (200 zabojstw)
{220, "21"}, // Poziom 21 (220 zabojstw)
{240, "22"}, // Poziom 22 (240 zabojstw)
{260, "23"}, // Poziom 23 (260 zabojstw)
{280, "24"}, // Poziom 24 (280 zabojstw)
{290, "25"}, // Poziom 25 (290 zabojstw)
{300, "26"}, // Poziom 26 (300 zabojstw)
{310, "27"}, // Poziom 27 (310 zabojstw)
{320, "28"}, // Poziom 28 (320 zabojstw)
{330, "29"}, // Poziom 29 (330 zabojstw)
{340, "30"}, // Poziom 30 (340 zabojstw)
{350, "31"}, // Poziom 31 (350 zabojstw)
{360, "32"}, // Poziom 32 (360 zabojstw)
{370, "33"}, // Poziom 33 (370 zabojstw)
{380, "34"}, // Poziom 34 (380 zabojstw)
{390, "35"}, // Poziom 35 (390 zabojstw)
{400, "36"}  // Poziom 36 (400 zabojstw)
}
 
 
new jb_packi_nv
new msgtext;
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
 
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
pPcvarDBHost = register_cvar("db_host", "145.239.236.240"); //ip bazy danych
pPcvarDBUser = register_cvar("db_user", "srv71572"); //nazwa uzytkownika
pPcvarDBPassword = register_cvar("db_pass", "6rv8oGdyeh"); //haslo do bazy danych
pPcvarDBBase = register_cvar("db_database", "srv71572"); //nazwa bazy danych
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
 
register_clcmd("jail_sklep_dolce", "jb_sklep")
register_clcmd("jail_sklep_dolce", "jb_sklep")
register_clcmd("jail_sklep_dolce", "jb_sklep")
 
register_cvar("jb_maxjp", "1000000" );
register_cvar("jb_tt", "25" );
register_cvar("jb_ct", "30" );
register_cvar("jb_hs", "45" );
register_cvar("jb_czas", "60");
register_cvar("jb_zapis", "2"); //1  - nvault, 2 - sql
register_cvar("jb_hud", "2"); //0 - off, 1 - status, 2 - hud
 
if(get_cvar_num("jb_zapis") == 2) { 
jb_packi_nv = nvault_open("jb_packi")
if(jb_packi_nv == INVALID_HANDLE)
set_fail_state("Nie moge otworzyc pliku");
}
 
register_event("DeathMsg", "DeathMsg", "a")
register_logevent("Koniec_Rundy", 2, "1=Round_End")
register_logevent("Poczatek_Rundy", 2, "1=Round_Start")
register_event("ResetHUD","HUD", "b");
 
register_concmd("jb_packgive", "cmd_give", ADMIN_IMMUNITY, "<nazwa> <ilosc>");
register_clcmd("typ_zapisu", "typ");
 
msgtext = get_user_msgid("StatusText");
 
register_forward(FM_PlayerPreThink, "forward_FM_PlayerPreThink", 0)
 
set_task(0.8, "HUD",0,"",0,"b");
 
}
 
public plugin_precache(){
precache_sound("jbe_tops/shop/welcome.wav")
precache_sound("jbe_tops/shop/1.mp3")
precache_sound("jbe_tops/shop/2.mp3")
precache_sound("jbe_tops/shop/3.mp3")
precache_sound("jbe_tops/shop/4.mp3")
precache_sound("jbe_tops/shop/6.mp3")
precache_sound("jbe_tops/shop/7.mp3")
precache_sound("jbe_tops/shop/8.mp3")
precache_sound("jbe_tops/shop/9.mp3")
precache_sound("jbe_tops/shop/10.mp3")
precache_sound("jbe_tops/shop/11.mp3")
precache_sound("jbe_tops/shop/12.mp3")
}
 
public HUD(id)  { 
for (new id=0; id < 32; id++) {
 
if (!is_user_connected(id))
continue
 
else if(get_user_flags(target) & VIP)
konto = "Kupiona"
if(get_user_flags(target) & SVIP)
konto = "Kupiona"
else
konto = "Darmowa"
 
if(rangi[ranga[id]][0] && ranga[id])
ranga[id]++
 
if(ranga[id])
ranga[id]--
 
if(is_user_alive(id)){
new HUD[128];
get_user_name(id,name,32)
new Time[9]
get_time("%H:%M:%S",Time,8)
    new nextmap[32] 
    get_cvar_string("amx_nextmap",nextmap,31) 
    new timeleft = get_timeleft() 
 
format(HUD, 127,"Szlugi: [%i] **^nGodzina: [%s] **^nEXP: [%s] **^nMisja: [%d] **^nBudynie: [%d] **^nZyczenia: [%d] **", ilosc_jbpack[id], Time, get_user_flags(id) & ADMIN_LEVEL_G ? "Tak" : "Nie", g_Mission[id], g_iBuntyGracza[id], g_iZyczeniaGracza[id]);
if(get_cvar_num("jb_hud") == 1){
message_begin(MSG_ONE, msgtext, {0,0,0}, id);
write_byte(0);
write_string(HUD); 
message_end();
return PLUGIN_CONTINUE;
}
else if(get_cvar_num("jb_hud") == 2)
{
set_hudmessage(200, 0, 200, 0.95, 0.60, 0, 6.0, 1.1, 0.0, 0.0, -1)
show_hudmessage(id, "%s",HUD)
}
}
}
return PLUGIN_CONTINUE;
}
/*public client_PreThink(id){
if(!is_user_alive(id)){
return PLUGIN_CONTINUE;
}
if(is_user_alive(id) && !is_user_bot(id) && get_cvar_num("jb_hud") > 0){
HUD(id);
}
return PLUGIN_HANDLED;
}*/
public DeathMsg()
{
new weaponname[20]
new kid = read_data(1)
new vid = read_data(2)
new headshot = read_data(3)
read_data(4,weaponname,31)
 
if(kid == vid)
{
return PLUGIN_HANDLED
}
if(get_user_team(kid) == 1)
{
new maxjp = get_cvar_num("jb_maxjp")
if(ilosc_jbpack[kid]<maxjp)
{
if(get_user_team(vid) == 2)
{
new pack_ct = get_cvar_num("jb_ct")
ilosc_jbpack[kid] += pack_ct
set_dhudmessage(244, 130, 0, -1.0, 0.45, 0, 0.01, 0.8, _, _, 3)
show_dhudmessage(id, "", pack_ct)
}
else
{
new pack_tt = get_cvar_num("jb_tt")
ilosc_jbpack[kid] += pack_tt
set_dhudmessage(244, 130, 0, -1.0, 0.45, 0, 0.01, 0.8, _, _, 3)
show_dhudmessage(id, "", pack_tt)
}
if(headshot)
{
new pack_hs = get_cvar_num("jb_hs")
ilosc_jbpack[kid] += pack_hs
set_dhudmessage(244, 130, 0, -1.0, 0.45, 0, 0.01, 0.8, _, _, 3)
show_dhudmessage(id, "", pack_hs)
}
}
else
{
set_dhudmessage(244, 130, 0, 1.0, 0.01, 0, 0.01, 0.8, _, _, 3)
show_dhudmessage(id, "")
 
return PLUGIN_CONTINUE
}
ColorChat(kid, GREEN, "", prefix, ilosc_jbpack[kid], maxjp);
if(get_cvar_num("jb_zapis") == 1) { 
sql_save(kid)
}
else
{
zapisz_jbpack(kid)
}
}
return PLUGIN_CONTINUE
}
 
 
////----//////
 
public jb_sklep(id)
{
if(blokada == true){
new czynny_sklep = get_cvar_num("jb_czas")
ColorChat(id, GREEN, "[Sklep]^x01 Czynny przez %d sekund!", czynny_sklep);
return PLUGIN_HANDLED
}
 
 
new menu,formats[64];
formatex(formats,charsmax(formats),"\wSklep wiezienny^n\dPosiadasz: \r%i \dszlugów\r",ilosc_jbpack[id])
menu = menu_create(formats,"handle_jb_sklep");
if(get_user_team(id) == 1)
client_cmd(id, "spk sound/jbe_tops/shop/welcome.wav");
{
menu_additem(menu,"\wGranat dymiący \r[\y150 szlugów\r]","0")
menu_additem(menu,"\wGranat oślepiający \r[\y180 szlugów\r]","1")
menu_additem(menu,"\wGranat wybuchający \r[\y200 szlugów\r]","2")
menu_additem(menu,"\r+50 \wkamizelki \d[na rundę] \r[\y150 szlugów\r]","3")
menu_additem(menu,"\r+100 \wkamizelki \d[na rundę] \r[\y250 szlugów\r]","4")
menu_additem(menu,"\r+50 \wzdrowia \d[na rundę] \r[\y170 szlugów\r]","5")
menu_additem(menu,"\r+100 \wzdrowia \d[na rundę] \r[\y270 szlugów\r]","6")
menu_additem(menu,"\wAutoBH \d[na rundę] \r[\y750 szlugów\r]","7")
menu_additem(menu,"\wButy bezszelestu \d[na rundę] \r[\y250 szlugów\r]","8")
menu_additem(menu,"\wButy szybkości \d[na rundę] \r[\y300 szlugów\r]","9")
menu_additem(menu,"\rDuszek \d[następny dzień] \r[\y800 szlugów\r]","10")
menu_additem(menu,"\rFreeDay \d[następny dzień] \r[\y800 szlugów\r]","11")
}
menu_setprop(menu,MPROP_EXIT,MEXIT_ALL)
menu_setprop(menu,MPROP_BACKNAME,"Poprzednia Strona")
menu_setprop(menu,MPROP_NEXTNAME,"Nastepna Strona")
menu_setprop(menu,MPROP_EXITNAME,"Wyjdź")
menu_display(id,menu,0)
return PLUGIN_HANDLED
}
public handle_jb_sklep(id, menu, item)
{
switch(item)
{
case 0:
{
if(!sprawdz(id,150)) return PLUGIN_HANDLED;
give_item(id, "weapon_smokegrenade");
client_cmd(id, "mp3 play sound/jbe_tops/shop/1.mp3");
ColorChat(id, GREEN, "[Sklep]x01 Kupilesx03 Granat Dymiacyx01!");
 
}
case 1:
{
if(!sprawdz(id,180)) return PLUGIN_HANDLED;
give_item(id, "weapon_flashbang");
client_cmd(id, "mp3 play sound/jbe_tops/shop/2.mp3");
ColorChat(id, GREEN, "[Sklep]x01 Kupiles^x03 Granat Oslepiajacy^x01!");
 
}
case 2:
{
if(!sprawdz(id,200)) return PLUGIN_HANDLED;
give_item(id, "weapon_hegrenade");
client_cmd(id, "mp3 play sound/jbe_tops/shop/3.mp3");
ColorChat(id, GREEN, "[Sklep]^x01 Kupiles^x03 Granat Wybuchajacy^x01!");
 
}
case 3:
{
if(!sprawdz(id,150)) return PLUGIN_HANDLED;
set_user_armor(id, get_user_armor(id) + 50)
client_cmd(id, "mp3 play sound/jbe_tops/shop/4.mp3");
ColorChat(id, GREEN, "[Sklep]^x01 Kupiles^x03 +50 kamizelki^x01!");
}
case 4:
{
if(!sprawdz(id,250)) return PLUGIN_HANDLED;
set_user_armor(id, get_user_armor(id) + 100)
client_cmd(id, "mp3 play sound/jbe_tops/shop/5.mp3");
ColorChat(id, GREEN, "[Sklep]^x01 Kupiles^x03 +100 kamizelki^x01!");
}
case 5:
{
if(!sprawdz(id,170)) return PLUGIN_HANDLED;
set_user_health(id, get_user_health(id) + 50)
client_cmd(id, "mp3 play sound/jbe_tops/shop/6.mp3");
ColorChat(id, GREEN, "[Sklep]^x01 Kupiles^x03 +50 zdrowia^x01!");
}
case 6:
{
if(!sprawdz(id,270)) return PLUGIN_HANDLED;
set_user_health(id, get_user_health(id) + 100)
client_cmd(id, "mp3 play sound/jbe_tops/shop/7.mp3");
ColorChat(id, GREEN, "[Sklep]^x01 Kupiles^x03 +100 zdrowia^x01!");
}
 
/*case 4:
{
if(!sprawdz(id,10)) return PLUGIN_HANDLED;
give_item(id, "weapon_glock18")
 
new weapon_id = find_ent_by_owner(-1, "weapon_glock18", id);
if(weapon_id)
{
cs_set_weapon_ammo(weapon_id, 4);
}
ColorChat(id, GREEN, "[%s] Kupiles glocka", prefix);
}*/
case 7:
{
if(!sprawdz(id,750)) return PLUGIN_HANDLED;
bhop_enabled[id] = true
client_cmd(id, "mp3 play sound/jbe_tops/shop/8.mp3");
ColorChat(id, GREEN, "[Sklep]^x01 Kupiles^x03 AutoBH^x01!");
ColorChat(id, GREEN, "[MOC]^x01 Trzymaj^x03 spacje^x01 i skacz bez przerwy!");
}
case 8:
{
if(!sprawdz(id,250)) return PLUGIN_HANDLED;
set_user_footsteps(id, 1)
client_cmd(id, "mp3 play sound/jbe_tops/shop/9.mp3");
ColorChat(id, GREEN, "[Sklep]x01 Kupiles^x03 Buty Bezszelestu^x01!");
}
case 9:
{
if(!sprawdz(id,300)) return PLUGIN_HANDLED;
set_user_maxspeed(id, 2450.0);
client_cmd(id, "mp3 play sound/jbe_tops/shop/10.mp3");
ColorChat(id, GREEN, "[Sklep]^x01 Kupiles^x03 Buty Szybkosci^x01!");
ColorChat(id, GREEN, "[BUTY]^x01 Twoja kondycja wzrasta do^x03 +5,20% predkosci^x01!");
}
case 10:
{
if(!sprawdz(id,800)) return PLUGIN_HANDLED;
ColorChat(id, GREEN, "[Sklep]^x01 Kupiles^x03 Duszka na jutro^x01!");
client_cmd(id, "mp3 play sound/jbe_tops/shop/11.mp3");
jail_set_prisoner_ghost(id, false, true);
}
case 11:
{
if(!sprawdz(id,800)) return PLUGIN_HANDLED;
ColorChat(id, GREEN, "[Sklep]^x01 Kupiles^x03 FreeDay'a na jutro^x01!");
client_cmd(id, "mp3 play sound/jbe_tops/shop/12.mp3");
jail_set_prisoner_free(id, false, true);
}
}
return PLUGIN_CONTINUE;
}
public sprawdz(id,jbpack){
if (ilosc_jbpack[id] >= jbpack){
ilosc_jbpack[id] -= jbpack
return true;
}
if(!is_user_alive(id)){
ColorChat(id, GREEN, "[Sklep]^x01 Nie mozesz korzystac ze sklepu!");
return false;
}
if(ilosc_jbpack[id] < jbpack)
{
ColorChat(id, GREEN, "[Sklep]^x01 Nie masz wystarczajaco szlugów na kupno!");
return false;
}
return PLUGIN_CONTINUE;
}
 
 
public Poczatek_Rundy() {
blokada = false
new czynny_skle = get_cvar_float("jb_czas")
 
set_task(czynny_skle, "Blokuj")
}
public Koniec_Rundy(){
for(new i =1;i<33;i++){
if(is_user_connected(i))
{
bhop_enabled[i] = false
set_user_footsteps(i, 0)
}
}
}
public Blokuj(){
blokada = true
}
public forward_FM_PlayerPreThink(id) 
if(bhop_enabled[id] == true) 
entity_set_float(id, EV_FL_fuser2, 0.0) 
 
if (entity_get_int(id, EV_INT_button) & 2) 
new flags = entity_get_int(id, EV_INT_flags) 
 
if (flags & FL_WATERJUMP) 
return PLUGIN_CONTINUE 
if ( entity_get_int(id, EV_INT_waterlevel) >= 2 ) 
return PLUGIN_CONTINUE 
if ( !(flags & FL_ONGROUND) ) 
return PLUGIN_CONTINUE 
 
new Float:velocity[3] 
entity_get_vector(id, EV_VEC_velocity, velocity) 
velocity[2] += 250.0 
entity_set_vector(id, EV_VEC_velocity, velocity) 
 
entity_set_int(id, EV_INT_gaitsequence, 6) 
return PLUGIN_CONTINUE 
}  
public cmd_give(id, level, cid)
{
if(!cmd_access(id, level, cid, 3))
return PLUGIN_CONTINUE;
 
new arg[33];
read_argv(1, arg, 32);
new target = cmd_target(id, arg, CMDTARGET_ALLOW_SELF);
 
if(!is_user_connected(target))
return PLUGIN_CONTINUE;
 
read_argv(2, arg, 32);
new ilejb = str_to_num(arg);
 
ilosc_jbpack[target] = ilosc_jbpack[target] + ilejb;
 
return PLUGIN_CONTINUE;
}
 
public plugin_natives()
{
register_native("get_user_jbpack","return_jbpack", 1)
register_native("set_user_jbpack","set_jbpack", 1)
}
 
public return_jbpack(id)
{
        return ilosc_jbpack[id];
}
public set_jbpack(id, amount)
{
ilosc_jbpack[id] = amount
}
 
 
//////////////
public typ(id) {
if(get_cvar_num("jb_zapis") == 1) { 
client_print(id, print_console, "Uzywasz obecnie zapisu SQL")
}
else
{
client_print(id, print_console, "Uzywasz obecnie zapisu nVault")
}
}
 
public zaladuj_jbpack(id)
{
new name[48]
get_user_name(id,name,47)
new vaultkey[64],vaultdata[128]
formatex(vaultkey,63,"%s-jbpack",name)
 
if(nvault_get(jb_packi_nv,vaultkey,vaultdata,127)) {
new jb_packii[16];
parse(vaultdata, jb_packii, 15)
 
ilosc_jbpack[id]=str_to_num(jb_packii)
}
 
return PLUGIN_CONTINUE
}  
 
public zapisz_jbpack(id) {
new name[48]
get_user_name(id,name,47)
new vaultkey[64],vaultdata[128]
formatex(vaultkey,63,"%s-jbpack",name)
formatex(vaultdata,127,"%d", ilosc_jbpack[id])
nvault_set(jb_packi_nv,vaultkey,vaultdata)
 
return PLUGIN_CONTINUE
}
 
public plugin_cfg(){
    SQLenabled = false;
    sql_init();
}
public plugin_end()
{
if ( SQLenabled )
{
SQL_FreeHandle(g_SqlTuple);
}
}
public Message_Intermission()
{
gIntermission = true;
}
public client_putinserver(id){
gTablesLoaded[id] = 0;
if(get_cvar_num("jb_zapis") == 1) { 
get_save_key(id);
}
else
{
zaladuj_jbpack(id);
}
}
public client_disconnect(id)
{
if(get_cvar_num("jb_zapis") == 1) { 
sql_save(id)
}
else
{
zapisz_jbpack(id)
}
}
public sql_init()
{
new szHost[32], szUser[32], szPass[32], szDB[32];
get_pcvar_string(pPcvarDBHost, szHost, 31);
get_pcvar_string(pPcvarDBUser, szUser, 31);
get_pcvar_string(pPcvarDBPassword, szPass, 31);
get_pcvar_string(pPcvarDBBase, szDB, 31);
 
g_SqlTuple = SQL_MakeDbTuple(szHost, szUser, szPass, szDB);
 
SQL_ThreadQuery(g_SqlTuple, "TableHandle", "CREATE TABLE IF NOT EXISTS jbpacki (nazwa_gracza VARCHAR(35), ilosc_jbpack INT(11), PRIMARY KEY (nazwa_gracza))");
}
public get_save_key(id)
{
get_user_name(id, gSaveKey[id], charsmax(gSaveKey[]));
sql_load(id);
}
public sql_load(id)
{
new index[1];
index[0] = id;
 
new tempSaveKey[63];
copy(tempSaveKey, charsmax(tempSaveKey), gSaveKey[id]);
replace_all(tempSaveKey, charsmax(tempSaveKey), "'", "\'" );
 
formatex(g_Cache, charsmax(g_Cache), "SELECT ilosc_jbpack FROM jbpacki WHERE nazwa_gracza='%s'", tempSaveKey);
SQL_ThreadQuery(g_SqlTuple, "SelectHandle", g_Cache, index, 1);
}
public TableHandle(FailState, Handle:Query, Error[], Errcode, Data[], DataSize)
{
if ( FailState )
{
if ( FailState == TQUERY_CONNECT_FAILED )
{
log_amx("Table - Could not connect to SQL database.  [%d] %s", Errcode, Error);
}
else if ( FailState == TQUERY_QUERY_FAILED )
{
log_amx("Table Query failed. [%d] %s", Errcode, Error);
}
 
SQLenabled = false;
 
return;
}
 
SQLenabled = true;
}
 
public QueryHandle(FailState, Handle:Query, Error[], Errcode,Data[], DataSize)
{
if ( FailState )
{
if ( FailState == TQUERY_CONNECT_FAILED )
{
log_amx("Save - Could not connect to SQL database.  [%d] %s", Errcode, Error);
}
else if ( FailState == TQUERY_QUERY_FAILED )
{
log_amx("Save Query failed. [%d] %s", Errcode, Error);
}
 
return;
}
}
 
public SelectHandle(FailState, Handle:Query, Error[], Errcode, Data[], DataSize)
{
if ( FailState )
{
if ( FailState == TQUERY_CONNECT_FAILED )
{
log_amx("Load - Could not connect to SQL database.  [%d] %s", Errcode, Error);
}
else if ( FailState == TQUERY_QUERY_FAILED )
{
log_amx("Load Query failed. [%d] %s", Errcode, Error);
}
 
return;
}
 
new id = Data[0];
 
if ( !SQL_NumResults(Query) )
{
new tempSaveKey[63];
copy(tempSaveKey, charsmax(tempSaveKey), gSaveKey[id]);
replace_all(tempSaveKey, charsmax(tempSaveKey), "'", "\'" );
 
formatex(g_Cache, charsmax(g_Cache), "INSERT INTO jbpacki VALUES('%s', '0')", tempSaveKey);
SQL_ThreadQuery(g_SqlTuple, "QueryHandle", g_Cache);
}
else
{
ilosc_jbpack[id] = SQL_ReadResult(Query,SQL_FieldNameToNum(Query,"ilosc_jbpack"));
}
gTablesLoaded[id]++;
}
 
public sql_save(id)
{
if ( gTablesLoaded[id] == 1 )
{
if ( gIntermission )
{
sql_save_nonthreaded(id);
return;
}
new tempSaveKey[63];
copy(tempSaveKey, charsmax(tempSaveKey), gSaveKey[id]);
replace_all(tempSaveKey, charsmax(tempSaveKey), "'", "\'" );
 
formatex(g_Cache, charsmax(g_Cache), "UPDATE jbpacki SET ilosc_jbpack=%i WHERE nazwa_gracza=^"%s^"", ilosc_jbpack[id], tempSaveKey);
SQL_ThreadQuery(g_SqlTuple, "QueryHandle", g_Cache);
}
}
 
sql_save_nonthreaded(id)
{
new Errcode, Error[128], Handle:SqlConnection;
 
SqlConnection = SQL_Connect(g_SqlTuple, Errcode, Error, charsmax(Error));
 
if ( !SqlConnection )
{
log_amx("Save - Could not connect to SQL database.  [%d] %s", Errcode, Error);
SQL_FreeHandle(SqlConnection);
return;
}
 
new tempSaveKey[63];
copy(tempSaveKey, charsmax(tempSaveKey), gSaveKey[id]);
replace_all(tempSaveKey, charsmax(tempSaveKey), "'", "\'" );
 
new Handle:Query;
Query = SQL_PrepareQuery(SqlConnection, "UPDATE jbpacki SET ilosc_jbpack=%i WHERE nazwa_gracza=^"%s^"", ilosc_jbpack[id], tempSaveKey);
if ( !SQL_Execute(Query) )
{
Errcode = SQL_QueryError(Query, Error, charsmax(Error));
log_amx("Save Query failed. [%d] %s", Errcode, Error);
SQL_FreeHandle(Query);
SQL_FreeHandle(SqlConnection);
return;
}
 
SQL_FreeHandle(Query);
 
SQL_FreeHandle(SqlConnection);
}
 
 
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1045\\ f0\\ fs16 \n\\ par }
*/
 
stock __dhud_color;
stock __dhud_x;
stock __dhud_y;
stock __dhud_effect;
stock __dhud_fxtime;
stock __dhud_holdtime;
stock __dhud_fadeintime;
stock __dhud_fadeouttime;
stock __dhud_reliable;
 
stock set_dhudmessage( red = 0, green = 160, blue = 0, Float:x = -1.0, Float:y = 0.65, effects = 2, Float:fxtime = 6.0, Float:holdtime = 3.0, Float:fadeintime = 0.1, Float:fadeouttime = 1.5, bool:reliable = false )
{
    #define clamp_byte(%1)       ( clamp( %1, 0, 255 ) )
    #define pack_color(%1,%2,%3) ( %3 + ( %2 << 8 ) + ( %1 << 16 ) )
 
    __dhud_color       = pack_color( clamp_byte( red ), clamp_byte( green ), clamp_byte( blue ) );
    __dhud_x           = _:X;
    __dhud_y           = _:y;
    __dhud_effect      = effects;
    __dhud_fxtime      = _:fxtime;
    __dhud_holdtime    = _:holdtime;
    __dhud_fadeintime  = _:fadeintime;
    __dhud_fadeouttime = _:fadeouttime;
    __dhud_reliable    = _:reliable;
 
    return 1;
}
 
stock show_dhudmessage( index, const message[], any:... )
{
    new buffer[ 128 ];
    new numArguments = numargs();
 
    if( numArguments == 2 )
    {
        send_dhudMessage( index, message );
    }
    else if( index || numArguments == 3 )
    {
        vformat( buffer, charsmax( buffer ), message, 3 );
        send_dhudMessage( index, buffer );
    }
    else
    {
        new playersList[ 32 ], numPlayers;
        get_players( playersList, numPlayers, "ch" );
 
        if( !numPlayers )
        {
            return 0;
        }
 
        new Array:handleArrayML = ArrayCreate();
 
        for( new i = 2, j; i < numArguments; i++ )
        {
            if( getarg( i ) == LANG_PLAYER )
            {
                while( ( buffer[ j ] = getarg( i + 1, j++ ) ) ) {}
                j = 0;
 
                if( GetLangTransKey( buffer ) != TransKey_Bad )
                {
                    ArrayPushCell( handleArrayML, i++ );
                }
            }
        }
 
        new size = ArraySize( handleArrayML );
 
        if( !size )
        {
            vformat( buffer, charsmax( buffer ), message, 3 );
            send_dhudMessage( index, buffer );
        }
        else
        {
            for( new i = 0, j; i < numPlayers; i++ )
            {
                index = playersList[ i ];
 
                for( j = 0; j < size; j++ )
                {
                    setarg( ArrayGetCell( handleArrayML, j ), 0, index );
                }
 
                vformat( buffer, charsmax( buffer ), message, 3 );
                send_dhudMessage( index, buffer );
            }
        }
 
        ArrayDestroy( handleArrayML );
    }
 
    return 1;
}
 
stock send_dhudMessage( const index, const message[] )
{
    message_begin( __dhud_reliable ? ( index ? MSG_ONE : MSG_ALL ) : ( index ? MSG_ONE_UNRELIABLE : MSG_BROADCAST ), SVC_DIRECTOR, _, index );
    {
        write_byte( strlen( message ) + 31 );
        write_byte( DRC_CMD_MESSAGE );
        write_byte( __dhud_effect );
        write_long( __dhud_color );
        write_long( __dhud_x );
        write_long( __dhud_y );
        write_long( __dhud_fadeintime );
        write_long( __dhud_fadeouttime );
        write_long( __dhud_holdtime );
        write_long( __dhud_fxtime );
        write_string( message );
    }
    message_end();
}
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
a tu drugie 
 

#include <amxmodx>
#include <amxmisc>
#include <sqlx>
#include <fakemeta>
#include <cstrike>
#include <hamsandwich>
#include <fun>
 
#define VERSION "1.0"
#define TAG "^x04[MISJE]^x01"
 
#if AMXX_VERSION_NUM < 183
#include <colorchat>
#include <dhudmessage>
#else
#define DontChange print_team_default
#define Blue print_team_blue
#define Red print_team_red
#define Grey print_team_grey
#endif
 
enum 
{
VAMPIRE = 1,
MONEY,
HEALTH,
SCOUT
}
 
enum
{
DOUBLE_WEAPON,
DOUBLE_GRENADE,
KNIFE,
M249,
NODMG,
HOSTAGE,
MOSTDMG,
FRAGS,
DMG_DGL,
DMG_AK47,
DMG_M4A1,
DMG_FAMAS,
DEFUSED,
NODEATH,
HEADSHOT,
KNIFEKILL
}
 
enum _:eType
{
_DMG,
_HOSTAGE,
_MOSTDMG,
_FRAGS,
_WEAPONDMG,
_DEFUSED,
_NODEATH
}
 
new g_eData[33][eType]
 
new const g_iMission[][][] =
{
{
"Zadanie 1 \r(\y+40 szlugow \dx4\r)",
"Zadanie 2 \r(\y+80 szlugow \dx3\r)",
"Zadanie 3 \r(\y+150 szlugow \dx4\r)",
"Zadanie 4 \r(\y+200 szlugow \dx3\r)"
},
{
"Zabij 2 wrogow 1 strzalem",
"Zabij 2 wrogow granatem",
"Zabij 2 przeciwnikow nozem \r(\y1 runda\r)",
"Zabij 4 wrogow AK47 \r(\y1 runda\r)"
},
{
"Nie trac zdrowia \r(\y1 runda\r)",
"?????? ???? (4) ?????????? (?????)",
"Zadaj najwieksze obrazenia",
"Zdobadz 7 fragow \r(\y1 runda\r)"
},
{
"Zadaj 400 DMG z deagle \r(\y1 runda\r)",
"Zadaj 700 DMG z ak47 \r(\y1 runda\r)",
"Zadaj 650 DMG z m4a1 \r(\y1 runda\r)",
"Zadaj 600 DMG z famasa \r(\y1 runda\r)"
},
{
"??????????? 3 ??? ????? (?????)",
"Zdobadz/Daj zyczenie 3 razy z rzedu",
"Traf 6 kulek w glowe \r(\y1 runda\r)",
"Zabij 4 razy nozem \r(\y1 runda\r)"
}
}
 
new Handle:g_hSQLTuple, g_szQuery[2048]
 
new pCvarSqlHost, pCvarSqlUser, pCvarSqlPwd, pCvarSqlDb
new pCvarHudColor[3], pCvarHudCoord[2], pCvarMinPlayers
new pCvarBonusMoney, pCvarBonusMoneyMax, pCvarBonusHealth, pCvarBonusHealthMax 
new pCvarScoutSpd, pCvarMenu
 
new g_CacheHudColor[3], Float:g_CacheHudCoord[2]
 
new g_ShowMenu[33]
 
new g_Mission[33], g_Bonus[33]
 
new g_iMaxPlayers
 
new g_LbzEnable, g_BlockMap
new g_Map[128][32], g_MapNum
 
 
public plugin_init() 
{
register_plugin("LBZ", VERSION, "ill")
 
register_clcmd("say /misje", "ClcShowMenu")
 
register_menu("Lbz Menu", 1023, "lbz_menu")
 
register_logevent("event_Hostage", 3, "2=Rescued_A_Hostage")
register_event("HLTV", "event_RoundStart", "a", "1=0", "2=0")
register_logevent("logevent_RoundEnd", 2, "1=Round_End")
register_event("TextMsg", "event_RestartGame", "a", "2=#Game_Commencing", "2=#Game_will_restart_in")
 
RegisterHam(Ham_Killed, "player", "fw_HamKilled")
RegisterHam(Ham_Spawn, "player", "fw_HamSpawnPost", 1)
RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_scout", "fw_PrimaryAttack_Post", 1)
 
pCvarSqlHost = register_cvar("lbz_sgl_host", "145.239.236.240")
pCvarSqlUser = register_cvar("lbz_sgl_user", "srv71572")
pCvarSqlPwd = register_cvar("lbz_sgl_pwd", "6rv8oGdyeh")
pCvarSqlDb = register_cvar("lbz_sgl_db", "srv71572")
 
pCvarHudColor[0] = register_cvar("lbz_hud_color_r", "0")
pCvarHudColor[1] = register_cvar("lbz_hud_color_g", "155")
pCvarHudColor[2] = register_cvar("lbz_hud_color_b", "255")
pCvarHudCoord[0] = register_cvar("lbz_hud_pos_x", "0.95")
pCvarHudCoord[1] = register_cvar("lbz_hud_pos_y", "0.75")
 
pCvarMinPlayers = register_cvar("lbz_min_players", "0")
 
pCvarBonusMoney = register_cvar("lbz_bonus_money", "700")
pCvarBonusMoneyMax = register_cvar("lbz_bonus_money_max", "16000")
 
pCvarMenu = register_cvar("lbz_menu", "1")
 
g_iMaxPlayers = get_maxplayers()
 
set_task(0.1, "SQL_Init_Connect")
set_task(0.5, "Cache_Cvars")
 
check_block_maps()
}
 
public plugin_precache() 
{
new iConfigsDir[64]
get_configsdir(iConfigsDir, charsmax(iConfigsDir))
server_cmd("exec %s/lbz.cfg", iConfigsDir)
 
new iMapList[128], i, iLen
formatex(iMapList, charsmax(iMapList), "%s/lbz_blockmaps.ini", iConfigsDir)
if(file_exists(iMapList)) 
{
i = 0
iLen = 0
while(i < 128 && read_file(iMapList, i, g_Map[g_MapNum], charsmax(g_Map), iLen)) 
{
i++
if(g_Map[g_MapNum][0] == ';' || !iLen) continue
g_MapNum++
}
else write_file(iMapList, "; Block maps")
}
 
public client_putinserver(id)
{
for(new i = 0; i < eType; i++)
{
g_eData[id][i] = 0
}
 
g_Mission[id] = 0
g_Bonus[id] = 0
 
new authid[32]
get_user_authid(id, authid, charsmax(authid))
 
formatex(g_szQuery, charsmax(g_szQuery), "SELECT `MISSION` , `BONUS` FROM `lbz_users` WHERE `AUTHID` = '%s'", authid)
 
new cData[1]
cData[0] = id
SQL_ThreadQuery(g_hSQLTuple, "LoadData_QueryHandler", g_szQuery, cData, 1)
}
 
public LoadData_QueryHandler(iFailState, Handle:hQuery, szError[], iErrnum, cData[], iSize, Float:fQueueTime) 
{
if(iFailState != TQUERY_SUCCESS) 
{
log_amx("LoadData_QueryHandler(): SQL Error #%d - %s", iErrnum, szError)
return
}
new id = cData[0]
 
if(!is_user_connected(id)) 
{
return
}
 
if(SQL_NumResults(hQuery))
{
g_Mission[id] = SQL_ReadResult(hQuery, 0)
g_Bonus[id] = SQL_ReadResult(hQuery, 1)
}
 
set_task(1.0, "Show_Hud", id, _, _, "b")
}
 
public bomb_defused(defuser) 
{
if(!g_LbzEnable || g_BlockMap) return
 
if(g_Mission[defuser] == DEFUSED)
g_eData[defuser][_DEFUSED]++
if(g_eData[defuser][_DEFUSED] == 3)
{
mission_complite(defuser)
}
}
}
 
public event_RoundStart()
{
get_game_players() < get_pcvar_num(pCvarMinPlayers) ? (g_LbzEnable = false) : (g_LbzEnable = true)
 
if(g_BlockMap)
{
ColorChat(0, RED, "%s Na tej mapie misje sa wylaczone!", TAG)
}
else if(!g_LbzEnable)
{
ColorChat(0, RED, "%s Na mapie jest mniej niz^x03 %d^x01 graczy, misje sa nie uznawane!", TAG, get_pcvar_num(pCvarMinPlayers))
}
 
for(new id = 1; id <= g_iMaxPlayers; id++)
{
g_eData[id][_DMG] = 0
g_eData[id][_HOSTAGE] = 0
g_eData[id][_MOSTDMG] = 0
g_eData[id][_FRAGS] = 0
g_eData[id][_HOSTAGE] = 0
g_eData[id][_WEAPONDMG] = 0
}
}
 
public event_RestartGame()
{
for(new id = 1; id <= g_iMaxPlayers; id++)
{
g_eData[id][_NODEATH] = 0
}
}
 
public logevent_RoundEnd()
{
if(!g_LbzEnable || g_BlockMap)
{
return
}
 
static iBest, id
iBest = 0
 
for(id = 1; id <= g_iMaxPlayers; id++)
{
if(is_user_connected(id))
{
switch(g_Mission[id])
{
case NODMG:
{
if(!g_eData[id][_DMG])
{
mission_complite(id)
}
}
case NODEATH:
{
if(is_user_alive(id))
{
g_eData[id][_NODEATH]++
if(g_eData[id][_NODEATH] == 3)
{
mission_complite(id)
}
}
}
}
 
if(g_eData[id][_MOSTDMG] > g_eData[iBest][_MOSTDMG])
{
iBest = id
}
}
}
 
if(g_Mission[iBest] == MOSTDMG && g_eData[iBest][_MOSTDMG])
{
mission_complite(iBest)
}
}
 
public event_Hostage(id) 
{
if(!g_LbzEnable || g_BlockMap) return
 
new id = get_loguser_index()
 
if(g_Mission[id] == HOSTAGE)
{
g_eData[id][_HOSTAGE]++
 
if(g_eData[id][_HOSTAGE] == 4)
{
mission_complite(id)
}
}
}
 
public fw_HamSpawnPost(id)
{
if(!g_LbzEnable || g_BlockMap)
return HAM_IGNORED
 
if(!is_user_alive(id))
{
return HAM_IGNORED
}
 
if(g_Bonus[id] >= HEALTH)
{
set_user_health(id, 120)
}
if(g_Bonus[id] >= SCOUT)
{
give_item(id, "weapon_hegrenade")
}
 
return HAM_IGNORED
}
 
public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type) 
{
if(!g_LbzEnable || g_BlockMap)
return HAM_IGNORED
 
if(!is_user_connected(victim) || !is_user_connected(attacker) || victim == attacker)
return HAM_IGNORED
 
if(get_user_team(victim) == get_user_team(attacker))
return HAM_IGNORED
 
if(g_Mission[victim] == NODMG)
{
g_eData[victim][_DMG] += floatround(damage)
}
 
switch(g_Mission[attacker])
{
case DMG_DGL:
{
if(get_user_weapon(attacker) == CSW_DEAGLE)
{
g_eData[attacker][_WEAPONDMG] += floatround(damage) 
if(g_eData[attacker][_WEAPONDMG] >= 400)
{
mission_complite(attacker)
g_eData[attacker][_WEAPONDMG] = 0
}
}
}
case DMG_AK47:
{
if(get_user_weapon(attacker) == CSW_AK47)
{
g_eData[attacker][_WEAPONDMG] += floatround(damage) 
if(g_eData[attacker][_WEAPONDMG] >= 700)
{
mission_complite(attacker)
g_eData[attacker][_WEAPONDMG] = 0
}
}
}
case DMG_M4A1:
{
if(get_user_weapon(attacker) == CSW_M4A1)
{
g_eData[attacker][_WEAPONDMG] += floatround(damage) 
if(g_eData[attacker][_WEAPONDMG] >= 650)
{
mission_complite(attacker)
g_eData[attacker][_WEAPONDMG] = 0
}
}
}
case DMG_FAMAS:
{
if(get_user_weapon(attacker) == CSW_FAMAS)
{
g_eData[attacker][_WEAPONDMG] += floatround(damage) 
if(g_eData[attacker][_WEAPONDMG] >= 600)
{
mission_complite(attacker)
g_eData[attacker][_WEAPONDMG] = 0
}
}
}
}
g_eData[attacker][_MOSTDMG] += floatround(damage)
 
return HAM_IGNORED
}
 
public fw_HamKilled(victim, attacker, shouldgib) 
{
if(!g_LbzEnable || g_BlockMap)
return HAM_IGNORED
 
if(!is_user_connected(victim) || !is_user_connected(attacker) || victim == attacker)
return HAM_IGNORED
 
static Float:iTime, Float:iKillTime, iKiller
iTime = get_gametime()
 
static iWpnName[24]
 
switch(g_Mission[attacker])
{
case DOUBLE_GRENADE:
{
get_killer_weapon(attacker, pev(victim, pev_dmg_inflictor), iWpnName, charsmax(iWpnName))
if(equal(iWpnName, "grenade")) 
{
if (iKillTime == iTime && iKiller == attacker) 
{
mission_complite(attacker)
}
iKillTime = iTime
iKiller = attacker
}
}
case DOUBLE_WEAPON:
{
if (iKillTime == iTime && iKiller == attacker) 
{
mission_complite(attacker)
}
iKillTime = iTime
iKiller = attacker
}
case KNIFE:
{
if(get_user_weapon(attacker) == CSW_KNIFE)
{
g_eData[attacker][_FRAGS]++
if(g_eData[attacker][_FRAGS] == 2)
{
mission_complite(attacker)
g_eData[attacker][_FRAGS] = 0
}
}
}
case M249:
{
if(get_user_weapon(attacker) == CSW_M249)
{
g_eData[attacker][_FRAGS]++
if(g_eData[attacker][_FRAGS] == 4)
{
mission_complite(attacker)
g_eData[attacker][_FRAGS] = 0
}
}
}
case FRAGS:
{
g_eData[attacker][_FRAGS]++ 
if(g_eData[attacker][_FRAGS] == 7)
{
mission_complite(attacker)
g_eData[attacker][_FRAGS] = 0
}
}
case HEADSHOT:
{
static iHS
iHS = get_pdata_int(victim, 75, 5) == HIT_HEAD ? 1 : 0
if(iHS)
{
g_eData[attacker][_FRAGS]++
if(g_eData[attacker][_FRAGS] == 6)
{
mission_complite(attacker)
g_eData[attacker][_FRAGS] = 0
}
}
}
case KNIFEKILL:
{
if(get_user_weapon(attacker) == CSW_KNIFE)
{
g_eData[attacker][_FRAGS]++
if(g_eData[attacker][_FRAGS] == 4)
{
mission_complite(attacker)
g_eData[attacker][_FRAGS] = 0
}
}
}
}
 
// Reset
g_eData[victim][_FRAGS] = 0
g_eData[victim][_WEAPONDMG] = 0
g_eData[victim][_NODEATH] = 0
 
// Bonus
new iMax, iValue
if(g_Bonus[attacker] >= VAMPIRE)
{
iMax = get_pcvar_num(pCvarBonusHealthMax)
iValue = get_user_health(attacker)
if(iValue + get_pcvar_num(pCvarBonusHealth) > iMax)
{
set_user_health(attacker, iMax)
}
else
{
set_user_health(attacker, iValue + get_pcvar_num(pCvarBonusHealth))
}
}
if(g_Bonus[attacker] >= MONEY)
{
iMax = get_pcvar_num(pCvarBonusMoneyMax)
iValue = cs_get_user_money(attacker)
if(iValue + get_pcvar_num(pCvarBonusMoney) > iMax)
{
cs_set_user_money(attacker, iMax)
}
else
{
cs_set_user_money(attacker, iValue + get_pcvar_num(pCvarBonusMoney))
}
}
return HAM_IGNORED
}
 
public Cache_Cvars()
{
g_CacheHudColor[0] = get_pcvar_num(pCvarHudColor[0])
g_CacheHudColor[1] = get_pcvar_num(pCvarHudColor[1])
g_CacheHudColor[2] = get_pcvar_num(pCvarHudColor[2])
g_CacheHudCoord[0] = get_pcvar_float(pCvarHudCoord[0])
g_CacheHudCoord[1] = get_pcvar_float(pCvarHudCoord[1])
}
 
public Show_Hud(id)
{
set_hudmessage(0, 255, 0, 0.80, 0.70, 0, 0.1, 1.0, 0.05, 0.05)
show_hudmessage(id, "{ Wpisz: /misje }^n{ Misja: %d|16 }^n{ Poziom: %d|4 }", g_Mission[id], g_Bonus[id])
}
 
public ClcShowMenu(id)
{
if(!get_pcvar_num(pCvarMenu))
{
return PLUGIN_HANDLED
}
g_ShowMenu[id] = 0
show_lbz_menu(id)
 
return PLUGIN_HANDLED
}
 
public show_lbz_menu(id)
{
new menu[512], len, i
new keys = MENU_KEY_0
 
new iMenu = g_ShowMenu[id]
 
new iMisNum = g_Mission[id] - (g_Bonus[id] * 4)
 
if(iMenu)
{
len += formatex(menu[len], charsmax(menu) - len, "\y%s^n^n", g_iMission[0][iMenu-1])
}
else
{
len += formatex(menu[len], charsmax(menu) - len, "\rZa wykonanie:^n^n\dZadanie 1: 40 szlugow za kazda misje!^nZadanie 2: 80 szlugow za kazda misje!^nZadanie 3: 150 szlugow za kazda misje!^nZadanie 4: 200 szlugow za kazda misje!^n^n")
if(g_Mission[id] < 16)
len += formatex(menu[len], charsmax(menu) - len, "\rAKTUALNA: \w%s\d!^n^n", g_iMission[g_Bonus[id]+1][iMisNum])
else
len += formatex(menu[len], charsmax(menu) - len, "\rWszystkie misje zakonczone!^n^n")
 
keys = MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_0
}
 
for(i = 0; i < 4; i++)
{
if(iMenu)
{
len += formatex(menu[len], charsmax(menu) - len, "\y%d. \w%s^n", i+1, g_iMission[iMenu][i])
}
else
{
len += formatex(menu[len], charsmax(menu) - len, "\y%d. \w%s%s^n", i+1, g_iMission[iMenu][i], g_Bonus[id] > i ? " \r(wykonane)" : "")
}
}
 
len += formatex(menu[len], charsmax(menu) - len, "^n\y0. \w%s^n", iMenu ? "Poprzednie menu" : "Wyjdz")
 
show_menu(id, keys, menu, -1, "Lbz Menu")
}
 
public lbz_menu(id, key)
{
switch(key)
{
case 9:
{
if(g_ShowMenu[id])
{
g_ShowMenu[id] = 0
show_lbz_menu(id)
}
}
default:
{
g_ShowMenu[id] = key+1
show_lbz_menu(id)
}
}
}
 
public fw_PrimaryAttack_Post(Weapon)
{
new id = get_pdata_cbase(Weapon, 41, 4)
 
if(pev_valid(id) != 2)
return HAM_IGNORED
 
if(g_Bonus[id] >= SCOUT)
{
set_pdata_float(Weapon, 46, get_pcvar_float(pCvarScoutSpd), 4)
}
 
return HAM_IGNORED
}
 
mission_complite(id)
{
new iMisNum = g_Mission[id] - (g_Bonus[id] * 4)
 
new szName[32]
get_user_name(id, szName, charsmax(szName))
 
set_dhudmessage(0, 255, 0, -1.0, -0.25, 2, 0.02, 8.0, 0.03, 0.2)
show_dhudmessage(id, "Zakonczyles misje: %s", g_iMission[g_Bonus[id]+1][iMisNum])
 
ColorChat(0, RED, "%s Gracz^x03 %s^x01 ukonczyl misje:^x04 %s", TAG, szName, g_iMission[g_Bonus[id]+1][iMisNum])
 
g_Mission[id]++
 
if(g_Mission[id] == 4 || g_Mission[id] == 8 || g_Mission[id] == 12 || g_Mission[id] == 16)
{
g_Bonus[id]++
}
 
new authid[32]
get_user_authid(id, authid, charsmax(authid))
 
formatex(g_szQuery, charsmax(g_szQuery),
"INSERT INTO `lbz_users` SET `AUTHID`='%s', `MISSION`='%d', `BONUS`='%d' ON DUPLICATE KEY UPDATE `MISSION`='%d', `BONUS`='%d'",
authid, g_Mission[id], g_Bonus[id], g_Mission[id], g_Bonus[id]) 
 
SQL_ThreadQuery(g_hSQLTuple, "QueryHandler", g_szQuery)
 
log_to_file("lbz_logs.log", "%s (%s) completed mission %d", szName, authid, g_Mission[id])
}
 
get_game_players() 
{
static count, i
count = 0
for(i = 1; i <= g_iMaxPlayers; i++) 
{
if(is_user_connected(i)) 
{
if(get_user_team(i) == 1 || get_user_team(i) == 2)
count++
}
}
return count
}
 
public SQL_Init_Connect() 
{
new iHost[64], iUser[64], iPwd[64], iDB[64]
 
get_pcvar_string(pCvarSqlHost, iHost, charsmax(iHost))
get_pcvar_string(pCvarSqlUser, iUser, charsmax(iUser))
get_pcvar_string(pCvarSqlPwd, iPwd, charsmax(iPwd))
get_pcvar_string(pCvarSqlDb, iDB, charsmax(iDB))
 
SQL_SetAffinity("mysql")
g_hSQLTuple = SQL_MakeDbTuple(iHost, iUser, iPwd, iDB)
 
SQL_Table()
}
 
SQL_Table() 
{
formatex(g_szQuery, charsmax(g_szQuery),"\
CREATE TABLE IF NOT EXISTS `lbz_users` (\
`AUTHID` varchar(32) NOT NULL,\
`MISSION` int(1) NOT NULL,\
`BONUS` int(1) NOT NULL,\
PRIMARY KEY (`AUTHID`))")
 
SQL_ThreadQuery(g_hSQLTuple, "QueryHandler", g_szQuery)
}
 
public QueryHandler(iFailState, Handle:hQuery, szError[], iErrnum, iData[], iSize, Float:fQueueTime) 
{
if(iFailState != TQUERY_SUCCESS) 
{
log_amx("QueryHandler(): SQL Error #%d - %s", iErrnum, szError)
return
}
}
 
public plugin_end() 
{
if (g_hSQLTuple) 
{
SQL_FreeHandle(g_hSQLTuple)
}
}
 
check_block_maps() 
{
new MapName[64], i
get_mapname(MapName, charsmax(MapName))
while(i < g_MapNum)
{
if(containi(MapName, g_Map[i++]) != -1) 
{
g_BlockMap = true
}
}
}
 
stock get_loguser_index()
{
new loguser[80], name[32]
read_logargv(0, loguser, charsmax(loguser))
parse_loguser(loguser, name, 31)
return get_user_index(name)
}
 
stock get_killer_weapon(killer,inflictor,retVar[],retLen) {
static killer_weapon_name[32]
killer_weapon_name = "world"
 
if(pev_valid(killer) && (pev(killer,pev_flags) & FL_CLIENT)) {
if(pev_valid(inflictor)) {
if(inflictor == killer) {
new weapon = get_user_weapon(killer)
get_weaponname(weapon,killer_weapon_name,31)
}
else pev(inflictor,pev_classname,killer_weapon_name,31)
}
} else {
if(pev_valid(killer)) pev(inflictor,pev_classname,killer_weapon_name,31)
else if(killer == 0) killer_weapon_name = "worldspawn"
}
if(equal(killer_weapon_name,"weapon_",7)) copy(killer_weapon_name,31,killer_weapon_name[7])
else if(equal(killer_weapon_name,"monster_",8)) copy(killer_weapon_name,31,killer_weapon_name[8])
else if(equal(killer_weapon_name,"func_",5)) copy(killer_weapon_name,31,killer_weapon_name[5])
 
copy(retVar,retLen,killer_weapon_name)
}
 

  • +
  • -
  • 0

#2 dasiek

    Nie wiem, nie znam się, nie orientuję się, zarobiony jestem.

  • Junior Admin

Reputacja: 2 063
Godlike

  • Postów:5 683
  • Imię:Adaś
  • Lokalizacja:Niedaleko WWy
Offline

Napisano 24.06.2021 16:31

Nazywaj tematy zgodnie z ich treścią.
Napisz ponownie temat nazywając go tak, aby każdy wiedział o co chodzi.

Jednoznacznie określ problematykę tematu, wyróżniając go spośród reszty.
Nie dodawaj zbędnych informacji, znaków, ani emotikon w nazwie tematu.

Ten temat w ciągu 24 godzin zostanie przeniesiony do kosza.
  • +
  • -
  • 0





Również z jednym lub większą ilością słów kluczowych: pomoc

Użytkownicy przeglądający ten temat: 0

0 użytkowników, 0 gości, 0 anonimowych


Coinsy CSGOAtse Za SMS, PSC , Przelew - CoinSell.pl