Raised This Month: $ Target: $400
 0% 

Looping for players and weapon pick up


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
t3hNox
Senior Member
Join Date: Oct 2009
Old 03-06-2010 , 04:41   Looping for players and weapon pick up
Reply With Quote #1

Hi there,
I'm trying things out and I have two questions.

First. I want to get a current amount of players. Code:
PHP Code:
        new const MAXPLAYERS get_maxplayers() 
    new 
playerCount
    
for (new 0<= MAXPLAYERSp++) {
        
playerCount++
    }
    if(
playerCount >= 6) {
        
//do something 
    

Second. Is there a more efficient way how to do this ?
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

public plugin_init() {
        
//register
    
register_forward(FM_PlayerPreThink"fwd_PlayerPreThink_post"1);

}

public 
fwd_PlayerPreThink_post(id)
{
    if(!
is_user_alive(id))
        return 
FMRES_IGNORED;
    
    static 
iWpn;
    
iWpn get_pdata_cbase(id373);
    
    if(
pev_valid(iWpn) && get_user_team(id) == 1)
    {
        if(
get_pdata_int(iWpn43) != CSW_KNIFE ) { 
            
engclient_cmd(id"weapon_knife");
            
client_print(idprint_center"** You cannot pick up this weapon **")
        }
    }
    return 
FMRES_IGNORED;

(The code above is mostly copied from another plugin.) How can I make that grenades and USP can be picked up too ?

I was in hurry when I wrote this so excause me for mistakes.
t3hNox is offline
 



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 08:40.


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