Advertisement
Aslai

Untitled

Dec 5th, 2012
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.90 KB | None | 0 0
  1. void ccb_roll( SOCKET sock, std::string msga, IRC::user sender, IRC::destination sendTo, void* data ){
  2.     char* msg = (char*) msga.c_str();
  3.     while( *msg != ' ' && *msg != 0 ) msg++; if( *msg == 0 ) return;
  4.     if( *(msg+1) == 0 ) return; ++msg;
  5.     int num, siz, plus;
  6.     plus = 0;
  7.     if(sscanf( msg, "%id%i", &num, &siz ) != 2 ) return;
  8.     printf("\n\n%i\n\n", siz );
  9.     if( num > 10 ) num = 10;
  10.     while( *msg != '+' && *msg != 0 ) msg++;
  11.     if( *msg != 0 ){
  12.         sscanf( msg, "+%i", &plus );
  13.     }
  14.     int total = 0;
  15.     ((IRC*)data)->sendMsg( true, "PRIVMSG %s :%c%c2%s%c3,%c4 your rolls are:%c3 ", sendTo.v.c_str(),15,3, sender.nick.c_str(),3,3,3);
  16.     for( int i = 0; i < num; ++i ){
  17.         int tmp = siz * lrand48() / 2147483648 + 1;
  18.         ((IRC*)data)->sendMsg( true, "%i ", tmp );
  19.         total += tmp;
  20.     }
  21.     ((IRC*)data)->sendMsg( false, "  %c2[ %c4Total:%c3 %i%c4 +%c3 %i %c4=%c%c6 %i%c %c2]", 3,3,3,total,3,3,plus,3,2,3,total+plus, 15,3 );
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement