Advertisement
Guest User

Example SQL

a guest
Nov 2nd, 2016
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.89 KB | None | 0 0
  1. forward Car_Load();
  2. public Car_Load()
  3. {
  4.     static
  5.         rows,
  6.         fields,
  7.         str[128];
  8.  
  9.     cache_get_data(rows, fields, g_dbConnection);
  10.  
  11.     for (new i = 0; i < rows; i ++) if (i < MAX_DYNAMIC_CARS)
  12.     {
  13.         CarData[i][carExists] = true;
  14.         CarData[i][carID] = cache_get_field_int(i, "carID");
  15.         CarData[i][carModel] = cache_get_field_int(i, "carModel");
  16.         CarData[i][carOwner] = cache_get_field_int(i, "carOwner");
  17.         CarData[i][carPos][0] = cache_get_field_float(i, "carPosX");
  18.         CarData[i][carPos][1] = cache_get_field_float(i, "carPosY");
  19.         CarData[i][carPos][2] = cache_get_field_float(i, "carPosZ");
  20.         CarData[i][carPos][3] = cache_get_field_float(i, "carPosR");
  21.         CarData[i][carColor1] = cache_get_field_int(i, "carColor1");
  22.         CarData[i][carColor2] = cache_get_field_int(i, "carColor2");
  23.         CarData[i][carPaintjob] = cache_get_field_int(i, "carPaintjob");
  24.         CarData[i][carLocked] = cache_get_field_int(i, "carLocked");
  25.         CarData[i][carImpounded] = cache_get_field_int(i, "carImpounded");
  26.         CarData[i][carImpoundPrice] = cache_get_field_int(i, "carImpoundPrice");
  27.         CarData[i][carFaction] = cache_get_field_int(i, "carFaction");
  28.  
  29.         for (new j = 0; j < 14; j ++)
  30.         {
  31.             if (j < 5)
  32.             {
  33.                 format(str, sizeof(str), "carWeapon%d", j + 1);
  34.                 CarData[i][carWeapons][j] = cache_get_field_int(i, str);
  35.  
  36.                 format(str, sizeof(str), "carAmmo%d", j + 1);
  37.                 CarData[i][carAmmo][j] = cache_get_field_int(i, str);
  38.             }
  39.             format(str, sizeof(str), "carMod%d", j + 1);
  40.             CarData[i][carMods][j] = cache_get_field_int(i, str);
  41.         }
  42.         Car_Spawn(i);
  43.     }
  44.     for (new i = 0; i < MAX_DYNAMIC_CARS; i ++) if (CarData[i][carExists]) {
  45.         format(str, sizeof(str), "SELECT * FROM `carstorage` WHERE `ID` = '%d'", CarData[i][carID]);
  46.  
  47.         mysql_tquery(g_dbConnection, str, "OnLoadCarStorage", "d", i);
  48.     }
  49.     return 1;
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement