AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Custom Block weapon pickup (CSS) (https://forums.alliedmods.net/showthread.php?t=140325)

russy 10-10-2010 19:28

Custom Block weapon pickup (CSS)
 
I'm tried to strip terroist team when they pick up an item (theier only ment to have knife)

so far i have:

Code:

StripAndGive( client )
{
    new wepIdx;
   
    if( GetClientTeam( client ) == CS_TEAM_T )
    {
       
        for( new i = 0; i < 2; i++ )
        {
            while( ( wepIdx = GetPlayerWeaponSlot( client, i ) ) != -1 )
            {
                RemovePlayerItem( client, wepIdx );
            }
        }
    }
}

public Action:Event_pickup(Handle:event, const String:name[], bool:dontBroadcast)
{
      if (GetClientTeam( client ) == CS_TEAM_T)
      {
            {
            RemovePlayerItem( client, wepIdx );
            }
      }
}

now i get the problem unidenifyed cleint for the last 2 cleints in the code
i've tried replaceing them with userid but thats has the problem how do i get around this problem?

Silvers 10-10-2010 20:18

Re: Custom Block weapon pickup (CSS)
 
I think you need to use this in the Event_pickup:

client = GetClientOfUserId(client)

To get the correct client ID.

russy 10-10-2010 20:28

Re: Custom Block weapon pickup (CSS)
 
well it's stoped the undfined symbol for the code above but now i got it for the code below >.<
Code:

public Action:Event_pickup(client = GetClientOfUserId(client), Handle:event, const String:name[], bool:dontBroadcast)

Silvers 10-10-2010 20:31

Re: Custom Block weapon pickup (CSS)
 
Lol

PHP Code:

public Action:Event_pickup(Handle:event, const String:name[], bool:dontBroadcast)
{
      new 
client GetEventInt(event"userid");
      
client GetClientOfUserId(client);

      if (
GetClientTeamclient ) == CS_TEAM_T
      {
            {
                  
RemovePlayerItemclientwepIdx );
            }
      }



russy 10-10-2010 20:43

Re: Custom Block weapon pickup (CSS)
 
o yea lol thanks

thetwistedpanda 10-10-2010 23:20

Re: Custom Block weapon pickup (CSS)
 
You could look into SDKHooks and WeaponCanUse ~ this will prevent the player from picking up items they can't use.

russy 10-11-2010 12:28

Re: Custom Block weapon pickup (CSS)
 
Quote:

Originally Posted by thetwistedpanda (Post 1321723)
You could look into SDKHooks and WeaponCanUse ~ this will prevent the player from picking up items they can't use.

a weaponCantUse would be really helpful for CT XD

thetwistedpanda 10-11-2010 12:35

Re: Custom Block weapon pickup (CSS)
 
Something like this:
PHP Code:

public Action:OnWeaponCanUse(clientweapon)
{
    if(
GetClientTeam(client) == CS_TEAM_CT)
    {
        
decl String:weaponString[64];
        
GetEdictClassname(weaponweaponStringsizeof(weaponString));
        if (!
StrEqual(weaponString"weapon_knife") && !StrEqual(weaponString"weapon_hegrenade"))
            return 
Plugin_Handled;
    }

    return 
Plugin_Continue;



russy 10-11-2010 13:49

Re: Custom Block weapon pickup (CSS)
 
that isn't working for me it wont block any weapons at all

Monkeys 10-11-2010 13:53

Re: Custom Block weapon pickup (CSS)
 
Quote:

Originally Posted by russy (Post 1322277)
that isn't working for me it wont block any weapons at all

You need SDKHooks installed.


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

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