Witam , mam problem zrobiłem VIPa w Generator VIPA ale mam jeden problem :
Opis sytuacji:
Minie 2 runda wybiorę broń z Menu VIPa np. AK47 + Deagle i jak wygram rundę i będzię następna i znów wyskakuje jak zawsze Menu VIPA i wezmę np M4A1 + Deagle to będę miał 2 bronie AK z poprzedniej rundy i M4 , tak jest jak po wygranej rundy nie wyrzucę broni .
proszę o naprawienie to !
A o to .sma vipa:
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.
|
Guest Message by DevFuse
Problem z broniami w pluginie VIP
Temat rozp.
Mr.Dziobak
, 18.01.2013 15:15
- Temat jest zamknięty
8 odpowiedzi w tym temacie
#2 Amaroq
Napisano 18.01.2013 15:26
Plugin informujący o zabiciu zakładnika (wysyła do admina na say nick gracza oraz zapisuje o tym logi) - Hostage Killer v1.3.3
DarkGL to mój autorytet.
DarkGL to mój autorytet.
#3 Gość_21977_*
- Gość
Reputacja: 0
Offline
Napisano 21.01.2013 00:37
Stosując kod FD_GODPL, po wybraniu broni z menu, gracz bezpowrotnie straci bombę.
Zdecydowanie bardziej polecam zastosować usunięcie jedynie broni ze slotów 1 i 2, co zaoszczędzi zniknięciu jedynej bomby, a tym
samym niemożliwości wykonania celów mapy, a także m.in. wyświetlania ikony noża, którego tak naprawdę nie otrzymujemy dwukrotnie.
Zdecydowanie bardziej polecam zastosować usunięcie jedynie broni ze slotów 1 i 2, co zaoszczędzi zniknięciu jedynej bomby, a tym
samym niemożliwości wykonania celów mapy, a także m.in. wyświetlania ikony noża, którego tak naprawdę nie otrzymujemy dwukrotnie.
StripWeapons(id, Primary);
StripWeapons(id, Secondary);
Spoiler
#if defined _stripweapons_included
#endinput
#endif
#define _stripweapons_included
#include <fakemeta>
#include <hamsandwich>
/*
* Strips a player's weapon based on type.
*
* @param id: Player id
* @param type: Weapon type (check enum below for types)
* @param bSwitchIfActive: Switch to other weapon before stripping
* if stripped weapon is currently deployed
* @return: 1 on success, otherwise 0
*
* Ex: StripWeapons(id, Secondary); // Strips secondary weapon with switching if deployed.
* StripWeapons(iPlayer, C4, false); // Strips c4 without switching if deployed.
*/
enum /* Weapon types */
{
Primary = 1
, Secondary
, Knife
, Grenades
, C4
};
stock StripWeapons(id, Type, bool: bSwitchIfActive = true)
{
new iReturn;
if(is_user_alive(id))
{
new iEntity, iWeapon;
while((iWeapon = GetWeaponFromSlot(id, Type, iEntity)) > 0)
iReturn = ham_strip_user_weapon(id, iWeapon, Type, bSwitchIfActive);
}
return iReturn;
}
/*
* bugsy
* http://forums.allied...989&postcount=2
*
* Gets a weapon entity id based on inventory slot.
*
* @param id: Player id
* @param iSlot: Inventory slot you want to get the weaponid from
* @param &iEntity: Weapon entity id
* @return: Weapon CSW_* index on success, otherwise 0
*
* Ex: GetWeaponFromSlot(id, 3, iEntity); // Should return CSW_KNIFE if player has one.
* // Knife is always in 3th slot (if not changed with plugin or something);
*/
stock GetWeaponFromSlot( id , iSlot , &iEntity )
{
if ( !( 1 <= iSlot <= 5 ) )
return 0;
iEntity = 0;
const m_rgpPlayerItems_Slot0 = 367;
const m_iId = 43;
const XO_WEAPONS = 4;
const XO_PLAYER = 5;
iEntity = get_pdata_cbase( id , m_rgpPlayerItems_Slot0 + iSlot , XO_PLAYER );
return ( iEntity > 0 ) ? get_pdata_int( iEntity , m_iId , XO_WEAPONS ) : 0;
}
/*
* ConnorMcLeod
* http://forums.allied...47&postcount=42
*
* Strips a player's weapon based on weapon index.
*
* @param id: Player id
* @param iCswId: Weapon CSW_* index
* @param iSlot: Inventory slot (Leave 0 if not sure)
* @param bSwitchIfActive: Switch weapon if currently deployed
* @return: 1 on success, otherwise 0
*
* Ex: ham_strip_user_weapon(id, CSW_M4A1); // Strips m4a1 if user has one.
* ham_strip_user_weapon(id, CSW_HEGRENADE, _, false); // Strips HE grenade if user has one
* // without switching weapons.
*/
stock ham_strip_user_weapon(id, iCswId, iSlot = 0, bool:bSwitchIfActive = true)
{
new iWeapon
if( !iSlot )
{
static const iWeaponsSlots[] = {
-1,
2, //CSW_P228
-1,
1, //CSW_SCOUT
4, //CSW_HEGRENADE
1, //CSW_XM1014
5, //CSW_C4
1, //CSW_MAC10
1, //CSW_AUG
4, //CSW_SMOKEGRENADE
2, //CSW_ELITE
2, //CSW_FIVESEVEN
1, //CSW_UMP45
1, //CSW_SG550
1, //CSW_GALIL
1, //CSW_FAMAS
2, //CSW_USP
2, //CSW_GLOCK18
1, //CSW_AWP
1, //CSW_MP5NAVY
1, //CSW_M249
1, //CSW_M3
1, //CSW_M4A1
1, //CSW_TMP
1, //CSW_G3SG1
4, //CSW_FLASHBANG
2, //CSW_DEAGLE
1, //CSW_SG552
1, //CSW_AK47
3, //CSW_KNIFE
1 //CSW_P90
}
iSlot = iWeaponsSlots[iCswId]
}
const XTRA_OFS_PLAYER = 5
const m_rgpPlayerItems_Slot0 = 367
iWeapon = get_pdata_cbase(id, m_rgpPlayerItems_Slot0 + iSlot, XTRA_OFS_PLAYER)
const XTRA_OFS_WEAPON = 4
const m_pNext = 42
const m_iId = 43
while( iWeapon > 0 )
{
if( get_pdata_int(iWeapon, m_iId, XTRA_OFS_WEAPON) == iCswId )
{
break
}
iWeapon = get_pdata_cbase(iWeapon, m_pNext, XTRA_OFS_WEAPON)
}
if( iWeapon > 0 )
{
const m_pActiveItem = 373
if( bSwitchIfActive && get_pdata_cbase(id, m_pActiveItem, XTRA_OFS_PLAYER) == iWeapon )
{
ExecuteHamB(Ham_Weapon_RetireWeapon, iWeapon)
}
if( ExecuteHamB(Ham_RemovePlayerItem, id, iWeapon) )
{
user_has_weapon(id, iCswId, 0)
ExecuteHamB(Ham_Item_Kill, iWeapon)
return 1
}
}
return 0
}
Użytkownik benio101 edytował ten post 21.01.2013 02:26
#5 Endriuu
Napisano 28.01.2013 00:21
witam, mam identyczny problem
benio, kod .sma który podałeś mam rozumieć, że zmniejsza ilość slotow broni, tylko jest problem ponieważ nie da się skompilować tego kodu, jakieś błędy
kod .sma mojego vipa
benio, kod .sma który podałeś mam rozumieć, że zmniejsza ilość slotow broni, tylko jest problem ponieważ nie da się skompilować tego kodu, jakieś błędy
kod .sma mojego vipa
Spoiler
#include <amxmodx> #include <colorchat> #include <cstrike> #include <csx> #include <engine> #include <fun> #include <hamsandwich> new Array:g_Array, bool:g_Vip[33], gRound=0, maxPlayers, menu, menu_callback_handler, weapon_id; new const g_Langcmd[][]={"say /vips","say_team /vips","say /vipy","say_team /vipy"}; public plugin_init(){ register_plugin("VIP Ultimate", "8.0.0.2", "benio101 & speedkill"); RegisterHam(Ham_Spawn, "player", "SpawnedEventPre", 1); register_event("HLTV", "event_new_round", "a", "1=0", "2=0"); register_logevent("GameCommencing", 2, "1=Game_Commencing"); register_event("DeathMsg", "DeathMsg", "a"); register_message(get_user_msgid("ScoreAttrib"), "VipStatus"); g_Array=ArrayCreate(64,32); for(new i;i<sizeof g_Langcmd;i++){ register_clcmd(g_Langcmd[i], "ShowVips"); } register_clcmd("say /vip", "ShowMotd"); register_logevent("RoundEnd", 2, "1=Round_End"); } public client_authorized(id){ if(get_user_flags(id) & 524288 == 524288){ client_authorized_vip(id); } } public client_authorized_vip(id){ g_Vip[id]=true; new g_Name[64]; get_user_name(id,g_Name,charsmax(g_Name)); new g_Size = ArraySize(g_Array); new szName[64]; for(new i = 0; i < g_Size; i++){ ArrayGetString(g_Array, i, szName, charsmax(szName)); if(equal(g_Name, szName)){ return 0; } } ArrayPushString(g_Array,g_Name); return PLUGIN_CONTINUE; } public client_disconnect(id){ if(g_Vip[id]){ client_disconnect_vip(id); } } public client_disconnect_vip(id){ g_Vip[id]=false; new Name[64]; get_user_name(id,Name,charsmax(Name)); new g_Size = ArraySize(g_Array); new g_Name[64]; for(new i = 0; i < g_Size; i++){ ArrayGetString(g_Array, i, g_Name, charsmax(g_Name)); if(equal(g_Name,Name)){ ArrayDeleteItem(g_Array,i); break; } } } public SpawnedEventPre(id){ if(g_Vip[id]){ if(is_user_alive(id)){ SpawnedEventPreVip(id); } } } public event_new_round(){ ++gRound; } public GameCommencing(){ gRound=0; } public SpawnedEventPreVip(id){ if(gRound<=2){ if(gRound>=1){ give_item(id, "weapon_hegrenade"); give_item(id, "weapon_flashbang"); cs_set_user_bpammo(id, CSW_FLASHBANG,2); give_item(id, "weapon_smokegrenade"); } } if(get_user_team(id)==2){ give_item(id, "item_thighpack"); } show_vip_menu(id); } public DeathMsg(){ new killer=read_data(1); new victim=read_data(2); if(is_user_alive(killer) && g_Vip[killer] && get_user_team(killer) != get_user_team(victim)){ DeathMsgVip(killer,victim,read_data(3)); } } public DeathMsgVip(kid,vid,hs){ set_user_health(kid, min(get_user_health(kid)+(hs?15:10),100)); cs_set_user_money(kid, cs_get_user_money(kid)+(hs?350:200)); } public show_vip_menu(id){ menu=menu_create("\Menu VIPa","menu_handler"); menu_callback_handler=menu_makecallback("menu_callback"); new bool:active=false, num=-1; menu_additem(menu,"\Wez Deagle+M4A1","",0,menu_callback_handler); if(menu_callback(id, menu, ++num)){ active=true; } menu_additem(menu,"\Wez Deagle+AK47","",0,menu_callback_handler); if(menu_callback(id, menu, ++num)){ active=true; } if(active){ menu_setprop(menu,MPROP_EXITNAME,"Wyjscie"); menu_setprop(menu,MPROP_TITLE,"\Menu Vipa"); menu_setprop(menu,MPROP_NUMBER_COLOR,"\"); menu_display(id, menu); } else { menu_destroy(menu); } } public recharge(id){ switch(get_user_weapon(id)){ case CSW_GLOCK18:cs_set_weapon_ammo(find_ent_by_owner(-1, "weapon_glock18",id),20); case CSW_USP:cs_set_weapon_ammo(find_ent_by_owner(-1, "weapon_usp",id),12); case CSW_P228:cs_set_weapon_ammo(find_ent_by_owner(-1, "weapon_p228",id),13); case CSW_DEAGLE:cs_set_weapon_ammo(find_ent_by_owner(-1, "weapon_deagle",id),7); case CSW_FIVESEVEN:cs_set_weapon_ammo(find_ent_by_owner(-1, "weapon_fiveseven",id),20); case CSW_ELITE:cs_set_weapon_ammo(find_ent_by_owner(-1, "weapon_elite",id),30); case CSW_M3:cs_set_weapon_ammo(find_ent_by_owner(-1, "weapon_m3",id),8); case CSW_XM1014:cs_set_weapon_ammo(find_ent_by_owner(-1, "weapon_xm1014",id),7); case CSW_TMP:cs_set_weapon_ammo(find_ent_by_owner(-1, "weapon_tmp",id),30); case CSW_MAC10:cs_set_weapon_ammo(find_ent_by_owner(-1, "weapon_mac10",id),30); case CSW_MP5NAVY:cs_set_weapon_ammo(find_ent_by_owner(-1, "weapon_mp5navy",id),30); case CSW_UMP45:cs_set_weapon_ammo(find_ent_by_owner(-1, "weapon_ump45",id),25); case CSW_P90:cs_set_weapon_ammo(find_ent_by_owner(-1, "weapon_p90",id),50); case CSW_FAMAS:cs_set_weapon_ammo(find_ent_by_owner(-1, "weapon_famas",id),30); case CSW_GALIL:cs_set_weapon_ammo(find_ent_by_owner(-1, "weapon_galil",id),35); case CSW_AK47:cs_set_weapon_ammo(find_ent_by_owner(-1, "weapon_ak47",id),30); case CSW_M4A1:cs_set_weapon_ammo(find_ent_by_owner(-1, "weapon_m4a1",id),30); case CSW_SCOUT:cs_set_weapon_ammo(find_ent_by_owner(-1, "weapon_scout",id),10); case CSW_SG552:cs_set_weapon_ammo(find_ent_by_owner(-1, "weapon_sg552",id),30); case CSW_AUG:cs_set_weapon_ammo(find_ent_by_owner(-1, "weapon_aug",id),30); case CSW_SG550:cs_set_weapon_ammo(find_ent_by_owner(-1, "weapon_sg550",id),30); case CSW_G3SG1:cs_set_weapon_ammo(find_ent_by_owner(-1, "weapon_g3sg1",id),20); case CSW_AWP:cs_set_weapon_ammo(find_ent_by_owner(-1, "weapon_awp",id),10); case CSW_M249:cs_set_weapon_ammo(find_ent_by_owner(-1, "weapon_m249",id),100); } } public menu_callback(id, menu, item){ if(gRound>=3){ if(is_user_alive(id)){ if(item==0){ return ITEM_ENABLED; } if(item==1){ return ITEM_ENABLED; } } } return ITEM_DISABLED; } public menu_handler(id, menu, item){ if(gRound>=3){ if(is_user_alive(id)){ if(item==0){ give_item(id, "weapon_deagle"); give_item(id, "ammo_50ae"); weapon_id=find_ent_by_owner(-1, "weapon_deagle", id); if(weapon_id)cs_set_weapon_ammo(weapon_id, 7); cs_set_user_bpammo(id, CSW_DEAGLE, 35); recharge(id); give_item(id, "weapon_m4a1"); give_item(id, "ammo_556nato"); weapon_id=find_ent_by_owner(-1, "weapon_m4a1", id); if(weapon_id)cs_set_weapon_ammo(weapon_id, 30); cs_set_user_bpammo(id, CSW_M4A1, 90); give_item(id, "weapon_hegrenade"); give_item(id, "weapon_flashbang"); give_item(id, "weapon_flashbang"); } if(item==1){ give_item(id, "weapon_deagle"); give_item(id, "ammo_50ae"); weapon_id=find_ent_by_owner(-1, "weapon_deagle", id); if(weapon_id)cs_set_weapon_ammo(weapon_id, 7); cs_set_user_bpammo(id, CSW_DEAGLE, 35); recharge(id); give_item(id, "weapon_ak47"); give_item(id, "ammo_762nato"); weapon_id=find_ent_by_owner(-1, "weapon_ak47", id); if(weapon_id)cs_set_weapon_ammo(weapon_id, 30); cs_set_user_bpammo(id, CSW_AK47, 90); give_item(id, "weapon_hegrenade"); give_item(id, "weapon_flashbang"); give_item(id, "weapon_flashbang"); } } } menu_destroy(menu); return PLUGIN_HANDLED; } public VipStatus(){ new id=get_msg_arg_int(1); if(is_user_alive(id) && g_Vip[id]){ set_msg_arg_int(2, ARG_BYTE, get_msg_arg_int(2)|4); } } public ShowVips(id){ new g_Name[64],g_Message[192]; new g_Size=ArraySize(g_Array); for(new i = 0; i < g_Size; i++){ ArrayGetString(g_Array, i, g_Name, charsmax(g_Name)); add(g_Message, charsmax(g_Message), g_Name); if(i == g_Size - 1){ add(g_Message, charsmax(g_Message), "."); } else{ add(g_Message, charsmax(g_Message), ", "); } } ColorChat(id,GREEN,"^x03Vipy ^x04na ^x03serwerze: ^x04%s", g_Message); return PLUGIN_CONTINUE; } public client_infochanged(id){ if(g_Vip[id]){ new szName[64]; get_user_info(id,"name",szName,charsmax(szName)); new Name[64]; get_user_name(id,Name,charsmax(Name)); if(!equal(szName,Name)){ ArrayPushString(g_Array,szName); new g_Size=ArraySize(g_Array); new g_Name[64]; for(new i = 0; i < g_Size; i++){ ArrayGetString(g_Array, i, g_Name, charsmax(g_Name)); if(equal(g_Name,Name)){ ArrayDeleteItem(g_Array,i); break; } } } } } public plugin_end(){ ArrayDestroy(g_Array); } public ShowMotd(id){ show_motd(id, "vip.txt", "Informacje o vipie"); } public bomb_planted(id){ if(is_user_alive(id) && g_Vip[id]){ cs_set_user_money(id,cs_get_user_money(id) + 150); } } public bomb_defused(id){ if(is_user_alive(id) && g_Vip[id]){ cs_set_user_money(id,cs_get_user_money(id) + 150); } } public plugin_cfg(){ maxPlayers=get_maxplayers(); } public RoundEnd(){ for(new i = 1; i <= maxPlayers; i++){ if(is_user_alive(i) && g_Vip[i]){ cs_set_user_money(i,cs_get_user_money(i) + 200); } } }
#6 sekio
Napisano 28.01.2013 00:27
Jak nie ma funkcji plugin_init to raczej nie zadziała
http://www.youtube.com/watch?v=T0qmmWiGAho
http://elite-skill.eu/
http://elite-skill.eu/
#8 Endriuu
Napisano 28.01.2013 10:29
chyba to, zresztą nie wiem nie znam się zbytnio
Spoiler
#if defined _stripweapons_included #endinput #endif #define _stripweapons_included #include <fakemeta> #include <hamsandwich> /* * Strips a player's weapon based on type. * * @param id: Player id * @param type: Weapon type (check enum below for types) * @param bSwitchIfActive: Switch to other weapon before stripping * if stripped weapon is currently deployed * @return: 1 on success, otherwise 0 * * Ex: StripWeapons(id, Secondary); // Strips secondary weapon with switching if deployed. * StripWeapons(iPlayer, C4, false); // Strips c4 without switching if deployed. */ enum /* Weapon types */ { Primary = 1 , Secondary , Knife , Grenades , C4 }; stock StripWeapons(id, Type, bool: bSwitchIfActive = true) { new iReturn; if(is_user_alive(id)) { new iEntity, iWeapon; while((iWeapon = GetWeaponFromSlot(id, Type, iEntity)) > 0) iReturn = ham_strip_user_weapon(id, iWeapon, Type, bSwitchIfActive); } return iReturn; } /* * bugsy * [url="http://forums.alliedmods.net/showpost.php?p=1575989&postcount=2"]http://forums.allied...989&postcount=2[/url] * * Gets a weapon entity id based on inventory slot. * * @param id: Player id * @param iSlot: Inventory slot you want to get the weaponid from * @param &iEntity: Weapon entity id * @return: Weapon CSW_* index on success, otherwise 0 * * Ex: GetWeaponFromSlot(id, 3, iEntity); // Should return CSW_KNIFE if player has one. * // Knife is always in 3th slot (if not changed with plugin or something); */ stock GetWeaponFromSlot( id , iSlot , &iEntity ) { if ( !( 1 <= iSlot <= 5 ) ) return 0; iEntity = 0; const m_rgpPlayerItems_Slot0 = 367; const m_iId = 43; const XO_WEAPONS = 4; const XO_PLAYER = 5; iEntity = get_pdata_cbase( id , m_rgpPlayerItems_Slot0 + iSlot , XO_PLAYER ); return ( iEntity > 0 ) ? get_pdata_int( iEntity , m_iId , XO_WEAPONS ) : 0; } /* * ConnorMcLeod * [url="http://forums.alliedmods.net/showpost.php?p=1109747&postcount=42"]http://forums.allied...47&postcount=42[/url] * * Strips a player's weapon based on weapon index. * * @param id: Player id * @param iCswId: Weapon CSW_* index * @param iSlot: Inventory slot (Leave 0 if not sure) * @param bSwitchIfActive: Switch weapon if currently deployed * @return: 1 on success, otherwise 0 * * Ex: ham_strip_user_weapon(id, CSW_M4A1); // Strips m4a1 if user has one. * ham_strip_user_weapon(id, CSW_HEGRENADE, _, false); // Strips HE grenade if user has one * // without switching weapons. */ stock ham_strip_user_weapon(id, iCswId, iSlot = 0, bool:bSwitchIfActive = true) { new iWeapon if( !iSlot ) { static const iWeaponsSlots[] = { -1, 2, //CSW_P228 -1, 1, //CSW_SCOUT 4, //CSW_HEGRENADE 1, //CSW_XM1014 5, //CSW_C4 1, //CSW_MAC10 1, //CSW_AUG 4, //CSW_SMOKEGRENADE 2, //CSW_ELITE 2, //CSW_FIVESEVEN 1, //CSW_UMP45 1, //CSW_SG550 1, //CSW_GALIL 1, //CSW_FAMAS 2, //CSW_USP 2, //CSW_GLOCK18 1, //CSW_AWP 1, //CSW_MP5NAVY 1, //CSW_M249 1, //CSW_M3 1, //CSW_M4A1 1, //CSW_TMP 1, //CSW_G3SG1 4, //CSW_FLASHBANG 2, //CSW_DEAGLE 1, //CSW_SG552 1, //CSW_AK47 3, //CSW_KNIFE 1 //CSW_P90 } iSlot = iWeaponsSlots[iCswId] } const XTRA_OFS_PLAYER = 5 const m_rgpPlayerItems_Slot0 = 367 iWeapon = get_pdata_cbase(id, m_rgpPlayerItems_Slot0 + iSlot, XTRA_OFS_PLAYER) const XTRA_OFS_WEAPON = 4 const m_pNext = 42 const m_iId = 43 while( iWeapon > 0 ) { if( get_pdata_int(iWeapon, m_iId, XTRA_OFS_WEAPON) == iCswId ) { break } iWeapon = get_pdata_cbase(iWeapon, m_pNext, XTRA_OFS_WEAPON) } if( iWeapon > 0 ) { const m_pActiveItem = 373 if( bSwitchIfActive && get_pdata_cbase(id, m_pActiveItem, XTRA_OFS_PLAYER) == iWeapon ) { ExecuteHamB(Ham_Weapon_RetireWeapon, iWeapon) } if( ExecuteHamB(Ham_RemovePlayerItem, id, iWeapon) ) { user_has_weapon(id, iCswId, 0) ExecuteHamB(Ham_Item_Kill, iWeapon) return 1 } } return 0 }
#9 Endriuu
Napisano 28.01.2013 14:13
sorry, że post pod postem, ale nie mogłem edytować
a można wiedzieć za kiedy będzie update? i generować vipa znowu od nowa ;/
jak długo trzeba czekać to nie, dziękuje, mi to potrzebne teraz, a nie za jakiś czas ;(
a można wiedzieć za kiedy będzie update? i generować vipa znowu od nowa ;/
jak długo trzeba czekać to nie, dziękuje, mi to potrzebne teraz, a nie za jakiś czas ;(
Użytkownik Endriuu edytował ten post 28.01.2013 14:13
Użytkownicy przeglądający ten temat: 0
0 użytkowników, 0 gości, 0 anonimowych
Odpowiedz na cytowane posty Wyczyść