Thread: [L4D2] Shop
View Single Post
L4D2Noob
AlliedModders Donor
Join Date: Mar 2020
Location: Moscow
Old 03-28-2020 , 18:17   Re: [L4D2] Shop
Reply With Quote #7

Quote:
Originally Posted by L4D2Noob View Post
Hey guys! I attached a version of the plugin that I edited for my server. Her changes:
  • Reduced the number of bonuses issued for killing infected
  • Defibrillator and full HP cut out for balance
  • Fixed a bug with a double purchase of adrenaline
  • Prices increased by 2 times
  • Fully translated into Russian

But I still did not understand how to limit the use of the !Shop command? So that it can be used every 4 minutes. Help pills :-)
HTML Code:
public Action HinT(int client, int args) // создаем функцию для комманды)
{
	Menu menu = CreateMenu(MeleeMenuHandler);
	SetMenuTitle(menu, "Твои деньги %d", g_iCredits[client]);

	AddMenuItem(menu, "option1", "Оружие");
	AddMenuItem(menu, "option2", "Рукопашное");
	AddMenuItem(menu, "option3", "Остальное");
	DisplayMenu(menu, client, MENU_TIME_FOREVER);
	SetMenuExitButton(menu, true);

	// Timer
	int currentTime = GetTime();
    if (cooldownTimes[client] != -1 && cooldownTimes[client] > currentTime)
    {
        ReplyToCommand(client, "Эй, ты слишком часто используешь магазин, подожди ка!");
        return Plugin_Handled;
    }
    // ayy at this point they're thing is -1 (they haven't used it before) or their cooldown is OK
    
    cooldownTimes[client] = currentTime + 240;
	//End Timer
	
	return Plugin_Handled;
}
The code that is above, it creates a menu and starts counting the Cooldown at the same time.

How to make it right so that either the menu opens or the Cooldown starts?
__________________

Last edited by L4D2Noob; 03-28-2020 at 18:27.
L4D2Noob is offline
Send a message via ICQ to L4D2Noob Send a message via Skype™ to L4D2Noob