Advertisement
Ygzeb

Guardar

Nov 2nd, 2014
655
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 5.63 KB | None | 0 0
  1. /*
  2.                                      Copyright © Guardar
  3.  ______________________________________________________________________________________________
  4. |                                                                                              |                                                                          
  5. |    * Sistema creado por Ygzeb para guardar datos de forma sencilla en SA-MP.                 |
  6. |______________________________________________________________________________________________|
  7.  
  8.                                   FilterScript - [FS]Guardar
  9.                                  ----------------------------
  10. */
  11.  
  12. //==============================================================================
  13. // Include.
  14. //==============================================================================
  15. #include <a_samp>
  16. //==============================================================================
  17. // Anti-Amx.
  18. //==============================================================================
  19. AntiAmx()
  20. {
  21. new a[][] =
  22. {
  23. "Unarmed (Fist)",
  24. "Brass K"
  25. };
  26. #pragma unused a
  27. }
  28. //==============================================================================
  29. // Define colors.
  30. //==============================================================================
  31. #define Basic 0xFE9D01AA
  32. #define Complex 0x1AFF00AA
  33. #define Blank 0xFFFFFFAA
  34. //==============================================================================
  35. //------------------------------------------------------------------------------
  36. //                          Publics.
  37. //------------------------------------------------------------------------------
  38. //==============================================================================
  39. //==============================================================================
  40. // Public - OnFilterScriptInit.
  41. //==============================================================================
  42. public OnFilterScriptInit()
  43. {
  44. AntiAmx();
  45. return 1;
  46. }
  47. //==============================================================================
  48. // Public - OnFilterScriptExit.
  49. //==============================================================================
  50. public OnFilterScriptExit()
  51. {
  52. AntiAmx();
  53. return 1;
  54. }
  55. //==============================================================================
  56. // Public - OnPlayerCommandText.
  57. //==============================================================================
  58. //==============================================================================
  59. // Command.
  60. //==============================================================================
  61. public OnPlayerCommandText(playerid, cmdtext[])
  62. {
  63. if(!strcmp(cmdtext, "/Pos", true))
  64. {
  65. new Text[100], Float: X, Float: Y, Float: Z, Float: Angle, Name[MAX_PLAYER_NAME], Year, Month, Day, Hour, Minute, Second;
  66. GetPlayerPos(playerid, X, Y, Z);
  67. GetPlayerFacingAngle(playerid, Angle);
  68. gettime(Second, Minute, Hour);
  69. getdate(Day, Month, Year);
  70. GetPlayerName(playerid, Name, sizeof(Name));
  71. format(Text, sizeof(Text), "| Fecha de guardado: %02d/%02d/%04d | Hora de guardado: %02d:%02d:%02d |", Day, Month, Year, Hour, Minute, Second);
  72. Saved(Text);
  73. SendClientMessage(playerid, Basic, Text);
  74. format(Text, sizeof(Text), "[<!>] Posición: %0.2f, %0.2f, %0.2f | Ángulo: %0.2f | Nombre: %s", X, Y, Z, Angle, Name);
  75. Saved(Text);
  76. SendClientMessage(playerid, Blank, Text);
  77. format(Text, sizeof(Text), "[<!>] Mundo virtual: %d | Interior: %d ", GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid));
  78. Saved(Text);
  79. SendClientMessage(playerid, Blank, Text);
  80. return 1;
  81. }
  82. if(!strcmp(cmdtext, "/Script", true))
  83. {
  84. new Text[100], Float: X, Float: Y, Float: Z, Float: Angle, Year, Month, Day, Hour, Minute, Second;
  85. GetPlayerPos(playerid, X, Y, Z);
  86. GetPlayerFacingAngle(playerid, Angle);
  87. gettime(Hour, Minute, Second);
  88. getdate(Year, Month, Day);
  89. format(Text, sizeof(Text), "| Fecha de script: %02d/%02d/%04d | Hora de script: %02d:%02d:%02d |", Day, Month, Year, Hour, Minute, Second);
  90. Script(Text);
  91. SendClientMessage(playerid, Complex, Text);
  92. format(Text, sizeof(Text), "SetPlayerPos(playerid, %0.2f, %0.2f, %0.2f);", X, Y, Z);
  93. Script(Text);
  94. SendClientMessage(playerid, Blank, Text);
  95. format(Text, sizeof(Text), "SetPlayerFacingAngle(playerid, %0.2f);", Angle);
  96. Script(Text);
  97. SendClientMessage(playerid, Blank, Text);
  98. format(Text, sizeof(Text), "SetPlayerVirtualWorld(playerid, %d);", GetPlayerVirtualWorld(playerid));
  99. Script(Text);
  100. SendClientMessage(playerid, Blank, Text);
  101. format(Text, sizeof(Text), "SetPlayerInterior(playerid, %d);", GetPlayerInterior(playerid));
  102. Script(Text);
  103. SendClientMessage(playerid, Blank, Text);
  104. format(Text, sizeof(Text), "SetCameraBehindPlayer(playerid);");
  105. Script(Text);
  106. SendClientMessage(playerid, Blank, Text);
  107. return 1;
  108. }
  109. if(!strcmp(cmdtext, "/Guardar", true))
  110. {
  111. SendClientMessage(playerid, Basic, "{FFFFFF}Sistema de {FFA600}guardado {FFFFFF}creado por {00FF15}Ygzeb {FFFFFF}de {FFA600}Flare Entertainment.");
  112. return 1;
  113. }
  114. return 0;
  115. }
  116. //==============================================================================
  117. // Stock - Save.
  118. //==============================================================================
  119. stock Saved(str[])
  120. {
  121. new File:log = fopen("Guardado.txt", io_append);
  122. format(str, 256, "%s\r\n", str);
  123. fwrite(log, str);
  124. fclose(log);
  125. return 1;
  126. }
  127. //==============================================================================
  128. // Stock - Script.
  129. //==============================================================================
  130. stock Script(str[])
  131. {
  132. new File:log = fopen("Script.txt", io_append);
  133. format(str, 256, "%s\r\n", str);
  134. fwrite(log, str);
  135. fclose(log);
  136. return 1;
  137. }
  138.  
  139. // © Flare Entertainment - Todos los derechos reservados.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement