Raised This Month: $ Target: $400
 0% 

Remove Weapon


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
tonykaram1993
Senior Member
Join Date: Mar 2013
Location: This World
Old 04-13-2013 , 21:52   Re: Remove Weapon
Reply With Quote #1

Alright, I know exactly what's happening here. I used to use HLTV event to count how many CT and T alive players there is, and I always used to get false results. If a T was killed the round before, he won't be counted. I realised that HLTV is executed almost before all the players have been spawned. Solution? I delayed the event for about 0.2 seconds and everything worked fine. Please try the following code and let me know the result:
PHP Code:
#include < amxmodx >
#include < fun >
// #include < fakemeta >

public plugin_init( ) {
    
register_plugin"Strip Test""1.0""tonykaram1993" );
    
    
register_event"HLTV",     "Event_HLTV""a""1=0""2=0" );
}

public 
Event_HLTV( ) {
    
set_task0.2"Task_DelayedHLTV" );
}

public 
Task_DelayedHLTV( ) {
    static 
iPlayers32 ], iNumiLoopiTempID;
    
get_playersiPlayersiNum"a" );
    
    for( 
iLoop 0iLoop iNumiLoop++ ) {
        
iTempID iPlayersiLoop ];
        
        
/*
            However I do not recommend you to strip players this way,
            since it could bug the player and he will not be able to 
            pickup a primary weapon anymore. If you want you can use
            the commented function below (you need to include fakemeta
            tho)
        */
        
strip_user_weaponsiTempID );
        
give_itemiTempID"weapon_knife" );
    }
}

/*
    To use the function below, you need to include fakemeta above
*/
/*StripPlayerWeapons( iPlayerID ) {
    strip_user_weapons( iPlayerID );
    set_pdata_int( iPlayerID, 116, 0 );
    
    give_item( iPlayerID, "weapon_knife" );
}*/ 
__________________
My Plugins:
UltimatePlugin
UltimateSurf
UltimateAdmin
Code:
rcon version | rcon amxx version | rcon meta version
rcon amxx plugins | rcon meta list | rcon status
I AM INACTIVE ON THIS FORUM - For direct contact: [email protected]

Last edited by tonykaram1993; 04-13-2013 at 21:53.
tonykaram1993 is offline
Leon M.
Senior Member
Join Date: Apr 2009
Location: Germany
Old 04-14-2013 , 01:09   Re: Remove Weapon
Reply With Quote #2

You should use Ham_Spawn
PHP Code:
#include <fun>
#include <fakemeta>
#include <hamsandwich>

public plugin_init(){
    
RegisterHam(Ham_Spawn"player""ham_spawn_player_post"1)
}

public 
ham_spawn_player_post(id){
    if (
is_user_alive(id)){
        
strip_user_weapons(id)
        
set_pdata_int(id1160)
        
give_item(id"weapon_knife")
        switch(
get_user_team(id)){
            case 
1give_item(id"weapon_galil")
            case 
2give_item(id"weapon_famas")
        }
    }

__________________
  • ZapTic - Paintball (Version 7.1.3 b1303)
  • Your #1 CS Paintball Server since 2008
  • 85.131.163.101:27015

Last edited by Leon M.; 04-14-2013 at 01:09.
Leon M. 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 10:54.


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