SA-MP Forums Archive
SQL Lite loading weapons on OnPlayerSpawn with loop crashes server. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: SQL Lite loading weapons on OnPlayerSpawn with loop crashes server. (/showthread.php?tid=375890)



SQL Lite loading weapons on OnPlayerSpawn with loop crashes server. - [WSF]ThA_Devil - 08.09.2012

Hello, I was trying to make that it loads weapons when player spawns but it's crashing server..
the code
pawn Код:
format(Query, sizeof(Query), "SELECT * FROM `WEAPONS` WHERE `NAME` = '%s' COLLATE NOCASE ", DB_Escape(name));
    new DBResult:Result,Field[20];
    Result = db_query(Database, Query);
    new weapons[13][2];
    new soltstring[20] = "";
    new slotdatastring[20] = "";
    for (new i = 0; i < 13; i++)
    {
        format(soltstring, sizeof(soltstring), "SLOT%i",i);
        print(soltstring);
        format(slotdatastring, sizeof(slotdatastring), "SLOT%iDATA",i);
        print(slotdatastring);
        db_get_field_assoc(Result, soltstring, Field, 30);
        weapons[i][0] = strval(Field);
        db_get_field_assoc(Result, slotdatastring, Field, 30);
        weapons[i][1] = strval(Field);
        if(weapons[i][1] != 0) GivePlayerWeapon(playerid,weapons[i][0],weapons[i][1]);
    }
the printing showed me:
Код:
[16:17:53] SLOT0
[16:17:53] SLOT0DATA
[16:17:53] SLOT1
[16:17:53] SLOT1DATA
[16:17:53] SLOT2
[16:17:53] SLOT2DATA
[16:17:53] SLOT3
[16:17:53] SLOT3DATA
It seems that it stops at SLOT3 and crashes... Any ideas? Thanks...