Advertisement
Gireada

Sistem Garaj

Mar 13th, 2013
1,769
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 22.91 KB | None | 0 0
  1. /****************************************************************************************************************************************************************************
  2. *****************************************************************************************************************************************************************************
  3. *****************************************************************************************************************************************************************************
  4. ***********************************************************************__________________************************************************************************************
  5. **********************************************************************|    Garaj Sistem  |***********************************************************************************
  6. **********************************************************************|                  |***********************************************************************************
  7. **********************************************************************|      By          |***********************************************************************************
  8. **********************************************************************|        Gireada   |***********************************************************************************
  9. **********************************************************************|                  |***********************************************************************************
  10. **********************************************************************|                  |***********************************************************************************
  11. **********************************************************************|                  |***********************************************************************************
  12. **********************************************************************|                  |***********************************************************************************
  13. **********************************************************************|                  |***********************************************************************************
  14. **********************************************************************---------------------************************************************************************************
  15. */
  16.  
  17. //Nu stergeti Creditele.
  18.  
  19. #include <a_samp>
  20. #include <dini>
  21. #include <sscanf>
  22. #include <zcmd>
  23. #include <streamer>
  24.  
  25.  
  26. new maxpersgaraje = 5;// Cate garaje poate avea un jucator
  27. new maxgaraje = 500;// Cate garaje are serverul
  28. new gpickup[1000];
  29. new Text3D:gtextlabel[1000];
  30. new curentg[MAX_PLAYERS];
  31.  
  32. forward LoadGaraje();
  33. forward SaveThisGaraj(garajid);
  34. forward SendAdminMesaj(color,const string[]);
  35.  
  36. stock pName(playerid)
  37. {
  38.     new name[MAX_PLAYER_NAME];
  39.     GetPlayerName(playerid,name,sizeof(name));
  40.     return name;
  41. }
  42.  
  43. enum PlayerData
  44. {
  45.     pGaraje,
  46. }
  47.  
  48. new PlayerInfo[MAX_PLAYERS][PlayerData];
  49.  
  50. enum GarajData
  51. {
  52.     Float:Intrarex,
  53.     Float:Intrarey,
  54.     Float:Intrarez,
  55.     Float:Iesirex,
  56.     Float:Iesirey,
  57.     Float:Iesirez,
  58.     GarajPropietar[MAX_PLAYER_NAME],
  59.     GarajPret,
  60.     GarajVirtual,
  61.     GarajStatus,
  62.     GarajCumparat,
  63. }
  64.  
  65. new GarajInfo[500][GarajData];
  66.  
  67. public OnGameModeInit()
  68. {
  69.     LoadGaraje();
  70.     return 1;
  71. }
  72.  
  73. public OnFilterScriptInit()
  74. {
  75.     print("\n--------------------------------------");
  76.     print(" Garage System by Gireada");
  77.     print("--------------------------------------\n");
  78.    
  79.     CreateDynamicObject(19456, 598.65, 1665.88, 7.68,   0.00, 0.00, 0.00);
  80.     CreateDynamicObject(19456, 598.65, 1675.51, 7.68,   0.00, 0.00, 0.00);
  81.     CreateDynamicObject(19456, 590.37, 1665.88, 7.68,   0.00, 0.00, 0.00);
  82.     CreateDynamicObject(10282, 594.69, 1666.51, 7.00,   0.00, 0.00, 180.00);
  83.     CreateDynamicObject(19456, 593.76, 1661.16, 7.68,   0.00, 0.00, 90.00);
  84.     CreateDynamicObject(19456, 590.37, 1675.51, 7.68,   0.00, 0.00, 0.00);
  85.     CreateDynamicObject(19456, 584.22, 1661.16, 11.20,   0.00, 0.00, 90.00);
  86.     CreateDynamicObject(19456, 579.46, 1665.87, 7.68,   0.00, 0.00, 0.00);
  87.     CreateDynamicObject(19456, 579.46, 1675.51, 7.68,   0.00, 0.00, 0.00);
  88.     CreateDynamicObject(10282, 584.72, 1666.50, 7.00,   0.00, 0.00, 180.00);
  89.     CreateDynamicObject(14679, 580.94, 1664.59, 6.41,   0.00, 0.00, 180.00);
  90.     CreateDynamicObject(2025, 580.01, 1665.34, 5.99,   0.00, 0.00, 90.00);
  91.     CreateDynamicObject(2025, 580.01, 1667.23, 5.99,   0.00, 0.00, 90.00);
  92.     CreateDynamicObject(19449, 588.71, 1672.36, 7.54,   -20.00, 90.00, 0.00);
  93.     CreateDynamicObject(19449, 592.17, 1666.05, 9.36,   0.00, 90.00, 0.00);
  94.     CreateDynamicObject(19449, 585.48, 1662.82, 9.18,   0.00, 90.00, 90.00);
  95.     CreateDynamicObject(3850, 582.41, 1667.71, 9.77,   0.00, 0.00, 90.00);
  96.     CreateDynamicObject(3850, 585.86, 1667.71, 9.77,   0.00, 0.00, 90.00);
  97.     CreateDynamicObject(3850, 580.73, 1665.99, 9.77,   0.00, 0.00, 0.00);
  98.     CreateDynamicObject(3850, 580.73, 1662.81, 9.77,   0.00, 0.00, 0.00);
  99.     CreateDynamicObject(19456, 584.22, 1661.16, 7.68,   0.00, 0.00, 90.00);
  100.     CreateDynamicObject(957, 580.96, 1661.52, 9.09,   0.00, 0.00, 0.00);
  101.     CreateDynamicObject(957, 580.96, 1667.41, 9.09,   0.00, 0.00, 0.00);
  102.     CreateDynamicObject(957, 589.95, 1667.41, 9.09,   0.00, 0.00, 0.00);
  103.     CreateDynamicObject(957, 585.03, 1661.52, 9.09,   0.00, 0.00, 0.00);
  104.     CreateDynamicObject(957, 590.12, 1661.52, 9.09,   0.00, 0.00, 0.00);
  105.     CreateDynamicObject(957, 585.03, 1667.41, 9.09,   0.00, 0.00, 0.00);
  106.     CreateDynamicObject(19456, 590.37, 1675.51, 11.20,   0.00, 0.00, 0.00);
  107.     CreateDynamicObject(19456, 590.37, 1665.88, 11.20,   0.00, 0.00, 0.00);
  108.     CreateDynamicObject(19456, 579.46, 1665.87, 11.20,   0.00, 0.00, 0.00);
  109.     CreateDynamicObject(19456, 579.46, 1675.51, 11.20,   0.00, 0.00, 0.00);
  110.     CreateDynamicObject(19437, 589.66, 1661.16, 11.20,   0.00, 0.00, 90.00);
  111.     CreateDynamicObject(957, 590.12, 1664.37, 9.09,   0.00, 0.00, 0.00);
  112.     CreateDynamicObject(957, 585.03, 1664.37, 9.09,   0.00, 0.00, 0.00);
  113.     CreateDynamicObject(957, 580.96, 1664.37, 9.09,   0.00, 0.00, 0.00);
  114.     CreateDynamicObject(19449, 585.48, 1666.13, 9.18,   0.00, 90.00, 90.00);
  115.     CreateDynamicObject(19449, 595.53, 1666.05, 9.36,   0.00, 90.00, 0.00);
  116.     CreateDynamicObject(19449, 596.95, 1666.05, 9.36,   0.00, 90.00, 0.00);
  117.     CreateDynamicObject(19449, 592.17, 1675.58, 9.36,   0.00, 90.00, 0.00);
  118.     CreateDynamicObject(19449, 595.53, 1675.58, 9.36,   0.00, 90.00, 0.00);
  119.     CreateDynamicObject(19449, 596.95, 1675.58, 9.36,   0.00, 90.00, 0.00);
  120.     CreateDynamicObject(19449, 588.70, 1675.53, 12.89,   0.00, 90.00, 0.00);
  121.     CreateDynamicObject(19449, 585.29, 1675.53, 12.89,   0.00, 90.00, 0.00);
  122.     CreateDynamicObject(19449, 581.89, 1675.53, 12.89,   0.00, 90.00, 0.00);
  123.     CreateDynamicObject(19449, 581.09, 1675.53, 12.89,   0.00, 90.00, 0.00);
  124.     CreateDynamicObject(19449, 588.70, 1665.94, 12.89,   0.00, 90.00, 0.00);
  125.     CreateDynamicObject(19449, 585.29, 1665.94, 12.89,   0.00, 90.00, 0.00);
  126.     CreateDynamicObject(19449, 581.09, 1665.94, 12.89,   0.00, 90.00, 0.00);
  127.     CreateDynamicObject(19449, 581.89, 1665.94, 12.89,   0.00, 90.00, 0.00);
  128.     CreateDynamicObject(19456, 584.25, 1680.25, 11.15,   0.00, 0.00, 90.00);
  129.     CreateDynamicObject(19456, 593.90, 1680.25, 7.68,   0.00, 0.00, 90.00);
  130.     CreateDynamicObject(19456, 584.27, 1680.25, 7.68,   0.00, 0.00, 90.00);
  131.     CreateDynamicObject(19437, 589.67, 1680.25, 11.20,   0.00, 0.00, 90.00);
  132.     CreateDynamicObject(5779, 594.31, 1680.18, 7.42,   0.00, 0.00, 90.00);
  133.     CreateDynamicObject(5779, 583.11, 1680.16, 7.42,   0.00, 0.00, 90.00);
  134.     return 1;
  135. }
  136.  
  137. public OnFilterScriptExit()
  138. {
  139.     return 1;
  140. }
  141.  
  142. main()
  143. {
  144.     print("\n----------------------------------");
  145.     print(" Garage System by Gireada");
  146.     print("----------------------------------\n");
  147. }
  148.  
  149. public OnPlayerConnect(playerid)
  150. {
  151.     new file[200];
  152.     format(file, sizeof(file),"JucatoriGaraj/%s.ini", pName(playerid));
  153.     if(dini_Exists(file))
  154.     {
  155.         PlayerInfo[playerid][pGaraje] = dini_Int(file,"Garaje");
  156.     }
  157.     else if(!dini_Exists(file))
  158.     {
  159.         dini_Create(file);
  160.         dini_IntSet(file,"Garaje",PlayerInfo[playerid][pGaraje] = 0);
  161.     }
  162.     curentg[playerid] = 0;
  163.     return 1;
  164. }
  165.  
  166. public OnPlayerDisconnect(playerid, reason)
  167. {
  168.     new file[35];
  169.     format(file, sizeof(file),"JucatoriGaraj/%s.ini", pName(playerid));
  170.     dini_IntSet(file,"Garaje",PlayerInfo[playerid][pGaraje]);
  171.     curentg[playerid] = 0;
  172.     return 1;
  173. }
  174.  
  175. CMD:statgaraj(playerid, params[])
  176. {
  177.     new gid = curentg[playerid], nume[MAX_PLAYER_NAME];
  178.     GetPlayerName(playerid, nume, sizeof(nume));
  179.     if(gid == 0)
  180.     {
  181.         SendClientMessage(playerid, 0xFFFFFFFF, "Trebuie sa fii in garaj pentru al inchide/deschide.");
  182.         return 1;
  183.     }
  184.     else if(gid == 1)
  185.     {
  186.         if(!(GarajInfo[gid][GarajPropietar] == nume[playerid]))
  187.         {
  188.             SendClientMessage(playerid, 0xFFFFFFFF, "Acesta nu e garajul tau.");
  189.             return 1;
  190.         }
  191.         if(IsPlayerInRangeOfPoint(playerid, 5.0, GarajInfo[gid][Iesirex], GarajInfo[gid][Iesirey], GarajInfo[gid][Iesirez]))
  192.         {
  193.             if(GarajInfo[gid][GarajStatus] == 0)
  194.             {
  195.                 GarajInfo[gid][GarajStatus] = 1;
  196.                 SendClientMessage(playerid, 0xFFFFFFFF, "Ti-ai inchis garajul.");
  197.                 SaveThisGaraj(gid);
  198.             }
  199.             else if(GarajInfo[gid][GarajStatus] == 1)
  200.             {
  201.                 GarajInfo[gid][GarajStatus] = 0;
  202.                 SendClientMessage(playerid, 0xFFFFFFFF, "Ti-ai deschis garajul.");
  203.                 SaveThisGaraj(gid);
  204.             }
  205.         }
  206.     }
  207.     return 1;
  208. }
  209.  
  210. CMD:cumparagaraj(playerid, params[])
  211. {
  212.     new propietar[MAX_PLAYER_NAME], string2[256];
  213.     format(propietar, sizeof(propietar), "N/a");
  214.     new nume[MAX_PLAYER_NAME];
  215.     GetPlayerName(playerid, nume, sizeof(nume));
  216.     if(PlayerInfo[playerid][pGaraje] <= maxpersgaraje)
  217.     {
  218.         for(new i= 1; i<=maxgaraje; i++)
  219.         {
  220.             if(IsPlayerInRangeOfPoint(playerid, 1.5, GarajInfo[i][Intrarex], GarajInfo[i][Intrarey], GarajInfo[i][Intrarez]))
  221.             {
  222.                 if(GarajInfo[i][GarajPropietar] == propietar[playerid])
  223.                 {
  224.                     if(GetPlayerMoney(playerid) >= GarajInfo[i][GarajPret])
  225.                     {
  226.                         GivePlayerMoney(playerid, -GarajInfo[i][GarajPret]); GarajInfo[i][GarajStatus] = 1;
  227.                         strmid(GarajInfo[i][GarajPropietar], nume, 0, strlen(nume), 255);
  228.                         PlayerInfo[playerid][pGaraje] += 1; GarajInfo[i][GarajCumparat] = 1;
  229.                         DestroyPickup(gpickup[i]); SaveThisGaraj(i);
  230.                         gpickup[i] = CreatePickup(1318, 1, GarajInfo[i][Intrarex], GarajInfo[i][Intrarey], GarajInfo[i][Intrarez], -1);
  231.                         format(string2, sizeof(string2), " Propietar: %s \n Valoare: %d \n Virtual: %d ",GarajInfo[i][GarajPropietar], GarajInfo[i][GarajPret],GarajInfo[i][GarajVirtual]);
  232.                         Update3DTextLabelText(gtextlabel[i], 0x7FFF00FF, string2);
  233.                         SendClientMessage(playerid, 0xFFFFFFFF, "Felicitari pentru noul garaj. Nu uita de /gajutor");
  234.                         break;
  235.                     }
  236.                     else
  237.                     {
  238.                         SendClientMessage(playerid, 0xFFFFFFFF, "Nu ai destui bani");
  239.                         break;
  240.                     }
  241.                 }
  242.                 else
  243.                 {
  244.                     SendClientMessage(playerid, 0xFFFFFFFF, "Garajul are deja un propietar");
  245.                     break;
  246.                 }
  247.             }
  248.         }
  249.     }
  250.     else
  251.     {
  252.         SendClientMessage(playerid, 0xFFFFFFFF, "Ai atins limita de garaje");
  253.     }
  254.     return 1;
  255. }
  256.  
  257. CMD:vindegaraj(playerid, params[])
  258. {
  259.     new propietar[MAX_PLAYER_NAME], string2[256];
  260.     format(propietar, sizeof(propietar), "N/a");
  261.     new nume[MAX_PLAYER_NAME];
  262.     GetPlayerName(playerid, nume, sizeof(nume));
  263.     for(new i= 1; i<=maxgaraje; i++)
  264.     {
  265.         if(IsPlayerInRangeOfPoint(playerid, 1.5, GarajInfo[i][Intrarex], GarajInfo[i][Intrarey], GarajInfo[i][Intrarez]))
  266.         {
  267.             if(GarajInfo[i][GarajPropietar] == nume[playerid])
  268.             {
  269.                 GivePlayerMoney(playerid, GarajInfo[i][GarajPret]/2); GarajInfo[i][GarajStatus] = 0;
  270.                 strmid(GarajInfo[i][GarajPropietar], "N/a", 0, strlen("N/a"), 255);
  271.                 SaveThisGaraj(i); PlayerInfo[playerid][pGaraje] -= 1; GarajInfo[i][GarajCumparat] = 0;
  272.                 SendClientMessage(playerid, 0xFFFFFFFF, "Ti-ai vandut garajul");
  273.                 DestroyPickup(gpickup[i]);
  274.                 gpickup[i] = CreatePickup(19471, 1, GarajInfo[i][Intrarex], GarajInfo[i][Intrarey], GarajInfo[i][Intrarez], -1);
  275.                 format(string2, sizeof(string2), " Propietar: %s\nValoare: %d\n Virtual: %d ",GarajInfo[i][GarajPropietar], GarajInfo[i][GarajPret],GarajInfo[i][GarajVirtual]);
  276.                 Update3DTextLabelText(gtextlabel[i], 0xFF4500FF, string2);
  277.                 break;
  278.             }
  279.             else
  280.             {
  281.                 SendClientMessage(playerid, 0xFFFFFFFF, "Nu este garajul tau");
  282.                 break;
  283.             }
  284.         }
  285.         else
  286.         {
  287.             SendClientMessage(playerid, 0xFFFFFFFF, "Trebuie sa fii in fata unui garaj");
  288.             break;
  289.         }
  290.     }
  291.     return 1;
  292. }
  293.  
  294. CMD:intrag(playerid, params[])
  295. {
  296.     new vehicleid = GetPlayerVehicleID(playerid);
  297.     new nume[MAX_PLAYER_NAME];
  298.     GetPlayerName(playerid, nume, sizeof(nume));
  299.     for(new i= 1; i<=maxgaraje; i++)
  300.     {
  301.         if(IsPlayerInRangeOfPoint(playerid, 1.5, GarajInfo[i][Intrarex], GarajInfo[i][Intrarey], GarajInfo[i][Intrarez]))
  302.         {
  303.             if(GarajInfo[i][GarajPropietar] == nume[playerid])
  304.             {
  305.                 if(IsPlayerInAnyVehicle(playerid))
  306.                 {
  307.                     curentg[playerid] = GarajInfo[i][GarajVirtual];
  308.                     SetVehiclePos(vehicleid, GarajInfo[i][Iesirex], GarajInfo[i][Iesirey], GarajInfo[i][Iesirez]);
  309.                     SetVehicleVirtualWorld(vehicleid, GarajInfo[i][GarajVirtual]); SetPlayerVirtualWorld(playerid, GarajInfo[i][GarajVirtual]);break;
  310.                 }
  311.                 else
  312.                 {
  313.                     curentg[playerid] = GarajInfo[i][GarajVirtual];
  314.                     SetPlayerPos(playerid, GarajInfo[i][Iesirex], GarajInfo[i][Iesirey], GarajInfo[i][Iesirez]);
  315.                     SetPlayerVirtualWorld(playerid, GarajInfo[i][GarajVirtual]);break;
  316.                 }
  317.             }
  318.             else
  319.             {
  320.                 if(GarajInfo[i][GarajStatus] == 0)
  321.                 {
  322.                     if(IsPlayerInAnyVehicle(playerid))
  323.                     {
  324.                         curentg[playerid] = GarajInfo[i][GarajVirtual];
  325.                         SetVehiclePos(vehicleid, GarajInfo[i][Iesirex], GarajInfo[i][Iesirey], GarajInfo[i][Iesirez]);
  326.                         SetVehicleVirtualWorld(vehicleid, GarajInfo[i][GarajVirtual]); SetPlayerVirtualWorld(playerid, GarajInfo[i][GarajVirtual]);
  327.                         break;
  328.                     }
  329.                     else
  330.                     {
  331.                         curentg[playerid] = GarajInfo[i][GarajVirtual];
  332.                         SetPlayerPos(playerid, GarajInfo[i][Iesirex], GarajInfo[i][Iesirey], GarajInfo[i][Iesirez]);
  333.                         SetPlayerVirtualWorld(playerid, GarajInfo[i][GarajVirtual]);
  334.                         break;
  335.                     }
  336.                 }
  337.             }
  338.         }
  339.     }
  340.     return 1;
  341. }
  342.  
  343. CMD:iesig(playerid, params[])
  344. {
  345.     new vehicleid = GetPlayerVehicleID(playerid);
  346.     new nume[MAX_PLAYER_NAME];
  347.     GetPlayerName(playerid, nume, sizeof(nume));
  348.     new i = curentg[playerid];
  349.     if(IsPlayerInRangeOfPoint(playerid, 1.5, GarajInfo[i][Iesirex], GarajInfo[i][Iesirey], GarajInfo[i][Iesirez]))
  350.     {
  351.         if(IsPlayerInAnyVehicle(playerid))
  352.         {
  353.             curentg[playerid] = 0; SetVehicleVirtualWorld(vehicleid, 0);
  354.             SetVehiclePos(vehicleid, GarajInfo[i][Intrarex], GarajInfo[i][Intrarey], GarajInfo[i][Intrarez]); SetPlayerVirtualWorld(playerid, 0);
  355.         }
  356.         else
  357.         {
  358.             SetPlayerPos(playerid, GarajInfo[i][Intrarex], GarajInfo[i][Intrarey], GarajInfo[i][Intrarez]);
  359.             SetPlayerVirtualWorld(playerid, 0); curentg[playerid] = 0;
  360.         }
  361.     }
  362.     else
  363.     {
  364.         SendClientMessage(playerid, 0xFFFFFFFF, "Trebuie sa fii in fata iesirii unui garaj");
  365.     }
  366.     return 1;
  367. }
  368.  
  369. CMD:creategaraj(playerid, params[])
  370. {
  371.     new file[256],tip,pret,string2[256],string[256];
  372.     new Float:x, Float:y,Float:z;
  373.     GetPlayerPos(playerid, x,y,z);
  374.     new nume[MAX_PLAYER_NAME];
  375.     GetPlayerName(playerid, nume, sizeof(nume));
  376.     if(unformat(params, "ii", tip,pret))
  377.     {
  378.         SendClientMessage(playerid, 0xFF0000AA, "Foloseste: /creategaraj <modelid> <pret>");
  379.         return 1;
  380.     }
  381.     if(!(tip == 1 || tip == 2))
  382.     {
  383.         SendClientMessage(playerid, 0xFF0000AA, "Model-ul pot fi de la 1 la 2");
  384.         return 1;
  385.     }
  386.     if(IsPlayerAdmin(playerid))
  387.     {
  388.         for(new i=1; i<sizeof(GarajInfo); i++)
  389.         {
  390.             format(file, sizeof(file), "Garaje/%d.ini",i);
  391.             if(!dini_Exists(file))
  392.             {
  393.                 if(tip == 1)
  394.                 {
  395.                     strmid(GarajInfo[i][GarajPropietar], "N/a", 0, strlen("N/a"), 255);
  396.                     GarajInfo[i][Intrarex] = x; GarajInfo[i][Intrarey] = y; GarajInfo[i][Intrarez] = z; GarajInfo[i][GarajStatus] = 0;
  397.                     GarajInfo[i][GarajPret] = pret; GarajInfo[i][GarajVirtual] = i;
  398.                     GarajInfo[i][Iesirex] = 594.2872; GarajInfo[i][Iesirey] = 1674.7228; GarajInfo[i][Iesirez] = 6.6259; GarajInfo[i][GarajCumparat] = 0;
  399.                     gpickup[i] = CreatePickup(19471, 1, GarajInfo[i][Intrarex], GarajInfo[i][Intrarey], GarajInfo[i][Intrarez], -1);
  400.                     format(string2, sizeof(string2), " Propietar: %s\nValoare: %d\n Virtual: %d ",GarajInfo[i][GarajPropietar], GarajInfo[i][GarajPret],i);
  401.                     gtextlabel[i] = Create3DTextLabel(string2, 0xFF4500FF, GarajInfo[i][Intrarex], GarajInfo[i][Intrarey], GarajInfo[i][Intrarez], 20.0, 0, 0);
  402.                     format(string, sizeof(string), " %s a creat garajul %d",nume,i);
  403.                     SendAdminMesaj(0xFFFFFFFF,string);
  404.                     SaveThisGaraj(i);break;
  405.                 }
  406.                 else if(tip == 2)// mare
  407.                 {
  408.                     GarajInfo[i][Intrarex] = x; GarajInfo[i][Intrarey] = y; GarajInfo[i][Intrarez] = z; GarajInfo[i][GarajStatus] = 0;
  409.                     GarajInfo[i][GarajPret] = pret; GarajInfo[i][GarajVirtual] = i;
  410.                     GarajInfo[i][Iesirex] = 582.9892; GarajInfo[i][Iesirey] = 1675.9623; GarajInfo[i][Iesirez] = 6.6259; GarajInfo[i][GarajCumparat] = 0;
  411.                     strmid(GarajInfo[i][GarajPropietar], "N/a", 0, strlen("N/a"), 255);
  412.                     gpickup[i] = CreatePickup(19471, 1, GarajInfo[i][Intrarex], GarajInfo[i][Intrarey], GarajInfo[i][Intrarez], -1);
  413.                     format(string2, sizeof(string2), " Propietar: %s\nValoare: %d\n Virtual: %d ",GarajInfo[i][GarajPropietar], GarajInfo[i][GarajPret],i);
  414.                     gtextlabel[i] = Create3DTextLabel(string2, 0xFF4500FF, GarajInfo[i][Intrarex], GarajInfo[i][Intrarey], GarajInfo[i][Intrarez], 20.0, 0, 0);
  415.                     format(string, sizeof(string), " %s a creat garajul %d",nume,i);
  416.                     SendAdminMesaj(0xFFFFFFFF,string);
  417.                     SaveThisGaraj(i);break;
  418.                 }
  419.             }
  420.         }
  421.     }
  422.     return 1;
  423. }
  424.  
  425. CMD:gajutor(playerid, params[])
  426. {
  427.     new string[1000];
  428.     strcat( string, "\t{FF9094}Garaj CMDS\n\n");
  429.     strcat( string, "{7CFC00}/cumparagaraj - {FFFAF0}cumperi garajul\n");
  430.     strcat( string, "{7CFC00}/vindegaraj - {FFFAF0}vinzi garajul\n");
  431.     strcat( string, "{7CFC00}/statgaraj - {FFFAF0}inchizi/deschizi garajul\n");
  432.     strcat( string, "{7CFC00}/intrag - {FFFAF0}intrii in garaj\n");
  433.     strcat( string, "{7CFC00}/iesig - {FFFAF0}iesi din garaj\n");
  434.     strcat( string, "{7CFC00}/creategaraj - {FFFAF0}creezi garajul(RCON ADMIN)\n\n\n");
  435.     strcat( string, "{FFFFFF}Garaj System creeat de {FFFAF0}Gireada");
  436.     ShowPlayerDialog(playerid, 8888, DIALOG_STYLE_MSGBOX,"Comenzi",string,"De Acord","");
  437.     return 1;
  438. }
  439.  
  440. public LoadGaraje()
  441. {
  442.     new file[512], string2[256];
  443.     for(new idx=1;idx<sizeof(GarajInfo);idx++)
  444.     {
  445.         format(file, sizeof(file),"Garaje/%d.ini", idx);
  446.         if(dini_Exists(file))
  447.         {
  448.             GarajInfo[idx][Intrarex] = dini_Float(file,"Intrarex");
  449.             GarajInfo[idx][Intrarey] = dini_Float(file,"Intrarey");
  450.             GarajInfo[idx][Intrarez] = dini_Float(file,"Intrarez");
  451.             GarajInfo[idx][Iesirex] = dini_Float(file,"Iesirex");
  452.             GarajInfo[idx][Iesirey] = dini_Float(file,"Iesirey");
  453.             GarajInfo[idx][Iesirez] = dini_Float(file,"Iesirez");
  454.             GarajInfo[idx][GarajCumparat] = dini_Int(file,"Cumparata");
  455.             strmid(GarajInfo[idx][GarajPropietar], dini_Get(file,"Propietar"), 0, strlen(dini_Get(file,"Propietar")), 255);
  456.             GarajInfo[idx][GarajPret] = dini_Int(file,"Pret");
  457.             GarajInfo[idx][GarajVirtual] = dini_Int(file,"Virtual");
  458.             GarajInfo[idx][GarajStatus] = dini_Int(file,"Status");
  459.             if(GarajInfo[idx][GarajCumparat] == 1)
  460.             {
  461.                 gpickup[idx] = CreatePickup(1318, 1, GarajInfo[idx][Intrarex], GarajInfo[idx][Intrarey], GarajInfo[idx][Intrarez], -1);
  462.                 format(string2, sizeof(string2), " Propietar: %s \n Valoare: %d \n Virtual: %d ",GarajInfo[idx][GarajPropietar], GarajInfo[idx][GarajPret],GarajInfo[idx][GarajVirtual]);
  463.                 gtextlabel[idx] = Create3DTextLabel(string2, 0x7FFF00FF, GarajInfo[idx][Intrarex], GarajInfo[idx][Intrarey], GarajInfo[idx][Intrarez], 20.0, 0, 0);
  464.             }
  465.             else if(GarajInfo[idx][GarajCumparat] == 0)
  466.             {
  467.                 gpickup[idx] = CreatePickup(19471, 1, GarajInfo[idx][Intrarex], GarajInfo[idx][Intrarey], GarajInfo[idx][Intrarez], -1);
  468.                 format(string2, sizeof(string2), " Propietar: %s\nValoare: %d\n Virtual: %d ",GarajInfo[idx][GarajPropietar], GarajInfo[idx][GarajPret],GarajInfo[idx][GarajVirtual]);
  469.                 gtextlabel[idx] = Create3DTextLabel(string2, 0xFF4500FF, GarajInfo[idx][Intrarex], GarajInfo[idx][Intrarey], GarajInfo[idx][Intrarez], 20.0, 0, 0);
  470.             }
  471.         }
  472.     }
  473.     return 1;
  474. }
  475.  
  476. public SaveThisGaraj(garajid)
  477. {
  478.     new file2[512];
  479.     format(file2, sizeof(file2),"Garaje/%d.ini", garajid);
  480.     if(dini_Exists(file2))
  481.     {
  482.         dini_FloatSet(file2,"Intrarex",GarajInfo[garajid][Intrarex]);
  483.         dini_FloatSet(file2,"Intrarey",GarajInfo[garajid][Intrarey]);
  484.         dini_FloatSet(file2,"Intrarez",GarajInfo[garajid][Intrarez]);
  485.         dini_FloatSet(file2,"Iesirex",GarajInfo[garajid][Iesirex]);
  486.         dini_FloatSet(file2,"Iesirey",GarajInfo[garajid][Iesirey]);
  487.         dini_FloatSet(file2,"Iesirez",GarajInfo[garajid][Iesirez]);
  488.         dini_IntSet(file2,"Cumparat",GarajInfo[garajid][GarajCumparat]);
  489.         dini_Set(file2,"Propietar",GarajInfo[garajid][GarajPropietar]);
  490.         dini_IntSet(file2,"Pret",GarajInfo[garajid][GarajPret]);
  491.         dini_IntSet(file2,"Virtual",GarajInfo[garajid][GarajVirtual]);
  492.         dini_IntSet(file2,"Status",GarajInfo[garajid][GarajStatus]);
  493.         return 1;
  494.     }
  495.     else if(!dini_Exists(file2))
  496.     {
  497.         dini_Create(file2);
  498.         dini_FloatSet(file2,"Intrarex",GarajInfo[garajid][Intrarex]);
  499.         dini_FloatSet(file2,"Intrarey",GarajInfo[garajid][Intrarey]);
  500.         dini_FloatSet(file2,"Intrarez",GarajInfo[garajid][Intrarez]);
  501.         dini_FloatSet(file2,"Iesirex",GarajInfo[garajid][Iesirex]);
  502.         dini_FloatSet(file2,"Iesirey",GarajInfo[garajid][Iesirey]);
  503.         dini_FloatSet(file2,"Iesirez",GarajInfo[garajid][Iesirez]);
  504.         dini_IntSet(file2,"Cumparat",GarajInfo[garajid][GarajCumparat]);
  505.         dini_Set(file2,"Propietar",GarajInfo[garajid][GarajPropietar]);
  506.         dini_IntSet(file2,"Pret",GarajInfo[garajid][GarajPret]);
  507.         dini_IntSet(file2,"Virtual",GarajInfo[garajid][GarajVirtual]);
  508.         dini_IntSet(file2,"Status",GarajInfo[garajid][GarajStatus]);
  509.         return 1;
  510.     }
  511.     return 1;
  512. }
  513.  
  514. public SendAdminMesaj(color,const string[])
  515. {
  516.     for(new i = 0; i < MAX_PLAYERS; i++)
  517.     {
  518.         if(IsPlayerConnected(i))
  519.         {
  520.             if(IsPlayerAdmin(i))
  521.             {
  522.                 SendClientMessage(i, color, string);
  523.                 printf("%s", string);
  524.             }
  525.         }
  526.     }
  527.     return 1;
  528. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement