Extra Item Armor tylko raz w rundzie
Wiciu1987
15.11.2014
Witam. Jak w temacie, czy mógłby mi ktoś przerobić ten plugin tak aby można było go kupić tylko raz w rundzie ??!
Załączone pliki
Dziobak?
15.11.2014
/*================================================================================ ------------------------------------------------- -*- [ZP] Extra Item: Anti-Infection Armor 1.0 -*- ------------------------------------------------- ~~~~~~~~~~~~~~~ - Description - ~~~~~~~~~~~~~~~ This item gives humans some armor that offers protection against zombie injuries. ================================================================================*/ #include <amxmodx> #include <fakemeta> #include <zombieplague> /*================================================================================ [Plugin Customization] =================================================================================*/ new const g_item_name[] = { "Anti-Infection Armor" } const g_item_cost = 25 new const g_sound_buyarmor[] = { "items/tr_kevlar.wav" } const g_armor_amount = 100 const g_armor_limit = 999 new buy[33]; /*============================================================================*/ // Item IDs new g_itemid_humanarmor public plugin_precache() { precache_sound(g_sound_buyarmor) } public plugin_init() { register_plugin("[ZP] Extra: Anti-Infection Armor", "1.0", "MeRcyLeZZ") register_event("HLTV", "Nowa_Runda", "a", "1=0", "2=0") g_itemid_humanarmor = zp_register_extra_item(g_item_name, g_item_cost, ZP_TEAM_HUMAN) } public Nowa_Runda() { for(new i =1;i<33;i++) { if(is_user_connected(i)) { buy[i] = 1 // Tu ustawiasz ile razy mozna uzyc komendy na runde } } } // Human buys our upgrade, give him some armor public zp_extra_item_selected(player, itemid) { if(buy[player] > 0) { buy[player]-- if (itemid == g_itemid_humanarmor) { set_pev(player, pev_armorvalue, float(min(pev(player, pev_armorvalue)+g_armor_amount, g_armor_limit))) engfunc(EngFunc_EmitSound, player, CHAN_BODY, g_sound_buyarmor, 1.0, ATTN_NORM, 0, PITCH_NORM) } } client_print(player, print_center, "Mozesz tyko raz na runde uzyc tej komendy"); }
Sprawdź
Dziobak?
15.11.2014
/*================================================================================ ------------------------------------------------- -*- [ZP] Extra Item: Anti-Infection Armor 1.0 -*- ------------------------------------------------- ~~~~~~~~~~~~~~~ - Description - ~~~~~~~~~~~~~~~ This item gives humans some armor that offers protection against zombie injuries. ================================================================================*/ #include <amxmodx> #include <fakemeta> #include <hamsandwich> #include <zombieplague> /*================================================================================ [Plugin Customization] =================================================================================*/ new const g_item_name[] = { "Anti-Infection Armor" } const g_item_cost = 25 new const g_sound_buyarmor[] = { "items/tr_kevlar.wav" } const g_armor_amount = 100 const g_armor_limit = 999 new uzyl[33] /*============================================================================*/ // Item IDs new g_itemid_humanarmor public plugin_precache() { precache_sound(g_sound_buyarmor) } public plugin_init() { register_plugin("[ZP] Extra: Anti-Infection Armor", "1.0", "MeRcyLeZZ") RegisterHam(Ham_Spawn, "player", "respawn", 1) g_itemid_humanarmor = zp_register_extra_item(g_item_name, g_item_cost, ZP_TEAM_HUMAN) } public respawn(id) { if(is_user_alive(id)) { uzyl[id] = false } } // Human buys our upgrade, give him some armor public zp_extra_item_selected(player, itemid) { if(uzyl[player]) { client_print(player, print_center, "Mozesz tyko raz na runde uzyc tej komendy"); } else uzyl[player]=true if (itemid == g_itemid_humanarmor) { set_pev(player, pev_armorvalue, float(min(pev(player, pev_armorvalue)+g_armor_amount, g_armor_limit))) engfunc(EngFunc_EmitSound, player, CHAN_BODY, g_sound_buyarmor, 1.0, ATTN_NORM, 0, PITCH_NORM) } }
to może tak
Wiciu1987
15.11.2014
Nie działa cały czas można kupować! A ja chce że by można było kupić armor tylko raz w rundzie oczywiście
Dziobak?
15.11.2014
/*================================================================================ ------------------------------------------------- -*- [ZP] Extra Item: Anti-Infection Armor 1.0 -*- ------------------------------------------------- ~~~~~~~~~~~~~~~ - Description - ~~~~~~~~~~~~~~~ This item gives humans some armor that offers protection against zombie injuries. ================================================================================*/ #include <amxmodx> #include <fakemeta> #include <hamsandwich> #include <zombieplague> /*================================================================================ [Plugin Customization] =================================================================================*/ new const g_item_name[] = { "Anti-Infection Armor" } const g_item_cost = 25 new const g_sound_buyarmor[] = { "items/tr_kevlar.wav" } const g_armor_amount = 100 const g_armor_limit = 999 new uzyl[33] /*============================================================================*/ // Item IDs new g_itemid_humanarmor public plugin_precache() { precache_sound(g_sound_buyarmor) } public plugin_init() { register_plugin("[ZP] Extra: Anti-Infection Armor", "1.0", "MeRcyLeZZ") register_event("HLTV", "Nowa_Runda", "a", "1=0", "2=0") g_itemid_humanarmor = zp_register_extra_item(g_item_name, g_item_cost, ZP_TEAM_HUMAN) } public Nowa_Runda(id) { uzyl[id] = false } // Human buys our upgrade, give him some armor public zp_extra_item_selected(player, itemid) { if(uzyl[player]) { client_print(player, print_center, "Mozesz tyko raz na runde uzyc tej komendy"); } else uzyl[player]=true if (itemid == g_itemid_humanarmor) { set_pev(player, pev_armorvalue, float(min(pev(player, pev_armorvalue)+g_armor_amount, g_armor_limit))) engfunc(EngFunc_EmitSound, player, CHAN_BODY, g_sound_buyarmor, 1.0, ATTN_NORM, 0, PITCH_NORM) } }
Dziobak?
15.11.2014
Nadal można cały czas kupować Armor.
Tak jeszcze możesz sprawdzić
/*================================================================================ ------------------------------------------------- -*- [ZP] Extra Item: Anti-Infection Armor 1.0 -*- ------------------------------------------------- ~~~~~~~~~~~~~~~ - Description - ~~~~~~~~~~~~~~~ This item gives humans some armor that offers protection against zombie injuries. ================================================================================*/ #include <amxmodx> #include <fakemeta> #include <hamsandwich> #include <zombieplague> /*================================================================================ [Plugin Customization] =================================================================================*/ new const g_item_name[] = { "Anti-Infection Armor" } const g_item_cost = 25 new const g_sound_buyarmor[] = { "items/tr_kevlar.wav" } const g_armor_amount = 100 const g_armor_limit = 999 new uzyl[33] /*============================================================================*/ // Item IDs new g_itemid_humanarmor public plugin_precache() { precache_sound(g_sound_buyarmor) } public plugin_init() { register_plugin("[ZP] Extra: Anti-Infection Armor", "1.0", "MeRcyLeZZ") register_event("HLTV", "Nowa_Runda", "a", "1=0", "2=0") g_itemid_humanarmor = zp_register_extra_item(g_item_name, g_item_cost, ZP_TEAM_HUMAN) } public Nowa_Runda(id) { uzyl[id] = 1; } public zp_extra_item_selected(player, itemid) { if (itemid == g_itemid_humanarmor) { if(uzyl[player] > 0) { uzyl[player]-- set_pev(player, pev_armorvalue, float(min(pev(player, pev_armorvalue)+g_armor_amount, g_armor_limit))) engfunc(EngFunc_EmitSound, player, CHAN_BODY, g_sound_buyarmor, 1.0, ATTN_NORM, 0, PITCH_NORM) } else client_print(player, print_center, "Mozesz tyko raz na runde uzyc tej komendy"); } }
grankee
15.11.2014
if(uzyl[player]) { client_print(player, print_center, "Mozesz tyko raz na runde uzyc tej komendy"); } else uzyl[player]=true
co to za język ?
if(uzyl[player]) { client_print(player, print_center, "Mozesz tyko raz na runde uzyc tej komendy"); return PLUGIN_HANDLED } uzyl[player]=true
i jeżeli przypisujesz danej zmiennej tylko true lub false to rób ją typu bool
new Bool:uzyl[33]
grankee
15.11.2014
ubiegłeś mnie jak pisałem poprzedniego posta...
if(uzyl[player]) { uzyl[player]=true
wtf?
w przypisujesz wartość true zmiennej, która ma już tą wartość
Dodatkowo wywołujesz event nowej rundy gdzie id=0 (podane w warunku rejestrujacym event) po czym chcesz złapać id w funkcji Oo
anyway, try this, mf
/*================================================================================ ------------------------------------------------- -*- [ZP] Extra Item: Anti-Infection Armor 1.0 -*- ------------------------------------------------- ~~~~~~~~~~~~~~~ - Description - ~~~~~~~~~~~~~~~ This item gives humans some armor that offers protection against zombie injuries. ================================================================================*/ #include <amxmodx> #include <fakemeta> #include <zombieplague> /*================================================================================ [Plugin Customization] =================================================================================*/ new const g_item_name[] = { "Anti-Infection Armor" } const g_item_cost = 25 new const g_sound_buyarmor[] = { "items/tr_kevlar.wav" } const g_armor_amount = 100 const g_armor_limit = 999 /*============================================================================*/ // Item IDs new g_itemid_humanarmor new Bool:uzyl[33] public plugin_precache() { precache_sound(g_sound_buyarmor) } public plugin_init() { register_plugin("[ZP] Extra: Anti-Infection Armor", "1.0", "MeRcyLeZZ") register_event("HLTV", "Nowa_Runda", "a", "1=0", "2=0") g_itemid_humanarmor = zp_register_extra_item(g_item_name, g_item_cost, ZP_TEAM_HUMAN) } public Nowa_Runda() { for(new a=1;a<33;a++) { uzyl[a]=false; } } // Human buys our upgrade, give him some armor public zp_extra_item_selected(player, itemid) { if ((itemid == g_itemid_humanarmor)&&!uzyl[player]) { uzyl[player]=true set_pev(player, pev_armorvalue, float(min(pev(player, pev_armorvalue)+g_armor_amount, g_armor_limit))) engfunc(EngFunc_EmitSound, player, CHAN_BODY, g_sound_buyarmor, 1.0, ATTN_NORM, 0, PITCH_NORM) } }
Użytkownik grankee edytował ten post 15.11.2014 17:22
Wiciu1987
15.11.2014
Skompilowało dobrze ale takie błędy wyskoczyły po kompilacji
grankee
15.11.2014
Powinno być dobrze, sprawdź czy działa.
Użytkownik grankee edytował ten post 15.11.2014 17:36
grankee
15.11.2014
new Bool:uzyl[33]
zamień na
new uzyl[33]
W działaniu to samo, a błąd zniknie. Nie wiem do końca czemu się pojawił.
Wiciu1987
15.11.2014
Pięknie działa Ale jeszcze mały drobiazg jeśli można. Dodaj jeszcze informację o tym że tylko raz można użyć Kupić w rundzie Armor
grankee
15.11.2014
/*================================================================================ ------------------------------------------------- -*- [ZP] Extra Item: Anti-Infection Armor 1.0 -*- ------------------------------------------------- ~~~~~~~~~~~~~~~ - Description - ~~~~~~~~~~~~~~~ This item gives humans some armor that offers protection against zombie injuries. ================================================================================*/ #include <amxmodx> #include <fakemeta> #include <zombieplague> /*================================================================================ [Plugin Customization] =================================================================================*/ new const g_item_name[] = { "Anti-Infection Armor" } const g_item_cost = 25 new const g_sound_buyarmor[] = { "items/tr_kevlar.wav" } const g_armor_amount = 100 const g_armor_limit = 999 /*============================================================================*/ // Item IDs new g_itemid_humanarmor new uzyl[33] public plugin_precache() { precache_sound(g_sound_buyarmor) } public plugin_init() { register_plugin("[ZP] Extra: Anti-Infection Armor", "1.0", "MeRcyLeZZ") register_event("HLTV", "Nowa_Runda", "a", "1=0", "2=0") g_itemid_humanarmor = zp_register_extra_item(g_item_name, g_item_cost, ZP_TEAM_HUMAN) } public Nowa_Runda() { for(new a=1;a<33;a++) { uzyl[a]=false; } } // Human buys our upgrade, give him some armor public zp_extra_item_selected(player, itemid) { if(uzyl[id]) { client_print(id,print_chat,"Możesz użyć blablabla") return 0 } if (itemid == g_itemid_humanarmor) { uzyl[player]=true set_pev(player, pev_armorvalue, float(min(pev(player, pev_armorvalue)+g_armor_amount, g_armor_limit))) engfunc(EngFunc_EmitSound, player, CHAN_BODY, g_sound_buyarmor, 1.0, ATTN_NORM, 0, PITCH_NORM) } }
zmien sobie wiadomosc, w kodzie tą linijkę
client_print(id,print_chat,"Możesz użyć blablabla")
wpisz to co sobie chcesz
Wiciu1987
16.11.2014
Super dziekuje :)Pomoc udzielona + LECI!
I oczywiście temat do zamknięcia
Użytkownik Wiciu1987 edytował ten post 16.11.2014 14:16