AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   New Plugin Submissions (https://forums.alliedmods.net/forumdisplay.php?f=26)
-   -   Modern warfare 2 Mod v1.3.6b (https://forums.alliedmods.net/showthread.php?t=165939)

wickedd 09-11-2011 15:57

Re: Modern warfare 2 Mod v1.2.0b
 
I just tried to use sqlvault and I got this error

Code:

[AMXX] Plugin ("cod_mw2_mod.amxx") is setting itself as failed.
[AMXX] Plugin says: Error opening nVault
[AMXX] Run time error 1 (plugin "cod_mw2_mod.amxx") - forced exit


modernwarfare 09-11-2011 16:49

Re: Modern warfare 2 Mod v1.2.0b
 
Code:

#include <sqlx>

new Host[]    = ""
new User[]    = ""
new Pass[]    = ""
new Db[]    = ""
new Handle:g_SqlTuple
new g_Error[512]


public plugin_init()
{
    set_task(1.0, "MySql_Init");
}

public MySql_Init()
{
    g_SqlTuple = SQL_MakeDbTuple(Host,User,Pass,Db)
   
    new ErrorCode,Handle:SqlConnection = SQL_Connect(g_SqlTuple,ErrorCode,g_Error,charsmax(g_Error))
    if(SqlConnection == Empty_Handle)
    {
        set_fail_state(g_Error)
    }
    new Handle:Queries
    Queries = SQL_PrepareQuery(SqlConnection,"CREATE TABLE IF NOT EXISTS mw2 (steamid varchar(32), rank TEXT(11), points INT(11), class INT(11))")
   
    if(!SQL_Execute(Queries))
    {
        SQL_QueryError(Queries,g_Error,charsmax(g_Error))
        set_fail_state(g_Error) 
    }
   
    SQL_FreeHandle(Queries)
    SQL_FreeHandle(SqlConnection) 
}

public plugin_end()
{
    SQL_FreeHandle(g_SqlTuple)
}

public LoadData(id)
{
    new ErrorCode,Handle:SqlConnection = SQL_Connect(g_SqlTuple,ErrorCode,g_Error,charsmax(g_Error))
   
    if(g_SqlTuple == Empty_Handle)
        set_fail_state(g_Error)
       
    new szSteamId[32], szTemp[512]
    get_user_authid(id, szSteamId, charsmax(szSteamId))
   
    new Data[1]
    Data[0] = id

    format(szTemp,charsmax(szTemp),"SELECT * FROM `mw2` WHERE (`mw2`.`steamid` = '%s')", szSteamId)
    SQL_ThreadQuery(g_SqlTuple,"register_client",szTemp,Data,1)
    SQL_FreeHandle(SqlConnection)
}

public register_client(FailState,Handle:Query,Error[],Errcode,Data[],DataSize)
{
    if(FailState == TQUERY_CONNECT_FAILED)
    {
        log_amx("Load - Could not connect to SQL database.  [%d] %s", Errcode, Error)
    }
    else if(FailState == TQUERY_QUERY_FAILED)
    {
        log_amx("Load Query failed. [%d] %s", Errcode, Error)
    }
    new id = Data[0]
   
    if(SQL_NumResults(Query) < 1)
    {
       
        new szSteamId[32]
        get_user_authid(id, szSteamId, charsmax(szSteamId))
       
        if (equal(szSteamId,"ID_PENDING"))
            return PLUGIN_HANDLED;
           
        new szTemp[512]
       
        new ErrorCode,Handle:SqlConnection = SQL_Connect(g_SqlTuple,ErrorCode,g_Error,charsmax(g_Error))
        if(g_SqlTuple == Empty_Handle)
            set_fail_state(g_Error)

        format(szTemp,charsmax(szTemp),"INSERT INTO `mw2`(`steamid`, `rank`, `points`, `class`) VALUES ('%s', '0', '0', '0')", szSteamId)
        SQL_ThreadQuery(g_SqlTuple,"IgnoreHandle",szTemp)
        server_print("seach information ")
        SQL_FreeHandle(SqlConnection)
    }
    else
    {

        player_rank[id] = SQL_ReadResult(Query, 1)
        player_points[id] = SQL_ReadResult(Query, 2)
        player_class[id] = SQL_ReadResult(Query, 3)
        server_print("read the result ")
    }
    return PLUGIN_CONTINUE;



public IgnoreHandle(FailState,Handle:Query,Error[],Errcode,Data[],DataSize)
{
    SQL_FreeHandle(Query)
    return PLUGIN_HANDLED;
}

public SaveData(id)
{
    new ErrorCode,Handle:SqlConnection = SQL_Connect(g_SqlTuple,ErrorCode,g_Error,511)
    if(g_SqlTuple == Empty_Handle)
        set_fail_state(g_Error)
 
    new szSteamId[32], szTemp[512]
    get_user_authid(id, szSteamId, charsmax(szSteamId))
   
    format(szTemp,charsmax(szTemp),"UPDATE `mw2` SET `rank` = '%d' , `points` = '%d' , `class` = '%d' WHERE `mw2`.`steamid` = '%s';", player_rank[id],  player_points[id], player_class[id], szSteamId)
    SQL_ThreadQuery(g_SqlTuple,"IgnoreHandle",szTemp)
    SQL_FreeHandle(SqlConnection);
}

here i made this code it uses sqlx

i hope you add it

D.Moder 09-11-2011 17:38

Re: Modern warfare 2 Mod v1.2.0b
 
disable the XACCURATE feature
//#define XACCURATE

wickedd 09-11-2011 18:13

Re: Modern warfare 2 Mod v1.2.0b
 
Quote:

Originally Posted by wickedd (Post 1553188)
I just tried to use sqlvault and I got this error

Code:

[AMXX] Plugin ("cod_mw2_mod.amxx") is setting itself as failed.
[AMXX] Plugin says: Error opening nVault
[AMXX] Run time error 1 (plugin "cod_mw2_mod.amxx") - forced exit


Quote:

Originally Posted by D.Moder (Post 1553269)
disable the XACCURATE feature
//#define XACCURATE

I'm getting the same error:
Code:

[AMXX] Plugin ("cod_mw2_mod.amxx") is setting itself as failed.
[AMXX] Plugin says: Error opening nVault
[AMXX] Run time error 1 (plugin "cod_mw2_mod.amxx") - forced exit

Also when I'm playing map de_dust and I jump from the sniper nest the game will freeze.

D.Moder 09-11-2011 19:48

Re: Modern warfare 2 Mod v1.2.0b
 
I'm closing/removing this, there is some error that crashes the server and I can't find it because it just suddenly closes the server window, and I can't see the error.
I do want to continue, but I'm just stuck.

*** remove this plugin ***

mattisbogus 09-11-2011 22:04

Re: Modern warfare 2 Mod v1.2.0b (delete this)
 
ahh man that sucks but i am glad it wasn't just me. I could never run very long without the server crashing. Sometimes it would say because mp.dll other times because fakemeta_amx.dll and sometimes just unknown. I even stripped the server of scavenger/health packs, grenaded launchers, semtex/frags, and even tried different methods of stripping weapons and respawning and still it would eventually crash without an error. Shame man you did an excellent job :(

D.Moder 09-11-2011 22:43

Re: Modern warfare 2 Mod v1.2.0b (delete this)
 
@mattisbogus
thanks man
now the only people who can save this mod from going down, is the amx moderators/plugin approvers.
I'm pretty sure it's just 1 freaking function/stock is messing it up, but I have over 100 functions in there!

modernwarfare 09-11-2011 23:56

Re: Modern warfare 2 Mod v1.2.0b
 
Quote:

Originally Posted by D.Moder (Post 1553325)
I'm closing/removing this, there is some error that crashes the server and I can't find it because it just suddenly closes the server window, and I can't see the error.
I do want to continue, but I'm just stuck.

*** remove this plugin ***

that was too fast


i started my xp mod before you but you quit your plugin before me

wickedd 09-12-2011 00:03

Re: Modern warfare 2 Mod v1.2.0b (delete this)
 
I think he started his plugin before you. He wrote his plugin, you copied and paste yours, that's a big difference.

@D.Moder

Don't give up. It's a good plugin, just has a few bugs.

modernwarfare 09-12-2011 00:06

Re: Modern warfare 2 Mod v1.2.0b (delete this)
 
Quote:

Originally Posted by wickedd (Post 1553399)
I think he started his mod before you. He wrote his mod, you copied and paste yours, that's a big difference.

@D.Moder

Don't give up. It's a good plugin, just has a few bugs.


hahhaha nub you cant even do better?


And dont worry i rewrote the codes

so take that


All times are GMT -4. The time now is 06:04.

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