Senior Member
|
11-25-2011
, 08:09
"while"
|
#1
|
Can any of these whiles couse server's crash without any error? I heard somwere that with "while" u might creat a permanent cicle witch crashes ur server but doesnt show any error. So sometimes i get this crash, but dont know becouse witch plugin.
1
Code:
while((pos <= sizeof(g_Buttons)) && (ent[0] = engfunc(EngFunc_FindEntityByString, ent[0], "classname", "info_player_deathmatch")))
{
pev(ent[0], pev_origin, origin)
while((ent[1] = engfunc(EngFunc_FindEntityInSphere, ent[1], origin, CELL_RADIUS)))
{
if(!is_valid_ent(ent[1]))
continue
entity_get_string(ent[1], EV_SZ_classname, info, charsmax(info))
if(!equal(info, "func_door"))
continue
entity_get_string(ent[1], EV_SZ_targetname, info, charsmax(info))
if(!info[0])
continue
if(TrieKeyExists(g_CellManagers, info))
{
TrieGetCell(g_CellManagers, info, ent[2])
}
else
{
ent[2] = engfunc(EngFunc_FindEntityByString, 0, "target", info)
}
if(is_valid_ent(ent[2]) && (in_array(ent[2], g_Buttons, sizeof(g_Buttons)) < 0))
{
g_Buttons[pos] = ent[2]
pos++
break
}
}
}
TrieDestroy(g_CellManagers)
}
2
Code:
while ( gNum < MAX_MAPS && read_file("mapcycle.txt",line++,gMap,63,i) )
{
if ( gMap[0] == ';' ) continue
if (equali(gMap,map))
{
cyclerfile = true
break
}
++gNum
} return PLUGIN_CONTINUE
3
Code:
while (nServerCount < g_nServerCount)
{
format(sFullAddress, MAX_SERVERADDRESS_LEN - 1, "%s:%d", g_saServerAddresses[nServerCount], g_naServerPorts[nServerCount])
if (equal(sFullAddress, sTmpOwnAddress) || equal(sFullAddress, sTmpServerIP))
{
g_nOwnServer = nServerCount
break
}
nServerCount++
}
---
4
Code:
while (div > result) // end when div == result, or just below
{
div = (div + result) / 2; // take mean value as new divisor
result = num / div;
}
5
Code:
while ((iWPNidx = find_ent_by_class(iWPNidx, wpn)) != 0)
{
if (id == entity_get_edict(iWPNidx, EV_ENT_owner))
{
cs_set_weapon_ammo(iWPNidx, getMaxClipAmmo(wpnid));
break;
}
}
6
Code:
while( (line = read_file(zonefile , line , input , 127 , len) ) != 0 )
{
if (!strlen(input) || (input[0] == ';')) continue; // Kommentar oder Leerzeile
new data[20], zm = 0, ct // "abgebrochenen" Daten - ZoneMode - CamperTime
new Float:mins[3], Float:maxs[3], Float:pos[3] // Gro?e & Position
// Zone abrufen
strbreak(input, data, 20, input, 999)
zm = -1
for(new i = 0; ZONEMODE:i < ZONEMODE; ZONEMODE:i++)
{
// Anderungen von CS:CZ zu allen Mods
if (equal(data, "wgz_camper_te")) format(data, 19, "wgz_camper_t1")
if (equal(data, "wgz_camper_ct")) format(data, 19, "wgz_camper_t2")
if (equal(data, zonename[ZONEMODE:i])) zm = i;
}
if (zm == -1)
{
log_amx("undefined zone -> '%s' ... dropped", data)
continue;
}
// Position holen
strbreak(input, data, 20, input, 999); pos[0] = str_to_float(data);
strbreak(input, data, 20, input, 999); pos[1] = str_to_float(data);
strbreak(input, data, 20, input, 999); pos[2] = str_to_float(data);
// Dimensionen
strbreak(input, data, 20, input, 999); mins[0] = str_to_float(data);
strbreak(input, data, 20, input, 999); mins[1] = str_to_float(data);
strbreak(input, data, 20, input, 999); mins[2] = str_to_float(data);
strbreak(input, data, 20, input, 999); maxs[0] = str_to_float(data);
strbreak(input, data, 20, input, 999); maxs[1] = str_to_float(data);
strbreak(input, data, 20, input, 999); maxs[2] = str_to_float(data);
if ((ZONEMODE:zm == ZM_CAMPING) || (ZONEMODE:zm == ZM_CAMPING_T1) || (ZONEMODE:zm == ZM_CAMPING_T2))
{
// Campertime wird immer mitgeliefert
strbreak(input, data, 20, input, 999)
ct = str_to_num(data)
}
// und nun noch erstellen
CreateZone(pos, mins, maxs, zm, ct);
}
7
Code:
while(engfunc(EngFunc_PointContents, vOrigin) == CONTENTS_EMPTY)
vOrigin[2] += 5.0;
Last edited by KamiN; 11-25-2011 at 08:15.
|
|