Sql vehicle system conflicting with other things
#1

I've narrowed it down to this system to load vehicles, when it's in the script, it makes you re register every time you log in, it's obviously conflicting with it but I don't know what with.

pawn Код:
stock VehicleLoad(vehicleID)
    {
    new Query1[200], DBResult: Result1;
    format(Query1, sizeof(Query1), "SELECT * FROM `VEHICLES` WHERE `ID` = %d LIMIT 1", vehicleID);
    Result1 = db_query(survival, Query1);
    if(db_num_rows(Result1))
        {
        new Field1[20];
        db_get_field_assoc(Result1, "FUEL", Field1, 30);
        VehicleInfo[vehicleID][vFuel] = strval(Field1);
        db_get_field_assoc(Result1, "MODEL", Field1, 30);
        VehicleInfo[vehicleID][vModel] = strval(Field1);
        db_get_field_assoc(Result1, "COLOR1", Field1, 30);
        VehicleInfo[vehicleID][vCol1] = strval(Field1);
        db_get_field_assoc(Result1, "COLOR2", Field1, 30);
        VehicleInfo[vehicleID][vCol2] = strval(Field1);
        db_get_field_assoc(Result1, "ID", Field1, 30);
        VehicleInfo[vehicleID][vID] = strval(Field1);
        db_get_field_assoc(Result1, "SPAWNX", Field1, 30);
        VehicleInfo[vehicleID][vSpawnX] = floatstr(Field1);
        db_get_field_assoc(Result1, "SPAWNY", Field1, 30);
        VehicleInfo[vehicleID][vSpawnY] = floatstr(Field1);
        db_get_field_assoc(Result1, "SPAWNZ", Field1, 30);
        VehicleInfo[vehicleID][vSpawnZ] = floatstr(Field1);
        db_get_field_assoc(Result1, "SPAWNA", Field1, 30);
        VehicleInfo[vehicleID][vSpawnA] = floatstr(Field1);
        print(Query1);
        }
    db_free_result(Result1);
    CreateVehicle(VehicleInfo[vehicleID][vModel], VehicleInfo[vehicleID][vSpawnX], VehicleInfo[vehicleID][vSpawnY], VehicleInfo[vehicleID][vSpawnZ], VehicleInfo[vehicleID][vSpawnA], VehicleInfo[vehicleID][vCol1], VehicleInfo[vehicleID][vCol2], 999999);
    }
pawn Код:
ONPLAYERCONNECT:

GetPlayerName(playerid, name, sizeof(name));
    format(Query, sizeof(Query), "SELECT `NAME` FROM `ACCOUNTS` WHERE `NAME` = '%s' COLLATE NOCASE", DB_Escape(name));
    Result = db_query(survival, Query);
   
    if(db_num_rows(Result))
        {
        new loginstring[100];
        format(loginstring, sizeof(loginstring), "Welcome back!\n{00FF00}Username: {FFFFFF}%s\nEnter your password below\nto get playing!", name);
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", loginstring, "Login", "Cancel");
        }
    else
        {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,"Register","Your account is not registered.\nPlease create a password and click register!","Register","Quit");
        }
    db_free_result(Result);
    return 1;
    }
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)