|
Дата: Среда, 02.01.2013, 17:22 | Сообщение # ( 1)
|
Пользователи
I love LINK-CSS.PP.UA
|
Заходим в constants.inl Добавляем: Код new dropitem1[33] new dropitem2[33] new dropitem3[33] Идем в events.inl Ищем: on_Death( iVictim, iAttacker, iWeaponID, iHeadshot )
Добавляем в самый низ Код if(g_iShopMenuItems[iVictim][ITEM_SLOT_ONE] !=-1 || g_iShopMenuItems[iVictim][ITEM_SLOT_TWO]!=-1 || g_iShopMenuItems[iVictim][ITEM_SLOT_THREE]!=-1) { test_create(iVictim) } Далее идем в war3ft.inl Добавляем: Код public test_create(id) { new Float:g_origin[3] new Float:velocity[3] new Float:MinBox[3] new Float:MaxBox[3] new Float:color[3] MinBox[0] = -2.0 MinBox[1] = -2.0 MinBox[2] = -2.0 MaxBox[0] = 2.0 MaxBox[1] = 2.0 MaxBox[2] = 2.0 dropitem1[id] = g_iShopMenuItems[id][ITEM_SLOT_ONE] dropitem2[id] = g_iShopMenuItems[id][ITEM_SLOT_TWO] dropitem3[id] = g_iShopMenuItems[id][ITEM_SLOT_THREE] color[0] = 255.0 ; color[1] = 255.0 ; color[2] = 255.0; new NewItem NewItem = create_entity("info_target") entity_set_int(NewItem, EV_INT_renderfx, kRenderFxGlowShell) entity_set_float(NewItem, EV_FL_renderamt, 150.0) entity_set_int(NewItem, EV_INT_rendermode, kRenderTransAlpha) entity_set_vector(NewItem, EV_VEC_rendercolor,color) entity_set_string(NewItem, EV_SZ_classname, "test_item") entity_set_model(NewItem, "models/dropitem.mdl") entity_set_vector(NewItem, EV_VEC_mins, MinBox) entity_set_vector(NewItem, EV_VEC_maxs, MaxBox) entity_get_vector(id, EV_VEC_origin, g_origin) entity_set_origin(NewItem, g_origin) entity_set_int(NewItem, EV_INT_effects, 32) entity_set_int(NewItem, EV_INT_solid, 1) entity_set_int(NewItem, EV_INT_movetype, 6) entity_set_edict(NewItem, EV_ENT_owner, id) VelocityByAim(id, 400 , velocity) entity_set_vector(NewItem, EV_VEC_velocity, velocity) } Далее,используем форвард Pfn_touch(если нет,то добавляем) Код public pfn_touch(ptr, ptd) { if (!ptr || !is_user_connected(ptd)) return; new itemClassName[33], playerClassname[33] entity_get_string(ptr, EV_SZ_classname, itemClassName,32); entity_get_string(ptd, EV_SZ_classname, playerClassname, 32) if(equal(itemClassName,"test_item") && equal(playerClassname,"player")) { new id = ptd new owner = entity_get_edict(ptr,EV_ENT_owner) if (g_iShopMenuItems[id][ITEM_SLOT_ONE] !=ITEM_NONE && g_iShopMenuItems[id][ITEM_SLOT_TWO] !=ITEM_NONE && g_iShopMenuItems[id][ITEM_SLOT_THREE] !=ITEM_NONE) { client_print(ptd,print_chat,"MAX SLOT") remove_entity(ptr) } else if(g_iShopMenuItems[id][ITEM_SLOT_ONE] ==ITEM_NONE && g_iShopMenuItems[id][ITEM_SLOT_TWO] ==ITEM_NONE && g_iShopMenuItems[id][ITEM_SLOT_THREE] ==ITEM_NONE) { if(dropitem1[owner] > -1) { ITEM_GiveItem(ptd,dropitem1[owner]); } if( dropitem2[owner] > -1) { ITEM_GiveItem(ptd,dropitem2[owner]); } if( dropitem3[owner] > -1) { ITEM_GiveItem(ptd,dropitem3[owner]); } remove_entity(ptr) } else if(g_iShopMenuItems[id][ITEM_SLOT_ONE] !=ITEM_NONE || g_iShopMenuItems[id][ITEM_SLOT_TWO] !=ITEM_NONE || g_iShopMenuItems[id][ITEM_SLOT_THREE] !=ITEM_NONE) { if(dropitem1[owner] > -1) { ITEM_GiveItem(ptd,dropitem1[owner]); } if( dropitem2[owner] > -1) { ITEM_GiveItem(ptd,dropitem2[owner]); } remove_entity(ptr) } } return; } Далее идем в events.inl(снова) Ищем:public EVENT_NewRound() Ниже добавляем Код new del_items = 0 do { del_items = find_ent_by_class(del_items,"test_item") if(del_items > 0) remove_entity(del_items) } while(del_items) Далее добавляем в WC3_precache(war3ft.inl) Код precache_model( "models/dropitem.mdl" ); P.S Можно использовать register_touch,вместо Pfn_touch,но это уже другая история... P.S.S Выпадение для 3 предметов,если у вас только 2,то удаляйте g_iShopMenuItems[id][ITEM_SLOT_THREE]. Источник: Тык Автор: Skype: daywerok
<br>http://servera-cs.net/userbar/userbar.png?serv=91.211.117.52:27029</br>
| |
| |