Advertisement
Guest User

[DayZ] Logitech G510 auto run / auto sprint

a guest
Jul 13th, 2012
4,960
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.25 KB | None | 0 0
  1. --[[
  2.         DayZ auto run and auto sprint script for Logitech G510 keyboard.
  3.        
  4.         Version: 1.0
  5.        
  6.         Created by Durux, admin on EU13 Spongebob Squarepants server.
  7.        
  8.         Info:
  9.         The script uses M1-G8 for auto run and M1-G7 for auto sprint.
  10.        
  11.         If needed to change the key setup, change the 8 or 7 in:
  12.        
  13.             if (event == "G_PRESSED" and arg == 8) then
  14.             or
  15.             if (event == "G_PRESSED" and arg == 7) then
  16.        
  17.         If you want to change the time the information is diplayed on the LCD, change:
  18.             iLCDTimer = 5000;
  19.             The time is in Miliseconds, so 5000 is 5 seconds.
  20. ]]
  21.  
  22. bAutoRun = false;
  23. bAutoSprint = false;
  24. sAutoRun = "OFF";
  25. sAutoSprint = "OFF";
  26. iLCDTimer = 5000;
  27.  
  28. function OnEvent(event, arg)
  29.  
  30.     current_mkey = GetMKeyState();
  31.  
  32.         if (current_mkey == 1) then
  33.  
  34.         if (event == "G_PRESSED" and arg == 8) then
  35.  
  36.             AutoRun();
  37.  
  38.         end
  39.        
  40.         if (event == "G_PRESSED" and arg == 7) then
  41.  
  42.             AutoSprint();
  43.  
  44.         end
  45.  
  46.     end
  47.  
  48. end
  49.  
  50. function AutoRun()
  51.  
  52.     local outputLCD;
  53.    
  54.     if (bAutoSprint == true) then
  55.    
  56.         ReleaseKey("w");
  57.         bAutoSprint = false;
  58.         sAutoSprint = "OFF";
  59.    
  60.     end
  61.  
  62.     if (bAutoRun == false) then
  63.    
  64.         sAutoRun = "ON";
  65.         bAutoRun = true;
  66.        
  67.         outputLCD = string.format("Auto run: %s\nAuto Sprint: %s", sAutoRun, sAutoSprint);
  68.        
  69.         ClearLCD();
  70.         OutputLCDMessage(outputLCD, iLCDTimer);
  71.         PressKey("w");
  72.    
  73.     else
  74.    
  75.         sAutoRun = "OFF";
  76.         bAutoRun = false;
  77.        
  78.         outputLCD = string.format("Auto run: %s\nAuto Sprint: %s", sAutoRun, sAutoSprint);
  79.        
  80.         ClearLCD();
  81.         OutputLCDMessage(outputLCD, iLCDTimer);
  82.         ReleaseKey("w");
  83.    
  84.     end
  85.    
  86. end
  87.  
  88. function AutoSprint()
  89.  
  90.     local outputLCD;
  91.    
  92.     if (bAutoRun == true) then
  93.    
  94.         ReleaseKey("w");
  95.         bAutoRun = false;
  96.         sAutoRun = "OFF";
  97.    
  98.     end
  99.    
  100.     if (bAutoSprint == false) then
  101.    
  102.         sAutoSprint = "ON";
  103.         bAutoSprint = true;
  104.        
  105.         outputLCD = string.format("Auto run: %s\nAuto Sprint: %s", sAutoRun, sAutoSprint);
  106.        
  107.         ClearLCD();
  108.         OutputLCDMessage(outputLCD, iLCDTimer);
  109.        
  110.         PressAndReleaseKey("w");
  111.         Sleep(50);
  112.         PressKey("w");
  113.    
  114.     else
  115.    
  116.         sAutoSprint = "OFF";
  117.         bAutoSprint = false;
  118.        
  119.         outputLCD = string.format("Auto run: %s\nAuto Sprint: %s", sAutoRun, sAutoSprint);
  120.        
  121.         ClearLCD();
  122.         OutputLCDMessage(outputLCD, iLCDTimer);
  123.        
  124.         ReleaseKey("w");
  125.    
  126.     end
  127.  
  128. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement