AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   give_item question (https://forums.alliedmods.net/showthread.php?t=228929)

xxxnenadxxx 10-29-2013 14:17

give_item question
 
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?

ConnorMcLeod 10-29-2013 14:24

Re: give_item question
 
You don't need that fix anymore, it has directly been fixed in the game.

xxxnenadxxx 10-29-2013 14:40

Re: give_item question
 
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?

ConnorMcLeod 10-30-2013 01:29

Re: give_item question
 
give_item(id, "weapon_shield") works fine.
There might be a plugin interferring, or there is a problem with your code.

xxxnenadxxx 10-30-2013 22:53

Re: give_item question
 
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.

alan_el_more 10-30-2013 23:11

Re: give_item question
 
Quote:

Originally Posted by xxxnenadxxx (Post 2054944)
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

xxxnenadxxx 10-31-2013 02:03

Re: give_item question
 
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 :)


All times are GMT -4. The time now is 23:18.

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