View Single Post
benqcon
Member
Join Date: Jul 2020
Old 04-06-2024 , 14:47   Re: GunXp special weapons
Reply With Quote #3

So what I tried is this:
First I added these line to the weapon from other plugin:
Quote:
public plugin_natives()
{
register_native("give_dual_uzi", "native_give_dual_uzi", 1)
}

public native_give_dual_uzi(id)
{
Set_BitVar(g_Had_Base, id)
give_item(id, weapon_base)
cs_set_user_bpammo(id, CSW_BASE, 400)
}
and then I try to call it in the main gunxp mod with this:
Quote:
if (PlayerLevel[id] == MAXLEVEL2 - 1) // Assuming the last level is MAXLEVEL2 - 1
{
// Call the native function from the "Dual_Uzi.amxx" plugin to give the player the special weapon
if (callfunc_begin("native_give_dual_uzi", "Dual_Uzi.amxx") == 1)
{
callfunc_push_int(id);
callfunc_end();
}
}
else if (PlayerLevel[id] >= 20) // Unlock the Dual Uzi at level 20
{
// Call the native function from the "Dual_Uzi.amxx" plugin to give the player the special weapon
if (callfunc_begin("native_give_dual_uzi", "Dual_Uzi.amxx") == 1)
{
callfunc_push_int(id);
callfunc_end();
}
}
it worked but not perfectly, There are some bugs:

1- The special weapon (Dual_Uzi) didn't show up in the menu

2- when I choose any weapon I also get the special one, so now I have two guns + the pistol
benqcon is offline