Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void ccb_roll( SOCKET sock, std::string msga, IRC::user sender, IRC::destination sendTo, void* data ){
- char* msg = (char*) msga.c_str();
- while( *msg != ' ' && *msg != 0 ) msg++; if( *msg == 0 ) return;
- if( *(msg+1) == 0 ) return; ++msg;
- int num, siz, plus;
- plus = 0;
- if(sscanf( msg, "%id%i", &num, &siz ) != 2 ) return;
- printf("\n\n%i\n\n", siz );
- if( num > 10 ) num = 10;
- while( *msg != '+' && *msg != 0 ) msg++;
- if( *msg != 0 ){
- sscanf( msg, "+%i", &plus );
- }
- int total = 0;
- ((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);
- for( int i = 0; i < num; ++i ){
- int tmp = siz * lrand48() / 2147483648 + 1;
- ((IRC*)data)->sendMsg( true, "%i ", tmp );
- total += tmp;
- }
- ((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 );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement