Raised This Month: $ Target: $400
 0% 

fm_give_item


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
tlch0324
Senior Member
Join Date: Jan 2007
Old 05-21-2009 , 06:58   fm_give_item
Reply With Quote #1

If I set fm_give_item weapon_c4 to terrorist
how can I set only one c4 in team terrorist
what code should add?
thank you
tlch0324 is offline
TitANious
Veteran Member
Join Date: Feb 2009
Location: Denmark
Old 05-21-2009 , 07:13   Re: fm_give_item
Reply With Quote #2

Fun is faster in that than fakemeta
PHP Code:
#include <amxmodx>
#include <fun>

#define PLUGIN    "Give Item to T"
#define VERSION "1.1"
#define AUTHOR    "TitANious"

public plugin_init() {
    
register_pluginPLUGINVERSIONAUTHOR );
    
    
register_clcmd"say /Knife,    "cmdKnife" );
}

public cmdKnife(id)
{
    if(get_user_team(id) == 1)
    {
        give_item(id, "
weapon_knife")
    }

__________________
I dislike this.

"A sneeze never comes alone!" <-- Important to remember.
TitANious is offline
Send a message via MSN to TitANious
tuty
Veteran Member
Join Date: Jul 2008
Location: UK
Old 05-21-2009 , 08:28   Re: fm_give_item
Reply With Quote #3

are u drunk?

give_item(id, "weapon_knife") =))))))))))))

he need one c4 on team T... and not knife
__________________
tuty is offline
Send a message via ICQ to tuty Send a message via AIM to tuty
minimiller
Veteran Member
Join Date: Aug 2007
Location: United Kingdom
Old 05-21-2009 , 09:01   Re: fm_give_item
Reply With Quote #4

try this
PHP Code:
/*-----------------------------------------------------------------------------------------------------------------------*/
/*  Script forged by Stewie!                                                                                             */
/*---------------------------------------------------------------------------------------------------------=[ Stewie! ]=-*/

#pragma semicolon 1;

#include <amxmodx>
#include <amxmisc>
#include <fakemeta_util>
#include <hamsandwich>

new PLUG[] = "";
new 
VERS[] = "1.0";
new 
AUTH[] = "Stewie!";

public 
plugin_init()
{
    
register_plugin(PLUGVERSAUTH);
    
register_cvar(PLUGVERSFCVAR_SERVER);

    
RegisterHam(Ham_Spawn"player""player_spawn"1);
}

public 
player_spawn(id)
{
    if(
is_user_alive(id))
    {
        
fm_strip_user_weapons(id);
        
        for(new 
i=1i<get_playersnum(); i++)
        {
            if(
get_user_team(id) == 1//T
            
{
                
fm_give_item(id"weapon_knife");
                
fm_give_item(id"weapon_glock");
            }
            else if(
get_user_team(id) == 2//CT
            
{
                
fm_give_item(id"weapon_knife");
                
fm_give_item(id"weapon_usp");
            }
        }
    }
    
    
give_bomb(random_num(0,get_playersnum()));
    return 
HAM_HANDLED;
}

public 
give_bomb(id)
{
    if(
get_user_team(id) == 2)
    {
        
fm_give_item(id"weapon_c4");
    }
    else
    {
        
give_bomb(random_num(0,get_playersnum()));
    }
    return 
PLUGIN_CONTINUE;

__________________
minimiller is offline
Send a message via MSN to minimiller
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 05-21-2009 , 11:05   Re: fm_give_item
Reply With Quote #5

@minimiller, stewie.
Ham_Spawn with "player" is obviously called on every player spawn, so what's that for looping doing there? Also you are giving the bomb everytime when player spawns, so almost every guy in the team would have bomb. Also you are giving the bomb to CTs instead of Ts.
Secondly what I remember, bomb is given after Ham_Spawn even in post, so that wouldn't even work to strip it.
Also there's an ability that you can plant, which you have to set also to the player you are giving the bomb, otherwise he has to drop the bomb and pickup the bomb to be allowed to plant it. Also removing the ability from the first player would be nice.

Last edited by SnoW; 05-21-2009 at 11:07.
SnoW is offline
Send a message via MSN to SnoW
minimiller
Veteran Member
Join Date: Aug 2007
Location: United Kingdom
Old 05-22-2009 , 04:08   Re: fm_give_item
Reply With Quote #6

Quote:
Originally Posted by SnoW View Post
@minimiller, stewie.
Ham_Spawn with "player" is obviously called on every player spawn, so what's that for looping doing there? Also you are giving the bomb everytime when player spawns, so almost every guy in the team would have bomb. Also you are giving the bomb to CTs instead of Ts.
Secondly what I remember, bomb is given after Ham_Spawn even in post, so that wouldn't even work to strip it.
Also there's an ability that you can plant, which you have to set also to the player you are giving the bomb, otherwise he has to drop the bomb and pickup the bomb to be allowed to plant it. Also removing the ability from the first player would be nice.
My bad
im still getting confused by get_user_team(id)
how poor =[
__________________
minimiller is offline
Send a message via MSN to minimiller
crazyeffect
Veteran Member
Join Date: Jul 2008
Location: Belgium
Old 05-21-2009 , 11:19   Re: fm_give_item
Reply With Quote #7

PHP Code:
#include <fun>
 
give_item(id"weapon_c4"); 
and

PHP Code:
#include <fun>
 
strip_user_weapons(id
is better

Learned that from xPaw

And titanious
You forgot is_user_alive also
__________________

Last edited by crazyeffect; 05-21-2009 at 11:24.
crazyeffect is offline
Send a message via MSN to crazyeffect
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 05-21-2009 , 13:19   Re: fm_give_item
Reply With Quote #8

Quote:
Originally Posted by crazyeffect View Post
PHP Code:
#include <fun>
 
strip_user_weapons(id
http://forums.alliedmods.net/showthread.php?t=90106
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 05-21-2009 , 15:20   Re: fm_give_item
Reply With Quote #9

Quote:
Originally Posted by crazyeffect View Post
You forgot is_user_alive also
No he didn't, minimiller is checking it in Ham_Spawn func, so there's no need to do it again in the other func. Just so everyone knows, you should use cs_set_user_plant.
Edit: You meant the random player I suppose, so you'r right, missunderstood.

Last edited by SnoW; 05-22-2009 at 07:55.
SnoW is offline
Send a message via MSN to SnoW
TitANious
Veteran Member
Join Date: Feb 2009
Location: Denmark
Old 05-24-2009 , 12:19   Re: fm_give_item
Reply With Quote #10

PHP Code:
if(get_user_team(id) == 1// Terrorist
if(get_user_team(id) == 2// Counter-Terrorist
if(get_user_team(id) == 3// Spec 
Can you do a
PHP Code:
if(get_user_team(id) == && 3
?
__________________
I dislike this.

"A sneeze never comes alone!" <-- Important to remember.
TitANious is offline
Send a message via MSN to TitANious
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 01:29.


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