AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Check if player used menu 3 times? Possible? (https://forums.alliedmods.net/showthread.php?t=170920)

Evaldas.Grigas 10-30-2011 10:53

Check if player used menu 3 times? Possible?
 
I know hot check if player used menu once, but is it possible to check if he used 3 times?

egbertjan 10-30-2011 11:00

Re: Check if player used menu 3 times? Possible?
 
For now you could try to add a 2nd check and a 3rd check with a bool untill a better answer comes.

lucas_7_94 10-30-2011 11:02

Re: Check if player used menu 3 times? Possible?
 
make a variable , when the player open the menu add a +1 , check if the thirt open and close it.

Evaldas.Grigas 10-30-2011 11:05

Re: Check if player used menu 3 times? Possible?
 
Examples please?

Erox902 10-30-2011 13:02

Re: Check if player used menu 3 times? Possible?
 
If you need a total example off how to add + 1 to a variable you should post in request instead of scripting help.
PHP Code:

public examplemenu(id)
{
    if ( 
gVariable[id] < )
    {
        
gVariable[id]++

        new 
menu menu_create....
        .......
        ....... 


Evaldas.Grigas 10-30-2011 13:35

Re: Check if player used menu 3 times? Possible?
 
Will test it. Thanks.
EDIT: I have to add?
PHP Code:

 new gVariable[what


poliisi299 10-30-2011 13:38

Re: Check if player used menu 3 times? Possible?
 
why all help you ?, and no help me ?? :((

nikhilgupta345 10-30-2011 13:48

Re: Check if player used menu 3 times? Possible?
 
Quote:

Originally Posted by Evaldas.Grigas (Post 1586584)
Will test it. Thanks.
EDIT: I have to add?
PHP Code:

 new gVariable[what


new gVariable[33]

33 = MaxPlayers + 1

Max Players = 32 for a CS server.

IDs start at 1, so to be able to use the id of the person that has 32, you have to make the array have 33 slots.

Evaldas.Grigas 10-30-2011 13:54

Re: Check if player used menu 3 times? Possible?
 
It works perfectly, but one warning
Code:

public cmdvipmenu(id)
{
    round++;
  if(gbUsed[id] < 3)
    {
        if (is_user_alive(id) && get_user_flags(id) & ADMIN_LEVEL_H )
        {
            if(round > 0)
            {
                Showrod(id)
            }
        }
    }
    return PLUGIN_HANDLED
}

I made bigger where warning is "Tag mismatch"
I use it like a bool:
PHP Code:

new bool:gbUsed[id


fysiks 10-30-2011 14:29

Re: Check if player used menu 3 times? Possible?
 
Quote:

Originally Posted by Evaldas.Grigas (Post 1586594)
It works perfectly, but one warning
Code:

public cmdvipmenu(id)
{
    round++;
  if(gbUsed[id] < 3)
    {
        if (is_user_alive(id) && get_user_flags(id) & ADMIN_LEVEL_H )
        {
            if(round > 0)
            {
                Showrod(id)
            }
        }
    }
    return PLUGIN_HANDLED
}

I made bigger where warning is "Tag mismatch"
I use it like a bool:
PHP Code:

new bool:gbUsed[id


You can't label something bool that is going to be used to count. Bool implies true or false ONLY.


All times are GMT -4. The time now is 14:28.

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