RSSy MYGO.pl Opublikowano Październik 4, 2021 o 00:20 RSSy Udostępnij Opublikowano Październik 4, 2021 o 00:20 Hello! I am using this plugin that when u write a command in the chat it shows a menu where u can buy weapon models with my shop plugin, it should be saving the guns on name but sometimes it's saving and sometimes not. I think i am missing something. Code: #include <amxmodx> #include <amxmisc> #include <engine> #include <fakemeta > #include <nvault> #if defined client_disconnected #define client_disconnect client_disconnected #endif #define ADM_RESTART ADMIN_RCON native bm_get_user_points(id) native bm_set_user_points(client, points); new g_iVault enum _: cldeagle { deagleName[100], deagleFoolder[64], deaglePFoolder[64], deaglePrice } new const deagleskin[][cldeagle] = // Deagle { // Name Folder //price// {"Normal Deagle","models/v_deagle.mdl","models/p_deagle.mdl",0}, {"Gold Deagle","models/v_deagle_gold.mdl","models/p_deagle_gold.mdl",1000}, {"Flames Deagle","models/v_deagle_flames.mdl","models/p_deagle_flames.mdl",1000}, } enum _: clmthree { mthreeName[100], mthreeFoolder[64], mthreePFoolder[64], mthreePrice } new const mthreeskin[][clmthree] = //Shotgun { // Name Folder //price// {"Normal Shotgun","models/v_m3.mdl","models/p_m3.mdl",0}, {"Shark Shotgun","models/v_m3_shark.mdl","models/p_m3_shark.mdl",1000}, {"Basillisk Shotgun","models/v_m3_basilisk.mdl","models/p_m3_basilisk.mdl",1000}, } enum _: clawp { awpName[100], awpFoolder[64], awpPFoolder[64], awpPrice } new const awpskin[][clawp] = //AWP { // Name Folder(v_mdl) Folder(p_mdl) //price// {"Normal AWP","models/v_awp.mdl", "models/p_awp.mdl",0}, {"Dream AWP","models/v_awp_fever2.mdl","models/p_awp_fever2.mdl",1000}, {"Boom AWP","models/v_awp_cylex.mdl","models/p_awp_cylex.mdl",1000}, } new Prefix[] = "Blabla-Gaming" new choose[33]; new DeagleOwned[33]; new DeagleUse[33]; new ShotgunOwned[33]; new ShotgunUse[33]; new AWPOwned[33]; new AWPUse[33]; new betselaction = 1 public plugin_init() { register_plugin("skin menu", "1.0", "CyTwe") //do not change credit please/// register_clcmd("say /guns","skinmenu") register_event("CurWeapon", "Event_CurWeapon", "be","1=1") register_clcmd("amx_reset_weaponskins", "restart_allweapon") set_task(60.0, "CheckS",_,_,_, "b") g_iVault = nvault_open("GunShop") } public restart_allweapon(id) { if(!(get_user_flags(id) & ADM_RESTART)) return PLUGIN_HANDLED static name[33] get_user_name(id,name,charsmax(name)) ColorChat(0,"^4[Weapons]^1 %s ^4restarted all ^1weapon skins!",name); nvault_prune(g_iVault , 0, 0) return PLUGIN_HANDLED } public plugin_precache() { for (new g = 0; g < sizeof deagleskin; g++) { precache_model(deagleskin[g][deagleFoolder] ); precache_model(deagleskin[g][deaglePFoolder] ); } for (new e = 0; e < sizeof mthreeskin; e++) { precache_model(mthreeskin[e][mthreeFoolder]); precache_model(mthreeskin[e][mthreePFoolder]); } for (new i = 0; i < sizeof awpskin; i++) { precache_model(awpskin[i][awpFoolder]); precache_model(awpskin[i][awpPFoolder]); } } public Event_CurWeapon(id) { weapon_player(id) return 1; } public CheckS() { ColorChat(0,"Write ^4/guns^1 to ^3change^1 your weapon skins."); } public client_putinserver( client ) { UseVault(client, 1) } public client_disconnect( client ) { if(is_user_connected(client)) { UseVault(client, 0) } } public skinmenu( id ) { static Menuz[100],Item[200]; formatex(Menuz,charsmax(Menuz),"\w[\r%s\w]\w Gun Shop^n\rYour BM Credits:\y %i",Prefix,bm_get_user_points(id)); new Smenu = menu_create(Menuz, "SubskinmenuMenu"); formatex(Item, charsmax(Item),"\wDeagle Skins"); menu_additem(Smenu, Item) formatex(Item, charsmax(Item),"\wM3 Skins"); menu_additem(Smenu, Item) formatex(Item, charsmax(Item),"\wAWP Skins"); menu_additem(Smenu, Item) menu_display(id, Smenu, 0) return 1; } public SubskinmenuMenu(id, Smenu, item) { if(item == MENU_EXIT) { return 1; } switch (item) { case 0: DeagleMenu( id ); case 1: ShotGunMenu( id ); case 2: AWPmenu( id ); } return 1; } public DeagleMenu(id) { new Menuz[100] formatex(Menuz,charsmax(Menuz),"\r[\w%s\r]\w Deagle Skin Menu^n\rYour BM Credits:\y %i",Prefix,bm_get_user_points(id)); new iMenu = menu_create(Menuz, "DeagleMenuHandler"); new szItem[64]; for( new i; i < sizeof deagleskin; i++) { if(DeagleOwned[id] < i) formatex(szItem, charsmax(szItem),"\w%s (\r%i \wBM credits\w)",deagleskin[i][deagleName],deagleskin[i][deaglePrice]); else formatex(szItem, charsmax(szItem),"\w%s %s",deagleskin[i][deagleName],i == DeagleUse[id] ? "(\yUsing\w)" : "\dOwned"); menu_additem(iMenu, szItem) } menu_setprop( iMenu, MPROP_NUMBER_COLOR, "\r"); menu_setprop( iMenu, MPROP_EXIT, MEXIT_ALL) menu_display(id, iMenu) return 1; } public DeagleMenuHandler(id, iMenu, item) { if(item == MENU_EXIT) { skinmenu( id ) menu_destroy (iMenu) return 1; } choose[id] = item new ifcanbought = choose[id] - DeagleOwned[id] if(DeagleOwned[id] >= choose[id]) { DeagleUse[id] = choose[id] static Clip, Ammo, Weapon; Weapon = get_user_weapon( id, Clip, Ammo ); if( Weapon == CSW_DEAGLE ) { entity_set_string(id,EV_SZ_viewmodel,deagleskin[DeagleUse[id]][deagleFoolder]); } ColorChat(id,"You are currently using ^4%s^1",deagleskin[DeagleUse[id]][deagleName]) DeagleMenu(id) return 1; } else if(ifcanbought > betselaction) { ColorChat(id,"You ^3cannot^1 buy ^4%s^1 because you ^3need^1 to buy ^4%s^1 first",deagleskin[choose[id]][deagleName],deagleskin[choose[id] - 1][deagleName]) DeagleMenu(id) return 1; } else if(DeagleOwned[id] >= choose[id]) { ColorChat(id,"You ^3already^1 have bought ^4%s^1",deagleskin[choose[id]][deagleName]) DeagleMenu(id) return 1; } if(bm_get_user_points(id) < deagleskin[choose[id]][deaglePrice]) { ColorChat(id,"You need ^3%i^1 more points to buy ^4%s^1",(deagleskin[choose[id]][deaglePrice] - bm_get_user_points(id)),deagleskin[choose[id]][deagleName]) DeagleMenu(id) return 1; } bm_set_user_points( id, bm_get_user_points(id) - deagleskin[choose[id]][deaglePrice]); DeagleOwned[id] = choose[id] DeagleUse[id] = choose[id] ColorChat(0,"^4%s^1 just bought ^3%s^1 for ^4%i^1 points",szName(id),deagleskin[choose[id]][deagleName],deagleskin[choose[id]][deaglePrice]) static Clip, Ammo, Weapon; Weapon = get_user_weapon( id, Clip, Ammo ); if( Weapon == CSW_DEAGLE ) { entity_set_string(id,EV_SZ_viewmodel,deagleskin[DeagleUse[id]][deagleFoolder]); } menu_destroy (iMenu); DeagleMenu(id) return 1; } public ShotGunMenu(id) { new Menuz[100] formatex(Menuz,charsmax(Menuz),"\r[\w%s\r]\w M3 Skin Menu^n\rYour BM Credits:\y %i",Prefix,bm_get_user_points(id)); new iMenu = menu_create(Menuz, "ShotGunMenuHandler"); new szItem[64]; for( new i; i < sizeof mthreeskin; i++) { if(ShotgunOwned[id] < i) formatex(szItem, charsmax(szItem),"\w%s (\r%i \wBM credits\w)",mthreeskin[i][mthreeName],mthreeskin[i][mthreePrice]); else formatex(szItem, charsmax(szItem),"\w%s %s",mthreeskin[i][mthreeName],i == ShotgunUse[id] ? "(\yUsing\w)" : "\dOwned"); menu_additem(iMenu, szItem) } menu_setprop( iMenu, MPROP_NUMBER_COLOR, "\r"); menu_setprop( iMenu, MPROP_EXIT, MEXIT_ALL) menu_display(id, iMenu) return 1; } public ShotGunMenuHandler(id, iMenu, item) { if(item == MENU_EXIT) { skinmenu( id ) menu_destroy (iMenu) return 1; } choose[id] = item new ifcanbought = choose[id] - ShotgunOwned[id] if(ShotgunOwned[id] >= choose[id]) { ShotgunUse[id] = choose[id] static Clip, Ammo, Weapon; Weapon = get_user_weapon( id, Clip, Ammo ); if( Weapon == CSW_M3 ) { entity_set_string(id,EV_SZ_viewmodel,mthreeskin[ShotgunUse[id]][mthreeFoolder]); } ColorChat(id,"You are currently using ^4%s^1",mthreeskin[ShotgunUse[id]][mthreeName]) ShotGunMenu(id) return 1; } else if(ifcanbought > betselaction) { ColorChat(id,"You ^3cannot^1 buy ^4%s^1 because you ^3need^1 to buy ^4%s^1 first",mthreeskin[choose[id]][mthreeName],mthreeskin[choose[id] - 1][mthreeName]) ShotGunMenu(id) return 1; } if(ShotgunOwned[id] >= choose[id]) { ColorChat(id,"You ^3already^1 have bought ^4%s^1",mthreeskin[choose[id]][mthreeName]) ShotGunMenu(id) return 1; } if(bm_get_user_points(id) < mthreeskin[choose[id]][mthreePrice]) { ColorChat(id,"You need ^3%i^1 more points to buy ^4%s^1",(mthreeskin[choose[id]][mthreePrice] - bm_get_user_points(id)),mthreeskin[choose[id]][mthreeName]) ShotGunMenu(id) return 1; } bm_set_user_points( id, bm_get_user_points(id) - mthreeskin[choose[id]][mthreePrice]); ShotgunOwned[id] = choose[id] ShotgunUse[id] = choose[id] ColorChat(0,"^4%s^1 just bought ^3%s^1 for ^4%i^1 points",szName(id),mthreeskin[choose[id]][mthreeName],mthreeskin[choose[id]][mthreePrice]) static Clip, Ammo, Weapon; Weapon = get_user_weapon( id, Clip, Ammo ); if( Weapon == CSW_M3 ) { entity_set_string(id,EV_SZ_viewmodel,mthreeskin[ShotgunUse[id]][mthreeFoolder]); } menu_destroy (iMenu); ShotGunMenu(id) return 1; } public AWPmenu(id) { new Menuz[100] formatex(Menuz,charsmax(Menuz),"\r[\w%s\r]\w AWP Skin Menu^n\rYour BM Credits:\y %i",Prefix,bm_get_user_points(id)); new iMenu = menu_create(Menuz, "AWPmenuHandler"); new szItem[64]; for( new i; i < sizeof awpskin; i++) { if(AWPOwned[id] < i) formatex(szItem, charsmax(szItem),"\w%s (\r%i \wBM credits\w)",awpskin[i][awpName],awpskin[i][awpPrice]); else formatex(szItem, charsmax(szItem),"\w%s %s",awpskin[i][awpName],i == AWPUse[id] ? "(\yUsing\w)" : "\dOwned"); menu_additem(iMenu, szItem) } menu_setprop( iMenu, MPROP_NUMBER_COLOR, "\r"); menu_setprop( iMenu, MPROP_EXIT, MEXIT_ALL) menu_display(id, iMenu) return 1; } public AWPmenuHandler(id, iMenu, item) { if(item == MENU_EXIT) { skinmenu( id ) menu_destroy (iMenu) return 1; } choose[id] = item new ifcanbought = choose[id] - AWPOwned[id] if(AWPOwned[id] >= choose[id]) { AWPUse[id] = choose[id] static Clip, Ammo, Weapon; Weapon = get_user_weapon( id, Clip, Ammo ); if( Weapon == CSW_AWP ) { entity_set_string(id,EV_SZ_viewmodel,awpskin[AWPUse[id]][awpFoolder]); } ColorChat(id,"You are currently using ^4%s^1",awpskin[AWPUse[id]][awpName]) AWPmenu(id) return 1; } else if(ifcanbought > betselaction) { ColorChat(id,"You ^3cannot^1 buy ^4%s^1 because you ^3need^1 to buy ^4%s^1 first",awpskin[choose[id]][awpName],awpskin[choose[id] - 1][awpName]) AWPmenu(id) return 1; } if(AWPOwned[id] >= choose[id]) { ColorChat(id,"You ^3already^1 have bought ^4%s^1",awpskin[choose[id]][awpName]) AWPmenu(id) return 1; } else if(bm_get_user_points(id) < awpskin[choose[id]][awpPrice]) { ColorChat(id,"You need ^3%i^1 more points to buy ^4%s^1",(awpskin[choose[id]][awpPrice] - bm_get_user_points(id)),awpskin[choose[id]][awpName]) AWPmenu(id) return 1; } bm_set_user_points( id, bm_get_user_points(id) - awpskin[choose[id]][awpPrice]); AWPOwned[id] = choose[id] AWPUse[id] = choose[id] ColorChat(0,"^4%s^1 just bought ^3%s^1 for ^4%i^1 points",szName(id),awpskin[choose[id]][awpName],awpskin[choose[id]][awpPrice]) static Clip, Ammo, Weapon; Weapon = get_user_weapon( id, Clip, Ammo ); if( Weapon == CSW_AWP ) { entity_set_string(id,EV_SZ_viewmodel,awpskin[AWPUse[id]][awpFoolder]); } menu_destroy (iMenu); AWPmenu(id) return 1; } UseVault(id, iType) { new szNameZZ[32], szData[31] get_user_name(id, szNameZZ, charsmax(szNameZZ)) switch(iType) { case 0: { formatex(szData, charsmax(szData), "%i %i %i %i %i %i", DeagleUse[id], DeagleOwned[id], AWPOwned[id], AWPUse[id], ShotgunUse[id], ShotgunOwned[id]) nvault_set(g_iVault, szNameZZ, szData) } case 1: { nvault_get(g_iVault, szNameZZ, szData, charsmax(szData)) new szArg[3][20] parse(szData, szArg[0], charsmax(szArg[]), szArg[1], charsmax(szArg[]), szArg[2], charsmax(szArg[])) DeagleUse[id] = str_to_num(szArg[0]) DeagleOwned[id] = str_to_num(szArg[0]) AWPOwned[id] = str_to_num(szArg[1]) AWPUse[id] = str_to_num(szArg[1]) ShotgunUse[id] = str_to_num(szArg[2]) ShotgunOwned[id] = str_to_num(szArg[2]) } } } stock szName( const index ) { static Name[ 128 ]; get_user_name( index, Name, charsmax( Name ) ); return Name; } stock szAuth( const index ) { static Auth[ 35 ]; get_user_authid( index, Auth, charsmax( Auth ) ); return Auth; } stock ColorChat(const id, const string[], {Float, Sql, Resul,_}:...) { new msg[191], players[32], count = 1; static len; len = formatex(msg, charsmax(msg), "^3[^1^4%s^1^3]^1 ",Prefix); vformat(msg[len], charsmax(msg) - len, string, 3); if(id) players[0] = id; else get_players(players,count,"ch"); for (new i = 0; i < count; i++) { if(is_user_connected(players[i])) { message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"),_, players[i]); write_byte(players[i]); write_string(msg); message_end(); } } return 1; } stock weapon_player(id) { static weapon; weapon = get_user_weapon(id) switch(weapon) { case CSW_DEAGLE: { entity_set_string(id,EV_SZ_viewmodel,deagleskin[DeagleUse[id]][deagleFoolder]); entity_set_string(id,EV_SZ_weaponmodel,deagleskin[DeagleUse[id]][deaglePFoolder]); } case CSW_AWP: { entity_set_string(id,EV_SZ_viewmodel,awpskin[AWPUse[id]][awpFoolder]); entity_set_string(id,EV_SZ_weaponmodel,awpskin[AWPUse[id]][awpPFoolder]); } case CSW_M3: { entity_set_string(id,EV_SZ_viewmodel,mthreeskin[ShotgunUse[id]][mthreeFoolder]); entity_set_string(id,EV_SZ_weaponmodel,mthreeskin[ShotgunUse[id]][mthreePFoolder]); } } } Przeczytaj cały wpis Odnośnik do komentarza Udostępnij na innych stronach Więcej opcji udostępniania...
Rekomendowane odpowiedzi