AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Approved Plugins (https://forums.alliedmods.net/forumdisplay.php?f=8)
-   -   Pistol And Ammo (Verison 1.1) (https://forums.alliedmods.net/showthread.php?t=103753)

wilson409 09-16-2009 06:17

Pistol And Ammo (Verison 1.1)
 
1 Attachment(s)
Pistol And Ammo
Description:

This is a simple plugin, if you drop your pistol then next round will give you a pistol(Ct = USP,
T = Glock18 ) and ammo

Cvar:

amx_pna - 1 enabled / 0 - disabled (def 1)

Modules:

- cstrike
- hamsandwich
- fun

Credits]

ConnorMcLeod - Ham_Spawn , has_user_pistol( id )

To DO]

V1.2 - which pistol you drop , which pistol you will get

One 09-16-2009 06:43

Re: Pistol And Amno
 
WTF? you just give ammo & pistols & nothing more oO wahts when i drop my DEAGLE ? =))

Xevious 09-16-2009 06:46

Re: Pistol And Amno
 
nice plugin , keep it up!

wilson409 09-16-2009 07:41

Re: Pistol And Amno
 
Quote:

Originally Posted by One (Post 934502)
WTF? you just give ammo & pistols & nothing more oO wahts when i drop my DEAGLE ? =))

Thank for your remind ! Changed Description

ConnorMcLeod 09-16-2009 07:55

Re: Pistol And Amno
 
Actually, your plugin give pistols even if players still have some pistols.
Would be more correct to give a gun when player has no gun, and to give default ammo when player has less than default.
Feel free to use my code.

PHP Code:

/*    Formatright © 2009, ConnorMcLeod

    Spawn with Pistols is free software;
    you can redistribute it and/or modify it under the terms of the
    GNU General Public License as published by the Free Software Foundation.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Spawn with Pistols; if not, write to the
    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/

#include <amxmodx>
#include <cstrike>
// #include <engine>
// #include <fakemeta>
#include <fun>
#include <hamsandwich>

#define VERSION "0.0.1"

#define m_rgpPlayerItems_slot2    369

public plugin_init()
{
    
register_plugin("Spawn with Pistols"VERSION"ConnorMcLeod")

    
RegisterHam(Ham_Spawn"player""Player_Spawn_Post"1)
}

public 
Player_Spawn_Postid )
{
    if( 
is_user_alive(id) && !has_user_pistol(id) )
    {
        switch( 
cs_get_user_teamid ) )
        {
            case 
CS_TEAM_T:
            {
                
give_item(id"weapon_glock18")
                if( 
cs_get_user_bpammo(idCSW_GLOCK18) < 40 )
                {
                    
cs_set_user_bpammo(idCSW_GLOCK1840)
                }
            }
            case 
CS_TEAM_CT:
            {
                
give_item(id"weapon_usp")
                if( 
cs_get_user_bpammo(idCSW_USP) < 24 )
                {
                    
cs_set_user_bpammo(idCSW_USP24)
                }
            }
        }
    }
}

has_user_pistolid )
{
    return ( 
get_pdata_cbase(idm_rgpPlayerItems_slot25) > )



wilson409 09-17-2009 05:23

Re: Pistol And Amno
 
Quote:

Originally Posted by ConnorMcLeod (Post 934560)
Actually, your plugin give pistols even if players still have some pistols.
Would be more correct to give a gun when player has no gun, and to give default ammo when player has less than default.
Feel free to use my code.

PHP Code:

/*    Formatright © 2009, ConnorMcLeod

    Spawn with Pistols is free software;
    you can redistribute it and/or modify it under the terms of the
    GNU General Public License as published by the Free Software Foundation.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Spawn with Pistols; if not, write to the
    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/

#include <amxmodx>
#include <cstrike>
// #include <engine>
// #include <fakemeta>
#include <fun>
#include <hamsandwich>

#define VERSION "0.0.1"

#define m_rgpPlayerItems_slot2    369

public plugin_init()
{
    
register_plugin("Spawn with Pistols"VERSION"ConnorMcLeod")

    
RegisterHam(Ham_Spawn"player""Player_Spawn_Post"1)
}

public 
Player_Spawn_Postid )
{
    if( 
is_user_alive(id) && !has_user_pistol(id) )
    {
        switch( 
cs_get_user_teamid ) )
        {
            case 
CS_TEAM_T:
            {
                
give_item(id"weapon_glock18")
                if( 
cs_get_user_bpammo(idCSW_GLOCK18) < 40 )
                {
                    
cs_set_user_bpammo(idCSW_GLOCK1840)
                }
            }
            case 
CS_TEAM_CT:
            {
                
give_item(id"weapon_usp")
                if( 
cs_get_user_bpammo(idCSW_USP) < 24 )
                {
                    
cs_set_user_bpammo(idCSW_USP24)
                }
            }
        }
    }
}

has_user_pistolid )
{
    return ( 
get_pdata_cbase(idm_rgpPlayerItems_slot25) > )



Thank you very much

wilson409 09-19-2009 03:13

Re: Pistol And Amno (Verison 1.1)
 
updated

crazyeffect 09-19-2009 03:16

Re: Pistol And Amno (Verison 1.1)
 
Amno -> Ammo

drop away your pistol -> drop your pistol

wilson409 09-19-2009 03:22

Re: Pistol And Amno (Verison 1.1)
 
Quote:

Originally Posted by crazyeffect (Post 937315)
Amno -> Ammo

drop away your pistol -> drop your pistol

sorry for my bad english

Hawk552 09-20-2009 15:59

Re: Pistol And Ammo (Verison 1.1)
 
This plugin is well done.

If you would like any information regarding possible adjustments you could make or things you could do to make this better, please feel free to post here or PM me.

Approved.


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

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