map_manager_stocks.inc
Original include source with line numbers.
| 1 | #if defined _map_manager_stocks_included |
| 2 | #endinput |
| 3 | #endif |
| 4 | #define _map_manager_stocks_included |
| 5 | |
| 6 | stock valid_map(map[]) |
| 7 | { |
| 8 | if(is_map_valid(map)) return true; |
| 9 | |
| 10 | new len = strlen(map) - 4; |
| 11 | |
| 12 | if(len < 0) return false; |
| 13 | |
| 14 | if(equali(map[len], ".bsp")) { |
| 15 | map[len] = '^0'; |
| 16 | if(is_map_valid(map)) return true; |
| 17 | } |
| 18 | |
| 19 | return false; |
| 20 | } |
| 21 | stock get_map_prefix(map[], prefix[], size) |
| 22 | { |
| 23 | copy(prefix, size, map); |
| 24 | for(new i; prefix[i]; i++) { |
| 25 | if(prefix[i] == '_') { |
| 26 | prefix[i + 1] = 0; |
| 27 | return 1; |
| 28 | } |
| 29 | } |
| 30 | return 0; |
| 31 | } |
| 32 | stock bool:is_string_with_space(string[]) |
| 33 | { |
| 34 | for(new i; string[i]; i++) { |
| 35 | if(string[i] == ' ') return true; |
| 36 | } |
| 37 | return false; |
| 38 | } |
| 39 | stock trim_bracket(text[]) |
| 40 | { |
| 41 | for(new i; text[i]; i++) { |
| 42 | if(text[i] == '[') { |
| 43 | text[i] = 0; |
| 44 | break; |
| 45 | } |
| 46 | } |
| 47 | } |
| 48 | stock intermission() |
| 49 | { |
| 50 | emessage_begin(MSG_ALL, SVC_INTERMISSION); |
| 51 | emessage_end(); |
| 52 | } |
| 53 | stock get_players_num(ignore = 0) |
| 54 | { |
| 55 | static maxplayers; |
| 56 | if(!maxplayers) { |
| 57 | maxplayers = get_maxplayers(); |
| 58 | } |
| 59 | new pnum; |
| 60 | for(new i = 1; i <= maxplayers; i++) { |
| 61 | if(ignore && i == ignore |
| 62 | || !is_user_connected(i) |
| 63 | || is_user_bot(i) |
| 64 | || is_user_hltv(i)) { |
| 65 | continue; |
| 66 | } |
| 67 | pnum++; |
| 68 | } |
| 69 | return pnum; |
| 70 | } |
| 71 | stock send_audio(id, audio[], pitch) |
| 72 | { |
| 73 | static msg_send_audio; |
| 74 | |
| 75 | if(!msg_send_audio) { |
| 76 | msg_send_audio = get_user_msgid("SendAudio"); |
| 77 | } |
| 78 | |
| 79 | message_begin( id ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, msg_send_audio, _, id); |
| 80 | write_byte(id); |
| 81 | write_string(audio); |
| 82 | write_short(pitch); |
| 83 | message_end(); |
| 84 | } |
| 85 | stock replace_color_tag(string[], len) |
| 86 | { |
| 87 | while(replace(string, len, "^^1", "^1")) {} |
| 88 | while(replace(string, len, "^^3", "^3")) {} |
| 89 | while(replace(string, len, "^^4", "^4")) {} |
| 90 | while(replace(string, len, "!d", "^1")) {} |
| 91 | while(replace(string, len, "!t", "^3")) {} |
| 92 | while(replace(string, len, "!g", "^4")) {} |
| 93 | } |
| 94 | |