Raised This Month: $ Target: $400
 0% 

How to give player a weapon on round start?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
6o}|{e
Junior Member
Join Date: Mar 2009
Location: Paradise!
Old 03-07-2009 , 08:25   How to give player a weapon on round start?
Reply With Quote #1

Hi there! ;)

How to give player a weapon or two or maybe more than one on round start?
6o}|{e is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 03-07-2009 , 08:29   Re: How to give player a weapon on round start?
Reply With Quote #2

Code:
#include <amxmodx> #include <fakemeta_util>   new g_MaxPlayers;   public plugin_init()         register_event("HLTV", "NewRound", "a", "1=0", "2=0");   public plugin_cfg()         g_MaxPlayers = get_maxplayers();   public NewRound()         for (new Client = 1; Client <= g_MaxPlayers; Client++)         {                 if (!is_user_alive(Client))                         continue;                   fm_give_item(Client, "weapon_awp"); // The way to give weapon         }
__________________

Last edited by hleV; 03-07-2009 at 09:47. Reason: Fixed.
hleV is offline
6o}|{e
Junior Member
Join Date: Mar 2009
Location: Paradise!
Old 03-07-2009 , 08:43   Re: How to give player a weapon on round start?
Reply With Quote #3

Man you are quick. Thanks and + karma.
6o}|{e is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-07-2009 , 08:58   Re: How to give player a weapon on round start?
Reply With Quote #4

hleV code won't compile unless you include fun instead of fakemeta_util, or unless you change give_item with fm_give_item.
Moreover, on new round, player who have died during the previous round are still dead.

It would be better to give weapons when players spawn.
Clic this link to see weapons and ammo names.

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

public plugin_init()
{
    
RegisterHam(Ham_Spawn"player""Player_Spawn_Post"1)
}

public 
Player_Spawn_Postid )
{
    if( 
is_user_aliveid ) )
    {
        
GiveNamedItemid "weapon_awp" )
        
GiveNamedItemid "ammo_338magnum" )
        
GiveNamedItemid "ammo_338magnum" )
        
GiveNamedItemid "ammo_338magnum" )
    }
}

GiveNamedItemid szName[] )
{
    new 
iEnt engfuncEngFunc_CreateNamedEntityengfunc(EngFunc_AllocStringszName) )
    if( 
pev_validiEnt ) )
    {
        new 
Float:fOrigin[3]
        
pev(idpev_originfOrigin)
        
set_pev(iEntpev_originfOrigin)
        
set_pev(iEntpev_spawnflagspev(iEntpev_spawnflags) | SF_NORESPAWN)
        
dllfunc(DLLFunc_SpawniEnt)
        
dllfunc(DLLFunc_TouchiEntid)
        if( 
szName[0] == 'w' && pev(iEntpev_effects) & EF_NODRAW )
        {
            return 
iEnt // returns only weapon ents
        
}
        else if( 
szName[0] == 'i' // only some items doesn't disappear
        
{
            
set_pev(iEntpev_flagsFL_KILLME)
        }
    }
    return 
0

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Dr.G
Senior Member
Join Date: Nov 2008
Old 03-07-2009 , 08:59   Re: How to give player a weapon on round start?
Reply With Quote #5

fm_give_item ???
__________________
Dr.G is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-07-2009 , 09:05   Re: How to give player a weapon on round start?
Reply With Quote #6

Quote:
Originally Posted by Dr.G View Post
fm_give_item ???
It's similar to the function GiveNamedItem i made, and it's included in fakemeta_util.inc.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Dr.G
Senior Member
Join Date: Nov 2008
Old 03-07-2009 , 09:36   Re: How to give player a weapon on round start?
Reply With Quote #7

yea i know it was a comment to helV's code... didnt see your post came between ;)
__________________
Dr.G 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 08:50.


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