AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Include file is preventing plugin from functioning. (https://forums.alliedmods.net/showthread.php?t=243735)

PreDominance 07-09-2014 00:03

Include file is preventing plugin from functioning.
 
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.

YamiKaitou 07-09-2014 00:16

Re: Include file is preventing plugin from functioning.
 
What is the message for the bad load?

PreDominance 07-09-2014 00:34

Re: Include file is preventing plugin from functioning.
 
I'm not getting any sort of message. I threw it in Debug and I got nothing.

I took it out of debug, and now it says it's running but it still lacks the plugin information.

Code:


Currently loaded plugins:
      name                    version    author            file            status 
 [  1] Admin Base              1.8.2      AMXX Dev Team    admin.amxx      running 
 [  2] Admin Commands          1.8.2      AMXX Dev Team    admincmd.amxx    running 
 [  3] Admin Help              1.8.2      AMXX Dev Team    adminhelp.amxx  running 
 [  4] Slots Reservation      1.8.2      AMXX Dev Team    adminslots.amxx  running 
 [  5] Multi-Lingual System    1.8.2      AMXX Dev Team    multilingual.am  running 
 [  6] Menus Front-End        1.8.2      AMXX Dev Team    menufront.amxx  running 
 [  7] Commands Menu          1.8.2      AMXX Dev Team    cmdmenu.amxx    running 
 [  8] Players Menu            1.8.2      AMXX Dev Team    plmenu.amxx      running 
 [  9] Maps Menu              1.8.2      AMXX Dev Team    mapsmenu.amxx    running 
 [ 10] Plugin Menu            1.8.2      AMXX Dev Team    pluginmenu.amxx  running 
 [ 11] Admin Chat              1.8.2      AMXX Dev Team    adminchat.amxx  running 
 [ 12] Anti Flood              1.8.2      AMXX Dev Team    antiflood.amxx  running 
 [ 13] Scrolling Message      1.8.2      AMXX Dev Team    scrollmsg.amxx  running 
 [ 14] Info. Messages          1.8.2      AMXX Dev Team    imessage.amxx    running 

 [ 15] Admin Votes            1.8.2      AMXX Dev Team    adminvote.amxx  running 
 [ 16] NextMap                1.8.2      AMXX Dev Team    nextmap.amxx    running 
 [ 17] Nextmap Chooser        1.8.2      AMXX Dev Team    mapchooser.amxx  running 
 [ 18] TimeLeft                1.8.2      AMXX Dev Team    timeleft.amxx    running 
 [ 19] Pause Plugins          1.8.2      AMXX Dev Team    pausecfg.amxx    running 
 [ 20] Stats Configuration    1.8.2      AMXX Dev Team    statscfg.amxx    running 
 [ 21] StatsX                  1.8.2      AMXX Dev Team    statsx.amxx      running 
 [ 22] unknown                unknown    unknown          nwc.amxx        running 
22 plugins, 22 running

Code:

] rcon meta list
Currently loaded plugins:
      description      stat pend  file              vers      src  load  unlod
 [ 1] AMX Mod X        RUN  -    amxmodx_mm.dll    v1.8.2    ini  Start ANY 
 [ 2] SQLite          RUN  -    sqlite_amxx.dll  v1.8.2    pl1  ANY  ANY 
 [ 3] Fun              RUN  -    fun_amxx.dll      v1.8.2    pl1  ANY  ANY 
 [ 4] Engine          RUN  -    engine_amxx.dll  v1.8.2    pl1  ANY  ANY 
 [ 5] FakeMeta        RUN  -    fakemeta_amxx.dl  v1.8.2    pl1  ANY  ANY 
 [ 6] CStrike          RUN  -    cstrike_amxx.dll  v1.8.2    pl1  ANY  ANY 
 [ 7] CSX              RUN  -    csx_amxx.dll      v1.8.2    pl1  ANY  ANY 
 [ 8] Ham Sandwich    RUN  -    hamsandwich_amxx  v1.8.2    pl1  ANY  ANY

Code:

] rcon amxx modules
Currently loaded modules:
      name                    version    author              status   
 [ 1] SQLite                  1.8.2      AMX Mod X Dev Team  running   
 [ 2] Fun                    1.8.2      AMX Mod X Dev Team  running   
 [ 3] Engine                  1.8.2      AMX Mod X Dev Team  running   
 [ 4] FakeMeta                1.8.2      AMX Mod X Dev Team  running   
 [ 5] nVault                  1.8.2      AMX Mod X Dev Team  running   
 [ 6] CStrike                1.8.2      AMX Mod X Dev Team  running   
 [ 7] CSX                    1.8.2      AMX Mod X Dev Team  running   
 [ 8] Ham Sandwich            1.8.2      AMX Mod X Dev Team  running

nwc.sma
Code:

//#pragma tabsize 0
//#pragma dynamic 32768

new const NAME[]    =    "NeoWarCraft";
new const AUTHOR[]    =    "PreDominance";
new const VERSION[]    =    "0.01";

#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fun>
#include <fakemeta>
#include <cstrike>
#include <hamsandwich>

#include "nwc/version.inl"
#include "nwc/constants.inl"
#include "nwc/logging.inl"
#include "nwc/util.inl"
#include "nwc/events.inl"
#include "nwc/vault.inl"

public plugin_init()
{
    register_plugin(NAME, VERSION, AUTHOR);
   
    //RegisterHam(Ham_Spawn, "player", "event_spawn", 1);
}

public plugin_precache()
{

}

public client_putinserver(id)
{
    //if (!(vault_playerExists(id))
    //{
        //vault_savePlayer(id, true);
    //}
}

public plugin_end()
{
    //nwc_log(LOGTYPE_SERVER, "Ending NWC plugin.");
}


YamiKaitou 07-09-2014 00:39

Re: Include file is preventing plugin from functioning.
 
unknown is displayed when a plugin doesn't user register_plugin

So, what exactly is the problem?

PreDominance 07-09-2014 00:39

Re: Include file is preventing plugin from functioning.
 
If you check out the nwc.sma, you can see that I've used regster_plugin under plugin_init().

YamiKaitou 07-09-2014 00:40

Re: Include file is preventing plugin from functioning.
 
Yes, it is in the code that you have showed us, but that may not be identical to what is on the server.

Again, what exactly is the problem?

PreDominance 07-09-2014 00:43

Re: Include file is preventing plugin from functioning.
 
The information with the plugin is not registered. Aside from that, a few things I did to test the functionality of the plugin (you can see the client_print in event_spawn) also do not work (which may be related to the unknown status?).

The information displayed here is precisely what's on the server, unless something changes when you compile the .sma and the includes.

fysiks 07-09-2014 01:35

Re: Include file is preventing plugin from functioning.
 
Attache the .sma file and the .inc file (as attachements).

PreDominance 07-09-2014 01:55

Re: Include file is preventing plugin from functioning.
 
2 Attachment(s)
As requested.

Attachment 135420
Attachment 135421

Black Rose 07-09-2014 05:16

Re: Include file is preventing plugin from functioning.
 
That seems to be the wrong include.


All times are GMT -4. The time now is 21:15.

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