badjhbzi

Nade Parkouring Level Creator

Jul 15th, 2013
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.99 KB | None | 0 0
  1. /*
  2. 888888888888888888888888888888888888888888
  3. 88    NADE-PARKOURING LEVEL CREATOR     88
  4. 888888888888888888888888888888888888888888
  5. 88 - AUTHOR: Badjouras                  88
  6. 88         (aka hbzi @ forum.sa-mp.com) 88
  7. 88 - VERSION: 1.0                       88
  8. 88 - LAST UPDATE: 15/07                 88
  9. 888888888888888888888888888888888888888888
  10. 88 - CHANGELOG:                         88
  11. 88                                      88
  12. 888888888888888888888888888888888888888888
  13. */
  14.  
  15. // * INCLUDES * //
  16. #include <a_samp>
  17. #include <Dini>
  18. #include <zcmd>
  19.  
  20. // * DEFINES FUNCS * //
  21. #define Msg SendClientMessage
  22. #define MsgAll SendClientMessageToAll
  23.  
  24. // * CONSTANTES * //
  25. #define DIALOG_START 1221
  26. #define DIALOG_END 1222
  27. #define MAX_FILES 100
  28.  
  29. // * VARS * //
  30. new str[128];
  31. new fileInUse[128];
  32. new bool:startP = false;
  33.  
  34. // * STOCKS * //
  35. stock LastFile()
  36. {
  37.     new file[128];
  38.     new i;
  39.     for (i=1; i<MAX_FILES; i++)
  40.     {
  41.         format(file, sizeof(file), "parkour/%d.txt", i);
  42.         if(!dini_Exists(file)) return i;
  43.     }
  44.     return 1;
  45. }
  46.  
  47. // * FUNCS * //
  48. public OnFilterScriptInit()
  49. {
  50.     print("\n--------------------------------------");
  51.     print(" Nade Parkour Level Editor by Badjouras");
  52.     print("--------------------------------------\n");
  53.     return 1;
  54. }
  55.  
  56. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  57. {
  58.     switch(dialogid)
  59.     {
  60.         case DIALOG_START:
  61.         {
  62.             if(response)
  63.             {
  64.                 format(str, sizeof(str), "parkour/%d.txt", LastFile());
  65.                 format(fileInUse, sizeof(fileInUse), "%s", str);
  66.                 dini_Create(fileInUse);
  67.                 new Float:pos[4];
  68.                 GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
  69.                 GetPlayerFacingAngle(playerid, pos[3]);
  70.                 dini_FloatSet(fileInUse, "posIX", pos[0]);
  71.                 dini_FloatSet(fileInUse, "posIY", pos[1]);
  72.                 dini_FloatSet(fileInUse, "posIZ", pos[2]);
  73.                 dini_FloatSet(fileInUse, "angI", pos[3]);
  74.                 startP = true;
  75.             }
  76.         }
  77.         case DIALOG_END:
  78.         {
  79.             if(response)
  80.             {
  81.                 new Float:pos[3];
  82.                 GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
  83.                 dini_FloatSet(fileInUse, "posFX", pos[0]);
  84.                 dini_FloatSet(fileInUse, "posFY", pos[1]);
  85.                 dini_FloatSet(fileInUse, "posFZ", pos[2]);
  86.                 startP = false;
  87.                 format(str, sizeof(str), "Level %d saved as %s", LastFile()-1, fileInUse);
  88.                 Msg(playerid, -1, str);
  89.             }
  90.         }
  91.     }
  92. }
  93.  
  94. // * COMANDOS * //
  95. CMD:pos(playerid, params[])
  96. {
  97.     new Float:pos[4];
  98.     GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
  99.     GetPlayerFacingAngle(playerid, pos[3]);
  100.     format(str, sizeof(str), "{FF0000}X: {FFFFFF}%f\n{FF0000}Y: {FFFFFF}%f\n{FF0000}Z: {FFFFFF}%f\n{FF0000}Rotation: {FFFFFF}%f", pos[0], pos[1], pos[2], pos[3]);
  101.     if(startP == false)     ShowPlayerDialog(playerid, DIALOG_START, 0, "Actual Position", str, "Save Start", "Cancel");
  102.     else ShowPlayerDialog(playerid, DIALOG_END, 0, "Actual Position", str, "Save End", "Cancel");
  103.     return 1;
  104. }
  105.  
  106. CMD:nades(playerid, params[])
  107. {
  108.     ResetPlayerWeapons(playerid);
  109.     GivePlayerWeapon(playerid, 16, 9999);
  110.     SetPlayerHealth(playerid, 9999999);
  111.     return 1;
  112. }
Advertisement
Add Comment
Please, Sign In to add comment