Witam, próbuję zrobić w sklepie "rzeczy dla ct i tt". Ale wszyscy mogą kupować owe przedmioty.
public jb_sklep(id) { new menu,formats[64]; formatex(formats,charsmax(formats),"\wSklep Zombie Escape^n\wIlosc Diamentow: \r%i",ilosc_jbpack[id]) menu = menu_create(formats,"handle_jb_sklep"); menu_additem(menu,"\wGranat zamrazajacy \r[\w4 Diamenty\r]\r[\w Human\r]","0") menu_additem(menu,"\wGranat oslepiajacy \r[\w3 Diamentow\r]\r[\w Human\r]","1") menu_additem(menu,"\wGranat podpalajacy \r[\w4 Diamentow\r]\r[\w Human\r]","2") menu_additem(menu,"\wKamizelka \r[\w8 Diamentow\r]\r[\w Human\r]","3") menu_additem(menu,"\wAutoBH na jedna runde \r[\w60 Diamentow\r]\r[\w Human\r]","4") menu_additem(menu,"\w+50 HP \r[\w30 Diamentow\r]\r[\w Human\r]","5") menu_additem(menu,"\wNiewidzialnosc (10s) \r[\w80 Diamenty\r]\r[\w Human\r]","6") menu_additem(menu,"\wCiche Chodzenie na jedna runde \r[\w50 Diamentow\r]\r[\w Human\r]","7") menu_additem(menu,"\wMniejsza grawitacja (30s) \r[\w50 Diamenty\r]\r[\w Human\r]","8") menu_additem(menu,"\wWieksza predkosc (30s) \r[\w100 Diamenty\r]\r[\w Human\r]","9") menu_additem(menu,"\w+500 HP \r[\w30 Diamentow\r]\r[\y Zombie\r]","10") menu_additem(menu,"\wNiesmiertelnosc i niewidzialnosc(10s) \r[\w100 Diamenty\r]\r[\w Zombie\r]","11") menu_setprop(menu,MPROP_EXIT,MEXIT_ALL) menu_setprop(menu,MPROP_EXITNAME,"Wyjscie") menu_setprop(menu,MPROP_NEXTNAME,"Dalej") menu_setprop(menu,MPROP_BACKNAME,"Wroc") menu_display(id,menu,0) return PLUGIN_HANDLED } public handle_jb_sklep(id, menu, item) { switch(item) { case 0: { if(!sprawdz(id,4,2)) return PLUGIN_HANDLED; // z tego co zrozumiałem to w tym "if(!sprawdz(id,4,2))" ostatnia cyfra to jest team. 1 = tt, 2 = ct. Ale nie działa. give_item(id, "weapon_smokegrenade"); ColorChat(id, GREEN, "[%s] Kupiles granat zamrazajacy", prefix); } case 1: { if(!sprawdz(id,3,2)) return PLUGIN_HANDLED; give_item(id, "weapon_flashbang"); ColorChat(id, GREEN, "[%s] Kupiles granat oslepiajacy", prefix); } case 2: { if(!sprawdz(id,4,2)) return PLUGIN_HANDLED; give_item(id, "weapon_hegrenade"); ColorChat(id, GREEN, "[%s] Kupiles granat wpodpalajacy", prefix); } case 3: { if(!sprawdz(id,8,2)) return PLUGIN_HANDLED; give_item(id, "item_kevlar") give_item(id, "item_assaultsuit") ColorChat(id, GREEN, "[%s] Kupiles kamizelke", prefix); } case 4: { if(!sprawdz(id,60,2)) return PLUGIN_HANDLED; bhop_enabled[id] = true ColorChat(id, GREEN, "[%s] Kupiles AutoBH na jedna runde", prefix); } case 5: { if(!sprawdz(id,30,2)) return PLUGIN_HANDLED; set_user_health(id, get_user_health(id) + 50) ColorChat(id, GREEN, "[%s] Kupiles +50hp", prefix); } case 6: { if(!sprawdz(id,80,2)) return PLUGIN_HANDLED; UruchomNiewidzialnosc(id); ColorChat(id, GREEN, "[%s] Kupiles ^x03Niewidzialnosc ^x01na 10 sekund!",prefix); set_user_rendering(id, kRenderFxNone, 0,0,0, kRenderTransAlpha, 0) } case 7: { if(!sprawdz(id,50,2)) return PLUGIN_HANDLED; set_user_footsteps(id, 1) ColorChat(id, GREEN, "[%s] Kupiles ciche chodzenie na jedna runde", prefix); } case 8: { if(!sprawdz(id,50,2)) return PLUGIN_HANDLED; UruchomGrawitacja(id); ColorChat(id, GREEN, "[%s] Kupiles ^x03Mniejsza grawitacje ^x01na 30 sekund!",prefix); set_user_gravity(id,0.4) } case 9: { if(!sprawdz(id,100,2)) return PLUGIN_HANDLED; UruchomSzybkosc(id) ColorChat(id, GREEN, "[%s] Kupiles ^x03Wieksza predkosc ^x01na 30 sekund!",prefix); set_user_maxspeed(id, 0.0) } case 10: { if(!sprawdz(id,30,1)) return PLUGIN_HANDLED; set_user_health(id, get_user_health(id) + 500) ColorChat(id, GREEN, "[%s] Kupiles +500hp", prefix); } case 11: { if(!sprawdz(id,100,1)) return PLUGIN_HANDLED; UruchomNiesmiertelnosc(id) ColorChat(id, GREEN, "[%s] Kupiles ^x03Niesmiertelnosc i niewidzialnosc ^x01na 10 sekund!",prefix); set_user_rendering(id, kRenderFxNone, 0,0,0, kRenderTransAlpha, 0) } } return PLUGIN_CONTINUE; } public sprawdz(id,jbpack,team){ if (ilosc_jbpack[id] >= jbpack){ ilosc_jbpack[id] -= jbpack return true; } if(!is_user_alive(id)){ ColorChat(id, GREEN, "[%s] Nie zyjesz", prefix); return false; } if(ilosc_jbpack[id] < jbpack) { ColorChat(id, GREEN, "[%s] Nie masz tylu Diamentow, aby to kupic", prefix); return false; } if(get_user_team(id) != team) // próbowałem tak... { ColorChat(id, GREEN, "[%s] Ten przedmiot jest niedostepny dla twojej druzyny.", prefix); return false; } return PLUGIN_CONTINUE; }
Wiem że tak mogę zrobić, ale w menu pokazuję mi tylko itemy wybranego teamu:
new menu,formats[64]; formatex(formats,charsmax(formats),"\wSklep Zombie Escape^n\wIlosc Diamentow: \r%i",ilosc_jbpack[id]) menu = menu_create(formats,"handle_jb_sklep"); if(get_user_team(id) == 2) { menu_additem(menu,"\wGranat zamrazajacy \r[\w4 Diamenty\r]\r[\w Human\r]","0") menu_additem(menu,"\wGranat oslepiajacy \r[\w3 Diamentow\r]\r[\w Human\r]","1") menu_additem(menu,"\wGranat podpalajacy \r[\w4 Diamentow\r]\r[\w Human\r]","2") menu_additem(menu,"\wKamizelka \r[\w8 Diamentow\r]\r[\w Human\r]","3") menu_additem(menu,"\wAutoBH na jedna runde \r[\w60 Diamentow\r]\r[\w Human\r]","4") menu_additem(menu,"\w+50 HP \r[\w30 Diamentow\r]\r[\w Human\r]","5") menu_additem(menu,"\wNiewidzialnosc (10s) \r[\w80 Diamenty\r]\r[\w Human\r]","6") menu_additem(menu,"\wCiche Chodzenie na jedna runde \r[\w50 Diamentow\r]\r[\w Human\r]","7") menu_additem(menu,"\wMniejsza grawitacja (30s) \r[\w50 Diamenty\r]\r[\w Human\r]","8") menu_additem(menu,"\wWieksza predkosc (30s) \r[\w100 Diamenty\r]\r[\w Human\r]","9") } if(get_user_team(id) == 1) { menu_additem(menu,"\w+500 HP \r[\w30 Diamentow\r]\r[\y Zombie\r]","10") menu_additem(menu,"\wNiesmiertelnosc i niewidzialnosc(10s) \r[\w100 Diamenty\r]\r[\w Zombie\r]","11") } menu_setprop(menu,MPROP_EXIT,MEXIT_ALL) menu_setprop(menu,MPROP_EXITNAME,"Wyjscie") menu_setprop(menu,MPROP_NEXTNAME,"Dalej") menu_setprop(menu,MPROP_BACKNAME,"Wroc") menu_display(id,menu,0) return PLUGIN_HANDLED }
A chciałem żeby wszystko razem było.
Proszę o szybką pomoc.
Nagradzam +.
Użytkownik protypek edytował ten post 11.03.2016 13:15