This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

How to open menu after 2 rounds


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
really
Junior Member
Join Date: Sep 2012
Old 11-08-2012 , 14:13   How to open menu after 2 rounds
Reply With Quote #1

Hello, Can someone tell me how can i do that, that player can open menu after 2 rounds. I made this but its not working and i dont know why... Can some help me?

PHP Code:
new round[33];

public 
OnPluginStart()
{    
    
HookEvent("player_spawn"Event_PlayerSpawnEventHookMode_Post);
}


public 
OnClientPutInServer(client)
{
    
round[client] = 0;
}

public 
Action:Event_PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{    
    new 
clientIndex GetClientOfUserId(GetEventInt(event"userid"));
    
    
round[clientIndex]++;
        

And then i wrote to menu this:
PHP Code:

if(round[param1] >= 2)
{
      .........
}
else
{
    
PrintToChat(param1"[\x04WarShare\x01] You can open menu after 2 rounds.");

Its opening menu alway. When is 1 round and also 2, 3 ,4.....
I want that the players can open menu after 2 or 3 rounds when the map starts but when he connect to server and it is 5 or more rounds left he can open the menu at nearest spawn. Please can someone help me?

Thanks Really

Ps: sorry if i have bad english DDD
really is offline
Chaosxk
Veteran Member
Join Date: Aug 2010
Location: Westeros
Old 11-08-2012 , 15:10   Re: How to open menu after 2 rounds
Reply With Quote #2

~snip

woops bad way.
__________________

Last edited by Chaosxk; 11-08-2012 at 15:37.
Chaosxk is offline
really
Junior Member
Join Date: Sep 2012
Old 11-08-2012 , 15:33   Re: How to open menu after 2 rounds
Reply With Quote #3

In menu has the param1 value userid? or no? it won't buggy?
really is offline
GsiX
gee, six eggs
Join Date: Aug 2012
Location: Land Below The Wind
Old 11-08-2012 , 15:38   Re: How to open menu after 2 rounds
Reply With Quote #4

hook event round start and count the round from there...
__________________
If i happen to insulted you unintentionally,
it was me and Google Translate who did it.
GsiX is offline
Chaosxk
Veteran Member
Join Date: Aug 2010
Location: Westeros
Old 11-08-2012 , 15:39   Re: How to open menu after 2 rounds
Reply With Quote #5

Edit: or what he said^

Sorry, just noticed what i wrote. Don't do that.

Try
round[clientIndex] += 1;
instead of
round[clientIndex]++;

Other than that, the code looks fine to me.
__________________

Last edited by Chaosxk; 11-08-2012 at 15:40.
Chaosxk is offline
really
Junior Member
Join Date: Sep 2012
Old 11-08-2012 , 16:00   Re: How to open menu after 2 rounds
Reply With Quote #6

round_start does not have userid so how can i do it? I some another way without userid?
really is offline
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 11-08-2012 , 16:03   Re: How to open menu after 2 rounds
Reply With Quote #7

Quote:
Originally Posted by really View Post
round_start does not have userid so how can i do it? I some another way without userid?
PHP Code:
for (new 1<= MaxClientsi++)
{
  if (
IsClientInGame(i))
  {  
    
round[i]++;
  }

Something like that - loop through all of the clients and +1 that variable

...:: TnT Edit ::...
Fixed syntax
__________________
View my Plugins | Donate

Last edited by TnTSCS; 11-08-2012 at 16:05.
TnTSCS is offline
really
Junior Member
Join Date: Sep 2012
Old 11-08-2012 , 16:03   Re: How to open menu after 2 rounds
Reply With Quote #8

i tried round[clientIndex]+=1; and its not working :/ shit! DD is some another way? so... i could try whis ^
|

Last edited by really; 11-08-2012 at 16:05. Reason: another way
really is offline
really
Junior Member
Join Date: Sep 2012
Old 11-09-2012 , 09:13   Re: How to open menu after 2 rounds
Reply With Quote #9

And how can I reset round value to zero when team switched?
really is offline
Skyy
AlliedModders Donor
Join Date: Jan 2010
Location: Toronto, Canada
Old 11-10-2012 , 14:58   Re: How to open menu after 2 rounds
Reply With Quote #10

Quote:
Originally Posted by Chaosxk View Post
Edit: or what he said^

Sorry, just noticed what i wrote. Don't do that.

Try
round[clientIndex] += 1;
instead of
round[clientIndex]++;

Other than that, the code looks fine to me.
Using ++ or += 1 won't change the outcome, as they both provide the exact same functionality. (Whichever method you choose to use is based on your personal preference)


You should hook the round_start event, just keep in mind that in some games, round_start triggers multiple times, so you will want to create a bool or some other sort of method of tracking that you've only accounted one time per round for round_start firing.

You can hook the player_team event, and check what their current team is and save if to a variable you've created that holds their team number. When you check the variable against their current team, if the values don't match, you can reset the counter.
__________________

Last edited by Skyy; 11-10-2012 at 14:58.
Skyy 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 07:01.


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