Raised This Month: $12 Target: $400
 3% 

[REQ] Spawn With Deagle


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
crazyeffect
Veteran Member
Join Date: Jul 2008
Location: Belgium
Old 03-06-2009 , 14:21   [REQ] Spawn With Deagle
Reply With Quote #1

Hello,

I just need a simple plugin that sets a deagle to all players who spawn...

T's and CT's, not spawngun.sma that conorr made me, its a cool plugin, but its not what i search after all
__________________
crazyeffect is offline
Send a message via MSN to crazyeffect
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 03-06-2009 , 14:31   Re: [REQ] Spawn With Deagle
Reply With Quote #2

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

#define AUTHOR "crazyeffect"
#define PLUGIN "Spawn with deagle"
#define VERSION "1.0"

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
           
RegisterHam(Ham_Spawn"player""fw_PlayerSpawn"1)
}
public 
fw_PlayerSpawn(id)
{
          if (!
is_user_alive(id))
                  return;
          
fm_give_item(id"weapon_deagle")
          
fm_set_user_bpammo(idCSW_DEAGLE35)
}
stock fm_give_item(index, const item[])
{
    if (!
equal(item"weapon_"7) && !equal(item"ammo_"5) && !equal(item"item_"5) && !equal(item"tf_weapon_"10))
        return 
0

    
new ent engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocStringitem))
    if (!
pev_valid(ent))
        return 
0

    
new Float:origin[3]
    
pev(indexpev_originorigin)
    
set_pev(entpev_originorigin)
    
set_pev(entpev_spawnflagspev(entpev_spawnflags) | SF_NORESPAWN)
    
dllfunc(DLLFunc_Spawnent)

    new 
save pev(entpev_solid)
    
dllfunc(DLLFunc_Touchentindex)
    if (
pev(entpev_solid) != save)
        return 
ent

    engfunc
(EngFunc_RemoveEntityent)

    return -
1
}
stock fm_set_user_bpammo(idiWeaponiAmount

    new 
iOffset
    switch(
iWeapon
    { 
        case 
CSW_AWPiOffset 377
        case 
CSW_SCOUTCSW_AK47CSW_G3SG1iOffset 378
        case 
CSW_M249iOffset 379
        case 
CSW_FAMASCSW_M4A1CSW_AUGCSW_SG550CSW_GALICSW_SG552iOffset 380
        case 
CSW_M3CSW_XM1014iOffset 381
        case 
CSW_USPCSW_UMP45CSW_MAC10iOffset 382
        case 
CSW_FIVESEVENCSW_P90iOffset 383
        case 
CSW_DEAGLEiOffset 384
        case 
CSW_P228iOffset 385
        case 
CSW_GLOCK18CSW_MP5NAVYCSW_TMPCSW_ELITEiOffset 386
        case 
CSW_FLASHBANGiOffset 387
        case 
CSW_HEGRENADEiOffset 388
        case 
CSW_SMOKEGRENADEiOffset 389
        case 
CSW_C4iOffset 390
        default:return; 
    } 
    
set_pdata_int(idiOffsetiAmount); 

xbatista is offline
Send a message via Skype™ to xbatista
crazyeffect
Veteran Member
Join Date: Jul 2008
Location: Belgium
Old 03-06-2009 , 14:39   Re: [REQ] Spawn With Deagle
Reply With Quote #3

I'm not a scirpter, but is this all nessascary?

PHP Code:
        case CSW_AWPiOffset 377;  
        case 
CSW_SCOUTCSW_AK47CSW_G3SG1iOffset 378;  
        case 
CSW_M249iOffset 379;  
        case 
CSW_FAMASCSW_M4A1CSW_AUGCSW_SG550CSW_GALICSW_SG552iOffset 380;  
        case 
CSW_M3CSW_XM1014iOffset 381;  
        case 
CSW_USPCSW_UMP45CSW_MAC10iOffset 382;  
        case 
CSW_FIVESEVENCSW_P90iOffset 383;  
        case 
CSW_DEAGLEiOffset 384;  
        case 
CSW_P228iOffset 385;  
        case 
CSW_GLOCK18CSW_MP5NAVYCSW_TMPCSW_ELITEiOffset 386;  
        case 
CSW_FLASHBANGiOffset 387;  
        case 
CSW_HEGRENADEiOffset 388;  
        case 
CSW_SMOKEGRENADEiOffset 389;  
        case 
CSW_C4iOffset 390
</SPAN>

Only deagle will work too


Anyway, i will try this very soon
__________________
crazyeffect is offline
Send a message via MSN to crazyeffect
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-06-2009 , 14:45   Re: [REQ] Spawn With Deagle
Reply With Quote #4

PHP Code:
/*    Copyright © 2009, ConnorMcLeod

    Spawn 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; if not, write to the
    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

#define PLUGIN "Spawn"
#define AUTHOR "ConnorMcLeod"
#define VERSION "0.0.1"

#define MAX_PLAYERS 32

const m_iId 43

const m_iTeam 114

new g_iTeam[MAX_PLAYERS+1]
new 
g_bFirstSpawn[MAX_PLAYERS+1]
new 
g_bRestart[MAX_PLAYERS+1]
new 
g_bRestarting
new g_iMaxPlayers

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
register_event("TextMsg""Event_TextMsg_Restart""a""2&#Game_C""2&#Game_w")
    
register_event("HLTV""Event_HLTV_New_Round""a""1=0""2=0")

    
RegisterHam(Ham_Spawn"player""Player_Spawn_Pre")
    
RegisterHam(Ham_AddPlayerItem"player""Player_AddPlayerItem")

    
register_forward(FM_ClientPutInServer"ClientPutInServer")

    
g_iMaxPlayers get_maxplayers()
}

public 
ClientPutInServer(id)
{
    
g_bFirstSpawnid ] = true
    g_iTeam
id ] = 0
    g_bRestart
id ] = false
}

public 
Event_TextMsg_Restart()
{
    
g_bRestarting true
}

public 
Event_HLTV_New_Round()
{
    if( 
g_bRestarting )
    {
        
g_bRestarting false
        
for(new id=1id<=g_iMaxPlayersid++)
        {
            if( 
is_user_aliveid ) )
            {
                
g_bRestartid ] = true
            
}
        }
    }
}

public 
Player_Spawn_Preid )
{
    if( 
g_bFirstSpawnid ] )
    {
        
g_bFirstSpawnid ] = false
        
return
    }

    if( 
ExecuteHam(Ham_IsAliveid) )
    {
        if( !
g_bRestartid ] )
        {
            return
        }
    }

    
g_bRestartid ] = false

    
switch( get_pdata_int(idm_iTeam5) )
    {
        case 
1:
        {
            
g_iTeamid ] = 1
        
}
        case 
2:
        {
            
g_iTeamid ] = 2
        
}
    }
}

public 
Player_AddPlayerItemid iWeapon )
{
    new 
szClassName[2]
    
pev iWeapon pev_classname szClassName charsmax szClassName ) )
    if( 
szClassName[0] != 'w' )
    {
        return 
HAM_IGNORED
    
}

    new 
iId get_pdata_intiWeaponm_iId)
    if( 
iId != CSW_GLOCK18 && iId != CSW_USP )
    {
        return 
HAM_IGNORED
    
}

    new 
iTeam g_iTeamid ]
    switch( 
iTeam )
    {
        case 
1:
        {
            if( 
iId != CSW_GLOCK18 )
            {
                return 
HAM_IGNORED
            
}
        }
        case 
2:
        {
            if( 
iId != CSW_USP )
            {
                return 
HAM_IGNORED
            
}
        }
        default:return 
HAM_IGNORED
    
}

    
set_pev(iWeaponpev_flagspev(iWeaponpev_flags) | FL_KILLME)

    
Give_Player_Deagleid )
    
g_iTeamid ] = 0
    SetHamReturnInteger
(0)
    
    return 
HAM_SUPERCEDE
}

Give_Player_Deagleid )
{
    
GiveNamedItemid "weapon_deagle" )
    
ExecuteHamB(Ham_GiveAmmoid21"50ae"35)
}

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' )
        {
            
set_pev(iEntpev_flagsFL_KILLME)
        }
    }
    return 
0

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Old 03-06-2009, 14:46
SnoW
This message has been deleted by SnoW. Reason: Connor's too fast.
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 03-06-2009 , 14:47   Re: [REQ] Spawn With Deagle
Reply With Quote #5

This is just a stock.
fm_set_user_bpammo(id, CSW_DEAGLE, 35) // CSW_DEAGLE is weapon const see: amxconst.inc and "35" value of ammo.
xbatista is offline
Send a message via Skype™ to xbatista
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 03-06-2009 , 14:58   Re: [REQ] Spawn With Deagle
Reply With Quote #6

@ xbatista
PHP Code:
fm_set_user_bpammo(idCSW_DEAGLE35)

// -> or even you can simple give_item, the ammo for deagle, i dont remember how it named right.

set_pdata_int(id38435); 
to save unnesesary stock, also i'm sure linux have other offests, and you also should strip glock/usp befeore giving deagle :]
__________________
xPaw is offline
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 03-06-2009 , 15:01   Re: [REQ] Spawn With Deagle
Reply With Quote #7

He don't say about glock,usp.
xbatista is offline
Send a message via Skype™ to xbatista
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-06-2009 , 15:22   Re: [REQ] Spawn With Deagle
Reply With Quote #8

Offsets are the same on linux except they are 5 higher for players, witch is the default value for extraoffset param for s/get_pdata_XXX natives.

The plugin i've posted shouldn't let the game give glock or usp to players when they spawn.
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 03-06-2009 at 15:26.
ConnorMcLeod is offline
crazyeffect
Veteran Member
Join Date: Jul 2008
Location: Belgium
Old 03-07-2009 , 04:46   Re: [REQ] Spawn With Deagle
Reply With Quote #9

Thanks conor, you'r plugin works perfectly, like always
__________________
crazyeffect is offline
Send a message via MSN to crazyeffect
Fighter3
Junior Member
Join Date: Mar 2011
Old 03-31-2011 , 12:26   Re: [REQ] Spawn With Deagle
Reply With Quote #10

hey,

what do i have to change that only cts spawn with a deagle?

thanks for your help :-)
Fighter3 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 07:40.


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