Skip to content

Commit

Permalink
change random to random_num
Browse files Browse the repository at this point in the history
fix typos
  • Loading branch information
Mistrick committed Sep 23, 2018
1 parent 2b3e949 commit 1d6447e
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 18 deletions.
2 changes: 1 addition & 1 deletion addons/amxmodx/configs/maplists.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
; anytime - this list will be always loaded
; example
; "Day Maps" "maps.ini" "1" "6:00" "22:59"
; "Nigth Maps" "nightmaps.ini" "1" "23:00" "5:59"
; "Night Maps" "nightmaps.ini" "1" "23:00" "5:59"
; "Another maps" "another.ini" "0" "anytime"

2 changes: 1 addition & 1 deletion addons/amxmodx/scripting/include/map_manager.inc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ native mapm_load_maplist_to_array(Array:array, filename[]);
native mapm_get_map_index(map[]);

/**
* Get prefix const from core.
* Get prefix from core.
*
* @param prefix Prefix string
* @param len String lenght
Expand Down
11 changes: 4 additions & 7 deletions addons/amxmodx/scripting/map_manager_core.sma
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#endif

#define PLUGIN "Map Manager: Core"
#define VERSION "3.0.0-Beta-5"
#define VERSION "3.0.0"
#define AUTHOR "Mistrick"

#pragma semicolon 1
Expand Down Expand Up @@ -359,8 +359,6 @@ prepare_vote(type)
return 0;
}

// server_print("--prepare vote--");

g_bVoteStarted = true;
g_bVoteFinished = false;

Expand All @@ -386,7 +384,7 @@ prepare_vote(type)
new map_info[MapStruct];
for(new random_map; g_iVoteItems < vote_max_items; g_iVoteItems++) {
do {
random_map = random(array_size);
random_map = random_num(0, array_size - 1);
ArrayGetArray(g_aMapsList, random_map, map_info);
} while(is_map_in_vote(map_info[MapName]) || !is_map_allowed(map_info[MapName], PUSH_BY_CORE, random_map));

Expand All @@ -413,7 +411,7 @@ prepare_vote(type)
arrayset(g_iRandomNums, -1, sizeof(g_iRandomNums));
for(new i; i < g_iVoteItems + g_bCanExtend; i++) {
do {
g_iRandomNums[i] = random(g_iVoteItems + g_bCanExtend);
g_iRandomNums[i] = random_num(0, g_iVoteItems + g_bCanExtend - 1);
} while(in_array(i, g_iRandomNums[i]));
}
} else {
Expand Down Expand Up @@ -579,7 +577,6 @@ finish_vote()
g_bVoteStarted = false;

// vote results
// server_print("--finish vote--");

// pre forward
new ret;
Expand All @@ -601,7 +598,7 @@ finish_vote()
}
}
else {
max_vote = random(g_iVoteItems);
max_vote = random_num(0, g_iVoteItems - 1);
}

// post forward
Expand Down
6 changes: 3 additions & 3 deletions addons/amxmodx/scripting/map_manager_nomination.sma
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#endif

#define PLUGIN "Map Manager: Nomination"
#define VERSION "0.0.7"
#define VERSION "0.0.8"
#define AUTHOR "Mistrick"

#pragma semicolon 1
Expand Down Expand Up @@ -345,7 +345,7 @@ show_nomination_menu(id, Array:maplist, custom_title[] = "")
for(new i = 0, index, nom_index; i < size; i++) {
if(random_sort) {
do {
index = random(size);
index = random_num(0, size - 1);
} while(in_array(array, index));
ArrayPushCell(array, index);
} else {
Expand Down Expand Up @@ -428,7 +428,7 @@ public mapm_prepare_votelist(type)
}
new nom_info[NomStruct];
for(new i, index; i < get_num(MAPS_IN_VOTE) && ArraySize(g_aNomList); i++) {
index = random(ArraySize(g_aNomList));
index = random_num(0, ArraySize(g_aNomList) - 1);
ArrayGetArray(g_aNomList, index, nom_info);
ArrayDeleteItem(g_aNomList, index);
g_iNomMaps[nom_info[NomPlayer]]--;
Expand Down
6 changes: 2 additions & 4 deletions addons/amxmodx/scripting/map_manager_online_sorter.sma
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <map_manager>

#define PLUGIN "Map Manager: Online sorter"
#define VERSION "0.0.1"
#define VERSION "0.0.2"
#define AUTHOR "Mistrick"

#pragma semicolon 1
Expand Down Expand Up @@ -38,18 +38,16 @@ public mapm_prepare_votelist(type)
new Array:array = ArrayCreate(MAPNAME_LENGTH, 1);
new map_info[MapStruct], size = ArraySize(g_aMapsList);

// server_print("Found maps for current online:");
for(new i; i < size; i++) {
ArrayGetArray(g_aMapsList, i, map_info);
if(map_info[MinPlayers] <= players_num <= map_info[MaxPlayers]) {
ArrayPushString(array, map_info[MapName]);
// server_print("%d - %s", ArraySize(array), map_info[MapName]);
}
}

new map[MAPNAME_LENGTH], max_items = mapm_get_votelist_size();
for(new i, index; i < max_items && ArraySize(array); i++) {
index = random(ArraySize(array));
index = random_num(0, ArraySize(array) - 1);
ArrayGetString(array, index, map, charsmax(map));
ArrayDeleteItem(array, index);
if(mapm_push_map_to_votelist(map, PUSH_BY_ONLINE_SORTER) == PUSH_BLOCKED) {
Expand Down
4 changes: 2 additions & 2 deletions addons/amxmodx/scripting/map_manager_rtv.sma
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#endif

#define PLUGIN "Map Manager: Rtv"
#define VERSION "0.0.3"
#define VERSION "0.0.4"
#define AUTHOR "Mistrick"

#pragma semicolon 1
Expand Down Expand Up @@ -85,7 +85,7 @@ public clcmd_rtv(id)

new need_votes;
if(get_num(MODE) == MODE_PERCENTS) {
need_votes = floatround(get_players_num() * get_num(PERCENT) / 100.0) - g_iVotes;
need_votes = floatround(get_players_num() * get_num(PERCENT) / 100.0, floatround_ceil) - g_iVotes;
} else {
need_votes = get_num(PLAYERS) - g_iVotes;
}
Expand Down

0 comments on commit 1d6447e

Please sign in to comment.