AlliedModders

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

tlch0324 05-21-2009 06:58

fm_give_item
 
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

TitANious 05-21-2009 07:13

Re: fm_give_item
 
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")
    }



tuty 05-21-2009 08:28

Re: fm_give_item
 
are u drunk?

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

he need one c4 on team T... and not knife

minimiller 05-21-2009 09:01

Re: fm_give_item
 
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;



SnoW 05-21-2009 11:05

Re: fm_give_item
 
@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.

crazyeffect 05-21-2009 11:19

Re: fm_give_item
 
PHP Code:

#include <fun>
 
give_item(id"weapon_c4"); 

and

PHP Code:

#include <fun>
 
strip_user_weapons(id

is better :D

Learned that from xPaw :D

And titanious :P
You forgot is_user_alive also :D

ot_207 05-21-2009 13:19

Re: fm_give_item
 
Quote:

Originally Posted by crazyeffect (Post 831701)
PHP Code:

#include <fun>
 
strip_user_weapons(id


http://forums.alliedmods.net/showthread.php?t=90106

SnoW 05-21-2009 15:20

Re: fm_give_item
 
Quote:

Originally Posted by crazyeffect (Post 831701)
You forgot is_user_alive also :D

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.

minimiller 05-22-2009 04:08

Re: fm_give_item
 
Quote:

Originally Posted by SnoW (Post 831695)
@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 =[

TitANious 05-24-2009 12:19

Re: fm_give_item
 
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

?


All times are GMT -4. The time now is 01:29.

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