LamdaProCS - Gaming Community - Forum
Unlock list - Printable Version

+- LamdaProCS - Gaming Community - Forum (https://forum.lamdaprocs.in)
+-- Forum: GENERAL DISCUSSION (https://forum.lamdaprocs.in/forumdisplay.php?fid=7)
+--- Forum: #PLUGINS, SCRIPTING, MODS (https://forum.lamdaprocs.in/forumdisplay.php?fid=130)
+---- Forum: Plugins + SMA (https://forum.lamdaprocs.in/forumdisplay.php?fid=135)
+---- Thread: Unlock list (/showthread.php?tid=4554)



Unlock list - Umbrella Swarm - 04-14-2021

Hey guys, I tried to add the unlock list but it didn't work for me
If one of you can help
I would be very grateful to him.

PHP Code:
#include <amxmodx>
#include <engine>
#include <amxmisc>
#include <fakemeta>
#include <fun>
#include <cstrike>
#include <nvault>
#include <gunxpmod>
#include <hamsandwich>

#define PLUGIN "Gun Xp Mod Shop"
#define AUTHOR "Scr"
#define VERSION "1.4"

#define TASK_SHOW_UPGRADES 10113
#define MAX_UNLOCKS 30
#define MAX_UNLOCKS_NAME_SIZE 64
#define MAX_UNLOCKS_DESC_SIZE 128

new g_menuPosition[33], gSelected[33];

enum _:iUnlocks

 
   UL_Knife
 
   UL_Pistol
 
   UL_Rifle
 
   UL_Grenade
 
   UL_Item
};

//all
new g_numberofitems[iUnlocks];
new 
g_itemindex[iUnlocks][MAX_UNLOCKS+1];
new 
g_itemcost[iUnlocks][MAX_UNLOCKS+1];
new 
g_itemlevel[iUnlocks][MAX_UNLOCKS+1];
new 
g_itemaccess[iUnlocks][MAX_UNLOCKS+1];
new 
g_itemname[iUnlocks][MAX_UNLOCKS+1][MAX_UNLOCKS_NAME_SIZE+1];
new 
g_itemdesc[iUnlocks][MAX_UNLOCKS+1][MAX_UNLOCKS_DESC_SIZE+1];
new 
g_itemwpn[iUnlocks][MAX_UNLOCKS+1];
new 
bool:g_PlayerItem[33][iUnlocks][MAX_UNLOCKS+1];

new 
Enabledshow_unlocks_textg_msgHudSync1;

public 
plugin_init()
{
 
register_plugin(PLUGINVERSIONAUTHOR);
 
 
register_dictionary("gunxpmod.txt");
 
 
register_clcmd("say /unlocks""menus")
 
register_clcmd("say unlocks""menus")
 
register_clcmd("say /ul""menus")
 
register_clcmd("say ul""menus")

 
Enabled register_cvar"hud_enable""1" ); // Plugin enabled? 1 = Yes, 0 = No.
 
show_unlocks_text register_cvar("gxm_unlocks_text","0"); // Show your level by : 1 = HUD message, 0 = Simple colored text message.

 
register_menucmd(register_menuid("Unlocks Shop"), 1023"action_item_upgrades");

 
g_msgHudSync1 CreateHudSyncObj()
}

public 
client_connect(id)
{
 static 
ij
 
for(0iUnlocks; ++i)
 for(
0<= MAX_UNLOCKS; ++j)
 
g_PlayerItem[id][i][j] = false;
}

public 
client_disconnected(id)
{
 
remove_taskTASK_SHOW_UPGRADES id );
}

public 
showhud(idtaskkeyposselection)
{
 if(!
is_user_alive(id) || !get_pcvar_num(show_unlocks_text) || !get_pcvar_num(Enabled) )
 return;

 new 
id task TASK_SHOW_UPGRADES

 
new plugin_id g_itemindex[gSelected[id]][g_menuPosition[id] * key]
 new 
item_id g_menuPosition[id] * key
 
new func get_func_id("gxm_item_enabled"plugin_id)
 new 
cost g_itemcost[gSelected[id]][item_id] = true;
 new 
item g_PlayerItem[id][gSelected[id]][item_id] = true;
 
gSelected[id] = selection;
 
action_item_upgrades(idkey)
 
display_item_upgrades(idposselection)

 
set_hudmessage(02552550.000.1200.00.30.00.0)
 
ShowSyncHudMsg(idg_msgHudSync1"%L"LANG_SERVER"LEVEL_HUD_TEXT"g_itemname[gSelected[id]][item_id], costitemplugin_iditem_idfunc)
 
 
set_task(0.1"task_show_upgrades"TASK_SHOW_UPGRADES id)
}

public 
menus(id)
{
 new 
menu menu_create("[\rGunXP] \yUnlocks""upgrades_menu");
 new 
call menu_makecallback("Call_Back");
 
gSelected[id] = 0;
 new 
szMsg[256];
 
 
format(szMsg255"Knifes", (GetItemCount(g_PlayerItem[id][UL_Knife], g_numberofitems[UL_Knife]) == g_numberofitems[UL_Knife]) ? "\r" "\y"GetItemCount(g_PlayerItem[id][UL_Knife], g_numberofitems[UL_Knife]), g_numberofitems[UL_Knife]);
 
menu_additem(menuszMsg__g_numberofitems[UL_Knife] ? -call);
 
 
format(szMsg255"Pistols", (GetItemCount(g_PlayerItem[id][UL_Pistol], g_numberofitems[UL_Pistol]) == g_numberofitems[UL_Pistol]) ? "\r" "\y"GetItemCount(g_PlayerItem[id][UL_Pistol], g_numberofitems[UL_Pistol]), g_numberofitems[UL_Pistol]);
 
menu_additem(menuszMsg__g_numberofitems[UL_Pistol] ? -call);
 
 
format(szMsg255"Rifles", (GetItemCount(g_PlayerItem[id][UL_Rifle], g_numberofitems[UL_Rifle]) == g_numberofitems[UL_Rifle]) ? "\r" "\y"GetItemCount(g_PlayerItem[id][UL_Rifle], g_numberofitems[UL_Rifle]), g_numberofitems[UL_Rifle]);
 
menu_additem(menuszMsg__g_numberofitems[UL_Rifle] ? -call);
 
 
format(szMsg255"Granades", (GetItemCount(g_PlayerItem[id][UL_Grenade], g_numberofitems[UL_Grenade]) == g_numberofitems[UL_Grenade]) ? "\r" "\y"GetItemCount(g_PlayerItem[id][UL_Grenade], g_numberofitems[UL_Grenade]), g_numberofitems[UL_Grenade]);
 
menu_additem(menuszMsg__g_numberofitems[UL_Grenade] ? -call);
 
 
format(szMsg255"Items", (GetItemCount(g_PlayerItem[id][UL_Item], g_numberofitems[UL_Item]) == g_numberofitems[UL_Item]) ? "\r" "\y"GetItemCount(g_PlayerItem[id][UL_Item], g_numberofitems[UL_Item]), g_numberofitems[UL_Item]);
 
menu_additem(menuszMsg__g_numberofitems[UL_Item] ? -call);

 
menu_setprop(menuMPROP_EXITMEXIT_ALL);
 
 
menu_display(idmenu0);

 return 
PLUGIN_HANDLED;
}

public 
Call_Back(idmenuitem)
 
   return ITEM_DISABLED;

public 
upgrades_menu(idmenuitem)
{
 if(
item == MENU_EXIT)
 {
 
menu_destroy(menu);
 return 
PLUGIN_HANDLED;
 }
 
 
gSelected[id] = item;
 
g_menuPosition[id] = 0;
 
display_item_upgrades(id0item);
 
 
menu_destroy(menu);
 return 
PLUGIN_HANDLED
}

public 
plugin_natives()
{
 
register_native("register_gxm_item""register_unlock")
 
register_native("register_item_gxm""register_unlock")
}

public 
register_unlock(pluginparams)
{
 static 
item_section
 item_section 
get_param(5)-1
 
 g_numberofitems
[item_section]++;
 
g_itemindex[item_section][g_numberofitems[item_section]] = plugin;
 
get_string(1g_itemname[item_section][g_numberofitems[item_section]], MAX_UNLOCKS_NAME_SIZE)
 
get_string(2g_itemdesc[item_section][g_numberofitems[item_section]], MAX_UNLOCKS_DESC_SIZE)
 
g_itemcost[item_section][g_numberofitems[item_section]] = get_param(3);
 
g_itemlevel[item_section][g_numberofitems[item_section]] = get_param(4);
 
g_itemaccess[item_section][g_numberofitems[item_section]] = get_param(6) ? get_param(6) : 0;
 
g_itemwpn[item_section][g_numberofitems[item_section]] = get_param(7);
}

//ALL
public display_item_upgrades(idposselection)
{
 if(!
is_user_alive(id))
 
  return;

 static 
menuBody[510], len;
 
len 0;
 
gSelected[id] = selection;

 if(
pos 0)
 return;
 
 new 
start pos 8
 
if(start >= g_numberofitems[selection])
 
start pos g_menuPosition[id];

 
len += formatex(menuBody[len], sizeof menuBody len"%L"LANG_SERVER"TITLE_MENU_SHOP" get_user_xp(id), get_user_max_level(id))

 new 
end start 8
 
new keys MENU_KEY_0

 
if(end g_numberofitems[selection])
 
end g_numberofitems[selection];
 
 new 
0
 
for(new startend; ++a
 {
 new 
1
 
new moneylevel

 money 
get_user_xp(id)
 
level get_user_level(id)

 if( 
g_PlayerItem[id][selection][i] ) 
 
len += formatex(menuBody[len], sizeof menuBody len,"%L"id"INACTIVE_MENU_SHOP_BOUGHT", ++bg_itemname[selection][i], g_itemcost[selection][i], g_itemlevel[selection][i])

 else if(
g_itemaccess[selection][i] == GUN_FIRST_ACCESS_ID && !(get_user_flags(id) & GUN_FIRST_ACCESS))
 
len += formatex(menuBody[len], sizeof menuBody len,"%L"id"INACTIVE_MENU_SHOP_ACCESS1", ++bg_itemname[selection][i], GUN_FIRST_ACCESS_TEXT);

 else if(
g_itemaccess[selection][i] == GUN_SECOND_ACCESS_ID && !(get_user_flags(id) & GUN_SECOND_ACCESS))
 
len += formatex(menuBody[len], sizeof menuBody len,"%L"id"INACTIVE_MENU_SHOP_ACCESS2", ++bg_itemname[selection][i], GUN_SECOND_ACCESS_TEXT);

 else if(
g_itemaccess[selection][i] == GUN_THIRD_ACCESS_ID && !(get_user_flags(id) & GUN_THIRD_ACCESS))
 
len += formatex(menuBody[len], sizeof menuBody len,"%L"id"INACTIVE_MENU_SHOP_ACCESS3", ++bg_itemname[selection][i], GUN_THIRD_ACCESS_TEXT);  

 
else if(level g_itemlevel[selection][i])  
 len 
+= formatex(menuBody[len], sizeof menuBody len,"%L"id"INACTIVE_MENU_SHOP_LEVEL", ++bg_itemname[selection][i], g_itemlevel[selection][i], g_itemcost[selection][i])
 
 else if(
PatrArTuri(idg_itemwpn[selection][i]))
 
len += formatex(menuBody[len], sizeof menuBody len,"%L"id"INACTIVE_MENU_NO_MORE", ++bg_itemname[selection][i], g_itemcost[selection][i], g_itemlevel[selection][i])
 
 else if( 
money g_itemcost[selection][i] ) 
 
len += formatex(menuBody[len], sizeof menuBody len,"%L"id"INACTIVE_MENU_SHOP", ++bg_itemname[selection][i], g_itemcost[selection][i], g_itemlevel[selection][i])
 else 
 {
 
keys |= (1<<b)
 
 switch(
g_itemaccess[selection][i])
 {
 case 
GUN_FIRST_ACCESS_ID:
 
len += formatex(menuBody[len], sizeof menuBody len,"%L"id"ACTIVE_MENU_SHOP2", ++bg_itemname[selection][i], g_itemcost[selection][i], g_itemlevel[selection][i], GUN_FIRST_ACCESS_TEXT)

 case 
GUN_SECOND_ACCESS_ID:
 
len += formatex(menuBody[len], sizeof menuBody len,"%L"id"ACTIVE_MENU_SHOP2", ++bg_itemname[selection][i], g_itemcost[selection][i], g_itemlevel[selection][i], GUN_SECOND_ACCESS_TEXT)

 case 
GUN_THIRD_ACCESS_ID:
 
len += formatex(menuBody[len], sizeof menuBody len,"%L"id"ACTIVE_MENU_SHOP2", ++bg_itemname[selection][i], g_itemcost[selection][i], g_itemlevel[selection][i], GUN_THIRD_ACCESS_TEXT
 
 default:
 
len += formatex(menuBody[len], sizeof menuBody len,"%L"id"ACTIVE_MENU_SHOP", ++bg_itemname[selection][i], g_itemcost[selection][i], g_itemlevel[selection][i])
 }
 }
 }

 if(
end != g_numberofitems[selection])
 {
 
len += formatex(menuBody[len], sizeof menuBody len"^n\r9. \w%L\r^n0. \w%L"id"NEXT_MENU"idpos "BACK_MENU" "EXIT_MENU")
 
keys |= MENU_KEY_9
 
}
 else
 {
 
len += formatex(menuBody[len], sizeof menuBody len"^n\r0. \w%L"idpos "BACK_MENU" "EXIT_MENU")
 }
 
 
show_menu(idkeysmenuBody, -1"Unlocks Shop")
}

public 
action_item_upgrades(idkey)
{
 switch(
key
 {
 case 
8display_item_upgrades(id, ++g_menuPosition[id], gSelected[id]);
 case 
9display_item_upgrades(id, --g_menuPosition[id], gSelected[id]);
 default:
 {
 if(!
is_user_alive(id))
 return 
PLUGIN_HANDLED;
 
 ++
key
 
new money
 
new plugin_id g_itemindex[gSelected[id]][g_menuPosition[id] * key]
 new 
item_id g_menuPosition[id] * key
 
new func get_func_id("gxm_item_enabled"plugin_id)

 
money get_user_xp(id)
 new 
cost g_itemcost[gSelected[id]][item_id];
 
 if(
money >= cost)
 {
 
callfunc_begin_i(funcplugin_id)
 
callfunc_push_int(id)
 
callfunc_end()

 
g_PlayerItem[id][gSelected[id]][item_id] = true

 
new overall money cost
 set_user_xp
(idoverall)

 
client_printcolor(1"/yItem Bought, Item: /g%s."g_itemname[gSelected[id]][item_id])
 
client_printcolor(1"/yDescripcion: /g%s."g_itemdesc[gSelected[id]][item_id])
 
display_item_upgrades(idg_menuPosition[id], gSelected[id]);
 }
 }
 }
 return 
PLUGIN_HANDLED;
}

stock client_printcolor( const id, const input[], any:... )
{
 
   new iCount 1iPlayers[32]
 
   
    new sNewMsg
[191]
 
   vformatsNewMsgcharsmax sNewMsg ), input)
 
   //format ( sNewMsg, charsmax ( sNewMsg ), "^4[x^1 %s", sNewMsg )
 
   
    replace_all 
sNewMsgcharsmax sNewMsg ), "/g""^4"// green txt
 
   replace_all sNewMsgcharsmax sNewMsg ), "/y""^1"// orange txt
 
   replace_all sNewMsgcharsmax sNewMsg ), "/t""^3"// team txt
 
   
    if 
id )
 
       iPlayers[0] = id
    else
        get_players 
iPlayersiCount"ch" )
 
       
    for 
( new iiCounti++ )
 
   {
 
       if is_user_connected iPlayers[i] ) )
 
       {
 
           message_begin MSG_ONE_UNRELIABLEget_user_msgid "SayText" ), _iPlayers[i] )
 
           write_byte iPlayers[i])
 
           write_string sNewMsg)
 
           message_end ()
 
       }
 
   }
}

stock bool:PatrArTuri(idwpn)
{
 static 
ij
 
for(0iUnlocks; ++i)
 {
 for(
0<= MAX_UNLOCKS; ++j)
 {
 if(
g_PlayerItem[id][i][j])
 {
 if(
g_itemwpn[i][j] == wpn)
 return 
true
 
}
 }
 }
 
 return 
false
}

GetItemCount(array[], size)
{
 
   new count 0;

 
   for(new 1<= sizei++)
 
       if(array[i])
 
           count++;
 
   
    return count
;




RE: Unlock list - rian - 04-16-2021

I don't know anything about gxp, sry.


RE: Unlock list - [B]LOOD-[F]ANG ツ - 04-17-2021

What's the problem?


RE: Unlock list - Umbrella Swarm - 04-19-2021

I'd like to be added the unlock list


RE: Unlock list - [B]LOOD-[F]ANG ツ - 04-24-2021

The plugin seems to be fine.


RE: Unlock list - Umbrella Swarm - 05-06-2021

(04-16-2021, 12:43 PM)rian Wrote: I don't know anything about gxp, sry.

Np bro