the Rainbow Networks
+++eXy FFA
Map: q3dm3
Players: 2 / 18
The golden pot › RAINBOW NETWORKS › Tech & Support › autotap
autotap
Something wrong with our servers or your system?
Post new topic   Reply to topic   Printer Friendly Page     Forum IndexTech & Support
View previous topic :: View next topic  
Author Message
jackthompson
Admin
Admin


Joined: Aug 15, 2007
Posts: 1302
Location: Here

PostPosted: Fri Jul 10, 2015 2:12 pm    Post subject: autotap Reply with quote

Small C program that simulates three lmb presses on one rmb press.

For weapons that lack burst.

You might want to tinker with
Code::
usleep (((rand () % 50) + 50) * 1000);
...and what buttons are used/simulated.

Code::
// gcc autotap.c -o autotap -std=gnu99
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <linux/input.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>


#define DEVICE "/dev/input/event6"


int
read_rmb (int fd)
{
  struct input_event press;
//  memset(&press, 0, sizeof (struct input_event));
  read(fd, &press, sizeof (struct input_event));
  if (press.type == EV_KEY && press.code == BTN_RIGHT)
    return 1;
  return 0;
}


int
write_lmb (int fd)
{
  struct input_event press, release;

  memset (&press, 0, sizeof (struct input_event));
  memset (&release, 0, sizeof (struct input_event));

  gettimeofday (&press.time, NULL);
  press.type = EV_KEY;
  press.code = BTN_MOUSE;
  press.value = 1;
  gettimeofday (&release.time, NULL);
  release.type = EV_KEY;
  release.code = BTN_MOUSE;
  release.value = 0;
  for (int i = 0; i < 3; i++)
    {
      write (fd, &press, sizeof (struct input_event));
      write (fd, &release, sizeof (struct input_event));
      usleep (((rand () % 50) + 50) * 1000);
    }
  return 0;
}


int
main (int argc, char **argv)
{
  int fd = open (DEVICE, O_RDWR);
  if (fd < 0)
    {
      printf("ERROR: open():%s\n", strerror(errno));
      return -1;
    }
  while (1)
    if (read_rmb (fd) == 1)
      write_lmb (fd);
  close (fd);
  return 0;
}
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic   Printer Friendly Page     Forum Index -> Tech & Support All times are GMT + 1 Hour
Page 1 of 1


Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Welcome Anonymous


Membership:
Latest: kontol
New Today: 0
New Yesterday: 0
Overall: 355

People Online:
Members: 0
Visitors: 32
Total: 32
Who Is Where:
 Visitors:
01: The golden pot
02: The golden pot
03: The golden pot
04: The golden pot
05: The golden pot
06: The golden pot
07: The golden pot
08: My Account
09: The golden pot
10: The golden pot
11: The golden pot
12: The golden pot
13: The golden pot
14: The golden pot
15: My Account
16: The golden pot
17: The golden pot
18: The golden pot
19: My Account
20: The golden pot
21: The golden pot
22: The golden pot
23: The golden pot
24: The golden pot
25: Home
26: My Account
27: Rainbow Media
28: Home
29: The golden pot
30: The golden pot
31: The golden pot
32: The golden pot

Staff Online:

No staff members are online!

The Rainbow Networks website is hosted by JockeTF and Soder on furver.se.

The Rainbow Networks
Interactive software released under GNU GPL, Code Credits, Privacy Policy
Azul theme and related images designed by Jamin