AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   No Weapon Pickup ... Not Working .. (https://forums.alliedmods.net/showthread.php?t=127173)

uNy 05-17-2010 18:42

No Weapon Pickup ... Not Working ..
 
Hi ya'll ... i have a problem .. i asked xPaw for a no weapon pickup, that applies just for TERRORISTS ! that means just T cant pick up weapons .. the others, can ! Here is the deal ... this is not making even weapon pickup block at any team ... so please .. someone edit it and make if for T Only .. and one that is working. Thx so much.


PHP Code:

#include < amxmodx >
#include < hamsandwich >

new g_iMaxPlayers;

public 
plugin_init( ) {
    
register_plugin"No Weapon Pickup""1.0""xPaw" );
    
    
g_iMaxPlayers get_maxplayers( );
    
    
RegisterHamHam_Touch"weaponbox""FwdHamPlayerWeaponTouch" );
    
RegisterHamHam_Touch"armoury_entity""FwdHamPlayerWeaponTouch" );
}

public 
FwdHamPlayerPickup( const iEntity, const id )
    return ( 
<= id <= g_iMaxPlayers ) ? HAM_SUPERCEDE HAM_IGNORED


JaGareN 05-17-2010 18:55

Re: No Weapon Pickup ... Not Working ..
 
PHP Code:

if( cs_get_user_team(index) == CS_TEAM_T )
{
       
//code



Bugsy 05-17-2010 19:09

Re: No Weapon Pickup ... Not Working ..
 
You should cache a players team when a team is joined; this will be more efficient than constantly calling get_user_team when this ham forward is fired (which is alot).

The reason it isn't working at all is your forward function name does not match the function name used to register.

RegisterHam( Ham_Touch, "weaponbox", "FwdHamPlayerWeaponTouch" );
RegisterHam( Ham_Touch, "armoury_entity", "FwdHamPlayerWeaponTouch" );

Try this:
PHP Code:

public FwdHamPlayerWeaponTouch( const iEntity, const id )
    return ( 
<= id <= g_iMaxPlayers ) ? HAM_SUPERCEDE HAM_IGNORED


uNy 05-17-2010 20:10

Re: No Weapon Pickup ... Not Working ..
 
Ok, i suck that bad ... can someone put that together please :) ?

Bugsy 05-17-2010 20:17

Re: No Weapon Pickup ... Not Working ..
 
This will work but can be done more efficiently.
PHP Code:

public FwdHamPlayerWeaponTouch( const iEntity, const id )
    return ( ( 
<= id <= g_iMaxPlayers ) && ( cs_get_user_teamid ) == CS_TEAM_T ) ) ? HAM_SUPERCEDE HAM_IGNORED


uNy 05-17-2010 20:21

Re: No Weapon Pickup ... Not Working ..
 
So, this is the final thing that i got .. and i can't compile it .. errors everywhere ...


PHP Code:

#include < amxmodx >
#include < hamsandwich >

new g_iMaxPlayers;

public 
plugin_init( ) {
    
register_plugin"No Weapon Pickup""1.0""xPaw" );
 

 
g_iMaxPlayers get_maxplayers( );
    
    
RegisterHamHam_Touch"weaponbox""FwdHamPlayerWeaponTouch" );
    
RegisterHamHam_Touch"armoury_entity""FwdHamPlayerWeaponTouch" );
}


public 
FwdHamPlayerWeaponTouch( const iEntity, const id )
    return ( ( 
<= id <= g_iMaxPlayers ) && ( cs_get_user_teamid ) == CS_TEAM_T ) ? HAM_SUPERCEDE HAM_IGNORED



Errors:

/groups/amxmodx/tmp3/textKEDH34.sma(10) : warning 217: loose indentation
/groups/amxmodx/tmp3/textKEDH34.sma(12) : warning 217: loose indentation
/groups/amxmodx/tmp3/textKEDH34.sma(18) : error 017: undefined symbol "cs_get_user_team"

Bugsy 05-17-2010 20:34

Re: No Weapon Pickup ... Not Working ..
 
PHP Code:

#include < amxmodx >
#include < hamsandwich >
#include < cstrike >

new g_iMaxPlayers;

public 
plugin_init( ) 
{
    
register_plugin"No Weapon Pickup""1.0""xPaw" );
    
    
g_iMaxPlayers get_maxplayers( );
    
    
RegisterHamHam_Touch"weaponbox""FwdHamPlayerWeaponTouch" );
    
RegisterHamHam_Touch"armoury_entity""FwdHamPlayerWeaponTouch" );
}

public 
FwdHamPlayerWeaponTouch( const iEntity, const id )
    return ( ( 
<= id <= g_iMaxPlayers ) && ( cs_get_user_teamid ) == CS_TEAM_T ) ) ? HAM_SUPERCEDE HAM_IGNORED



All times are GMT -4. The time now is 03:39.

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