07.08.2017, 19:43
Quote:
@Salik, @TommyB, @IstuntmanI - do not use strlen for non-strings under any circumstances! If you pass a brand new array, strlen will return 0 and I don't think it would do any harm, the maxlen param ends its life in this function: https://sourcegraph.com/github.com/s...oArray#L92-108 but it certainly wouldn't do anything useful at all.
Use sizeof, it's even the default. You can also limit the amount of work done by using some value lower than sizeof if for example you only want the closest 3 items. |
PHP код:
new DynamicPickup:pickups[300], Float:x, Float:y, Float:z, id, pickuparray[2];
GetPlayerPos(playerid, x, y, z);
Streamer_GetNearbyItems(x, y, z, STREAMER_TYPE_PICKUP, pickups, 300, dist);
for(new p = 0; p < strlen(_:pickups); p++)
{
Streamer_GetArrayData(STREAMER_TYPE_PICKUP, pickups[p], E_STREAMER_EXTRA_ID, pickuparray);
//...
}
Код:
[14:28:02] strlen: 2 sizeof: 300