Raised This Month: $ Target: $400
 0% 

Strip User Weapons Last CT


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Monster Truck
Member
Join Date: Jan 2012
Location: France
Old 07-24-2014 , 22:37   Strip User Weapons Last CT
Reply With Quote #1

Hi, i tried to make a little plugin that strips terros weapons (primary, secondary, c4) when only 1 CT remains, but it didn't work.

- The Link to the stock i Used : Strip Primary weapon, secondary, grenades.

- This Code i made :
PHP Code:
#include < amxmodx >
#include < cstrike >
#include < stripweapons >

#define VERSION "1.2"
#define MAX_PLAYERS 32

public plugin_init( )

    
register_plugin"Strip Weapons Last CT"VERSION"Imag!ne" )

    
register_event"DeathMsg""Event_DeathMsg""a" );
}

public 
Event_DeathMsgid )
{
    new 
iPlayersCtMAX_PLAYERS ], iNumCt;
    
get_playersiPlayersCtiNumCt"ae""CT" ) ;
    
    if( 
iNumCt == )
    {
        
StripTerrosWeaponsid );
    }
}

public 
StripTerrosWeaponsid )
{
    if( 
is_user_aliveid ) && cs_get_user_teamid ) == CS_TEAM_T )
    {
        
StripWeaponsidPrimary );
        
StripWeaponsidSecondary );
        
StripWeaponsidC4 );
    }

- And The Notable error i got :
Code:
L 07/24/2014 - 19:02:58: [CSTRIKE] Player out of range (0)
Actually, I think the error is that the condition i made will check for a player that is the last CT and Terrorist together, but i really don't know how to do it otherwise.

If someone has the time to help me, i'll be really gratefull.

Last edited by Monster Truck; 07-25-2014 at 15:37.
Monster Truck is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 07-24-2014 , 22:44   Re: Strip User Weapons Last CT
Reply With Quote #2

Where is the rest of the code? Where is the complete error message?
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 07-24-2014 , 22:47   Re: Strip User Weapons Last CT
Reply With Quote #3

First of all, there is no arguments passed through the function header for that message.
And if you have only 1 player found with get_players(), then you can get their index with iPlayersCt[ 0 ], which you would pass to your stripping function.
However I'm not sure why your checking for the last CT but then trying to strip weapons off a T.
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
Eagle07
Veteran Member
Join Date: May 2014
Location: Morocco :D
Old 07-24-2014 , 23:05   Re: Strip User Weapons Last CT
Reply With Quote #4

try with
fm_strip_user_weapons( index );
include fakemeta_util.inc
__________________
Eagle07 is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 07-24-2014 , 23:29   Re: Strip User Weapons Last CT
Reply With Quote #5

Quote:
Originally Posted by Eagle07 View Post
try with
fm_strip_user_weapons( index );
include fakemeta_util.inc
That is completely unrelated and fakemeta_util should never be used.
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
Monster Truck
Member
Join Date: Jan 2012
Location: France
Old 07-25-2014 , 10:06   Re: Strip User Weapons Last CT
Reply With Quote #6

Quote:
Originally Posted by YamiKaitou View Post
Where is the rest of the code? Where is the complete error message?
This is The Only Error message i got, but it's not in the compilation as u can see it, it's in when it's activated on the server.
This is also the full code, the stock is given in the link on the first post.

Hornet, i want the server to strips all Terros weapons when it still only 1 CT left on the round.
I can't use iPlayersCt[ 0 ] in strips user weapons because it'll strip the weapons to the last CT, and i don't want to do that.

What do you mean by :
Quote:
Originally Posted by hornet View Post
First of all, there is no arguments passed through the function header for that message.

Last edited by Monster Truck; 07-25-2014 at 10:39.
Monster Truck is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 07-25-2014 , 11:27   Re: Strip User Weapons Last CT
Reply With Quote #7

DeathMsg doesn't have arguments passed into the header of the function,you get them with read_data.

PHP Code:
#include < amxmodx >
#include < cstrike >
#include < stripweapons >

#define VERSION "1.2"
#define MAX_PLAYERS 32

public plugin_init( )

    
register_plugin"Strip Weapons Last CT"VERSION"Imag!ne" )
    
    
register_event"DeathMsg""Event_DeathMsg""a" );
}

public 
Event_DeathMsg( )
{
    new 
iPlayersCtMAX_PLAYERS ], iNumCt;
    
get_playersiPlayersCtiNumCt"ae""CT" ) ;
    
    if( 
iNumCt == )
    {
        
StripTerrosWeapons( );
    }
}

public 
StripTerrosWeapons(  )
{
    new 
iPlayersCtMAX_PLAYERS ], iNumCt,id;
    
get_playersiPlayersCtiNumCt"ae""TERRORIST" ) ;
    
    for( new 
iiNumCti++ ) 
    {
        
id iPlayersCt ]
        
StripWeaponsidPrimary );
        
StripWeaponsidSecondary );
        
StripWeaponsidC4 );
        
    }


Last edited by HamletEagle; 07-27-2014 at 04:57. Reason: Fixed variable name.
HamletEagle is offline
Blizzard_87
Veteran Member
Join Date: Oct 2012
Old 07-25-2014 , 17:54   Re: Strip User Weapons Last CT
Reply With Quote #8

Quote:
Originally Posted by Eagle07 View Post
try with
fm_strip_user_weapons( index );
include fakemeta_util.inc
Please read the OP thread post before you give code which doesn't relate to the problem.
__________________
Blizzard_87 is offline
Monster Truck
Member
Join Date: Jan 2012
Location: France
Old 07-25-2014 , 19:10   Re: Strip User Weapons Last CT
Reply With Quote #9

Thanks for the code HamletEagle, i'm testing it when i'll have the time, but i think this is the right way to do it.

Last edited by Monster Truck; 07-25-2014 at 19:10.
Monster Truck is offline
Monster Truck
Member
Join Date: Jan 2012
Location: France
Old 07-26-2014 , 19:53   Re: Strip User Weapons Last CT
Reply With Quote #10

It worked, if someone wants to take his code and is not experienced, change

PHP Code:
for( new iiNumCTi++ ); 

PHP Code:
for( new iiNumCti++ ); 
Or u'll get an error "Undefined Symbol" when u'll compile.

Edit: Nvm, got fixed

Last edited by Monster Truck; 01-01-2015 at 07:37.
Monster Truck 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:28.


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