Raised This Month: $ Target: $400
 0% 

give_item question


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
xxxnenadxxx
Junior Member
Join Date: Oct 2010
Location: Brod
Old 10-29-2013 , 14:17   give_item question
Reply With Quote #1

Hey guys, I created plugin that gives players specific item/weapon on round start.
Now the problem is that I can't give them shield (tactical shield for CT), with give_item(id, "weapon_shield") function. At round start it strips their weapons so I thought it was because of that, I used this fix:
PHP Code:
StripWeapons(id)
{
    const 
m_fHasPrimary 116
    strip_user_weapons
(id)
    
set_pdata_int(idm_fHasPrimary0)

that I found on forum posted by Connor (I think) but it still doesn't work. What could block shield? And does shield model need to be precached first?
xxxnenadxxx is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 10-29-2013 , 14:24   Re: give_item question
Reply With Quote #2

You don't need that fix anymore, it has directly been fixed in the game.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
xxxnenadxxx
Junior Member
Join Date: Oct 2010
Location: Brod
Old 10-29-2013 , 14:40   Re: give_item question
Reply With Quote #3

Well I just wanted to try it before I ask for help, but even with or without that fix it still doesn't work.
I don't know what could be blocking it :/ Any ideas?
xxxnenadxxx is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 10-30-2013 , 01:29   Re: give_item question
Reply With Quote #4

give_item(id, "weapon_shield") works fine.
There might be a plugin interferring, or there is a problem with your code.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
xxxnenadxxx
Junior Member
Join Date: Oct 2010
Location: Brod
Old 10-30-2013 , 22:53   Re: give_item question
Reply With Quote #5

Problem was not in my code or in plugins interferring. The real problem was in strip_user_weapons function. Luckily I found solution for it even with using that function Thank you anyway.
xxxnenadxxx is offline
alan_el_more
Veteran Member
Join Date: Jul 2008
Location: amxmodx-es.com
Old 10-30-2013 , 23:11   Re: give_item question
Reply With Quote #6

Quote:
Originally Posted by xxxnenadxxx View Post
Problem was not in my code or in plugins interferring. The real problem was in strip_user_weapons function. Luckily I found solution for it even with using that function Thank you anyway.
Post it here because someone will find this thread but with a solution
__________________
alan_el_more is offline
xxxnenadxxx
Junior Member
Join Date: Oct 2010
Location: Brod
Old 10-31-2013 , 02:03   Re: give_item question
Reply With Quote #7

For some reason give_item(id, "weapon_shield") can't be called right after strip_user_weapons function. I used set_task with 0.1 interval to call another public to give shield.
Something like this
PHP Code:
#include <amxmodx>
#include <fun>

public plugin_init() 

    
register_plugin("Plugin""1.0""Author");
    
register_concmd("say /get" "test"ADMIN_BAN);
}

public 
test(id)
{
    
strip_user_weapons(id);
    
    
set_task(0.1"give_shield"id)
    return 
PLUGIN_HANDLED;
}

public 
give_shield(id)
{
    
give_item(id"weapon_knife");
    
give_item(id"weapon_deagle");
    
give_item(id"weapon_shield");
    return 
PLUGIN_HANDLED;

It worked for me

Last edited by xxxnenadxxx; 10-31-2013 at 02:06.
xxxnenadxxx is offline
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 23:18.


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