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

[solved] Clcmd after 2 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 , 03:33   [solved] Clcmd after 2 rounds
Reply With Quote #1

Description : say /test it will show you welcome to the server after that it will say you have to wait 2 rounds then 1 rounds then again welcome to the server

Problem: it works when i am alone in server but it does not work when server is having more than 20+ players. When players more than 20+ it reset bool in next round or it stay but it say you have to wait 2 rounds [current round]. Its showing in next round welcome to the server it must be show you have to wait 1 more rounds.

but it works in while testing plugins.

Test Code :

PHP Code:

#include <amxmodx>

new bool:g_used[33];
new 
g_iRounds;

public 
plugin_init() 
{
    
register_logevent"logevent_RoundStart"2"1=Round_Start" );
    
register_clcmd("say /test""show_msg");
}

public 
client_connect(id) {
    
g_used[id] = false;
}

public 
logevent_RoundStart() 
{
    new 
Players32 ], iNumid;
    
get_playersPlayersiNum"ch" );
    
    while( --
iNum >= )
    {
        
id PlayersiNum ];
        
        if( 
g_iRounds == 
        { 
            
g_used[id] = false;
            
g_iRounds 0;
        } 
        
g_iRounds++ ;
    }
}

public 
show_msg(id)

    if(
g_used[id])
    {
        switch(
g_iRounds)
        {
            case 
1client_print(id,print_chat,"you have to wait 2 rounds");
            case 
2client_print(id,print_chat,"you have to wait 1 rounds");
        }
        return 
PLUGIN_CONTINUE;
    }
    
show_real_msg(id);
    return 
PLUGIN_HANDLED;
}  

public 
show_real_msg(id)
{
    
client_print(id,print_chat,"welcome to the server");
    
g_used[id] = true;

EDIT : Still the same problem i have changed this
i think the problem is here wait let me test again with more players
PHP Code:
if( g_iRounds == 
        { 
            
g_used[id] = false;
            
g_iRounds 0;
        } 
        
g_iRounds++ ; 
i have change this with this
PHP Code:

if( g_iRounds == 
        { 
            
g_used[id] = false;
            
g_iRounds 0;
        } 
        else
        {
        
g_iRounds++ ;
        } 
Attached Files
File Type: sma Get Plugin or Get Source (round_fixed.sma - 481 views - 935 Bytes)
__________________
Thanks everyone. #miss_you_all

Last edited by indraraj striker; 09-06-2016 at 02:57.
indraraj striker is offline
indraraj striker
Veteran Member
Join Date: Mar 2014
Location: Under the water
Old 09-04-2016 , 06:25   Re: [Help] Clcmd after 2 rounds
Reply With Quote #2

*Bump for notify*
After edit still it does not work

PHP Code:

if( g_iRounds == )  
        {  
            
g_used[id] = false
            
g_iRounds 0
        }  
        else 
        { 
        
g_iRounds++ ; 
        } 
__________________
Thanks everyone. #miss_you_all
indraraj striker is offline
Freezo Begin
BANNED
Join Date: Mar 2014
Location: Morocco
Old 09-04-2016 , 13:08   Re: [Help] Clcmd after 2 rounds
Reply With Quote #3

PHP Code:
#include <amxmodx> 
#include <fun> 

#define roundToExecute 2

new bool:messageS[33];

new 
messageShowediCount[33];
new 
count 0;

public 
plugin_init() 

    
register_event("HLTV""event_new_round""a""1=0""2=0")  
    
    
register_clcmd("say /test""show_msg"); 


public 
event_new_round()
{
    
    new 
iPlayers[32], iCount
    
    get_players
(iPlayersiCount"ch")
    if( !
iCount ) return
    
    new 
id
    
    
    
for(--iCountiCount>=0iCount--)
    {
        
id iPlayers[iCount]
        if( !
is_user_connecting(id) )
        {
            if(
messageS[id]){
                
messageShowediCount[id]++;
            }
        }
    }
}


public 
show_msg(id) { 
        
        
        if(
messageShowediCount[id] == count){
            
            
                
client_print(id,print_chat,"welcome to the server"); 
                
                
count roundToExecute;
                
messageS[id] = true;
        }
        else{
            
            
client_print(id3"You need to wait 2 more round to use Grenade_Menu.")
            
        }

    

Freezo Begin is offline
indraraj striker
Veteran Member
Join Date: Mar 2014
Location: Under the water
Old 09-05-2016 , 01:56   Re: [Help] Clcmd after 2 rounds
Reply With Quote #4

@Freezo Begin it doesnt work at all i slayed myself to check it

first time it works but after that it gives the false result

Commands : /test
output : welcome to the server
next round output : You need to wait 2 more round to use Grenade_Menu.
next round output : You need to wait 2 more round to use Grenade_Menu.
then it works again welcome to server

After that it gives false result
Commands : /test
output : welcome to the server
next round output : You need to wait 2 more round to use Grenade_Menu.
next round output : You need to wait 2 more round to use Grenade_Menu.
then it stay as same msg You need to wait 2 more round to use Grenade_Menu.

Commands : /test
output : welcome to the server
next round output : welcome to the server
next round output : welcome to the server
then it stay as same msg

It is same as below link i will close this thread if the below link problem resolve
link: https://forums.alliedmods.net/showthread.php?t=287285
Thanks
__________________
Thanks everyone. #miss_you_all
indraraj striker is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 09-05-2016 , 15:10   Re: [Help] Clcmd after 2 rounds
Reply With Quote #5

Indaraj , you try to make code instead of understand them, forgot about your code and go to read more, because what's happening in your code have no sense, why the fucking hell you use whie() instead of for() ? anyway ..
__________________
Project: Among Us
Craxor is offline
Send a message via ICQ to Craxor
indraraj striker
Veteran Member
Join Date: Mar 2014
Location: Under the water
Old 09-06-2016 , 01:59   Re: [Help] Clcmd after 2 rounds
Reply With Quote #6

@Craxor thanks man for writing this type of comment in my post have a nice day (Y)
why the hell ? is it hell ? no man you didnt understand go to tutorial and see
While loop or for loop or do while All are same exactly and it will give same output why the phack should i use FOR loop i dont want to discuss anymore about this once again thanks
__________________
Thanks everyone. #miss_you_all
indraraj striker is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 09-06-2016 , 02:39   Re: [Help] Clcmd after 2 rounds
Reply With Quote #7

Woaw, be pacient dude i'm not eating your heart no? I'm just say will be more easy to write/understand(for Others) to write using for( ), maybe the problem is the way you writing the loop.

I'm not trying to insult you, just i want to say to you that you will have more to win in life if you're pacient, calm and understand what you're doing.

Anyway my friend :

PHP Code:
  
        
if( g_iRounds == )  
        {  
            
g_used[id] = false
            
g_iRounds 0
        }  
        
g_iRounds++ ; 
    } 

You reset the g_round and in the same you increase it., so every day you should have just "1"

Try with this and give me the output result:

Code:
public logevent_RoundStart( ) {     new Players[33], PlayerCountVar;     get_players( Players, PlayerCountVar, "a" )         for( new i=0; i < PlayerCountVar; i++ )     {         if( g_iRounds >= 2 )         {             g_used[Players[i]] = false;             g_iRounds = 0;         }         else             g_iRounds++;     } }
__________________
Project: Among Us

Last edited by Craxor; 09-06-2016 at 02:42.
Craxor is offline
Send a message via ICQ to Craxor
indraraj striker
Veteran Member
Join Date: Mar 2014
Location: Under the water
Old 09-06-2016 , 02:56   Re: [Help] Clcmd after 2 rounds
Reply With Quote #8

Quote:
Originally Posted by indraraj striker View Post
*Bump for notify*
After edit still it does not work

PHP Code:

if( g_iRounds == )  
        {  
            
g_used[id] = false
            
g_iRounds 0
        }  
        else 
        { 
        
g_iRounds++ ; 
        } 

that i already did but it works when i m alone in server but when we have more than 20+ it always give false result
the conclusion that g_iRounds should be array not variable
__________________
Thanks everyone. #miss_you_all
indraraj striker is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 09-06-2016 , 06:06   Re: [solved] Clcmd after 2 rounds
Reply With Quote #9

array? Your conclusion is wrong, should work perfectly as an variable, as i say, test and give me the result output don't take any conclusion before test it. ( and btw its already an array , is not created with CreateArray() but this kind of variables are arrays ) - > https://forums.alliedmods.net/showthread.php?t=249602

And please test the code above i gave to you and give me the result output, if you want to continue solving the problem ofcourse.
__________________
Project: Among Us
Craxor is offline
Send a message via ICQ to Craxor
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 09-06-2016 , 07:15   Re: [solved] Clcmd after 2 rounds
Reply With Quote #10

Just do it like Craxor said, it should work.

else just try this

PHP Code:
#include <amxmodx>

new bool:g_used[33];
new 
g_iRounds;

public 
plugin_init() 
{
    
register_logevent"logevent_RoundStart"2"1=Round_Start" );
    
register_clcmd("say /test""show_msg");
}

public 
client_connect(id) {
    
g_used[id] = false;
}

public 
logevent_RoundStart() 
{
    new 
Players32 ], iNumid;
    
get_playersPlayersiNum"ch" );
    
    for(new 
iiNumi++) {
        if(
g_iRounds == 2) {
            
g_used[Players[i]] = false
            g_iRounds 
0
        
}
        
g_iRounds++
    }
}

public 
show_msg(id)

    if(
g_used[id])
    {
        switch(
g_iRounds)
        {
            case 
1client_print(id,print_chat,"you have to wait 2 rounds");
                case 
2client_print(id,print_chat,"you have to wait 1 rounds");
            }
        return 
PLUGIN_CONTINUE;
    }
    
show_real_msg(id);
    return 
PLUGIN_HANDLED;
}  

public 
show_real_msg(id)
{
    
client_print(id,print_chat,"welcome to the server");
    
g_used[id] = true;

__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
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 11:52.


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