AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   ConnorMcLeods Start Weapons Plugin (https://forums.alliedmods.net/showthread.php?t=223225)

MrKiller2010 08-11-2013 05:19

ConnorMcLeods Start Weapons Plugin
 
This plugin by ConnorMcLeod
Is working, but at some jb maps no players will get any weapon not even knife.
Could someone help me to fix it? :shock:


PHP Code:

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

#define VERSION "0.0.1"
#define PLUGIN "Jail Start Weapons"

#define m_fHasSurvivedLastRound 113
#define m_iTeam    114
#define TEAM_CT    2

new bool:g_bNewPlayer,
    
HamHook:g_iHhAddPlayerItemPreHamHook:g_iHhCBasePlayerGiveAmmoPreHamHook:g_iHhCBasePlayerSpawnPost

public plugin_init()
{
    
register_plugin(PLUGINVERSION"ConnorMcLeod")

    if( 
engfunc(EngFunc_FindEntityByStringFM_NULLENT"classname""game_player_equip") )
    {
        
pause("ac")
    }

    
RegisterHam(Ham_Spawn"player""OnCBasePlayer_Spawn"false)

    
DisableHamForwardg_iHhAddPlayerItemPre RegisterHam(Ham_AddPlayerItem"player""OnCBasePlayer_AddPlayerItem"false) )
    
DisableHamForwardg_iHhCBasePlayerGiveAmmoPre RegisterHam(Ham_GiveAmmo"player""OnCBasePlayer_GiveAmmo"false) )
    
DisableHamForwardg_iHhCBasePlayerSpawnPost RegisterHam(Ham_Spawn"player""OnCBasePlayer_Spawn_Post"true) )
}

CBasePlayer_GiveDefaultItemsid )
{
    
give_item(id"weapon_knife")

    if( 
get_pdata_int(idm_iTeam) == TEAM_CT )
    {
        
give_item(id"weapon_deagle")
        
give_item(id"weapon_m4a1")
        
ExecuteHamB(Ham_GiveAmmoid35"50ae"35)
        
ExecuteHamB(Ham_GiveAmmoid90"556nato"90)
    }
}

public 
OnCBasePlayer_Spawnid )
{
    if( !
get_pdata_int(idm_fHasSurvivedLastRound) )
    {
        
EnableHamForwardg_iHhAddPlayerItemPre )
        
EnableHamForwardg_iHhCBasePlayerGiveAmmoPre )
        
EnableHamForwardg_iHhCBasePlayerSpawnPost )
        
g_bNewPlayer true
    
}
    else if( 
is_user_aliveid ) )
    {
        
strip_user_weapons(id)
        
CBasePlayer_GiveDefaultItemsid )
    }
}

public 
OnCBasePlayer_AddPlayerItem(idiWeapon)
{
    if( 
g_bNewPlayer )
    {
        
g_bNewPlayer false
        DisableHamForward
g_iHhAddPlayerItemPre )
        
DisableHamForwardg_iHhCBasePlayerGiveAmmoPre )

        
CBasePlayer_GiveDefaultItemsid )

        
EnableHamForwardg_iHhAddPlayerItemPre )
        
EnableHamForwardg_iHhCBasePlayerGiveAmmoPre )
    }

    
set_pev(iWeaponpev_flagsFL_KILLME)
    
SetHamReturnInteger(0)

    return 
HAM_SUPERCEDE
}

public 
OnCBasePlayer_GiveAmmo()
{
    return 
HAM_SUPERCEDE
}

public 
OnCBasePlayer_Spawn_Postid )
{
    
DisableHamForwardg_iHhAddPlayerItemPre )
    
DisableHamForwardg_iHhCBasePlayerGiveAmmoPre )
    
DisableHamForwardg_iHhCBasePlayerSpawnPost )



Arkshine 08-11-2013 05:25

Re: ConnorMcLeods Start Weapons Plugin
 
The plugin runs only if the map doesn't have a game_player_equip entity.

MrKiller2010 08-11-2013 05:30

Re: ConnorMcLeods Start Weapons Plugin
 
Quote:

Originally Posted by Arkshine (Post 2010556)
The plugin runs only if the map doesn't have a game_player_equip entity.

Hmm weird.
So what do suggest me to do?

mottzi 08-11-2013 07:51

Re: ConnorMcLeods Start Weapons Plugin
 
In plugin_init remove the

if(engfunc(findentbystring))
pause()

MrKiller2010 08-11-2013 16:27

Re: ConnorMcLeods Start Weapons Plugin
 
Quote:

Originally Posted by mottzi (Post 2010656)
In plugin_init remove the

if(engfunc(findentbystring))
pause()

Then i need to remove all Ham's :S
And it doesn't work..

fysiks 08-11-2013 17:30

Re: ConnorMcLeods Start Weapons Plugin
 
Quote:

Originally Posted by MrKiller2010 (Post 2011040)
Then i need to remove all Ham's :S
And it doesn't work..

What???

MrKiller2010 08-12-2013 03:33

Re: ConnorMcLeods Start Weapons Plugin
 
Quote:

Originally Posted by fysiks (Post 2011076)
What???

When I remove the code he said.
I need to remove:
PHP Code:

DisableHamForwardg_iHhAddPlayerItemPre RegisterHam(Ham_AddPlayerItem"player""OnCBasePlayer_AddPlayerItem"false) ) 
    
DisableHamForwardg_iHhCBasePlayerGiveAmmoPre RegisterHam(Ham_GiveAmmo"player""OnCBasePlayer_GiveAmmo"false) ) 
    
DisableHamForwardg_iHhCBasePlayerSpawnPost RegisterHam(Ham_Spawn"player""OnCBasePlayer_Spawn_Post"true) ) 

In order to compile it.

guipatinador 08-12-2013 03:36

Re: ConnorMcLeods Start Weapons Plugin
 
Read again.

MrKiller2010 08-12-2013 07:14

Re: ConnorMcLeods Start Weapons Plugin
 
Quote:

Originally Posted by guipatinador (Post 2011288)
Read again.

Still don't get it.

hleV 08-12-2013 07:55

Re: ConnorMcLeods Start Weapons Plugin
 
He told you to remove the if block in plugin_init.


All times are GMT -4. The time now is 15:53.

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