Raised This Month: $51 Target: $400
 12% 

[solved] Frags,shield and invisibility issue


Post New Thread Reply   
 
Thread Tools Display Modes
indraraj striker
Veteran Member
Join Date: Mar 2014
Location: Under the water
Old 08-29-2016 , 00:35   Re: Frags,shield and invisibility issue
Reply With Quote #11

@HamletEagle nope it doesnt work when i am having rifle gun but it works when i am having usp gun. I want to remove his rifle and give shield with usp
Code:
Attached Files
File Type: sma Get Plugin or Get Source (not_working.sma - 172 views - 3.8 KB)
__________________
Thanks everyone. #miss_you_all
indraraj striker is offline
indraraj striker
Veteran Member
Join Date: Mar 2014
Location: Under the water
Old 08-30-2016 , 03:39   Re: Frags,shield and invisibility issue
Reply With Quote #12

Bump Bump still someone who can solve this ?
__________________
Thanks everyone. #miss_you_all
indraraj striker is offline
indraraj striker
Veteran Member
Join Date: Mar 2014
Location: Under the water
Old 12-25-2016 , 11:24   Re: Frags,shield and invisibility issue
Reply With Quote #13

Bump still some one who can solve this

currently i m using stripweapons.inc to remove primary weapon to add shield but its does not work. When i am having primary weapon but strip the primary weapon correctly but it does not add shield
code :

PHP Code:
#include < amxmodx > 
#include < fun >
#include < stripweapons >

public plugin_init()
{
    
register_clcmd("say /shield","get_a_shield");
}

public 
get_a_shield(id)
{
    if(
is_user_alive(id))
    {
        
StripWeapons(idPrimary);
        
set_task(1.0,"give_shield",id);
    }
}

public 
give_shield(id)
{
    if(
is_user_alive(id))
    {
        
give_item(id,"weapon_shield");
        
client_print(id,print_chat,"Now i added shield");
    }

Edit: is there any way to get primary weapon name and strip particular weapon using this stock cs_drop_user_weapon
i don't want to use if condition for every weapon like if(weapon == weapon_ak47) and strip the ak47 then add shield. I want his primary weapon name if its primary then strip that weapon and then add shield
__________________
Thanks everyone. #miss_you_all

Last edited by indraraj striker; 12-25-2016 at 11:59.
indraraj striker is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 12-25-2016 , 12:31   Re: Frags,shield and invisibility issue
Reply With Quote #14

Maybe

- > make a const and insert all Primary Weapons bits ( CSW_M4A1, etc ... )
- > user get_user_weapons and check if they have const bits, make a loop using the stock and drop them.

Here's the code:

Spoiler
__________________
Project: Among Us

Last edited by Craxor; 12-26-2016 at 06:10.
Craxor is offline
Send a message via ICQ to Craxor
NiHiLaNTh
Way Past Expiration
Join Date: May 2009
Location: Latvia
Old 12-25-2016 , 18:23   Re: Frags,shield and invisibility issue
Reply With Quote #15

P228 is not a primary weapon actually. You probably wanted to write CSW_ELITE.

Code:
#define m_rgPlayerItems[6] = {367, 368, ...}

new weaponent = get_pdata_cbase(id, m_rgPlayerItems[1]) // pointer to the weapon(s) in each slot.

if (weaponent > 0) // we have a primary weapon
{
        new wname[32]
        get_weaponname(cs_get_weapon_id(weaponent), wname, charsmax(wname));
        engclient_cmd(id, "drop", wname);
}
else if (user_has_weapon(id, CSW_ELITE))
{
         engclient_cmd(id, "drop", "weapon_elite");
}
Edit.
You can also trying looking at the code from this post.
__________________


Last edited by NiHiLaNTh; 12-25-2016 at 18:28.
NiHiLaNTh is offline
Send a message via Skype™ to NiHiLaNTh
indraraj striker
Veteran Member
Join Date: Mar 2014
Location: Under the water
Old 12-26-2016 , 01:33   Re: Frags,shield and invisibility issue
Reply With Quote #16

Craxor Thanks a lot it works great but one little problem when i am having CSW_P90 weapon it does not drop and add shield
NiHiLaNTh Thanks you for little code i tried your code i m getting undefined symbol "m_rgPlayerItems" while compiling

PHP Code:
#include < amxmodx > 
#include < fun >
#include < hamsandwich >

#define m_rgPlayerItems[6] = {367, 368, ...}

public plugin_init()
{
    
register_clcmd("say /shield","get_a_shield");
}

public 
get_a_shield(id)
{
    new 
weaponent get_pdata_cbase(idm_rgPlayerItems[1]); // pointer to the weapon(s) in each slot.
    
if (weaponent 0// we have a primary weapon
    
{
        new 
wname[32]
        
get_weaponname(cs_get_weapon_id(weaponent), wnamecharsmax(wname));
        
engclient_cmd(id"drop"wname);
    }
    else if (
user_has_weapon(idCSW_ELITE))
    {
        
engclient_cmd(id"drop""weapon_elite");
    }
    
set_task(1.0,"give_shield",id);
}

public 
give_shield(id)
{
    if(
is_user_alive(id))
    {
        
give_item(id,"weapon_shield");
        
client_print(id,print_chat,"Now i added shield");
    }

this code (link) is already tried does not work when i m having primary weapon
__________________
Thanks everyone. #miss_you_all

Last edited by indraraj striker; 12-26-2016 at 01:50.
indraraj striker is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 12-26-2016 , 02:55   Re: Frags,shield and invisibility issue
Reply With Quote #17

sorry p228 is a pistol my bad ) , code updated.
__________________
Project: Among Us
Craxor is offline
Send a message via ICQ to Craxor
indraraj striker
Veteran Member
Join Date: Mar 2014
Location: Under the water
Old 12-26-2016 , 03:14   Re: Frags,shield and invisibility issue
Reply With Quote #18

Quote:
Originally Posted by Craxor View Post
sorry p228 is a pistol my bad ) , code updated.
Craxor Thanks a lot it works great but one little problem when i am having CSW_P90 weapon it does not drop and add shield
__________________
Thanks everyone. #miss_you_all
indraraj striker is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 12-26-2016 , 04:12   Re: Frags,shield and invisibility issue
Reply With Quote #19

i tested a little, get_user_weapons() detect it but my stock just simple has no effect idk why ..

i will look better when i will have time ..
__________________
Project: Among Us
Craxor is offline
Send a message via ICQ to Craxor
NiHiLaNTh
Way Past Expiration
Join Date: May 2009
Location: Latvia
Old 12-26-2016 , 04:34   Re: Frags,shield and invisibility issue
Reply With Quote #20

Code:
#define m_rgPlayerItems[6] = {367, 368, ...}
-->
new const m_rgPlayerItems[6] = {367, 368, ...}
__________________

NiHiLaNTh is offline
Send a message via Skype™ to NiHiLaNTh
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 20:17.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode