Raised This Month: $ Target: $400
 0% 

Team limiting + round limiting.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
eskemo
Senior Member
Join Date: Dec 2008
Location: Australia
Old 10-26-2011 , 07:24   Team limiting + round limiting.
Reply With Quote #1

Not to sure on scripting but i have started, I don't know what includes are needed for this but i added aload. Ok In the menu i want it to make it you can only use that menu item once per round (NO IDEA HOW TO DO THIS AND WOULD LOVE SOME HELP!) and the 2nd thing would be making case 1 limited to the Counter-terrorist team.. and the case 2 limited to the terrorist and case 3 is to be left alone as i am not to sure if i am going to add any more thing's like a new wep or something in their atm.

If you find my typing isn't lacking grammer and letter's. Sorry I havn't had much sleep and school/work is fucking with me.
Please help me if you can thank you.

EDIT : Forgot to add can i get help on making it have a delay time from start of round so it doesn't screw with other things.
Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <amxmisc>
#include <fakemeta>
#include <fun>


#define PLUGIN "Poison + Bazooka"
#define VERSION "1.0"
#define AUTHOR "eskemo"


public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR);
    register_clcmd("avpBP","PosionBazooka" );
}

public PosionBazooka(id)
{
    new menu = menu_create("\rAlien + Predator Spec's :", "menu_handler");
    menu_additem(menu, "\wPredator Bazooka", "1", 0);
    menu_additem(menu, "\wAlien Acid", "2", 0);
    menu_additem(menu, "\rComming Soon", "3", ADMIN_ADMIN);
    menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
    menu_display(id, menu, 0);
}

public menu_handler(id, menu, item)
{
    if( item == MENU_EXIT )
    {
        menu_destroy(menu);
        return PLUGIN_HANDLED;
    }
    
    new data[6], szName[64];
    new access, callback;
    menu_item_getinfo(menu, item, access, data,charsmax(data), szName,charsmax(szName), callback);

    new key = str_to_num(data);
    switch(key)
    {
        case 1:
         if( CS_TEAM_CT == 1 )
        {
            client_print(id, print_chat, "You have just used your only Predator Missile.");
            client_print(id, print_chat, "You were given 25 Armour as a bonus of using this feature.");
            menu_destroy(menu);
            return PLUGIN_HANDLED;
        }
        else
        {
            client_print(id, print_chat, "eskemo.info : Please wait till you are on the Predators Team.");
            menu_destroy(menu);
            return PLUGIN_HANDLED;
        }
        case 2:
        if( CS_TEAM_T == 1 )
        {
            client_print(id, print_chat, "You have just used your only Alien Acid");
            client_print(id, print_chat, "You were given a 200 health bonus for using this feature");
            menu_destroy(menu);
            return PLUGIN_HANDLED;
        }
        else
        {
            client_print(id, print_chat, "Eskemo.info : Please wait till you are on the Aliens Team.");
            menu_destroy(menu);
            return PLUGIN_HANDLED;
        }
        case 3:
        {
            client_print(id, print_chat, "Admin Selection Comming soon");
            return PLUGIN_HANDLED;
        }
    }
    menu_destroy(menu);
    return PLUGIN_HANDLED;
}
__________________


Free Australian FASTDL Server PM ME

Last edited by eskemo; 10-26-2011 at 07:28.
eskemo is offline
Evaldas.Grigas
Senior Member
Join Date: Sep 2011
Location: Lithuania
Old 10-26-2011 , 09:25   Re: Team limiting + round limiting.
Reply With Quote #2

Here this code should make it that it could be used once per round.
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <amxmisc>
#include <fakemeta>
#include <fun>

#define MAXPLAYERS 10 + 1

#define PLUGIN "Poison + Bazooka"
#define VERSION "1.0"
#define AUTHOR "eskemo"

new bool:gbUsed[MAXPLAYERS];

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR);
    
register_clcmd("avpBP","PosionBazooka" );
}

public 
eventRoundEnd()
{
    
arraysetgbUsedfalseMAXPLAYERS )
}

public 
client_disconnect(id)
{
    
gbUsed[id] = false;
}

public 
PosionBazooka(id)
{
    if (!
gbUsed[id])
    {
    new 
menu menu_create("\rAlien + Predator Spec's :""menu_handler");
    
menu_additem(menu"\wPredator Bazooka""1"0);
    
menu_additem(menu"\wAlien Acid""2"0);
    
menu_additem(menu"\rComming Soon""3"ADMIN_ADMIN);
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
menu_display(idmenu0);
    
gbUsed[id] = true;
    }
    return 
PLUGIN_HANDLED
}

public 
menu_handler(idmenuitem)
{
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    
    new 
data[6], szName[64];
    new 
accesscallback;
    
menu_item_getinfo(menuitemaccessdata,charsmax(data), szName,charsmax(szName), callback);

    new 
key str_to_num(data);
    switch(
key)
    {
    case 
1:
    {
    if( 
get_user_team(id) == )
    {
        
client_print(idprint_chat"You have just used your only Predator Missile.");
        
client_print(idprint_chat"You were given 25 Armour as a bonus of using this feature.");
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    else
    {
        
client_print(idprint_chat"eskemo.info : Please wait till you are on the Predators Team.");
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    }
    case 
2:
    {
    if( 
get_user_team(id) == )
    {
        
client_print(idprint_chat"You have just used your only Alien Acid");
        
client_print(idprint_chat"You were given a 200 health bonus for using this feature");
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    else
    {
        
client_print(idprint_chat"Eskemo.info : Please wait till you are on the Aliens Team.");
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    }
    case 
3:
    {
        
client_print(idprint_chat"Admin Selection Comming soon");
        return 
PLUGIN_HANDLED;
    }
    }
    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;

__________________
Please enter this website everyday: http://forums.alliedmods.net/showthread.php?t=169067
Evaldas.Grigas is offline
Send a message via Skype™ to Evaldas.Grigas
eskemo
Senior Member
Join Date: Dec 2008
Location: Australia
Old 10-26-2011 , 17:27   Re: Team limiting + round limiting.
Reply With Quote #3

Thanks Now i see what i did wrong for the player teams aswell

Just tested it's still being used multiple times
__________________


Free Australian FASTDL Server PM ME

Last edited by eskemo; 10-26-2011 at 17:32.
eskemo is offline
eskemo
Senior Member
Join Date: Dec 2008
Location: Australia
Old 10-26-2011 , 17:43   Re: Team limiting + round limiting.
Reply With Quote #4

I apologise, It does work. but by the looks of it once per map. I need it once per round. how do you change this?
__________________


Free Australian FASTDL Server PM ME
eskemo is offline
Blue Snake.
Member
Join Date: May 2011
Location: Romania
Old 10-27-2011 , 08:23   Re: Team limiting + round limiting.
Reply With Quote #5

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <amxmisc>
#include <fakemeta>
#include <fun>

#define MAXPLAYERS 33

#define PLUGIN "Poison + Bazooka"
#define VERSION "1.0"
#define AUTHOR "eskemo"

new bool:gbUsed[MAXPLAYERS];

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR);
    
register_logevent"EventRoundEnd"2"1=Round_End" );
    
register_clcmd("avpBP","PosionBazooka" );
}

public 
EventRoundEnd()
{
    for(new 
i=0;i<MAXPLAYERS;i++)
        
gbUsed[i]=false;
}

public 
client_disconnect(id)
{
    
gbUsed[id] = false;
}

public 
PosionBazooka(id)
{
    if (!
gbUsed[id])
    {
    new 
menu menu_create("\rAlien + Predator Spec's :""menu_handler");
    
menu_additem(menu"\wPredator Bazooka""1"0);
    
menu_additem(menu"\wAlien Acid""2"0);
    
menu_additem(menu"\rComming Soon""3"ADMIN_ADMIN);
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
menu_display(idmenu0);
    
gbUsed[id] = true;
    }
    return 
PLUGIN_HANDLED
}

public 
menu_handler(idmenuitem)
{
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    
    new 
data[6], szName[64];
    new 
accesscallback;
    
menu_item_getinfo(menuitemaccessdata,charsmax(data), szName,charsmax(szName), callback);

    new 
key str_to_num(data);
    switch(
key)
    {
    case 
1:
    {
    if( 
get_user_team(id) == )
    {
        
client_print(idprint_chat"You have just used your only Predator Missile.");
        
client_print(idprint_chat"You were given 25 Armour as a bonus of using this feature.");
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    else
    {
        
client_print(idprint_chat"eskemo.info : Please wait till you are on the Predators Team.");
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    }
    case 
2:
    {
    if( 
get_user_team(id) == )
    {
        
client_print(idprint_chat"You have just used your only Alien Acid");
        
client_print(idprint_chat"You were given a 200 health bonus for using this feature");
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    else
    {
        
client_print(idprint_chat"Eskemo.info : Please wait till you are on the Aliens Team.");
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    }
    case 
3:
    {
        
client_print(idprint_chat"Admin Selection Comming soon");
        return 
PLUGIN_HANDLED;
    }
    }
    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;

Try this.
Blue Snake. is offline
Xellath
Veteran Member
Join Date: Dec 2007
Location: Sweden
Old 10-27-2011 , 09:02   Re: Team limiting + round limiting.
Reply With Quote #6

Use arrayset() to set an array to a certain value instead of looping through players.

Instead of:
Code:
// MAXPLAYERS shouldn't be hardcoded either, cache and use get_maxplayers() for(new i=0;i<MAXPLAYERS;i++)     gbUsed[i]=false;

Use:
Code:
// hardcoding MAXPLAYERS to 33 here is okay, because the array is created with 33 cells (of course using the cached value of get_maxplayers() is fine as well, but just for reference) arrayset(gbUsed, false, MAXPLAYERS);
__________________
Achievements API - a simple way for you to create your OWN custom achievements!

Last edited by Xellath; 10-27-2011 at 09:04.
Xellath is offline
Reply


Thread Tools
Display Modes

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 14:16.


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