SQL Lite loading weapons on OnPlayerSpawn with loop crashes server.
#1

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...
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)