}
void GetCvars(float f)
{
- string s;
+ string s = string_null;
if (f > 0)
s = strcat1(argv(f));
float g_pickup_ammo_anyway;
float g_pickup_weapons_anyway;
float g_weaponarena;
+WEPSET_DECLARE_A(g_weaponarena_weapons);
float g_weaponarena_random;
float g_weaponarena_random_with_laser;
string g_weaponarena_list;
float g_weaponforcefactor;
float g_weaponspreadfactor;
-float start_weapons;
+WEPSET_DECLARE_A(start_weapons);
+WEPSET_DECLARE_A(start_weapons_default);
+WEPSET_DECLARE_A(start_weapons_defaultmask);
float start_items;
float start_ammo_shells;
float start_ammo_nails;
float start_ammo_fuel;
float start_health;
float start_armorvalue;
-float warmup_start_weapons;
+WEPSET_DECLARE_A(warmup_start_weapons);
+WEPSET_DECLARE_A(warmup_start_weapons_default);
+WEPSET_DECLARE_A(warmup_start_weapons_defaultmask);
float warmup_start_ammo_shells;
float warmup_start_ammo_nails;
float warmup_start_ammo_rockets;
float want_weapon(string cvarprefix, entity weaponinfo, float allguns)
{
var float i = weaponinfo.weapon;
+ var float d = 0;
if (!i)
return 0;
- var float t = cvar(strcat(cvarprefix, weaponinfo.netname));
-
- if (t < 0) // "default" weapon selection
+ if (g_lms || g_ca || allguns)
{
- if (g_lms || g_ca || allguns)
- t = (weaponinfo.spawnflags & WEP_FLAG_NORMAL);
- else if(t < -1)
- t = 0;
- else if (g_cts)
- t = (i == WEP_SHOTGUN);
- else if (g_nexball)
- t = 0; // weapon is set a few lines later
+ if(weaponinfo.spawnflags & WEP_FLAG_NORMAL)
+ d = TRUE;
else
- t = (i == WEP_LASER || i == WEP_SHOTGUN);
- if(g_grappling_hook) // if possible, redirect off-hand hook to on-hand hook
- t |= (i == WEP_HOOK);
+ d = FALSE;
}
+ else if (g_cts)
+ d = (i == WEP_SHOTGUN);
+ else if (g_nexball)
+ d = 0; // weapon is set a few lines later
+ else
+ d = (i == WEP_LASER || i == WEP_SHOTGUN);
+
+ if(g_grappling_hook) // if possible, redirect off-hand hook to on-hand hook
+ d |= (i == WEP_HOOK);
+ if(weaponinfo.spawnflags & WEP_FLAG_MUTATORBLOCKED) // never default mutator blocked guns
+ d = 0;
- // we cannot disable porto in Nexball, we must force it
- if(g_nexball && i == WEP_PORTO)
- t = 1;
+ var float t = cvar(strcat(cvarprefix, weaponinfo.netname));
+
+ //print(strcat("want_weapon: ", weaponinfo.netname, " - d: ", ftos(d), ", t: ", ftos(t), ". \n"));
+
+ // bit order in t:
+ // 1: want or not
+ // 2: is default?
+ // 4: is set by default?
+ if(t < 0)
+ t = 4 | (3 * d);
+ else
+ t |= (2 * d);
return t;
}
string s;
// initialize starting values for players
- start_weapons = 0;
+ WEPSET_CLEAR_A(start_weapons);
+ WEPSET_CLEAR_A(start_weapons_default);
+ WEPSET_CLEAR_A(start_weapons_defaultmask);
start_items = 0;
start_ammo_shells = 0;
start_ammo_nails = 0;
start_armorvalue = cvar("g_balance_armor_start");
g_weaponarena = 0;
+ WEPSET_CLEAR_A(g_weaponarena_weapons);
+
s = cvar_string("g_weaponarena");
if (s == "0" || s == "")
{
}
else if (s == "all")
{
+ g_weaponarena = 1;
g_weaponarena_list = "All Weapons";
for (j = WEP_FIRST; j <= WEP_LAST; ++j)
{
e = get_weaponinfo(j);
- g_weaponarena |= e.weapons;
- weapon_action(e.weapon, WR_PRECACHE);
+ if not(e.spawnflags & WEP_FLAG_MUTATORBLOCKED)
+ WEPSET_OR_AW(g_weaponarena_weapons, j);
}
}
else if (s == "most")
{
+ g_weaponarena = 1;
g_weaponarena_list = "Most Weapons";
for (j = WEP_FIRST; j <= WEP_LAST; ++j)
{
e = get_weaponinfo(j);
- if (e.spawnflags & WEP_FLAG_NORMAL)
- {
- g_weaponarena |= e.weapons;
- weapon_action(e.weapon, WR_PRECACHE);
- }
+ if not(e.spawnflags & WEP_FLAG_MUTATORBLOCKED)
+ if (e.spawnflags & WEP_FLAG_NORMAL)
+ WEPSET_OR_AW(g_weaponarena_weapons, j);
}
}
else if (s == "none")
{
+ g_weaponarena = 1;
g_weaponarena_list = "No Weapons";
- g_weaponarena = WEPBIT_ALL + 1; // this supports no single weapon bit!
}
else
{
+ g_weaponarena = 1;
t = tokenize_console(s);
g_weaponarena_list = "";
for (i = 0; i < t; ++i)
e = get_weaponinfo(j);
if (e.netname == s)
{
- g_weaponarena |= e.weapons;
- weapon_action(e.weapon, WR_PRECACHE);
+ WEPSET_OR_AW(g_weaponarena_weapons, j);
g_weaponarena_list = strcat(g_weaponarena_list, e.message, " & ");
break;
}
if (g_weaponarena)
{
- start_weapons = g_weaponarena;
+ g_minstagib = 0; // incompatible
+ g_pinata = 0; // incompatible
+ g_weapon_stay = 0; // incompatible
+ WEPSET_COPY_AA(start_weapons, g_weaponarena_weapons);
if(!(g_lms || g_ca))
start_items |= IT_UNLIMITED_AMMO;
}
else if (g_minstagib)
{
+ g_pinata = 0; // incompatible
+ g_weapon_stay = 0; // incompatible
+ g_bloodloss = 0; // incompatible
start_health = 100;
start_armorvalue = 0;
- start_weapons = WEPBIT_MINSTANEX;
- weapon_action(WEP_MINSTANEX, WR_PRECACHE);
+ WEPSET_COPY_AW(start_weapons, WEP_MINSTANEX);
g_minstagib_invis_alpha = cvar("g_minstagib_invis_alpha");
+ start_items |= IT_UNLIMITED_SUPERWEAPONS;
if (g_minstagib_invis_alpha <= 0)
g_minstagib_invis_alpha = -1;
for (i = WEP_FIRST; i <= WEP_LAST; ++i)
{
e = get_weaponinfo(i);
- if(want_weapon("g_start_weapon_", e, FALSE))
- start_weapons |= e.weapons;
+ float w = want_weapon("g_start_weapon_", e, FALSE);
+ if(w & 1)
+ WEPSET_OR_AW(start_weapons, i);
+ if(w & 2)
+ WEPSET_OR_AW(start_weapons_default, i);
+ if(w & 4)
+ WEPSET_OR_AW(start_weapons_defaultmask, i);
}
}
if(!cvar("g_use_ammunition"))
start_items |= IT_UNLIMITED_AMMO;
+ if(cvar("g_nexball"))
+ start_items |= IT_UNLIMITED_SUPERWEAPONS; // FIXME BAD BAD BAD BAD HACK, NEXBALL SHOULDN'T ABUSE PORTO'S WEAPON SLOT
+
if(g_minstagib)
{
start_ammo_cells = cvar("g_minstagib_ammo_start");
warmup_start_ammo_fuel = start_ammo_fuel;
warmup_start_health = start_health;
warmup_start_armorvalue = start_armorvalue;
- warmup_start_weapons = start_weapons;
+ WEPSET_COPY_AA(warmup_start_weapons, start_weapons);
+ WEPSET_COPY_AA(warmup_start_weapons_default, start_weapons_default);
+ WEPSET_COPY_AA(warmup_start_weapons_defaultmask, start_weapons_defaultmask);
if (!g_weaponarena && !g_minstagib && !g_ca)
{
warmup_start_ammo_fuel = cvar("g_warmup_start_ammo_fuel");
warmup_start_health = cvar("g_warmup_start_health");
warmup_start_armorvalue = cvar("g_warmup_start_armor");
- warmup_start_weapons = 0;
+ WEPSET_CLEAR_A(warmup_start_weapons);
+ WEPSET_CLEAR_A(warmup_start_weapons_default);
+ WEPSET_CLEAR_A(warmup_start_weapons_defaultmask);
for (i = WEP_FIRST; i <= WEP_LAST; ++i)
{
e = get_weaponinfo(i);
- if(want_weapon("g_start_weapon_", e, cvar("g_warmup_allguns")))
- warmup_start_weapons |= e.weapons;
+ float w = want_weapon("g_start_weapon_", e, cvar("g_warmup_allguns"));
+ if(w & 1)
+ WEPSET_OR_AW(warmup_start_weapons, i);
+ if(w & 2)
+ WEPSET_OR_AW(warmup_start_weapons_default, i);
+ if(w & 4)
+ WEPSET_OR_AW(warmup_start_weapons_defaultmask, i);
}
}
}
- if (g_jetpack || (g_grappling_hook && (start_weapons & WEPBIT_HOOK)))
+ if (g_jetpack)
+ start_items |= IT_JETPACK;
+
+ MUTATOR_CALLHOOK(SetStartItems);
+
+ if ((start_items & IT_JETPACK) || (g_grappling_hook && WEPSET_CONTAINS_AW(start_weapons, WEP_HOOK)))
{
g_grappling_hook = 0; // these two can't coexist, as they use the same button
start_items |= IT_FUEL_REGEN;
warmup_start_ammo_fuel = max(warmup_start_ammo_fuel, cvar("g_balance_fuel_rotstable"));
}
- if (g_jetpack)
- start_items |= IT_JETPACK;
-
- MUTATOR_CALLHOOK(SetStartItems);
-
for (i = WEP_FIRST; i <= WEP_LAST; ++i)
{
e = get_weaponinfo(i);
- if(e.weapons & (start_weapons | warmup_start_weapons))
- weapon_action(e.weapon, WR_PRECACHE);
+ if(WEPSET_CONTAINS_AW(start_weapons, i) || WEPSET_CONTAINS_AW(warmup_start_weapons, i))
+ weapon_action(i, WR_PRECACHE);
}
start_ammo_shells = max(0, start_ammo_shells);
string GetGametype(); // g_world.qc
void readlevelcvars(void)
{
- // first load all the mutators
- if(cvar("g_invincible_projectiles"))
- MUTATOR_ADD(mutator_invincibleprojectiles);
- if(cvar("g_nix"))
- MUTATOR_ADD(mutator_nix);
+ g_minstagib = cvar("g_minstagib");
+
+ // load ALL the mutators
if(cvar("g_dodging"))
MUTATOR_ADD(mutator_dodging);
- if(cvar("g_rocket_flying"))
- MUTATOR_ADD(mutator_rocketflying);
- if(cvar("g_vampire"))
- MUTATOR_ADD(mutator_vampire);
if(cvar("g_spawn_near_teammate"))
MUTATOR_ADD(mutator_spawn_near_teammate);
+ if(!g_minstagib)
+ {
+ if(cvar("g_invincible_projectiles"))
+ MUTATOR_ADD(mutator_invincibleprojectiles);
+ if(cvar("g_new_toys"))
+ MUTATOR_ADD(mutator_new_toys);
+ if(cvar("g_nix"))
+ MUTATOR_ADD(mutator_nix);
+ if(cvar("g_rocket_flying"))
+ MUTATOR_ADD(mutator_rocketflying);
+ if(cvar("g_vampire"))
+ MUTATOR_ADD(mutator_vampire);
+ }
// is this a mutator? is this a mode?
if(cvar("g_sandbox"))
g_grappling_hook = cvar("g_grappling_hook");
g_jetpack = cvar("g_jetpack");
g_midair = cvar("g_midair");
- g_minstagib = cvar("g_minstagib");
g_norecoil = cvar("g_norecoil");
g_bloodloss = cvar("g_bloodloss");
sv_maxidle = cvar("sv_maxidle");
inWarmupStage = 0; // these modes cannot work together, sorry
g_pickup_respawntime_weapon = cvar("g_pickup_respawntime_weapon");
+ g_pickup_respawntime_superweapon = cvar("g_pickup_respawntime_superweapon");
g_pickup_respawntime_ammo = cvar("g_pickup_respawntime_ammo");
g_pickup_respawntime_short = cvar("g_pickup_respawntime_short");
g_pickup_respawntime_medium = cvar("g_pickup_respawntime_medium");
g_pickup_respawntime_long = cvar("g_pickup_respawntime_long");
g_pickup_respawntime_powerup = cvar("g_pickup_respawntime_powerup");
g_pickup_respawntimejitter_weapon = cvar("g_pickup_respawntimejitter_weapon");
+ g_pickup_respawntimejitter_superweapon = cvar("g_pickup_respawntimejitter_superweapon");
g_pickup_respawntimejitter_ammo = cvar("g_pickup_respawntimejitter_ammo");
g_pickup_respawntimejitter_short = cvar("g_pickup_respawntimejitter_short");
g_pickup_respawntimejitter_medium = cvar("g_pickup_respawntimejitter_medium");
void Send_CSQC_Centerprint_Generic(entity e, float id, string s, float duration, float countdown_num)
{
- if (clienttype(e) == CLIENTTYPE_REAL)
+ if ((clienttype(e) == CLIENTTYPE_REAL) && (e.flags & FL_CLIENT))
{
msg_entity = e;
WRITESPECTATABLE_MSG_ONE({
{
if (e.initialize_entity)
{
- entity ent, prev;
+ entity ent, prev = world;
for (ent = initialize_entity_first; ent; )
{
if ((ent == e) || ((ent.classname == "initialize_entity") && (ent.enemy == e)))
e.initialize_entity_order = order;
cur = initialize_entity_first;
+ prev = world;
for (;;)
{
if (!cur || cur.initialize_entity_order > order)
}
#define PROJECTILE_TOUCH if(WarpZone_Projectile_Touch()) return
-float MAX_IPBAN_URIS = 16;
-
-float URI_GET_DISCARD = 0;
-float URI_GET_IPBAN = 1;
-float URI_GET_IPBAN_END = 16;
+#define ITEM_TOUCH_NEEDKILL() (((trace_dpstartcontents | trace_dphitcontents) & DPCONTENTS_NODROP) || (trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY))
+#define ITEM_DAMAGE_NEEDKILL(dt) (((dt) == DEATH_HURTTRIGGER) || ((dt) == DEATH_SLIME) || ((dt) == DEATH_LAVA) || ((dt) == DEATH_SWAMP))
void URI_Get_Callback(float id, float status, string data)
{
- dprint("Received HTTP request data for id ", ftos(id), "; status is ", ftos(status), "\nData is:\n");
- dprint(data);
- dprint("\nEnd of data.\n");
-
- if(url_URI_Get_Callback(id, status, data))
- {
- // handled
- }
- else if (id == URI_GET_DISCARD)
- {
- // discard
- }
- else if (id >= URI_GET_IPBAN && id <= URI_GET_IPBAN_END)
- {
- // online ban list
- OnlineBanList_URI_Get_Callback(id, status, data);
- }
- else
- {
- print("Received HTTP request data for an invalid id ", ftos(id), ".\n");
- }
+ if(url_URI_Get_Callback(id, status, data))
+ {
+ // handled
+ }
+ else if (id == URI_GET_DISCARD)
+ {
+ // discard
+ }
+ else if (id >= URI_GET_CURL && id <= URI_GET_CURL_END)
+ {
+ // sv_cmd curl
+ Curl_URI_Get_Callback(id, status, data);
+ }
+ else if (id >= URI_GET_IPBAN && id <= URI_GET_IPBAN_END)
+ {
+ // online ban list
+ OnlineBanList_URI_Get_Callback(id, status, data);
+ }
+ else
+ {
+ print("Received HTTP request data for an invalid id ", ftos(id), ".\n");
+ }
}
string uid2name(string myuid) {
float newpos;
newpos = race_readPos(map, t);
- float i, prevpos;
+ float i, prevpos = 0;
for(i = 1; i <= RANKINGS_CNT; ++i)
{
if(race_readUID(map, i) == myuid)
else
return strcat(ftos(pos), "th");
}
-string getrecords(float page) // 50 records per page
-{
- float rec;
- string h;
- float r;
- float i;
- string s;
-
- rec = 0;
-
- s = "";
-
- if (g_ctf)
- {
- for (i = page * 200; i < MapInfo_count && i < page * 200 + 200; ++i)
- {
- if (MapInfo_Get_ByID(i))
- {
- r = stof(db_get(ServerProgsDB, strcat(MapInfo_Map_bspname, "/captimerecord/time")));
- if (r == 0)
- continue;
- // TODO: uid2name
- h = db_get(ServerProgsDB, strcat(MapInfo_Map_bspname, "/captimerecord/netname"));
- s = strcat(s, strpad(32, MapInfo_Map_bspname), " ", strpad(-6, ftos_decimals(r, 2)), " ", h, "\n");
- ++rec;
- }
- }
- }
-
- if (g_race)
- {
- for (i = page * 200; i < MapInfo_count && i < page * 200 + 200; ++i)
- {
- if (MapInfo_Get_ByID(i))
- {
- r = race_readTime(MapInfo_Map_bspname, 1);
- if (r == 0)
- continue;
- h = race_readName(MapInfo_Map_bspname, 1);
- s = strcat(s, strpad(32, MapInfo_Map_bspname), " ", strpad(-8, TIME_ENCODED_TOSTRING(r)), " ", h, "\n");
- ++rec;
- }
- }
- }
-
- if (g_cts)
- {
- for (i = page * 200; i < MapInfo_count && i < page * 200 + 200; ++i)
- {
- if (MapInfo_Get_ByID(i))
- {
- r = race_readTime(MapInfo_Map_bspname, 1);
- if (r == 0)
- continue;
- h = race_readName(MapInfo_Map_bspname, 1);
- s = strcat(s, strpad(32, MapInfo_Map_bspname), " ", strpad(-8, TIME_ENCODED_TOSTRING(r)), " ", h, "\n");
- ++rec;
- }
- }
- }
-
- MapInfo_ClearTemps();
-
- if (s == "" && page == 0)
- return "No records are available on this server.\n";
- else
- return s;
-}
-
-string getrankings()
-{
- string n;
- float t;
- float i;
- string s;
- string p;
- string map;
-
- s = "";
-
- map = GetMapname();
-
- for (i = 1; i <= RANKINGS_CNT; ++i)
- {
- t = race_readTime(map, i);
- if (t == 0)
- continue;
- n = race_readName(map, i);
- p = race_placeName(i);
- s = strcat(s, strpad(8, p), " ", strpad(-8, TIME_ENCODED_TOSTRING(t)), " ", n, "\n");
- }
-
- MapInfo_ClearTemps();
-
- if (s == "")
- return strcat("No records are available for the map: ", map, "\n");
- else
- return strcat("Records for ", map, ":\n", s);
-}
-
-#define LADDER_FIRSTPOINT 100
-#define LADDER_CNT 10
- // position X still gives LADDER_FIRSTPOINT/X points
-#define LADDER_SIZE 30
- // ladder shows the top X players
-string top_uids[LADDER_SIZE];
-float top_scores[LADDER_SIZE];
-string getladder()
-{
- float i, j, k, uidcnt;
- string s, temp_s;
-
- s = "";
- temp_s = "";
-
- string rr;
- if(g_cts)
- rr = CTS_RECORD;
- else
- rr = RACE_RECORD;
-
- string myuid;
-
- for (k = 0; k < MapInfo_count; ++k)
- {
- if (MapInfo_Get_ByID(k))
- {
- for (i = 0; i <= LADDER_CNT; ++i) { // i = 0 because it is the speed award
- if(i == 0) // speed award
- {
- if(stof(db_get(ServerProgsDB, strcat(MapInfo_Map_bspname, rr, "speed/speed"))) == 0)
- continue;
-
- myuid = db_get(ServerProgsDB, strcat(MapInfo_Map_bspname, rr, "speed/crypto_idfp"));
- }
- else // normal record, if it exists (else break)
- {
- if(race_readTime(MapInfo_Map_bspname, i) == 0)
- continue;
-
- myuid = race_readUID(MapInfo_Map_bspname, i);
- }
-
- // string s contains:
- // arg 0 = # of speed recs
- // arg 1 = # of 1st place recs
- // arg 2 = # of 2nd place recs
- // ... etc
- // LADDER_CNT+1 = total points
-
- temp_s = db_get(TemporaryDB, strcat("ladder", myuid));
- if (temp_s == "")
- {
- db_put(TemporaryDB, strcat("uid", ftos(uidcnt)), myuid);
- ++uidcnt;
- for (j = 0; j <= LADDER_CNT + 1; ++j)
- {
- if(j != LADDER_CNT + 1)
- temp_s = strcat(temp_s, "0 ");
- else
- temp_s = strcat(temp_s, "0");
- }
- }
-
- tokenize_console(temp_s);
- s = "";
-
- if(i == 0) // speed award
- for (j = 0; j <= LADDER_CNT; ++j) // loop over each arg in the string
- {
- if(j == 0) // speed award
- s = strcat(s, ftos(stof(argv(j)) +1)); // add 1 to speed rec count and write
- else
- s = strcat(s, " ", argv(j)); // just copy over everything else
- }
- else // record
- for (j = 0; j <= LADDER_CNT; ++j) // loop over each arg in the string
- {
- if(j == 0)
- s = strcat(s, argv(j)); // speed award, dont prefix with " "
- else if(j == i) // wanted rec!
- s = strcat(s, " ", ftos(stof(argv(j)) +1)); // update argv(j)
- else
- s = strcat(s, " ", argv(j)); // just copy over everything else
- }
-
- // total points are (by default) calculated like this:
- // speedrec = floor(100 / 10) = 10 points
- // 1st place = floor(100 / 1) = 100 points
- // 2nd place = floor(100 / 2) = 50 points
- // 3rd place = floor(100 / 3) = 33 points
- // 4th place = floor(100 / 4) = 25 points
- // 5th place = floor(100 / 5) = 20 points
- // ... etc
-
- if(i == 0)
- s = strcat(s, " ", ftos(stof(argv(LADDER_CNT+1)) + LADDER_FIRSTPOINT / 10)); // speed award, add LADDER_FIRSTPOINT / 10 points
- else
- s = strcat(s, " ", ftos(stof(argv(LADDER_CNT+1)) + floor(LADDER_FIRSTPOINT / i))); // record, add LADDER_FIRSTPOINT / i points
-
- db_put(TemporaryDB, strcat("ladder", myuid), s);
- }
- }
- }
-
- float thiscnt;
- string thisuid;
- for (i = 0; i <= uidcnt; ++i) // for each known uid
- {
- thisuid = db_get(TemporaryDB, strcat("uid", ftos(i)));
- temp_s = db_get(TemporaryDB, strcat("ladder", thisuid));
- tokenize_console(temp_s);
- thiscnt = stof(argv(LADDER_CNT+1));
-
- if(thiscnt > top_scores[LADDER_SIZE-1])
- for (j = 0; j < LADDER_SIZE; ++j) // for each place in ladder
- {
- if(thiscnt > top_scores[j])
- {
- for (k = LADDER_SIZE-1; k >= j; --k)
- {
- top_uids[k] = top_uids[k-1];
- top_scores[k] = top_scores[k-1];
- }
- top_uids[j] = thisuid;
- top_scores[j] = thiscnt;
- break;
- }
- }
- }
-
- s = "^3-----------------------\n\n";
-
- s = strcat(s, "Pos ^3|");
- s = strcat(s, " ^7Total ^3|");
- for (i = 1; i <= LADDER_CNT; ++i)
- {
- s = strcat(s, " ^7", race_placeName(i), " ^3|");
- }
- s = strcat(s, " ^7Speed awards ^3| ^7Name");
-
- s = strcat(s, "\n^3----+--------");
- for (i = 1; i <= min(9, LADDER_CNT); ++i)
- {
- s = strcat(s, "+-----");
- }
-#if LADDER_CNT > 9
- for (i = 1; i <= LADDER_CNT - 9; ++i)
- {
- s = strcat(s, "+------");
- }
-#endif
-
- s = strcat(s, "+--------------+--------------------\n");
-
- for (i = 0; i < LADDER_SIZE; ++i)
- {
- temp_s = db_get(TemporaryDB, strcat("ladder", top_uids[i]));
- tokenize_console(temp_s);
- if (argv(LADDER_CNT+1) == "") // total is 0, skip
- continue;
- s = strcat(s, strpad(4, race_placeName(i+1)), "^3| ^7"); // pos
- s = strcat(s, strpad(7, argv(LADDER_CNT+1)), "^3| ^7"); // total
- for (j = 1; j <= min(9, LADDER_CNT); ++j)
- {
- s = strcat(s, strpad(4, argv(j)), "^3| ^7"); // 1st, 2nd, 3rd etc cnt
- }
-#if LADDER_CNT > 9
- for (j = 10; j <= LADDER_CNT; ++j)
- {
- s = strcat(s, strpad(4, argv(j)), " ^3| ^7"); // 1st, 2nd, 3rd etc cnt
- }
-#endif
-
- s = strcat(s, strpad(13, argv(0)), "^3| ^7"); // speed award cnt
- s = strcat(s, uid2name(top_uids[i]), "\n"); // name
- }
-
- MapInfo_ClearTemps();
-
- if (s == "")
- return "No ladder on this server!\n";
- else
- return strcat("Top ", ftos(LADDER_SIZE), " ladder rankings:\n", s);
-}
-
float MoveToRandomMapLocation(entity e, float goodcontents, float badcontents, float badsurfaceflags, float attempts, float maxaboveground, float minviewdistance)
{
org = world.mins;
delta = world.maxs - world.mins;
+ start = end = org;
+
for (i = 0; i < attempts; ++i)
{
start_x = org_x + random() * delta_x;
SoundEntity_StopSound(pl, i);
}
-
-float ParseCommandPlayerSlotTarget_firsttoken;
-entity GetCommandPlayerSlotTargetFromTokenizedCommand(float tokens, float idx) // idx = start index
-{
- string s;
- entity e, head;
- float n;
-
- s = string_null;
-
- ParseCommandPlayerSlotTarget_firsttoken = -1;
-
- if (tokens > idx)
- {
- if (substring(argv(idx), 0, 1) == "#")
- {
- s = substring(argv(idx), 1, -1);
- ++idx;
- if (s == "") if (tokens > idx)
- {
- s = argv(idx);
- ++idx;
- }
- ParseCommandPlayerSlotTarget_firsttoken = idx;
- n = stof(s);
- if (s == ftos(n) && n > 0 && n <= maxclients)
- {
- e = edict_num(n);
- if (e.flags & FL_CLIENT)
- return e;
- }
- }
- else
- {
- // it must be a nick name
- s = argv(idx);
- ++idx;
- ParseCommandPlayerSlotTarget_firsttoken = idx;
-
- n = 0;
- FOR_EACH_CLIENT(head)
- if (head.netname == s)
- {
- e = head;
- ++n;
- }
- if (n == 1)
- return e;
-
- s = strdecolorize(s);
- n = 0;
- FOR_EACH_CLIENT(head)
- if (strdecolorize(head.netname) == s)
- {
- e = head;
- ++n;
- }
- if (n == 1)
- return e;
- }
- }
-
- return world;
-}
-
.float scale2;
float modeleffect_SendEntity(entity to, float sf)