s = "";
for(int j = 0; j < n; ++j)
{
- FOREACH(Weapons, it != WEP_Null, {
- if(argv(j) == it.netname)
- s = cons_mid(s, " & ", it.m_name);
- });
+ entity wep = Weapons_fromstr(argv(j));
+ if(wep != WEP_Null)
+ {
+ s = cons_mid(s, " & ", wep.m_name);
+ }
}
s = sprintf(_("%s Arena"), s);
for (i = 0; i < t; ++i)
{
s = argv(i);
- FOREACH(Weapons, it != WEP_Null, {
- if(it.netname == s)
- {
- g_weaponarena_weapons |= (it.m_wepset);
- g_weaponarena_list = strcat(g_weaponarena_list, it.m_name, " & ");
- break;
- }
- });
+ entity wep = Weapons_fromstr(s);
+ if(wep != WEP_Null)
+ {
+ g_weaponarena_weapons |= (wep.m_wepset);
+ g_weaponarena_list = strcat(g_weaponarena_list, wep.m_name, " & ");
+ }
}
g_weaponarena_list = strzone(substring(g_weaponarena_list, 0, strlen(g_weaponarena_list) - 3));
}
for (int i = 1; i < t; ++i)
{
s = argv(i);
- FOREACH(Weapons, it != WEP_Null, {
- if(it.netname == s)
- {
- entity replacement = spawn();
- copyentity(this, replacement);
- replacement.m_isreplaced = true;
- weapon_defaultspawnfunc(replacement, it);
- break;
- }
- });
+ entity wep = Weapons_fromstr(s);
+ if(wep != WEP_Null)
+ {
+ entity replacement = spawn();
+ copyentity(this, replacement);
+ replacement.m_isreplaced = true;
+ weapon_defaultspawnfunc(replacement, wep);
+ }
}
}
if (t >= 1) // always the case!
{
s = argv(0);
- wpn = WEP_Null;
- FOREACH(Weapons, it != WEP_Null, {
- if(it.netname == s)
- {
- wpn = it;
- break;
- }
- });
+ wpn = Weapons_fromstr(s);
}
if (wpn == WEP_Null)
{