Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // server.cpp : "case SV_POSC" : add "if( ((cl->f >> 7)&1) == 1 && ((f>>7)&1) != 1) check_teabag(cl);"
- // serverchecks.h :
- bool check_teabag(client *c)
- {
- if(gamemillis - c->state.lastteabagmillis < 800) return false; // teabag occured too recently
- loopv(clients) if(clients[i] && clients[i] != c && clients[i]->type == ST_TCPIP && clients[i]->isauthed // target logged
- && clients[i]->state.state == CS_DEAD && (gamemillis - clients[i]->state.lastdeath) < 6000 // target was killed recently enough
- && (gamemillis - c->state.lastteabagmillis > 5000 || c->state.lastteabagcn != clients[i]->clientnum) // target was not teabagged recently
- && clients[i]->state.o.dist(c->state.o) < 6.5f) // target is close enough
- {
- if(gamemillis - c->state.lastteabagmillis < 5500 && c->state.lastteabagcn == clients[i]->clientnum) continue;
- loopj(4) c->state.crouches[4-j] = c->state.crouches[3-j];
- c->state.crouches[0] = gamemillis;
- bool fastenough = (gamemillis - c->state.crouches[2] < 5000) || (gamemillis - c->state.crouches[1] < 1000); // 3 crouches within 5 seconds or 2 within a second
- if(fastenough)
- {
- ++c->state.teabags_done;
- ++clients[i]->state.teabags_received;
- ++c->lscore.teabagsdone;
- ++clients[i]->lscore.teabagsreceived;
- c->state.lastteabagcn = clients[i]->clientnum;
- c->state.lastteabagmillis = gamemillis;
- defformatstring(msg_actor)("\f9you teabagged %s", clients[i]->name);
- defformatstring(msg_target)("\f9you were teabagged by %s", c->name);
- sendservmsg(msg_actor, c->clientnum);
- sendservmsg(msg_target, clients[i]->clientnum);
- logline(ACLOG_INFO, "[%s] %s teabagged %s", c->hostname, c->name, clients[i]->name);
- loopj(5) c->state.crouches[j] = 0;
- return true;
- }
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement