Raised This Month: $ Target: $400
 0% 

Include file is preventing plugin from functioning.


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
PreDominance
Member
Join Date: Jul 2014
Old 07-09-2014 , 00:03   Include file is preventing plugin from functioning.
Reply With Quote #1

Greetings ladies and gents,
I have an include file to my plugin that, when I include it, renders my plugin useless (typing amx_plugins makes the plugin look like "unknown unknown unknown nwc.amxx bad_load").

Can anyone spot the problem?
PHP Code:
#define INVALID_HANDLE -1

new VAULT_HANDLE;
//Connect to the vault.
vault_connect() 
{
    
VAULT_HANDLE nvault_open("nwc_db_players.log");
    if (
VAULT_HANDLE == INVALID_HANDLE
    {
        
nwc_log(LOGTYPE_ERROR"Could not open vault!");
    } else
    {
        return 
PLUGIN_HANDLED;
    }
}
//Is vault open?
bool:vault_check() 
{
    if (
VAULT_HANDLE == INVALID_HANDLE)
    {
        return 
false;
    }
    else
    {
        return 
true;
    }
}
//Returns the key of the KV pair. By systematically generating keys, it becomes
//easier to enforce consistency.
vault_getUserKey(idtype[]) 
{
    static 
szReturn[60];
    static 
szKeyType[30];
    
get_user_authid(idszReturncharsmax(szReturn));
    
format(szKeyTypecharsmax(szKeyType), "%s"type);
    if (
equali(typeKEY_RACE) || equali(typeKEY_RACELEVELS))
    {
        
format(szKeyTypecharsmax(szKeyType), "%s %i"szKeyTypeP_DATA[id][P_RACE]);
    } 
    
format(szReturncharsmax(szReturn), "%s %s"szReturnszKeyType);
    return 
szReturn;
}
//Save an entire player (current race, current race's level, current xp
vault_savePlayer(idbool:firstConnect
{
    if (!
vault_check()) 
    {
        
nwc_log(LOGTYPE_ERROR"Can not save player, Vault is not open.");
        RETURN 
PLUGIN_HANDLED;
    }
    static 
szTemp[20];
    
//This is the initial connect which will save the user's first name used on the server.
    
if (firstConnect
    {
        
get_user_name(idszTempcharsmax(szTemp));
        
nvault_set(VAULT_HANDLEvault_getUserKey(idKEY_NAME), szTemp);
        return 
PLUGIN_HANDLED;
    }
    
vault_savePlayerCurRace(id);
    
vault_savePlayerRace(id);

}
//Saves the player's current race so it can be loaded next time the player connects.
vault_savePlayerCurRace(id
{
    if (!
vault_check())
    {
        
nwc_log(LOGTYPE_ERROR"Can not save race, Vault is not open.");
    }
    
vault_set(VAULT_HANDLEvault_getUserKey(idKEY_CURRACE), P_DATA[id][P_RACE]);
}
//Saves the XP in a player's race. Gotta remember to call this before changing race! 
vault_savePlayerRace(id)
{
    if (!
vault_check())
    {
        
nwc_log(LOGTYPE_ERROR"Can not save race, Vault is not open.");
    }
    
vault_set(VAULT_HANDLEvault_getUserKey(idKEY_RACE), P_DATA[id][P_XP]);
}
//Saves the levels of a player's current race. 
vault_savePlayerLevels(id
{
    static 
szRaceLevels[50];
    
format(szRaceLevelscharsmax(szRaceLevels), "%i,%i,%i,%i,%i,%i,%i,%i"P_SKILLLEVELAP_SKILLLEVELBP_SKILLLEVELCP_SKILLLEVELDP_SKILLLEVELEP_SKILLLEVELFP_SKILLLEVELGP_SKILLLEVELH);
    
vault_set(VAULT_HANDLEvault_getUserKey(idKEY_RACELEVEL), szRaceLevels);

//Saves the player's NWCBank which is used to store levels and xp.
vault_savePlayerBank(id)
{
    if (!
vault_check())
    {
        
nwc_log(LOGTYPE_ERROR"Can not save race, Vault is not open.");
    }
    
vault_set(VAULT_HANDLEvault_getUserKey(idKEY_BANKLEVEL), P_DATA[id][P_BANKLEVEL]);
    
vault_set(VAULT_HANDLEvault_getUserKey(idKEY_BANKXP), P_DATA[id][P_BANKXP]);
}

//Checks to see if this is the player's first time connecting to the servar.
bool:vault_playerExists(id
{
    static 
szAuth[35];    
    static 
szName[20];
    static 
timeStamp;
    
get_user_authid(idszAuthcharsmax(szAuth));
    return (
nvault_lookup(VAULT_HANDLEKEY_NAMEszNamecharsmax(szName), timeStamp));
}

//Returns the skill levels of a race given by id into the int array output[]
//output must be of length RACE_MAXSKILLS
vault_getRaceLevels(idraceIdoutput[])
{
    static 
szUnfLevels[30];
    static 
szLevels[RACE_MAXSKILLS][5];
    static 
timeStampi;
    
vault_lookup(VAULT_HANDLEKEY_RACELEVELszUnfLevelscharsmax(szUnfLevels), timeStamp);
    
util_explodeString(szLevelsRACE_MAXSKILLS4szUnfLevels',');
    for (
0RACE_MAXSKILLSi++) 
    {
        
szLevels[i] = str_to_num(szLevels[i]);
    }

PHP Code:
event_spawn(id)
{
    
nwc_log(LOGTYPE_DEBUG"User has spawned.");
    
client_print(idprint_console"Welcome!");

If anyone needs to see the constants file I can post that up as well, but assume all are existing.

Last edited by PreDominance; 07-09-2014 at 00:44.
PreDominance is offline
 


Thread Tools
Display Modes

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 21:15.


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