Raised This Month: $51 Target: $400
 12% 

[Solved] After 1 rounds


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
indraraj striker
Veteran Member
Join Date: Mar 2014
Location: Under the water
Old 09-04-2016 , 12:06   [Solved] After 1 rounds
Reply With Quote #1

i want this /flash commands will work after 1 rounds [interval]
if i said /flash and purchased flashbang then next time you will able to purchase after 1 rounds

what i have tried link : https://forums.alliedmods.net/showthread.php?t=287263

and below code of grenade menu:

PHP Code:

#include <amxmodx>
#include <fun>

public plugin_init()
{
    
register_clcmd("/flash""ShowMenu");
}

public 
ShowMenu(id)
{
    new 
menu menu_create("Grenade_Menu""mh_MyMenu");
    
menu_additem(menu"flashbang"""0); // case 0
    
menu_display(idmenu0);
    return 
PLUGIN_HANDLED;
}

public 
mh_MyMenu(idmenuitem)
{
    switch(
item)
    {
        case 
0
        {
        
give_item(id"weapon_flashbang");
        
client_print(idprint_chat"You have purhcased flashbang");
        }
    }
    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;

__________________
Thanks everyone. #miss_you_all

Last edited by indraraj striker; 09-06-2016 at 02:20.
indraraj striker is offline
pupdebox
Senior Member
Join Date: Feb 2016
Location: Wakanda
Old 09-04-2016 , 12:19   Re: [request] After 1 rounds
Reply With Quote #2

Edited: Try again
PHP Code:
#include <amxmodx> 
#include <fun> 

new flashok[33]
new 
bool:wait[33]

public 
plugin_init() 

    
register_clcmd("say /flash""ShowMenu");
    
register_logevent("startroundx"2"1=Round_Start");
}

public 
client_putinserver(id)
{
    
flashok[id] = 0
    wait
[id] = false
}

public 
client_disconnect(id)
{
    
flashok[id] = 0
    wait
[id] = false


public 
ShowMenu(id
{
    if(
flashok[id] == 0){
    new 
menu menu_create("Grenade_Menu""mh_MyMenu"); 
    
menu_additem(menu"flashbang"""0); // case 0 
    
menu_display(idmenu0);
    }
    else if(
flashok[id] == && !wait[id])
    
client_print(idprint_chat"You have to wait 1 round in order to open this menu.")
    else if(
flashok[id] == && wait[id])
    
client_print(idprint_chat"You have already used the menu in this round.")
    return 
PLUGIN_HANDLED


public 
mh_MyMenu(idmenuitem

    switch(
item
    { 
        case 
.. 7:  
        {
            if(
item == 0){
            
give_item(id"weapon_flashbang"); 
            
client_print(idprint_chat"You have purhcased flashbang");
            }
            
flashok[id]++
            
wait[id] = true
        

    }
    
menu_destroy(menu); 
    return 
PLUGIN_HANDLED
}

public 
startroundx()
{    
    for(new 
1;i<=get_maxplayers();i++){
    if(
wait[i] && is_user_connected(i) && !is_user_bot(i))
    
wait[i] = false
    
else if(is_user_connected(i) && !(is_user_bot(i)) && !wait[i])
    
flashok[i] = 0
    
}

__________________
Quote:
Originally Posted by wickedd View Post
Make me or STFU boy

Last edited by pupdebox; 09-05-2016 at 13:08.
pupdebox is offline
indraraj striker
Veteran Member
Join Date: Mar 2014
Location: Under the water
Old 09-04-2016 , 12:27   Re: [request] After 1 rounds
Reply With Quote #3

@pupdebox wrong i want to block commands he will able to use that commands after 1 rounds interval i have so many cases in my menu
you just blocked flashbang so he will not able to buy flashbang more than 1 flashbang i want to block commands /flash

what i have tried link : https://forums.alliedmods.net/showthread.php?t=287263
but thanks for the help (Y)
__________________
Thanks everyone. #miss_you_all

Last edited by indraraj striker; 09-04-2016 at 12:29.
indraraj striker is offline
Freezo Begin
BANNED
Join Date: Mar 2014
Location: Morocco
Old 09-04-2016 , 12:43   Re: [request] After 1 rounds
Reply With Quote #4

Code:
#include <amxmodx> #include <fun> new purchasedFlashiCount[33]; new bool:purchasedFlash[33]; public plugin_init() {     register_logevent( "logevent_RoundStart", 2, "1=Round_Start" );         register_clcmd("say /flash", "ShowMenu"); } public logevent_RoundStart() {         new iPlayers[32], iCount         get_players(iPlayers, iCount, "ch")     if( !iCount ) return         new id     for(--iCount; iCount>=0; iCount--)     {         id = iPlayers[iCount]                 if(purchasedFlash[id]) purchasedFlashiCount[id]++;             } } public ShowMenu(id) {     if(is_user_alive(id)){                 if(purchasedFlashiCount[id] == 0){                         new menu = menu_create("Grenade_Menu", "mh_MyMenu");             menu_additem(menu, "flashbang", "", 0); // case 0             menu_display(id, menu, 0);                     }         else{                         client_print(id, 3, "You need to wait for 1 more round to use Grenade_Menu.")                     }     }     else{                 client_print(id, 3, "You need to be alive to use Grenade_Menu.")             }     return PLUGIN_HANDLED;     } public mh_MyMenu(id, menu, item) {     switch(item)     {         case 0:          {             give_item(id, "weapon_flashbang");             client_print(id, print_chat, "You have purchased flashbang");                         purchasedFlash[id] = true;             purchasedFlashiCount[id]--;         }     }     menu_destroy(menu);     return PLUGIN_HANDLED; }

Last edited by Freezo Begin; 09-05-2016 at 06:41.
Freezo Begin is offline
pupdebox
Senior Member
Join Date: Feb 2016
Location: Wakanda
Old 09-04-2016 , 12:47   Re: [request] After 1 rounds
Reply With Quote #5

I have edited my post.
__________________
Quote:
Originally Posted by wickedd View Post
Make me or STFU boy
pupdebox is offline
indraraj striker
Veteran Member
Join Date: Mar 2014
Location: Under the water
Old 09-05-2016 , 01:40   Re: [request] After 1 rounds
Reply With Quote #6

@Freezo Begin i have tested your code it works great but i m able to purchase flashbang in next round i should wait 1 round interval to purchase flashbang again i think so round count will be 2 and i m also not able to understand why you use this if( !is_user_connecting(id) ) event round will occur in when you are in server.

@pupdebox i have tested you code it works but it has minor issue when you select exit bool set to 1 it should be 0 i think you have to check bool in callback too and same issue as freezo plugin but i m able to purchase flashbang in next round i should wait 1 round interval to purchase flashbang again i think so round count will be 2

Thanks both of you it will be great if you fix this
__________________
Thanks everyone. #miss_you_all
indraraj striker is offline
Freezo Begin
BANNED
Join Date: Mar 2014
Location: Morocco
Old 09-05-2016 , 06:40   Re: [request] After 1 rounds
Reply With Quote #7

try it now.
Freezo Begin is offline
indraraj striker
Veteran Member
Join Date: Mar 2014
Location: Under the water
Old 09-05-2016 , 07:03   Re: [request] After 1 rounds
Reply With Quote #8

Freezo Begin This part should be change

PHP Code:

public logevent_RoundStart()
{
    
    new 
iPlayers[32], iCount
    
    get_players
(iPlayersiCount"ch")
    if( !
iCount ) return
    
    new 
id

    
for(--iCountiCount>=0iCount--)
    {
        
id iPlayers[iCount]
        
        if(
purchasedFlash[id]) purchasedFlashiCount[id]++;
        
    }

i m able to purchase flashbang in next round i should wait 1 round interval to purchase flashbang again i think so round count will be 2
i think you have to create on more bool to count round

output should be like this :
You already purchased in this round
in next round
you have to wait 1 round to purchase again
then after this round he will able to purchase again
__________________
Thanks everyone. #miss_you_all
indraraj striker is offline
Freezo Begin
BANNED
Join Date: Mar 2014
Location: Morocco
Old 09-05-2016 , 07:40   Re: [request] After 1 rounds
Reply With Quote #9

Quote:
Originally Posted by indraraj striker View Post
Freezo Begin This part should be change

PHP Code:

public logevent_RoundStart()
{
    
    new 
iPlayers[32], iCount
    
    get_players
(iPlayersiCount"ch")
    if( !
iCount ) return
    
    new 
id

    
for(--iCountiCount>=0iCount--)
    {
        
id iPlayers[iCount]
        
        if(
purchasedFlash[id]) purchasedFlashiCount[id]++;
        
    }

i m able to purchase flashbang in next round i should wait 1 round interval to purchase flashbang again i think so round count will be 2
i think you have to create on more bool to count round

output should be like this :
You already purchased in this round
in next round
you have to wait 1 round to purchase again
then after this round he will able to purchase again
Idk what are you talking about, but i have tested, and it's working.
Freezo Begin is offline
indraraj striker
Veteran Member
Join Date: Mar 2014
Location: Under the water
Old 09-05-2016 , 07:57   Re: [request] After 1 rounds
Reply With Quote #10

here is the log file sometime it open grenade menu in next round too and sometime it say you have to wait 1 more round

here is log file and i have added log_amx and set round time 1 minute
Quote:
L 09/05/2016 - 17:19:51: -------- Mapchange to de_dust2 --------
L 09/05/2016 - 17:20:02: [test_flashbang.amxx] You have purchased flashbang
L 09/05/2016 - 17:21:07: [test_flashbang.amxx] You have purchased flashbang
L 09/05/2016 - 17:22:18: [test_flashbang.amxx] You need to wait for 1 more round to use Grenade_Menu.
PHP Code:

#include <amxmodx> 
#include <fun> 


new purchasedFlashiCount[33];
new 
bool:purchasedFlash[33];

public 
plugin_init() 

    
register_logevent"logevent_RoundStart"2"1=Round_Start" ); 
    
    
register_clcmd("say /flash""ShowMenu"); 


public 
logevent_RoundStart()
{
    
    new 
iPlayers[32], iCount
    
    get_players
(iPlayersiCount"ch")
    if( !
iCount ) return
    
    new 
id

    
for(--iCountiCount>=0iCount--)
    {
        
id iPlayers[iCount]
        
        if(
purchasedFlash[id]) purchasedFlashiCount[id]++;
        
    }
}
public 
ShowMenu(id) { 
    if(
is_user_alive(id)){
        
        if(
purchasedFlashiCount[id] == 0){
            
            new 
menu menu_create("Grenade_Menu""mh_MyMenu"); 
            
menu_additem(menu"flashbang"""0); // case 0 
            
menu_display(idmenu0); 
            
        }
        else{
            
            
client_print(id3"You need to wait for 1 more round to use Grenade_Menu.")
            
log_amx("You need to wait for 1 more round to use Grenade_Menu.")
            
        }
    }
    else{
        
        
client_print(id3"You need to be alive to use Grenade_Menu.")
        
    }
    return 
PLUGIN_HANDLED
    
}
public 
mh_MyMenu(idmenuitem

    switch(
item
    { 
        case 
0:  
        { 
            
give_item(id"weapon_flashbang"); 
            
client_print(idprint_chat"You have purchased flashbang"); 
            
log_amx("You have purchased flashbang")
            
            
purchasedFlash[id] = true;
            
purchasedFlashiCount[id]--;
        } 
    } 
    
menu_destroy(menu); 
    return 
PLUGIN_HANDLED

But the output should be like this :
Quote:
You already purchased in this round
in next round
you have to wait 1 round to purchase again
then after this round he will able to purchase again same loop
__________________
Thanks everyone. #miss_you_all
indraraj striker 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 23:36.


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