reyeshn

COMM

Sep 30th, 2020
634
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <a_samp>
  2. #include <crashdetect>
  3. #include <Pawn.CMD>
  4. #include <a_mysql>
  5. #include <sscanf2>
  6. #include <easy-mysql>
  7. #include <streamer>
  8.  
  9. // Definiciones.
  10. #define MAX_COMMERCE            100             // MÁXIMO DE NEGOCIOS EN TODO EL SERVIDOR.
  11. #define MAX_COMMERCE_INT        100
  12. #define TBL_COMMERCE            "commerce"
  13. #define TBL_COMMERCE_INTERIOR   "commerce_interior"
  14. #define COMM_STATE_SALE         "ON_SALE"
  15. #define COMM_STATE_NOTSALE      "NOT_SALE"
  16. #define FILTERSCRIPT
  17.  
  18. // Enumeraciones.
  19. enum _commerceInfo
  20. {
  21.     ID,
  22.     Name[50 + 1],
  23.     Owner,
  24.     ownerName[24 + 1],
  25.     Price,
  26.     State,
  27.     Interior,           // SA-MP INTERIOR
  28.     World,              // SA-MP WORLD
  29.     customInterior,     // INTERIOR PERSONALIZADO QUE SE UTILIZARÁ COMO INTERIOR DEL NEGOCIO.
  30.     Float:entryPosX,
  31.     Float:entryPosY,
  32.     Float:entryPosZ,
  33.     STREAMER_TAG_3D_TEXT_LABEL:dynamicLabelId
  34. };
  35.  
  36. enum _commerceInterior
  37. {
  38.     ID,
  39.     Name[30 + 1],
  40.     Interior,
  41.     World, 
  42.     Float:intPosX,
  43.     Float:intPosY,
  44.     Float:intPosZ,
  45.     STREAMER_TAG_3D_TEXT_LABEL:dynamicLabelId
  46. };
  47.  
  48. // Variables.
  49. new commerceInfo[MAX_COMMERCE][_commerceInfo];
  50. new commerceInterior[MAX_COMMERCE_INT][_commerceInterior];
  51.  
  52. new MySQL:hDb;
  53.  
  54. public OnFilterScriptInit()
  55. {
  56.     print("Cargando property-manage");
  57.     SQL::Connect("localhost", "teamkproj", "123", "db_kproj");
  58.     if(mysql_errno(hDb) > 0 )
  59.     {
  60.         // ERROR CON LA BASE DE DATOS.
  61.         print("[MySQL] No se ha podido conectar a la base de datos.");
  62.     }
  63.     else
  64.     {
  65.         // CONEXIÓN A LA BASE DE DATOS CORRECTA.
  66.         print("[MySQL] Se ha conectado correctamente a la base de datos.");
  67.  
  68.         /*if(!SQL::ExistsTable(TBL_COMMERCE))
  69.         {
  70.             new handle = SQL::Open(SQL::CREATE, TBL_COMMERCE);
  71.             SQL::AddTableColumn(handle, "comm_id", SQL_TYPE_INT, 11, false, true, true);
  72.             SQL::AddTableColumn(handle, "comm_name", SQL_TYPE_VCHAR, 50);
  73.             SQL::AddTableColumn(handle, "comm_owner", SQL_TYPE_INT);
  74.             SQL::AddTableColumn(handle, "comm_price", SQL_TYPE_INT);
  75.             SQL::AddTableColumn(handle, "comm_state", SQL_TYPE_VCHAR, 30);
  76.             SQL::AddTableColumn(handle, "comm_entryx", SQL_TYPE_FLOAT);
  77.             SQL::AddTableColumn(handle, "comm_entryy", SQL_TYPE_FLOAT);
  78.             SQL::AddTableColumn(handle, "comm_entryz", SQL_TYPE_FLOAT);
  79.             SQL::AddTableColumn(handle, "comm_entrya", SQL_TYPE_FLOAT);
  80.             SQL::Close(handle);
  81.         }
  82.  
  83.         if(!SQL::ExistsTable(TBL_COMMERCE_INTERIOR))
  84.         {
  85.             new handle = SQL::Open(SQL::CREATE, TBL_COMMERCE);
  86.             SQL::AddTableColumn(handle, "cint_id", SQL_TYPE_INT, 11, false, true, true);
  87.             SQL::AddTableColumn(handle, "cint_world", SQL_TYPE_INT, 50);
  88.             SQL::AddTableColumn(handle, "cint_interior", SQL_TYPE_INT);
  89.             SQL::AddTableColumn(handle, "cint_posx", SQL_TYPE_FLOAT);
  90.             SQL::AddTableColumn(handle, "cint_posy", SQL_TYPE_FLOAT);
  91.             SQL::AddTableColumn(handle, "cint_posz", SQL_TYPE_FLOAT);
  92.             SQL::AddTableColumn(handle, "cint_posa", SQL_TYPE_FLOAT);
  93.             SQL::Close(handle);
  94.         }*/
  95.  
  96.         loadCommerce();
  97.         loadCommerceInterior();
  98.     }
  99.     return true;
  100. }
  101.  
  102. public OnFilterScriptExit()
  103. {
  104.     mysql_close(hDb);
  105.     return true;
  106. }
  107.  
  108. CMD:comprarnegocio(playerid, params[])
  109. {
  110.     new nearCommerce = getPlayerNearCommerce(playerid);
  111.  
  112.     if( nearCommerce == -1 )
  113.         return SendClientMessage(playerid, -1, "ERROR: No estás cerca de ningún negocio.");
  114.     if( strcmp(commerceInfo[nearCommerce][State], COMM_STATE_SALE, true) )
  115.         return SendClientMessage(playerid, -1, "ERROR: Este negocio no esta en venta.");
  116.     if( GetPlayerMoney(playerid) < commerceInfo[ nearCommerce ][Price] )
  117.         return SendClientMessage(playerid, -1, "ERROR: No tienes suficiente dinero para hacer esta compra.");
  118.  
  119.     commerceInfo[ nearCommerce ][Owner] = 1; // CAMBIAR 1 POR LA VARIABLE QUE REPRESENTA EL ID DE CUENTA DEL JUGADOR.
  120.     GivePlayerMoney(playerid, -commerceInfo[ nearCommerce ][Price]);
  121.  
  122.  
  123.     SendClientMessage(playerid, -1, "Se ha comprado el negocio correctamente.");
  124.     updateCommerce(nearCommerce);
  125.     return true;
  126. }
  127.  
  128. CMD:crearnegocio(playerid, params[])
  129. {
  130.     if( !IsPlayerAdmin(playerid) )
  131.         return SendClientMessage(playerid, -1, "ERROR: Solo administradores pueden crear negocios.");
  132.  
  133.     new p_name[30 + 1], p_price, p_int;
  134.     if( sscanf(params, "s[30]dd", p_name, p_price, p_int) )
  135.         return SendClientMessage(playerid, -1, "Utilización: /crearnegocio [Nombre] [Precio] [ID del Interior (DB) (/commint) ]");
  136.  
  137.     if(!existCommerceInterior(p_int))
  138.         return SendClientMessage(playerid, -1, "ERROR: No se ha encontrado ningún interior (personalizado) con la ID que se ha indicado.");
  139.  
  140.     new Float:pPosX, Float:pPosY, Float:pPosZ, pInterior, pWorld;
  141.     GetPlayerPos(playerid, pPosX, pPosY, pPosZ);
  142.     pInterior = GetPlayerInterior(playerid);
  143.     pWorld = GetPlayerVirtualWorld(playerid);
  144.  
  145.     new commId = createCommerce(p_name, p_price, pWorld, pInterior, p_int, pPosX, pPosY, pPosZ);
  146.     if( commId > 0 )
  147.     {
  148.         new strMessage[144 + 1];
  149.         format(strMessage, sizeof(strMessage), "Se ha creado exitosamente el negocio %s(ID: %d)", p_name, commId);
  150.         SendClientMessage(playerid, -1, strMessage);
  151.     }
  152.     else
  153.     {
  154.         SendClientMessage(playerid, -1, "ERROR: Un problema a ocurrido al intentar crear la casa.");   
  155.     }
  156.     return true;
  157. }
  158.  
  159. CMD:borrarnegocio(playerid, params[])
  160. {
  161.     if( !IsPlayerAdmin(playerid) )
  162.         return SendClientMessage(playerid, -1, "ERROR: Solo administradores pueden borrar negocios.");
  163.  
  164.     new nearCommerce = getPlayerNearCommerce(playerid);
  165.  
  166.     if( nearCommerce == -1 )
  167.         return SendClientMessage(playerid, -1, "ERROR: No estás cerca de ningún negocio.");
  168.  
  169.     new strMessage[144 + 1];
  170.     format(strMessage, sizeof(strMessage), "Se borrará el negocio %s[ID: %d].", commerceInfo[nearCommerce][Name], commerceInfo[nearCommerce][ID]);
  171.     SendClientMessage(playerid, -1, strMessage);
  172.     deleteCommerce(nearCommerce);
  173.     return true;
  174. }
  175.  
  176.  
  177. CMD:borrarnegint(playerid, params[])
  178. {
  179.     if( !IsPlayerAdmin(playerid) )
  180.         return SendClientMessage(playerid, -1, "ERROR: Solo administradores pueden borrar interiores de negocios.");
  181.  
  182.     new p_cint;
  183.     if( sscanf(params, "d", p_cint) )
  184.         return SendClientMessage(playerid, -1, "Utilización: /borrarnegint [ID]");
  185.  
  186.     if( !existCommerceInterior(p_cint) )
  187.         return SendClientMessage(playerid, -1, "ERROR: El ID de interior de negocio que se ha indicado no es correcto.");
  188.  
  189.     new commId = -1;
  190.     new handle = SQL::Open(SQL::READ, TBL_COMMERCE, "cint_id", p_cint);
  191.     SQL::ReadInt(handle, "comm_id", commId);
  192.     SQL::Close(handle);
  193.    
  194.     if( commId != -1 )
  195.         return SendClientMessage(playerid, -1, "ERROR: Este interior esta siendo utilizado por uno o varios negocios, elimina el negocio o cambia el interior.");
  196.  
  197.     new strMessage[144 + 1];
  198.     format(strMessage, sizeof(strMessage), "Se borrará el interior de negocio %s[ID: %d].", commerceInterior[p_cint][Name], commerceInterior[p_cint][ID]);
  199.     SendClientMessage(playerid, -1, strMessage);
  200.     deleteCommerceInterior(p_cint);
  201.     return true;
  202. }
  203.  
  204.  
  205. CMD:crearnegint(playerid, params[])
  206. {
  207.     if( !IsPlayerAdmin(playerid) )
  208.         return SendClientMessage(playerid, -1, "ERROR: Solo administradores pueden crear negocios.");
  209.  
  210.     new p_name[30], p_world, p_interior;
  211.     if( sscanf(params, "s[30]D(0)D(0)", p_name, p_world, p_interior) )
  212.         return SendClientMessage(playerid, -1, "Utilización: /crearcomint [Nombre] [Mundo Virtual] [Interior (SA-MP)]");
  213.  
  214.     p_world = ( (p_world < 0 ) ? (GetPlayerVirtualWorld(playerid)) : (p_world) );
  215.     p_interior = ( (p_interior < 0 ) ? (GetPlayerInterior(playerid)) : (p_interior) );
  216.    
  217.     new Float:pPosX, Float:pPosY, Float:pPosZ;
  218.     GetPlayerPos(playerid, pPosX, pPosY, pPosZ);
  219.  
  220.     new commIntId = createCommerceInterior(p_name, p_world, p_interior, pPosX, pPosY, pPosZ), strMessage[144 + 1];
  221.     if( commIntId > 0 )
  222.     {
  223.         format(strMessage, sizeof(strMessage), "Se ha creado el interior personalizado %s(ID: %d).", p_name, commIntId);
  224.     }
  225.     else
  226.     {
  227.         SendClientMessage(playerid, -1, "ERROR: Un problema a ocurrido al intentar crear la casa.");   
  228.     }
  229.  
  230.     return true;
  231. }
  232.  
  233. loadCommerce()
  234. {
  235.     // CARGANDO NEGOCIOS.
  236.     new handle = SQL::Open(SQL::MTREAD, TBL_COMMERCE), tempId, commerceCount, strLabel[144 + 1];
  237.     SQL::ReadRetrievedRows(handle, i)
  238.     {
  239.         SQL::ReadInt(handle, "comm_id", tempId, i);
  240.         SQL::ReadInt(handle, "comm_id", commerceInfo[tempId][ID], i);
  241.         SQL::ReadString(handle, "comm_name", commerceInfo[tempId][Name], 50, i);
  242.         SQL::ReadInt(handle, "comm_owner", commerceInfo[tempId][Owner], i);
  243.         SQL::ReadInt(handle, "comm_price", commerceInfo[tempId][Price], i);
  244.         SQL::ReadInt(handle, "comm_state", commerceInfo[tempId][State], i);
  245.         SQL::ReadInt(handle, "comm_world", commerceInfo[tempId][World], i);
  246.         SQL::ReadInt(handle, "comm_interior", commerceInfo[tempId][Interior], i);
  247.         SQL::ReadInt(handle, "cint_id", commerceInfo[tempId][customInterior], i);
  248.         SQL::ReadFloat(handle, "comm_entryx", commerceInfo[tempId][entryPosX], i);
  249.         SQL::ReadFloat(handle, "comm_entryy", commerceInfo[tempId][entryPosY], i);
  250.         SQL::ReadFloat(handle, "comm_entryz", commerceInfo[tempId][entryPosZ], i);
  251.  
  252.         // CREANDO ETIQUETA.
  253.  
  254.         if(!strcmp(commerceInfo[tempId][State], COMM_STATE_SALE, true))
  255.         {
  256.             format(strLabel, sizeof(strLabel), "%s (ID: %d)\nPropietario: %s\nPrecio: $%d\n\n/negocio comprar", commerceInfo[tempId][Name], tempId, commerceInfo[tempId][Owner], commerceInfo[tempId][Price]);
  257.             commerceInfo[tempId][dynamicLabelId] = CreateDynamic3DTextLabel(strLabel, -1, commerceInfo[tempId][entryPosX], commerceInfo[tempId][entryPosY], commerceInfo[tempId][entryPosZ], 10.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, commerceInfo[tempId][World], commerceInfo[tempId][Interior]);
  258.         }
  259.         else if(!strcmp(commerceInfo[tempId][State], COMM_STATE_NOTSALE, true))
  260.         {
  261.             format(strLabel, sizeof(strLabel), "%s (ID: %d)\nPropietario: %s", commerceInfo[tempId][Name], tempId, commerceInfo[tempId][Owner], commerceInfo[tempId][Price]);
  262.             commerceInfo[tempId][dynamicLabelId] = CreateDynamic3DTextLabel(strLabel, -1, commerceInfo[tempId][entryPosX], commerceInfo[tempId][entryPosY], commerceInfo[tempId][entryPosZ], 10.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, commerceInfo[tempId][World], commerceInfo[tempId][Interior]);
  263.         }
  264.  
  265.         printf("[Negocio] Se ha cargado el negocio %s (ID: %d).", commerceInfo[tempId][Name], tempId);
  266.         commerceCount++;
  267.     }
  268. }
  269.  
  270. loadCommerceInterior()
  271. {
  272.     // CARGANDO NEGOCIOS.
  273.     new handle = SQL::Open(SQL::MTREAD, TBL_COMMERCE_INTERIOR), tempId, commerceCount;
  274.     SQL::ReadRetrievedRows(handle, i)
  275.     {
  276.         SQL::ReadInt(handle, "cint_id", tempId, i);
  277.         SQL::ReadInt(handle, "cint_id", commerceInterior[tempId][ID], i);
  278.         SQL::ReadString(handle, "cint_name", commerceInterior[tempId][Name], 50, i);
  279.         SQL::ReadInt(handle, "cint_world", commerceInterior[tempId][World], i);
  280.         SQL::ReadInt(handle, "cint_interior", commerceInterior[tempId][Interior], i);
  281.         SQL::ReadFloat(handle, "cint_posx", commerceInterior[tempId][intPosX], i);
  282.         SQL::ReadFloat(handle, "cint_posy", commerceInterior[tempId][intPosY], i);
  283.         SQL::ReadFloat(handle, "cint_posz", commerceInterior[tempId][intPosZ], i);
  284.  
  285.         commerceInterior[tempId][dynamicLabelId] = CreateDynamic3DTextLabel("Escribe /salirnegocio o presiona Y para salir del negocio.", -1, commerceInterior[tempId][intPosX], commerceInterior[tempId][intPosY], commerceInterior[tempId][intPosZ], 10.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, commerceInterior[tempId][World], commerceInterior[tempId][Interior]);
  286.  
  287.         printf("[Interior] Se ha cargado el interior de negocio %s(ID: %d).", commerceInterior[tempId][Name], tempId);
  288.         commerceCount++;
  289.     }
  290. }
  291.  
  292. updateCommerce(id, bool:redrawig = false)
  293. {
  294.     new handle = SQL::Open(SQL::UPDATE, TBL_COMMERCE, "comm_id", id);
  295.     SQL::WriteString(handle, "comm_name", commerceInfo[id][Name]);
  296.     SQL::WriteInt(handle, "comm_owner", commerceInfo[id][Owner]);
  297.     SQL::WriteInt(handle, "comm_price", commerceInfo[id][Price]);
  298.     SQL::WriteString(handle, "comm_state", commerceInfo[id][State]);
  299.     SQL::WriteFloat(handle, "comm_entryx", commerceInfo[id][entryPosX]);
  300.     SQL::WriteFloat(handle, "comm_entryy", commerceInfo[id][entryPosY]);
  301.     SQL::WriteFloat(handle, "comm_entryz", commerceInfo[id][entryPosZ]);
  302.     SQL::Close(handle);
  303.  
  304.     printf("[Negocio] Se ha actualizado los datos del negocio %d", id);
  305.  
  306.     if(redrawig)
  307.     {
  308.         new strLabel[144 + 1];
  309.         DestroyDynamic3DTextLabel(commerceInfo[id][dynamicLabelId]);
  310.         if(!strcmp(commerceInfo[id][State], COMM_STATE_SALE, true))
  311.         {
  312.             format(strLabel, sizeof(strLabel), "%s (ID: %d)\nPropietario: %s\nPrecio: $%d\n\n/negocio comprar", commerceInfo[id][Name], id, commerceInfo[id][Owner], commerceInfo[id][Price]);
  313.             commerceInfo[id][dynamicLabelId] = CreateDynamic3DTextLabel(strLabel, -1, commerceInfo[id][entryPosX], commerceInfo[id][entryPosY], commerceInfo[id][entryPosZ], 10.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, commerceInfo[id][World], commerceInfo[id][Interior]);
  314.         }
  315.         else if(!strcmp(commerceInfo[id][State], COMM_STATE_NOTSALE, true))
  316.         {
  317.             format(strLabel, sizeof(strLabel), "%s (ID: %d)\nPropietario: %s", commerceInfo[id][Name], id, commerceInfo[id][Owner], commerceInfo[id][Price]);
  318.             commerceInfo[id][dynamicLabelId] = CreateDynamic3DTextLabel(strLabel, -1, commerceInfo[id][entryPosX], commerceInfo[id][entryPosY], commerceInfo[id][entryPosZ], 10.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, commerceInfo[id][World], commerceInfo[id][Interior]);
  319.         }
  320.     }
  321.     return true;
  322. }
  323.  
  324. getPlayerNearCommerce(playerid)
  325. {
  326.     new nearId = -1;
  327.     for(new a = 0, b = sizeof(commerceInfo); a < b; a++)
  328.     {
  329.         if( commerceInfo[a][ID] == 0 )
  330.             continue;
  331.  
  332.         if( IsPlayerInRangeOfPoint(playerid, 10.0, commerceInfo[a][entryPosX], commerceInfo[a][entryPosY], commerceInfo[a][entryPosZ]) )
  333.         {
  334.             nearId = a;
  335.             break;
  336.         }
  337.     }
  338.     return nearId;
  339. }
  340.  
  341. createCommerce(commName[], commPrice, commWorld, commInterior, commCustomInterior, Float:commPosX, Float:commPosY, Float:commPosZ)
  342. {
  343.     new commerceId = 0;
  344.     new handle = SQL::Open(SQL::INSERT, TBL_COMMERCE);
  345.     SQL::ToggleAutoIncrement(handle, true);
  346.     SQL::WriteString(handle, "comm_name", commName);
  347.     SQL::WriteString(handle, "comm_state", COMM_STATE_SALE);
  348.     SQL::WriteInt(handle, "comm_price", commPrice);
  349.     SQL::WriteInt(handle, "comm_world", commWorld);
  350.     SQL::WriteInt(handle, "comm_interior", commInterior);
  351.     SQL::WriteInt(handle, "cint_id", commCustomInterior);
  352.     SQL::WriteFloat(handle, "comm_entryposx", commPosX);
  353.     SQL::WriteFloat(handle, "comm_entryposy", commPosY);
  354.     SQL::WriteFloat(handle, "comm_entryposz", commPosZ);
  355.     commerceId = SQL::Close(handle);
  356.     commerceInfo[commerceId][ID] = commerceId;
  357.     format(commerceInfo[commerceId][Name], 50, "%s", commName);
  358.     commerceInfo[commerceId][Owner] = 0;
  359.     format(commerceInfo[commerceId][ownerName], 30, "%s", "Mobilaria R&A");
  360.     commerceInfo[commerceId][Price] = commPrice;
  361.     format(commerceInfo[commerceId][State], 30, "%s", COMM_STATE_SALE);
  362.     commerceInfo[commerceId][Interior] = commInterior;
  363.     commerceInfo[commerceId][World] = commWorld;
  364.     commerceInfo[commerceId][customInterior] = commCustomInterior;
  365.     commerceInfo[commerceId][entryPosX] = commPosX;
  366.     commerceInfo[commerceId][entryPosY] = commPosY;
  367.     commerceInfo[commerceId][entryPosZ] = commPosZ;
  368.  
  369.     new strLabel[144 + 1];
  370.     format(strLabel, sizeof(strLabel), "%s (ID: %d)\nPropietario: %s\nPrecio: $%d\n\n/negocio comprar", commerceInfo[commerceId][Name], commerceId, commerceInfo[commerceId][ownerName], commerceInfo[commerceId][Price]);
  371.     commerceInfo[commerceId][dynamicLabelId] = CreateDynamic3DTextLabel(strLabel, -1, commerceInfo[commerceId][entryPosX], commerceInfo[commerceId][entryPosY], commerceInfo[commerceId][entryPosZ], 10.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, commerceInfo[commerceId][World], commerceInfo[commerceId][Interior]);
  372.     return commerceId;
  373. }
  374.  
  375. createCommerceInterior(comIntName[], comIntWorld, comIntInterior, Float:comIntPosX, Float:comIntPosY, Float:comIntPosZ)
  376. {
  377.     new commerceInteriorId = 0;
  378.     new handle = SQL::Open(SQL::INSERT, TBL_COMMERCE_INTERIOR);
  379.     SQL::ToggleAutoIncrement(handle, true);
  380.     SQL::WriteString(handle, "cint_name", comIntName);
  381.     SQL::WriteInt(handle, "cint_world", comIntWorld);
  382.     SQL::WriteInt(handle, "cint_interior", comIntInterior);
  383.     SQL::WriteFloat(handle, "cint_posx", comIntPosX);
  384.     SQL::WriteFloat(handle, "cint_posy", comIntPosY);
  385.     SQL::WriteFloat(handle, "cint_posz", comIntPosZ);
  386.     commerceInteriorId = SQL::Close(handle);
  387.  
  388.     commerceInterior[commerceInteriorId][ID] = commerceInteriorId;
  389.     format(commerceInterior[commerceInteriorId][Name], 30, "%s", comIntName);
  390.     commerceInterior[commerceInteriorId][Interior] = comIntInterior;
  391.     commerceInterior[commerceInteriorId][World] = comIntWorld;
  392.     commerceInterior[commerceInteriorId][intPosX] = comIntPosX;
  393.     commerceInterior[commerceInteriorId][intPosY] = comIntPosY;
  394.     commerceInterior[commerceInteriorId][intPosZ] = comIntPosZ;
  395.  
  396.     commerceInterior[commerceInteriorId][dynamicLabelId] = CreateDynamic3DTextLabel("Escribe /salirnegocio o presiona Y para salir del negocio.", -1, commerceInterior[commerceInteriorId][intPosX], commerceInterior[commerceInteriorId][intPosY], commerceInterior[commerceInteriorId][intPosZ], 10.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, commerceInterior[commerceInteriorId][World], commerceInterior[commerceInteriorId][Interior]);
  397.     return commerceInteriorId;
  398. }
  399.  
  400.  
  401. deleteCommerce(id)
  402. {
  403.     SQL::DeleteRow(TBL_COMMERCE, "comm_id", id);
  404.     DestroyDynamic3DTextLabel(commerceInfo[id][dynamicLabelId]);
  405.  
  406.     commerceInfo[id][Name][0]           =   EOS;
  407.     commerceInfo[id][ownerName][0]      =   EOS;
  408.     commerceInfo[id][ID]                =
  409.     commerceInfo[id][Owner]             =
  410.     commerceInfo[id][Price]             =
  411.     commerceInfo[id][State]             =
  412.     commerceInfo[id][Interior]          =
  413.     commerceInfo[id][World]             =
  414.     commerceInfo[id][customInterior]    =       0;
  415.     commerceInfo[id][entryPosX]         =          
  416.     commerceInfo[id][entryPosY]         =          
  417.     commerceInfo[id][entryPosZ]         =       0.0;
  418.     commerceInfo[id][dynamicLabelId]    =       STREAMER_TAG_3D_TEXT_LABEL:-1;
  419.     return true;
  420. }
  421.  
  422. deleteCommerceInterior(id)
  423. {
  424.     SQL::DeleteRow(TBL_COMMERCE, "cint_id", id);
  425.     DestroyDynamic3DTextLabel(commerceInterior[id][dynamicLabelId]);
  426.  
  427.     commerceInterior[id][Name][0]           =   EOS;
  428.     commerceInterior[id][ID]                =
  429.     commerceInterior[id][Interior]          =
  430.     commerceInterior[id][World]             =   0;
  431.     commerceInterior[id][intPosX]           =          
  432.     commerceInterior[id][intPosY]           =          
  433.     commerceInterior[id][intPosZ]           =   0.0;
  434.     commerceInterior[id][dynamicLabelId]    =   STREAMER_TAG_3D_TEXT_LABEL:-1;
  435.     return true;
  436. }
  437.  
  438. existCommerceInterior(id)
  439. {
  440.     new commerceInteriorId = 0;
  441.     new handle = SQL::Open(SQL::READ, TBL_COMMERCE_INTERIOR, "cint_id", id);
  442.     SQL::ReadInt(handle, "cint_id", commerceInteriorId);
  443.     SQL::Close(handle);
  444.     return ( (commerceInteriorId > 0 ) ? (true) : (false) );
  445. }
RAW Paste Data