daily pastebin goal
21%
SHARE
TWEET

Untitled

a guest Dec 5th, 2018 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. new userVeh[MAX_PLAYERS] = 0;
  2.  
  3. function LoadPVeh(playerid) {
  4.     gQuery[0] = EOS;
  5.     mysql_format(SQL, gQuery, sizeof(gQuery), "SELECT * FROM `player_vehs` WHERE `vOwnerSQL`='%d'", PlayerInfo[playerid][pID]);
  6.     new Cache: db = mysql_query(SQL, gQuery);
  7.     new x,result[256];
  8.     for (new i, j = cache_num_rows(); i != j; ++i) {
  9.         userVeh[playerid]++;
  10.         // ints
  11.         cache_get_value_name_int(i, "vID", VehicleInfo[x][vID]);
  12.         cache_get_value_name_int(i, "vOwnerSQL", VehicleInfo[x][vOwnerSQL]);
  13.         cache_get_value_name_int(i, "vModel", VehicleInfo[x][vModel]);
  14.         cache_get_value_name_int(i, "vColor1", VehicleInfo[x][vColor1]);
  15.         cache_get_value_name_int(i, "vColor2", VehicleInfo[x][vColor2]);
  16.         // vars
  17.         cache_get_value_name(i, "vOwnerName", result);      format(VehicleInfo[x][vOwnerName], MAX_PLAYER_NAME, result);
  18.         cache_get_value_name(i, "vPlate", result);          format(VehicleInfo[x][vPlate], 18, result);
  19.         // floats
  20.         cache_get_value_name_float(i, "vPosX", VehicleInfo[x][vPosX]);
  21.         cache_get_value_name_float(i, "vPosY", VehicleInfo[x][vPosY]);
  22.         cache_get_value_name_float(i, "vPosZ", VehicleInfo[x][vPosZ]);
  23.         cache_get_value_name_float(i, "vPosA", VehicleInfo[x][vPosA]);
  24.  
  25.         CreateVehicle(VehicleInfo[x][vModel], VehicleInfo[x][vPosX], VehicleInfo[x][vPosY], VehicleInfo[x][vPosZ], VehicleInfo[x][vPosA], VehicleInfo[x][vColor1], VehicleInfo[x][vColor2], -1);
  26.         SetVehicleToRespawn(VehicleInfo[x][vID]);
  27.         SetVehicleNumberPlate(VehicleInfo[x][vID], VehicleInfo[x][vPlate]);
  28.     }
  29.     printf("[MySQL] P-Vehs for %s: %d.", GetName(playerid), userVeh[playerid]);
  30.     cache_delete(db);
  31.     return 1;
  32. }
  33.  
  34. public OnPlayerSpawn(playerid) {
  35.     LoadPVeh(playerid);
  36.     return 1;
  37. }
  38.  
  39. CMD:givecar(playerid, params[]) {
  40.     if(PlayerInfo[playerid][pAdmin] <= 4) return StaffOnly(playerid, 5);
  41.     new target, model;
  42.     if(sscanf(params, "ui", target, model)) return Usage(playerid, "/givecar <playername> <model>");
  43.     gString[0] = EOS;
  44.     format(gString, sizeof(gString), "Admin %s[%d] gave to %s[%d] car model: %d.", GetName(playerid), playerid, GetName(target), target, model);
  45.     SendAdminMessage(COLOR_ORANGE, gString, 1);
  46.     SCMx(playerid, -1, "Admin %s[%d] gave you car model:%d.",GetName(playerid), playerid, model);
  47.     gQuery[0] = EOS;
  48.     mysql_format(SQL, gQuery, sizeof(gQuery), "INSERT INTO `player_vehs` (`vOwnerSQL`,`vOwnerName`,`vModel`) VALUES ('%d','%s','%d')", PlayerInfo[target][pID], GetName(target), model);
  49.     mysql_query(SQL, gQuery);
  50.     return 1;
  51. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top