View Single Post
azalty
AlliedModders Donor
Join Date: Feb 2020
Location: France
Old 09-27-2021 , 12:22   Re: Error in plugin code block
Reply With Quote #4

PHP Code:
CPrintToChat(client"iPenalty %i iPenaltyCounter %i client %i"iPenalty[client],clientiPenaltyCounter[client]); 
to
PHP Code:
CPrintToChat(client"iPenalty %i iPenaltyCounter %i client %i"iPenalty[client], iPenaltyCounter[client], client); 
If you use colorvariables, you can use {color} instead of \x05 and similar.
List of colors (CS:GO):

default (white): \x01
teamcolour (will be purple if message from server): \x03
red: \x07
lightred: \x0F
darkred: \x02
bluegrey: \x0A
blue: \x0B
darkblue: \x0C
purple: \x03
orchid: \x0E
yellow: \x09
gold: \x10
lightgreen: \x05
green: \x04
lime: \x06
grey: \x08
grey2: \x0D


clientId is a bad name for an AdminId. It works but it's confusing.

PHP Code:
new iPenaltyCounter[MAXPLAYERS 1]; 
to
PHP Code:
int iPenaltyCounter[MAXPLAYERS 1]; 
(or even g_iPenaltyCounter if you want to use this style)

The rest seems okay. We need more code since the problem doesn't seem to come from here. That's what "PC Gamer" meant.

you can change
PHP Code:
public void OnClientPostAdminCheck(int client) {
    
//If I want, let's set back to 0 once he's inside our server
    
iPenaltyCounter[client] = 0;

to
PHP Code:
public void OnClientDisconnect(int client) {
    
iPenaltyCounter[client] = 0;

since you don't need to wait the admin check to set that variable. Resetting on connection/disconnection doesn't really matter though. I just like to do it on disconnects, especially if I work with databases (push/update values to DB).

What do you mean by "This is a timer variable"?
__________________
GitHub | Discord: @azalty | Steam

Last edited by azalty; 09-27-2021 at 12:26.
azalty is offline