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

Solved How to set personal count?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
N1uddey
New Member
Join Date: Jul 2020
Old 07-30-2020 , 09:39   How to set personal count?
Reply With Quote #1

For example, someone says '!ex'.
The count now is 1, he says '!ex' again and the count will be 2.
But the max of count is 5.
So how to set the plugin to solve this?
Each person’s count is separate and reset at the beginning of the next round.

I would be very grateful if you can help me.

Last edited by N1uddey; 07-31-2020 at 04:04. Reason: Solved
N1uddey is offline
SSheriFF
AlliedModders Donor
Join Date: May 2020
Location: Israel
Old 07-30-2020 , 10:27   Re: How to set personal count?
Reply With Quote #2

Quote:
Originally Posted by N1uddey View Post
For example, someone says '!ex'.
The count now is 1, he says '!ex' again and the count will be 2.
But the max of count is 5.
So how to set the plugin to solve this?
Each person’s count is separate and reset at the beginning of the next round.

I would be very grateful if you can help me.
PHP Code:
#pragma semicolon 1

#define DEBUG

#define PLUGIN_AUTHOR ""
#define PLUGIN_VERSION "0.00"

#include <sourcemod>
#include <sdktools>

#pragma newdecls required
int counter[MAXPLAYERS 1];

public 
Plugin myinfo 
{
    
name "",
    
author PLUGIN_AUTHOR,
    
description "",
    
version PLUGIN_VERSION,
    
url ""
};

public 
void OnPluginStart()
{
    
RegConsoleCmd("sm_ex"ExCommand);
    
HookEvent("round_start"OnRoundStart);
}
public 
void OnClientConnected(int client)
{
    
counter[client] = 0;
}
public 
Action ExCommand(int clientint args)
{
    
counter[client]++;
    if(
counter[client]>5)
        
counter[client] = 5;
    
PrintToChat(client"The count is %d"counter[client]);
}
public 
Action OnRoundStart(Event event, const char[] namebool dontBroadcast)
{
    for(
int i 1<= MaxClients; ++i)
    {
        if(
IsClientInGame(i) && !IsFakeClient(i))
            
counter[i] = 0;    
    }        

__________________
Taking small private requests (Free) and big private requests (Paid).
Contact me via Discord: WilDick#1524

My Plugins:
SSheriFF is offline
N1uddey
New Member
Join Date: Jul 2020
Old 07-31-2020 , 03:34   Re: How to set personal count?
Reply With Quote #3

Quote:
Originally Posted by SSheriFF View Post
PHP Code:
#pragma semicolon 1

#define DEBUG

#define PLUGIN_AUTHOR ""
#define PLUGIN_VERSION "0.00"

#include <sourcemod>
#include <sdktools>

#pragma newdecls required
int counter[MAXPLAYERS 1];

public 
Plugin myinfo 
{
    
name "",
    
author PLUGIN_AUTHOR,
    
description "",
    
version PLUGIN_VERSION,
    
url ""
};

public 
void OnPluginStart()
{
    
RegConsoleCmd("sm_ex"ExCommand);
    
HookEvent("round_start"OnRoundStart);
}
public 
void OnClientConnected(int client)
{
    
counter[client] = 0;
}
public 
Action ExCommand(int clientint args)
{
    
counter[client]++;
    if(
counter[client]>5)
        
counter[client] = 5;
    
PrintToChat(client"The count is %d"counter[client]);
}
public 
Action OnRoundStart(Event event, const char[] namebool dontBroadcast)
{
    for(
int i 1<= MaxClients; ++i)
    {
        if(
IsClientInGame(i) && !IsFakeClient(i))
            
counter[i] = 0;    
    }        

Thank you very much!
N1uddey 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 04:10.


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