#define NULL_CHAR '^0' new speaktimeleft_intervals = 60; new lastcallfortimeleft; new lastcallforspeak; /* returns 1 if two strings are EXACTLY the same in the first n (or less if one is smaller than n) digits, 0 otherwise */ streq(a[],b[],n) { new i; // be careful about how much we check if (n > strlen(a)) n=strlen(a); if (n > strlen(b)) n=strlen(b); for(i=0;i 0) { Base /= 10; str[i++] = '0' + (num - (num % Base)) / Base; num = num % Base; } str[i++] = NULL_CHAR; } } // From [WHO]Them // splits the digits of a number into individual arrays, for ease of use, it returns the array of // numbers in opposite order(last digit in retunr_array[0]... second to last in // return_array[1]..etc...) public number_array(num, return_array[]) { new counter = 0; new isnegative = 1; if(num < 0) isnegative = -1; num = num * isnegative; for(counter = 0; counter < 50; counter = counter + 1) return_array[counter] = '^0'; for(counter = 0; num != 0; counter=counter+1) { for(return_array[counter] = 0; num % 10 != 0; num = num -1) { return_array[counter] = return_array[counter] + 1; } num = num / 10; } if(isnegative == -1) return_array[counter] = -1; } public do_nothing() { return; } public execute_all(a[]) { new userid1 = 0; new wonid1 = 0; new username[200]; new i=0; new x = 0; x = maxplayercount(); for(i=1; i<=x; i=i+1) { username[0] = NULL_CHAR; playerinfo(i, username, 200, userid1, wonid1); if(check_user(username)==1) execclient(username, a); } } /* Put strEnd on the end of strBegin. Note that strBegin must be large enough to handle this; the size of strEnd doesn't matter. */ strcat(strBegin[],strEnd[]) { new i=0; new Length = strlen(strEnd); new j; while(strBegin[i]!=0) i++; for(j=0;j=0;i--) strEnd[i+BeginLength]=strEnd[i]; strEnd[BeginLength+EndLength] = NULL_CHAR; for (i=0;i strlen(strTwo)) Length=strlen(strTwo); for(i=0;i 0 || secondsleft[1] > 0) strncpy(words[12], "seconds ", strlen("seconds ")); if(secondsleft[1] == 1) { if(secondsleft[0] == 0) strncpy(words[10], "ten ", strlen("ten ")); if(secondsleft[0] == 1) strncpy(words[10], "eleven ", strlen("eleven ")); if(secondsleft[0] == 2) strncpy(words[10], "twelve ", strlen("twelve ")); if(secondsleft[0] == 3) strncpy(words[10], "thirteen ", strlen("thriteen ")); if(secondsleft[0] == 4) strncpy(words[10], "fourteen ", strlen("fourteen ")); if(secondsleft[0] == 5) strncpy(words[10], "fifteen ", strlen("fifteen ")); if(secondsleft[0] == 6) strncpy(words[10], "sixteen ", strlen("sixteen ")); if(secondsleft[0] == 7) strncpy(words[10], "seventeen ", strlen("seventeen ")); if(secondsleft[0] == 8) strncpy(words[10], "eightteen ", strlen("eightteen ")); if(secondsleft[0] == 9) strncpy(words[10], "nineteen ", strlen("nineteen ")); } else { if(secondsleft[1] == 2) strncpy(words[10], "twenty ", strlen("twenty ")); if(secondsleft[1] == 3) strncpy(words[10], "thirty ", strlen("thirty ")); if(secondsleft[1] == 4) strncpy(words[10], "fourty ", strlen("fourty ")); if(secondsleft[1] == 5) strncpy(words[10], "fifty ", strlen("fifty ")); if(secondsleft[0] == 1) strncpy(words[11], "one ", strlen("one ")); if(secondsleft[0] == 2) strncpy(words[11], "two ", strlen("two ")); if(secondsleft[0] == 3) strncpy(words[11], "three ", strlen("three ")); if(secondsleft[0] == 4) strncpy(words[11], "four ", strlen("four ")); if(secondsleft[0] == 5) strncpy(words[11], "five ", strlen("five ")); if(secondsleft[0] == 6) strncpy(words[11], "six ", strlen("six ")); if(secondsleft[0] == 7) strncpy(words[11], "seven ", strlen("seven ")); if(secondsleft[0] == 8) strncpy(words[11], "eight ", strlen("eight ")); if(secondsleft[0] == 9) strncpy(words[11], "nine ", strlen("nine ")); } if(minutesleft[0] > 0 || minutesleft[1] > 0) strncpy(words[9], "minutes ", strlen("minutes ")); if(minutesleft[1] == 1) { if(minutesleft[0] == 0) strncpy(words[7], "ten ", strlen("ten ")); if(minutesleft[0] == 1) strncpy(words[7], "eleven ", strlen("eleven ")); if(minutesleft[0] == 2) strncpy(words[7], "twelve ", strlen("twelve ")); if(minutesleft[0] == 3) strncpy(words[7], "thirteen ", strlen("thriteen ")); if(minutesleft[0] == 4) strncpy(words[7], "fourteen ", strlen("fourteen ")); if(minutesleft[0] == 5) strncpy(words[7], "fifteen ", strlen("fifteen ")); if(minutesleft[0] == 6) strncpy(words[7], "sixteen ", strlen("sixteen ")); if(minutesleft[0] == 7) strncpy(words[7], "seventeen ", strlen("seventeen ")); if(minutesleft[0] == 8) strncpy(words[7], "eightteen ", strlen("eightteen ")); if(minutesleft[0] == 9) strncpy(words[7], "nineteen ", strlen("nineteen ")); } else { if(minutesleft[1] == 2) strncpy(words[7], "twenty ", strlen("twenty ")); if(minutesleft[1] == 3) strncpy(words[7], "thirty ", strlen("thirty ")); if(minutesleft[1] == 4) strncpy(words[7], "fourty ", strlen("fourty ")); if(minutesleft[1] == 5) strncpy(words[7], "fifty ", strlen("fifty ")); if(minutesleft[1] == 6) strncpy(words[7], "sixty ", strlen("sixty ")); if(minutesleft[1] == 7) strncpy(words[7], "seventy ", strlen("seventy ")); if(minutesleft[1] == 8) strncpy(words[7], "eighty ", strlen("eighty ")); if(minutesleft[1] == 9) strncpy(words[7], "ninety ", strlen("ninety ")); if(minutesleft[0] == 1) strncpy(words[8], "one ", strlen("one ")); if(minutesleft[0] == 2) strncpy(words[8], "two ", strlen("two ")); if(minutesleft[0] == 3) strncpy(words[8], "three ", strlen("three ")); if(minutesleft[0] == 4) strncpy(words[8], "four ", strlen("four ")); if(minutesleft[0] == 5) strncpy(words[8], "five ", strlen("five ")); if(minutesleft[0] == 6) strncpy(words[8], "six ", strlen("six ")); if(minutesleft[0] == 7) strncpy(words[8], "seven ", strlen("seven ")); if(minutesleft[0] == 8) strncpy(words[8], "eight ", strlen("eight ")); if(minutesleft[0] == 9) strncpy(words[8], "nine ", strlen("nine ")); } strncpy(outputstring, "speak ^"fvox/", strlen("speak ^"fvox/")); strcat(outputstring, words[7]); strcat(outputstring, words[8]); strcat(outputstring, words[9]); strcat(outputstring, words[10]); strcat(outputstring, words[11]); strcat(outputstring, words[12]); strcat(outputstring, "remaining^""); execute_all(outputstring); } public usersearch(a[], returnstring[]) { new counter=0; new counter2=1; new counter3=0; new unused=0; new unused2 = 0; new highscore=0; new highscorewinner=0; new usernum=0; new check_namelength = 0; new data_namelength = strlen(a); //I like to store useful numbers in variables instead of calling them numerous time, saving a little cpu time new max_players = maxplayercount(); new scores[40]; usernum = strtonum(a); strncpy(returnstring, a, strlen(a)); if(usernum > 0 && usernum <= max_players) playerinfo(usernum, returnstring, 40, unused, unused2); if(check_user(returnstring)!=1) get_username(a, returnstring, 40); if(check_user(returnstring)!=1) { new usernames[34][40]; for(counter = 0; counter < max_players; counter = counter + 1) { scores[counter] = 0; usernames[counter][0] = '^0'; playerinfo(counter+1, usernames[counter], 200, unused, unused2); } for(counter = 0; counter < 34; counter = counter + 1) { if(usernames[counter][0] == NULL_CHAR) continue; check_namelength = strlen(usernames[counter]); if(check_namelength == data_namelength) scores[counter] = scores[counter] + 2; for(counter2 = 0; counter2 < data_namelength; counter2 = counter2 + 1) { if(usernames[counter][counter2] == a[counter2]) { //character found that was an exact match in the same spot if(counter2 > 0) if(usernames[counter][counter2-1] == a[counter2-1]+5555) scores[counter] = scores[counter] + 2; scores[counter] = scores[counter] + 3; usernames[counter][counter2] = usernames[counter][counter2] + 5555; continue; } if(toupper(usernames[counter][counter2]) == a[counter2] || tolower(usernames[counter][counter2]) == a[counter2]) { //character found, case mismatch in the same spot if(counter2 > 0) if(toupper(usernames[counter][counter2-1]) == a[counter2-1]+5555 || tolower(usernames[counter][counter2-1]) == a[counter2-1]+5555) scores[counter] = scores[counter] + 2; scores[counter] = scores[counter] + 2; usernames[counter][counter2] = usernames[counter][counter2] + 5555; continue; } for(counter3 = 0; counter3 < check_namelength; counter3 = counter3 + 1) { if(usernames[counter][counter3] == a[counter2]) { //character found that was an exact match in wrong spot if(counter2 > 0 && counter3 > 0) if(usernames[counter][counter3-1] == a[counter2-1]+5555) scores[counter] = scores[counter] + 2; scores[counter] = scores[counter] + 2; usernames[counter][counter2] = usernames[counter][counter2] + 5555; break; } if(toupper(usernames[counter][counter3]) == a[counter2] || tolower(usernames[counter][counter3]) == a[counter2]) { //character found, case mismatch in wrong spot if(counter2 > 0 && counter3 > 0) if(toupper(usernames[counter][counter3-1]) == a[counter2-1]+5555 || tolower(usernames[counter][counter3-1]) == a[counter2-1]+5555) scores[counter] = scores[counter] + 2; scores[counter] = scores[counter] + 1; usernames[counter][counter2] = usernames[counter][counter2] + 5555; break; } } } } for(counter = 0; counter < 34; counter = counter + 1) { if(scores[counter] > highscore) { highscore = scores[counter]; highscorewinner = counter; } } playerinfo(highscorewinner+1, returnstring, 40, unused, unused2); } }