View Single Post
impossible_cc
Senior Member
Join Date: Sep 2018
Location: Ukraine
Old 01-15-2019 , 17:58   Re: Problems with my first plugin
Reply With Quote #4

Quote:
Originally Posted by quasemago View Post
First, use PHP tag in code.
Second, use ServerCommand.

PHP Code:
public void OnClientPutInServer(int client)
{
    if (
GetClientCount() >= GetConVarInt(g_cvar_PlayerLimit))
    {
        
PrintToChatAll("Es sind mehr als %d Spieler online, Map ist jetzt offen... map is open now"GetConVarInt(g_cvar_PlayerLimit));
        
ServerCommand("exec dod_donner_og/dod_donner_og_open.cfg");
    }
}

public 
void OnClientDisconnect_Post(int client)
{
    if (
GetClientCount() < GetConVarInt(g_cvar_PlayerLimit))
    {
        
PrintToChatAll("Es sind weniger als 12 Spieler online... ONLY GARDEN!");
        
ServerCommand("exec dod_donner_og/dod_donner_og_close.cfg");
    }

Message can be printed and config can be executed multiple times in a row with your code, if 12th player joins <EXECUTE> then 13th player joins <Execute> etc...



PHP Code:
public void OnClientPutInServer(int client)
{
    if (
GetClientCount() == GetConVarInt(g_cvar_PlayerLimit))
    {
        
PrintToChatAll("Es sind mehr als %d Spieler online, Map ist jetzt offen... map is open now"GetConVarInt(g_cvar_PlayerLimit));
        
ServerCommand("exec dod_donner_og/dod_donner_og_open.cfg");
    }
}

public 
void OnClientDisconnect_Post(int client)
{
    if (
GetClientCount() + ==GetConVarInt(g_cvar_PlayerLimit))
    {
        
PrintToChatAll("Es sind weniger als 12 Spieler online... ONLY GARDEN!");
        
ServerCommand("exec dod_donner_og/dod_donner_og_close.cfg");
    }


Last edited by impossible_cc; 01-15-2019 at 17:59.
impossible_cc is offline