View Single Post
Aceleracion
Member
Join Date: Jul 2017
Location: Ecuador
Old 11-13-2017 , 02:16   Re: [L4D2] Gifts Drop & Spawn
Reply With Quote #7

Quote:
Originally Posted by Striker black View Post
The plugin shows the gifts but still does not show advertisement and no sounds are heard

#define PLUGIN_VERSION "1.3.2"
#define TAG_GIFT "{G}[{L}GIFTS{G}]\x01"
#define SND_REWARD1 "level/loud/climber.wav"
#define SND_REWARD2 "level/gnomeftw.wav"

The version 1.3.3 is already released?

The plugin can work without the need for database?

PHP Code:
#define DATABASE_CONFIG     "l4dstats"

public OnConfigsExecuted()
{
    
GetCvars();
    
    if (!
ConnectDB())
    {
        
LogError("Connecting to database failed. Read error log for further details.");
    }
}

bool:ConnectDB()
{
    if (
db != INVALID_HANDLE)
        return 
true;

    if (
SQL_CheckConfig(DATABASE_CONFIG))
    {
        new 
String:Error[256];
        
db SQL_Connect(DATABASE_CONFIGtrueErrorsizeof(Error));

        if (
db == INVALID_HANDLE)
        {
            
LogError("Failed to connect to database: %s"Error);
            return 
false;
        }

        if (!
CheckDatabaseValidity())
        {
            
LogError("Database is missing required table or tables.");
            return 
false;
        }
    }
    else
    {
        
LogError("Databases.cfg missing '%s' entry!"DATABASE_CONFIG);
        return 
false;
    }

    return 
true;
}

bool:CheckDatabaseValidity()
{
    if (!
SQL_FastQuery(db"SELECT * FROM players WHERE 1 = 2"))
    {
        return 
false;
    }

    return 
true;

_____________________________________________ ______________________

This plugin was first intended for coop servers where they manage a player statistics system and earn points for each collected gift. Now the dependence on the database has been removed, but it would be advisable to work with a database and it may be the same one that you use for your player stats if you have one.

I attach the new version of the plugin (v1.3.4)
Attached Files
File Type: sp Get Plugin or Get Source (l4d2_gifts.sp - 860 views - 29.7 KB)
__________________
by Aceleración
To succeed in your goals, use your true potential

Last edited by Aceleracion; 11-13-2017 at 02:18.
Aceleracion is offline